some improvements to tests and error tracebacks
authorandy
Thu, 10 Apr 2008 21:11:04 +0000
changeset 2923 b5c8043382fc
parent 2922 168b91cbfefc
child 2926 bd9b2e9f21b4
some improvements to tests and error tracebacks
reportlab/platypus/doctemplate.py
reportlab/platypus/paragraph.py
reportlab/rl_config.py
reportlab/test/test_pdfgen_general.py
--- a/reportlab/platypus/doctemplate.py	Tue Apr 01 16:46:50 2008 +0000
+++ b/reportlab/platypus/doctemplate.py	Thu Apr 10 21:11:04 2008 +0000
@@ -687,6 +687,10 @@
 
     def _startBuild(self, filename=None, canvasmaker=canvas.Canvas):
         self._calc()
+
+        #each distinct pass gets a sequencer
+        self.seq = reportlab.lib.sequencer.Sequencer()
+        
         self.canv = canvasmaker(filename or self.filename,
                                 pagesize=self.pagesize,
                                 invariant=self.invariant,
--- a/reportlab/platypus/paragraph.py	Tue Apr 01 16:46:50 2008 +0000
+++ b/reportlab/platypus/paragraph.py	Thu Apr 10 21:11:04 2008 +0000
@@ -1030,7 +1030,7 @@
         style = self.style
         #for now we only handle one fragment.  Need to generalize this quickly.
         if len(self.frags) > 1:
-            raise ValueError('CJK Wordwrap can only handle one fragment per paragraph for now')
+            raise ValueError('CJK Wordwrap can only handle one fragment per paragraph for now.  Tried to handle:\ntext:  %s\nfrags: %s' % (self.text, self.frags))
         elif len(self.frags) == 0:
             return ParaLines(kind=0, fontSize=style.fontSize, fontName=style.fontName,
                             textColor=style.textColor, lines=[],ascent=style.fontSize,descent=-0.2*style.fontSize)
--- a/reportlab/rl_config.py	Tue Apr 01 16:46:50 2008 +0000
+++ b/reportlab/rl_config.py	Thu Apr 10 21:11:04 2008 +0000
@@ -68,6 +68,13 @@
                 '%(REPORTLAB_DIR)s/../fonts',   #special
                 '%(REPORTLAB_DIR)s/../../fonts',#special
                 '%(HOME)s/fonts',               #special
+                #mac os X - from
+                #http://developer.apple.com/technotes/tn/tn2024.html
+                '~/Library/Fonts',
+                '/Library/Fonts',
+                '/Network/Library/Fonts',
+                '/System/Library/Fonts',
+                
                 )
 
 # places to look for CMap files - should ideally merge with above
--- a/reportlab/test/test_pdfgen_general.py	Tue Apr 01 16:46:50 2008 +0000
+++ b/reportlab/test/test_pdfgen_general.py	Thu Apr 10 21:11:04 2008 +0000
@@ -747,6 +747,14 @@
             tgif = outputfile(os.path.basename('_i_am_actually_a_jpeg.gif'))
             shutil.copyfile(tjpg,tgif)
             c.drawImage(tgif, 4*inch, 9.25*inch, w, h, mask='auto')
+
+        #preserveAspectRatio test
+        c.drawString(inch, 6.25*inch, 'Both these should have the usual aspect ratio')
+
+        (w, h) = c.drawImage(gif, inch, 6*inch, width=2*inch, height=2*inch, preserveAspectRatio=True)
+        (w, h) = c.drawInlineImage(gif, inch, 4*inch, width=2*inch, height=2*inch, preserveAspectRatio=True)
+                    
+
         c.showPage()