tests/test_pdfgen_pycanvas.py
branchpy33
changeset 3794 398ea04239b5
parent 3721 0c93dd8ff567
child 3800 e8547b00eb59
equal deleted inserted replaced
3793:cc3f9cc828f7 3794:398ea04239b5
     4 __version__=''' $Id$ '''
     4 __version__=''' $Id$ '''
     5 __doc__='testscript for reportlab.pdfgen'
     5 __doc__='testscript for reportlab.pdfgen'
     6 #tests and documents new low-level canvas and the pycanvas module to output Python source code.
     6 #tests and documents new low-level canvas and the pycanvas module to output Python source code.
     7 from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
     7 from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
     8 setOutDir(__name__)
     8 setOutDir(__name__)
     9 import string, os, unittest
     9 import os, unittest
    10 from reportlab.pdfgen import pycanvas   # gmcm 2000/10/13, pdfgen now a package
    10 from reportlab.pdfgen import pycanvas   # gmcm 2000/10/13, pdfgen now a package
    11 from reportlab.lib.units import inch, cm
    11 from reportlab.lib.units import inch, cm
    12 from reportlab.lib import colors
    12 from reportlab.lib import colors
    13 from reportlab.lib.utils import haveImages, rl_isfile
    13 from reportlab.lib.utils import haveImages, rl_isfile
    14 
    14 
   107         self.comment2 = "That was a doc block"
   107         self.comment2 = "That was a doc block"
   108         self.drawHeight = 0
   108         self.drawHeight = 0
   109 
   109 
   110     def _getHeight(self):
   110     def _getHeight(self):
   111         "splits into lines"
   111         "splits into lines"
   112         self.comment1lines = string.split(self.comment1, '\n')
   112         self.comment1lines = self.comment1.split('\n')
   113         self.codelines = string.split(self.code, '\n')
   113         self.codelines = self.code.split('\n')
   114         self.comment2lines = string.split(self.comment2, '\n')
   114         self.comment2lines = self.comment2.split('\n')
   115         textheight = (len(self.comment1lines) +
   115         textheight = (len(self.comment1lines) +
   116                 len(self.code) +
   116                 len(self.code) +
   117                 len(self.comment2lines) +
   117                 len(self.comment2lines) +
   118                 18)
   118                 18)
   119         return max(textheight, self.drawHeight)
   119         return max(textheight, self.drawHeight)