tests/test_pdfgen_general.py
branchpy33
changeset 3794 398ea04239b5
parent 3721 0c93dd8ff567
child 3800 e8547b00eb59
equal deleted inserted replaced
3793:cc3f9cc828f7 3794:398ea04239b5
     4 __doc__='testscript for reportlab.pdfgen'
     4 __doc__='testscript for reportlab.pdfgen'
     5 __version__=''' $Id$ '''
     5 __version__=''' $Id$ '''
     6 #tests and documents new low-level canvas
     6 #tests and documents new low-level canvas
     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 os, string
     9 import os
    10 import unittest
    10 import unittest
    11 from reportlab.pdfgen import canvas   # gmcm 2000/10/13, pdfgen now a package
    11 from reportlab.pdfgen import canvas   # gmcm 2000/10/13, pdfgen now a package
    12 from reportlab.lib.units import inch, cm
    12 from reportlab.lib.units import inch, cm
    13 from reportlab.lib import colors
    13 from reportlab.lib import colors
    14 from reportlab.lib.utils import haveImages, fileName2Utf8
    14 from reportlab.lib.utils import haveImages, fileName2Utf8
   104         self.comment2 = "That was a doc block"
   104         self.comment2 = "That was a doc block"
   105         self.drawHeight = 0
   105         self.drawHeight = 0
   106 
   106 
   107     def _getHeight(self):
   107     def _getHeight(self):
   108         "splits into lines"
   108         "splits into lines"
   109         self.comment1lines = string.split(self.comment1, '\n')
   109         self.comment1lines = self.comment1.split('\n')
   110         self.codelines = string.split(self.code, '\n')
   110         self.codelines = self.code.split('\n')
   111         self.comment2lines = string.split(self.comment2, '\n')
   111         self.comment2lines = self.comment2.split('\n')
   112         textheight = (len(self.comment1lines) +
   112         textheight = (len(self.comment1lines) +
   113                 len(self.code) +
   113                 len(self.code) +
   114                 len(self.comment2lines) +
   114                 len(self.comment2lines) +
   115                 18)
   115                 18)
   116         return max(textheight, self.drawHeight)
   116         return max(textheight, self.drawHeight)