added test for "--flatten l/i chars disappearing" problem
authorMatthias Kramm <kramm@quiss.org>
Thu, 13 Aug 2009 19:44:29 +0000 (21:44 +0200)
committerMatthias Kramm <kramm@quiss.org>
Thu, 13 Aug 2009 19:44:29 +0000 (21:44 +0200)
spec/edit_spec.py
spec/smalltext.pdf [new file with mode: 0644]
spec/smalltext.py [new file with mode: 0644]
spec/smalltext.spec.rb [new file with mode: 0644]

index ba6448d..2ab4453 100755 (executable)
@@ -482,8 +482,7 @@ if __name__ == "__main__":
     parser.add_option("-t", "--test", dest="test", help="Test checks against swf", action="store_true")
     (options, args) = parser.parse_args()
 
     parser.add_option("-t", "--test", dest="test", help="Test checks against swf", action="store_true")
     (options, args) = parser.parse_args()
 
-    if options.test:
-        TESTMODE = True
+    TESTMODE = options.test
 
     app = wx.PySimpleApp()
     model = Model.load(args[0])
 
     app = wx.PySimpleApp()
     model = Model.load(args[0])
diff --git a/spec/smalltext.pdf b/spec/smalltext.pdf
new file mode 100644 (file)
index 0000000..d7c7eeb
Binary files /dev/null and b/spec/smalltext.pdf differ
diff --git a/spec/smalltext.py b/spec/smalltext.py
new file mode 100644 (file)
index 0000000..a0ac9df
--- /dev/null
@@ -0,0 +1,26 @@
+from sys import * 
+from pdflib_py import * 
+p = PDF_new() 
+PDF_open_file(p, "smalltext.pdf")
+
+PDF_set_parameter(p, "usercoordinates", "true")
+
+PDF_set_info(p, "Creator", "smalltext.py")
+PDF_begin_page(p, 612, 200)
+font = PDF_load_font(p, "Helvetica", "host", "")
+
+PDF_setfont(p, font, 6.0)
+PDF_set_text_pos(p, 40, 100);PDF_show(p, "|")
+PDF_set_text_pos(p, 80, 100);PDF_show(p, "i")
+PDF_set_text_pos(p, 120, 100);PDF_show(p, "l")
+PDF_set_text_pos(p, 160, 100);PDF_show(p, "-")
+
+PDF_setfont(p, font, 9.0)
+PDF_set_text_pos(p, 40, 50);PDF_show(p, "|")
+PDF_set_text_pos(p, 80, 50);PDF_show(p, "i")
+PDF_set_text_pos(p, 120, 50);PDF_show(p, "l")
+PDF_set_text_pos(p, 160, 50);PDF_show(p, "-")
+
+PDF_end_page(p)
+PDF_close(p)
+PDF_delete(p);
diff --git a/spec/smalltext.spec.rb b/spec/smalltext.spec.rb
new file mode 100644 (file)
index 0000000..eb65646
--- /dev/null
@@ -0,0 +1,15 @@
+require File.dirname(__FILE__) + '/spec_helper'
+
+describe "pdf conversion" do
+    convert_file "smalltext.pdf" do
+        area_at(37,93,44,103).should_not_be_plain_colored
+        area_at(77,94,86,104).should_not_be_plain_colored
+        area_at(117,94,123,104).should_not_be_plain_colored
+        area_at(157,94,165,103).should_not_be_plain_colored
+        area_at(37,139,45,155).should_not_be_plain_colored
+        area_at(76,139,85,154).should_not_be_plain_colored
+        area_at(116,142,125,152).should_not_be_plain_colored
+        area_at(155,145,167,151).should_not_be_plain_colored
+        area_at(27,110,180,115).should_be_plain_colored
+    end
+end