add greyscale image and tests thereof
authorrobin
Mon, 19 Aug 2013 12:43:13 +0100
changeset 3770 66947196524b
parent 3769 51bcf79be4df
child 3771 41e8f74a3174
add greyscale image and tests thereof
tests/pythonpowered-gs.gif
tests/test_graphics_images.py
tests/test_pdfgen_general.py
Binary file tests/pythonpowered-gs.gif has changed
--- a/tests/test_graphics_images.py	Mon Aug 19 12:42:35 2013 +0100
+++ b/tests/test_graphics_images.py	Mon Aug 19 12:43:13 2013 +0100
@@ -13,8 +13,8 @@
 
 
 IMAGES = []
-IMAGENAME = 'cs_logo.gif'
 IMAGENAME = 'pythonpowered.gif'
+GSIMAGE = 'pythonpowered-gs.gif'
 
 
 class ImageTestCase(unittest.TestCase):
@@ -31,6 +31,7 @@
             d.add(img)
         outPath = outputfile("test_graphics_images.pdf")
         renderPDF.drawToFile(d, outPath) #, '')
+        print outPath
         assert os.path.exists(outPath) == 1
 
 
@@ -76,9 +77,17 @@
         d.rotate(45)
         IMAGES.append(d)
 
+
+    def test4(self):
+        "Test convert a greyscale bitmap file as Image shape into a tmp. PDF file."
+
+        d = Drawing(110, 44)
+        img = Image(0, 0, 110, 44, GSIMAGE)
+        d.add(img)
+        d.translate(0,2*72)
+        IMAGES.append(d)
         IMAGES.append(None) # used to indicate last test
 
-
 def makeSuite():
     return makeSuiteForClasses(ImageTestCase)
 
--- a/tests/test_pdfgen_general.py	Mon Aug 19 12:42:35 2013 +0100
+++ b/tests/test_pdfgen_general.py	Mon Aug 19 12:43:13 2013 +0100
@@ -680,8 +680,10 @@
         from reportlab.lib.testutils import testsFolder
         gif = os.path.join(testsFolder,'pythonpowered.gif')
         c.drawInlineImage(gif,2*inch, 7*inch)
+        c.drawInlineImage(os.path.join(testsFolder,'pythonpowered-gs.gif'),4*inch, 7.5*inch)
     else:
         c.rect(2*inch, 7*inch, 110, 44)
+        c.rect(4*inch, 7*inch, 110, 44)
 
     c.line(1.5*inch, 7*inch, 4*inch, 7*inch)
     c.line(2*inch, 6.5*inch, 2*inch, 8*inch)