tests/test_graphics_render.py
author robin <robin@reportlab.com>
Tue, 07 Mar 2017 10:00:34 +0000
changeset 4330 617ffa6bbdc8
parent 4306 8ffb2ffc283b
child 4455 c637072fda31
permissions -rw-r--r--
changes for release 3.4.0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4330
617ffa6bbdc8 changes for release 3.4.0
robin <robin@reportlab.com>
parents: 4306
diff changeset
     1
#Copyright ReportLab Europe Ltd. 2000-2017
3977
06da9dfa6e20 renderPDF/PM.py: make tests configuarble and add a unittest to call test()
robin
parents:
diff changeset
     2
#see license.txt for license details
06da9dfa6e20 renderPDF/PM.py: make tests configuarble and add a unittest to call test()
robin
parents:
diff changeset
     3
"""
06da9dfa6e20 renderPDF/PM.py: make tests configuarble and add a unittest to call test()
robin
parents:
diff changeset
     4
Tests for renderers
06da9dfa6e20 renderPDF/PM.py: make tests configuarble and add a unittest to call test()
robin
parents:
diff changeset
     5
"""
06da9dfa6e20 renderPDF/PM.py: make tests configuarble and add a unittest to call test()
robin
parents:
diff changeset
     6
from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
06da9dfa6e20 renderPDF/PM.py: make tests configuarble and add a unittest to call test()
robin
parents:
diff changeset
     7
setOutDir(__name__)
06da9dfa6e20 renderPDF/PM.py: make tests configuarble and add a unittest to call test()
robin
parents:
diff changeset
     8
import unittest, os, sys, glob
3978
48bcae3e8018 test_graphics_render.py: comment out 2.7 segfaulters for now
robin
parents: 3977
diff changeset
     9
from reportlab.lib.utils import isPy3
4239
75c7de3058a6 more changes related to pypy testing
robin
parents: 3989
diff changeset
    10
try:
75c7de3058a6 more changes related to pypy testing
robin
parents: 3989
diff changeset
    11
    from reportlab.graphics import _renderPM
75c7de3058a6 more changes related to pypy testing
robin
parents: 3989
diff changeset
    12
except:
75c7de3058a6 more changes related to pypy testing
robin
parents: 3989
diff changeset
    13
    _renderPM = None
4306
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    14
from reportlab.graphics.shapes import _DrawingEditorMixin, Drawing, Group, Rect, Path, String
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    15
from reportlab.lib.colors import Color, CMYKColor, PCMYKColor
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    16
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    17
class FillModeDrawing(_DrawingEditorMixin,Drawing):
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    18
    def __init__(self,width=600.0,height=200.0,fillMode='even-odd',*args,**kw):
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    19
        Drawing.__init__(self,width,height,*args,**kw)
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    20
        self.transform = (1,0,0,1,0,0)
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    21
        v0=self._nn(Group())
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    22
        v0.transform = (1,0,0,-1,0,200)
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    23
        v0.add(Rect(1,1,599,199,rx=0,ry=0,strokeDashArray=None,strokeWidth=2,strokeMiterLimit=0,strokeOpacity=None,strokeLineJoin=0,fillOpacity=1,strokeColor=Color(0,0,1,1),strokeLineCap=0,fillColor=None))
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    24
        v1=v0._nn(Group())
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    25
        v1.transform = (.5,0,0,.5,0,0)
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    26
        v1.add(Path(points=[250,75,323,301,131,161,369,161,177,301],operators=[0,1,1,1,1,3],isClipPath=0,autoclose='svg',fillMode=fillMode,strokeDashArray=None,strokeWidth=3,strokeMiterLimit=0,strokeOpacity=None,strokeLineJoin=0,fillOpacity=1,strokeColor=Color(0,0,0,1),strokeLineCap=0,fillColor=Color(1,0,0,1)))
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    27
        v2=v1._nn(Group())
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    28
        v2.transform = (.309017,.951057,-0.951057,.309017,306.21,249)
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    29
        v2.add(Path(points=[16,0,-8,9,-8,-9],operators=[0,1,1,3],isClipPath=0,autoclose='svg',fillMode=1,strokeDashArray=None,strokeWidth=1,strokeMiterLimit=0,strokeOpacity=None,strokeLineJoin=0,fillColor=Color(0,0,0,1),strokeColor=None,strokeLineCap=0,fillOpacity=1))
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    30
        v2=v1._nn(Group())
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    31
        v2.transform = (-0.809017,-0.587785,.587785,-0.809017,175.16,193.2)
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    32
        v2.add(Path(points=[16,0,-8,9,-8,-9],operators=[0,1,1,3],isClipPath=0,autoclose='svg',fillMode=1,strokeDashArray=None,strokeWidth=1,strokeMiterLimit=0,strokeOpacity=None,strokeLineJoin=0,fillColor=Color(0,0,0,1),strokeColor=None,strokeLineCap=0,fillOpacity=1))
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    33
        v2=v1._nn(Group())
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    34
        v2.transform = (1,0,0,1,314.26,161)
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    35
        v2.add(Path(points=[16,0,-8,9,-8,-9],operators=[0,1,1,3],isClipPath=0,autoclose='svg',fillMode=1,strokeDashArray=None,strokeWidth=1,strokeMiterLimit=0,strokeOpacity=None,strokeLineJoin=0,fillColor=Color(0,0,0,1),strokeColor=None,strokeLineCap=0,fillOpacity=1))
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    36
        v2=v1._nn(Group())
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    37
        v2.transform = (-0.809017,.587785,-0.587785,-0.809017,221.16,268.8)
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    38
        v2.add(Path(points=[16,0,-8,9,-8,-9],operators=[0,1,1,3],isClipPath=0,autoclose='svg',fillMode=1,strokeDashArray=None,strokeWidth=1,strokeMiterLimit=0,strokeOpacity=None,strokeLineJoin=0,fillColor=Color(0,0,0,1),strokeColor=None,strokeLineCap=0,fillOpacity=1))
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    39
        v2=v1._nn(Group())
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    40
        v2.transform = (.309017,-0.951057,.951057,.309017,233.21,126.98)
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    41
        v2.add(Path(points=[16,0,-8,9,-8,-9],operators=[0,1,1,3],isClipPath=0,autoclose='svg',fillMode=1,strokeDashArray=None,strokeWidth=1,strokeMiterLimit=0,strokeOpacity=None,strokeLineJoin=0,fillColor=Color(0,0,0,1),strokeColor=None,strokeLineCap=0,fillOpacity=1))
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    42
        v1.add(Path(points=[600,81,659.0945,81,707,128.9055,707,188,707,247.0945,659.0945,295,600,295,540.9055,295,493,247.0945,493,188,493,128.9055,540.9055,81,600,81,600,139,627.062,139,649,160.938,649,188,649,215.062,627.062,237,600,237,572.938,237,551,215.062,551,188,551,160.938,572.938,139,600,139],operators=[0,2,2,2,2,3,0,2,2,2,2,3],isClipPath=0,autoclose='svg',fillMode=fillMode,strokeDashArray=None,strokeWidth=3,strokeMiterLimit=0,strokeOpacity=None,strokeLineJoin=0,fillOpacity=1,strokeColor=Color(0,0,0,1),strokeLineCap=0,fillColor=Color(1,0,0,1)))
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    43
        v2=v1._nn(Group())
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    44
        v2.transform = (0,1,-1,0,707,188)
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    45
        v2.add(Path(points=[16,0,-8,9,-8,-9],operators=[0,1,1,3],isClipPath=0,autoclose='svg',fillMode=1,strokeDashArray=None,strokeWidth=1,strokeMiterLimit=0,strokeOpacity=None,strokeLineJoin=0,fillColor=Color(0,0,0,1),strokeColor=None,strokeLineCap=0,fillOpacity=1))
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    46
        v2=v1._nn(Group())
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    47
        v2.transform = (-0.866025,-0.5,.5,-0.866025,546.5,280.6647)
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    48
        v2.add(Path(points=[16,0,-8,9,-8,-9],operators=[0,1,1,3],isClipPath=0,autoclose='svg',fillMode=1,strokeDashArray=None,strokeWidth=1,strokeMiterLimit=0,strokeOpacity=None,strokeLineJoin=0,fillColor=Color(0,0,0,1),strokeColor=None,strokeLineCap=0,fillOpacity=1))
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    49
        v2=v1._nn(Group())
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    50
        v2.transform = (.866025,-0.5,.5,.866025,546.5,95.33528)
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    51
        v2.add(Path(points=[16,0,-8,9,-8,-9],operators=[0,1,1,3],isClipPath=0,autoclose='svg',fillMode=1,strokeDashArray=None,strokeWidth=1,strokeMiterLimit=0,strokeOpacity=None,strokeLineJoin=0,fillColor=Color(0,0,0,1),strokeColor=None,strokeLineCap=0,fillOpacity=1))
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    52
        v2=v1._nn(Group())
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    53
        v2.transform = (-0.866025,.5,-0.5,-0.866025,624.5,230.4352)
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    54
        v2.add(Path(points=[16,0,-8,9,-8,-9],operators=[0,1,1,3],isClipPath=0,autoclose='svg',fillMode=1,strokeDashArray=None,strokeWidth=1,strokeMiterLimit=0,strokeOpacity=None,strokeLineJoin=0,fillColor=Color(0,0,0,1),strokeColor=None,strokeLineCap=0,fillOpacity=1))
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    55
        v2=v1._nn(Group())
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    56
        v2.transform = (0,-1,1,0,551,188)
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    57
        v2.add(Path(points=[16,0,-8,9,-8,-9],operators=[0,1,1,3],isClipPath=0,autoclose='svg',fillMode=1,strokeDashArray=None,strokeWidth=1,strokeMiterLimit=0,strokeOpacity=None,strokeLineJoin=0,fillColor=Color(0,0,0,1),strokeColor=None,strokeLineCap=0,fillOpacity=1))
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    58
        v2=v1._nn(Group())
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    59
        v2.transform = (.866025,.5,-0.5,.866025,624.5,145.5648)
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    60
        v2.add(Path(points=[16,0,-8,9,-8,-9],operators=[0,1,1,3],isClipPath=0,autoclose='svg',fillMode=1,strokeDashArray=None,strokeWidth=1,strokeMiterLimit=0,strokeOpacity=None,strokeLineJoin=0,fillColor=Color(0,0,0,1),strokeColor=None,strokeLineCap=0,fillOpacity=1))
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    61
        v1.add(Path(points=[950,81,1009.094,81,1057,128.9055,1057,188,1057,247.0945,1009.094,295,950,295,890.9055,295,843,247.0945,843,188,843,128.9055,890.9055,81,950,81,950,139,922.938,139,901,160.938,901,188,901,215.062,922.938,237,950,237,977.062,237,999,215.062,999,188,999,160.938,977.062,139,950,139],operators=[0,2,2,2,2,3,0,2,2,2,2,3],isClipPath=0,autoclose='svg',fillMode=fillMode,strokeDashArray=None,strokeWidth=3,strokeMiterLimit=0,strokeOpacity=None,strokeLineJoin=0,fillOpacity=1,strokeColor=Color(0,0,0,1),strokeLineCap=0,fillColor=Color(1,0,0,1)))
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    62
        v2=v1._nn(Group())
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    63
        v2.transform = (0,1,-1,0,1057,188)
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    64
        v2.add(Path(points=[16,0,-8,9,-8,-9],operators=[0,1,1,3],isClipPath=0,autoclose='svg',fillMode=1,strokeDashArray=None,strokeWidth=1,strokeMiterLimit=0,strokeOpacity=None,strokeLineJoin=0,fillColor=Color(0,0,0,1),strokeColor=None,strokeLineCap=0,fillOpacity=1))
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    65
        v2=v1._nn(Group())
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    66
        v2.transform = (-0.866025,-0.5,.5,-0.866025,896.5,280.6647)
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    67
        v2.add(Path(points=[16,0,-8,9,-8,-9],operators=[0,1,1,3],isClipPath=0,autoclose='svg',fillMode=1,strokeDashArray=None,strokeWidth=1,strokeMiterLimit=0,strokeOpacity=None,strokeLineJoin=0,fillColor=Color(0,0,0,1),strokeColor=None,strokeLineCap=0,fillOpacity=1))
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    68
        v2=v1._nn(Group())
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    69
        v2.transform = (.866025,-0.5,.5,.866025,896.5,95.33528)
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    70
        v2.add(Path(points=[16,0,-8,9,-8,-9],operators=[0,1,1,3],isClipPath=0,autoclose='svg',fillMode=1,strokeDashArray=None,strokeWidth=1,strokeMiterLimit=0,strokeOpacity=None,strokeLineJoin=0,fillColor=Color(0,0,0,1),strokeColor=None,strokeLineCap=0,fillOpacity=1))
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    71
        v2=v1._nn(Group())
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    72
        v2.transform = (.866025,-0.5,.5,.866025,974.5,230.4352)
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    73
        v2.add(Path(points=[16,0,-8,9,-8,-9],operators=[0,1,1,3],isClipPath=0,autoclose='svg',fillMode=1,strokeDashArray=None,strokeWidth=1,strokeMiterLimit=0,strokeOpacity=None,strokeLineJoin=0,fillColor=Color(0,0,0,1),strokeColor=None,strokeLineCap=0,fillOpacity=1))
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    74
        v2=v1._nn(Group())
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    75
        v2.transform = (0,1,-1,0,901,188)
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    76
        v2.add(Path(points=[16,0,-8,9,-8,-9],operators=[0,1,1,3],isClipPath=0,autoclose='svg',fillMode=1,strokeDashArray=None,strokeWidth=1,strokeMiterLimit=0,strokeOpacity=None,strokeLineJoin=0,fillColor=Color(0,0,0,1),strokeColor=None,strokeLineCap=0,fillOpacity=1))
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    77
        v2=v1._nn(Group())
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    78
        v2.transform = (-0.866025,-0.5,.5,-0.866025,974.5,145.5648)
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    79
        v2.add(Path(points=[16,0,-8,9,-8,-9],operators=[0,1,1,3],isClipPath=0,autoclose='svg',fillMode=1,strokeDashArray=None,strokeWidth=1,strokeMiterLimit=0,strokeOpacity=None,strokeLineJoin=0,fillColor=Color(0,0,0,1),strokeColor=None,strokeLineCap=0,fillOpacity=1))
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    80
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    81
class _410Drawing(_DrawingEditorMixin,Drawing):
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    82
    def __init__(self,width=100.0,height=100.0,*args,**kw):
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    83
        Drawing.__init__(self,width,height,*args,**kw)
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    84
        self.transform = (1,0,0,1,0,0)
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    85
        v0=self._nn(Group())
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    86
        v0.transform = (1,0,0,-1,0,100)
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    87
        v0.add(Path(points=[30,1,70,1,99,30,99,70,70,99,30,99,1,70,1,30],operators=[0,1,1,1,1,1,1,1,3],isClipPath=0,autoclose='svg',fillMode=1,strokeDashArray=None,strokeWidth=1,strokeMiterLimit=0,strokeOpacity=None,strokeLineJoin=0,fillOpacity=1,strokeColor=Color(0,0,0,1),strokeLineCap=0,fillColor=Color(0,0,0,1)))
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    88
        v0.add(Path(points=[31,3,69,3,97,31,97,69,69,97,31,97,3,69,3,31],operators=[0,1,1,1,1,1,1,1,3],isClipPath=0,autoclose='svg',fillMode=1,strokeDashArray=None,strokeWidth=1,strokeMiterLimit=0,strokeOpacity=None,strokeLineJoin=0,fillOpacity=1,strokeColor=None,strokeLineCap=0,fillColor=Color(.666667,.133333,.2,1)))
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    89
        v1=v0._nn(Group())
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    90
        v1.transform = (1,0,0,-1,0,136)
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    91
        v1.add(String(50,68,u'410',textAnchor=u'middle',fontName='Helvetica',fontSize=48,fillColor=Color(1,1,1,1)))
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    92
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    93
class AutoCloseDrawing(_DrawingEditorMixin,Drawing):
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    94
    def __init__(self,width=100.0,height=100.0,autoclose='',*args,**kw):
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    95
        Drawing.__init__(self,width,height,*args,**kw)
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    96
        self.transform = (1,0,0,1,0,0)
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    97
        v0=self._nn(Group())
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    98
        v0.transform = (1,0,0,-1,0,100)
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
    99
        v1=v0._nn(Group())
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
   100
        v1.transform = (1,0,0,-1,0,100)
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
   101
        v1.add(Path(points=[10,10,10,90,20,90,20,10,30,10,30,90,40,90,40,10,50,10,50,90,60,90,60,10,70,10,70,90,80,90,80,10],operators=[0,1,1,1,3,0,1,1,1,0,1,1,1,3,0,1,1,1],isClipPath=0,autoclose=autoclose,fillMode=1,strokeDashArray=None,strokeWidth=2,strokeMiterLimit=0,strokeOpacity=None,strokeLineJoin=0,fillOpacity=1,strokeColor=Color(1,0,0,1),strokeLineCap=0,fillColor=Color(0,0,1,1)))
3977
06da9dfa6e20 renderPDF/PM.py: make tests configuarble and add a unittest to call test()
robin
parents:
diff changeset
   102
06da9dfa6e20 renderPDF/PM.py: make tests configuarble and add a unittest to call test()
robin
parents:
diff changeset
   103
class RenderTestCase(unittest.TestCase):
06da9dfa6e20 renderPDF/PM.py: make tests configuarble and add a unittest to call test()
robin
parents:
diff changeset
   104
    "Test renderPS classes."
06da9dfa6e20 renderPDF/PM.py: make tests configuarble and add a unittest to call test()
robin
parents:
diff changeset
   105
06da9dfa6e20 renderPDF/PM.py: make tests configuarble and add a unittest to call test()
robin
parents:
diff changeset
   106
    @classmethod
06da9dfa6e20 renderPDF/PM.py: make tests configuarble and add a unittest to call test()
robin
parents:
diff changeset
   107
    def setUpClass(cls):
06da9dfa6e20 renderPDF/PM.py: make tests configuarble and add a unittest to call test()
robin
parents:
diff changeset
   108
        cls.outDir = outDir = outputfile('render-out')
06da9dfa6e20 renderPDF/PM.py: make tests configuarble and add a unittest to call test()
robin
parents:
diff changeset
   109
        if not os.path.isdir(outDir):
06da9dfa6e20 renderPDF/PM.py: make tests configuarble and add a unittest to call test()
robin
parents:
diff changeset
   110
            os.makedirs(outDir)
06da9dfa6e20 renderPDF/PM.py: make tests configuarble and add a unittest to call test()
robin
parents:
diff changeset
   111
        for x in glob.glob(os.path.join(outDir,'*')):
06da9dfa6e20 renderPDF/PM.py: make tests configuarble and add a unittest to call test()
robin
parents:
diff changeset
   112
            os.remove(x)
06da9dfa6e20 renderPDF/PM.py: make tests configuarble and add a unittest to call test()
robin
parents:
diff changeset
   113
3983
5211314b7317 test_graphics_render.py: only renderPM test commented now
robin
parents: 3978
diff changeset
   114
    def test0(self):
5211314b7317 test_graphics_render.py: only renderPM test commented now
robin
parents: 3978
diff changeset
   115
        from reportlab.graphics.renderPS import test
5211314b7317 test_graphics_render.py: only renderPM test commented now
robin
parents: 3978
diff changeset
   116
        assert test(self.outDir) is None
4239
75c7de3058a6 more changes related to pypy testing
robin
parents: 3989
diff changeset
   117
3983
5211314b7317 test_graphics_render.py: only renderPM test commented now
robin
parents: 3978
diff changeset
   118
    def test1(self):
5211314b7317 test_graphics_render.py: only renderPM test commented now
robin
parents: 3978
diff changeset
   119
        from reportlab.graphics.renderPDF import test
5211314b7317 test_graphics_render.py: only renderPM test commented now
robin
parents: 3978
diff changeset
   120
        assert test(self.outDir) is None
3989
eea734ecb11d test_graphics_render.p: add renderPM & renderSVG tests
robin
parents: 3983
diff changeset
   121
4239
75c7de3058a6 more changes related to pypy testing
robin
parents: 3989
diff changeset
   122
    @unittest.skipIf(not _renderPM,'no _renderPM')
3989
eea734ecb11d test_graphics_render.p: add renderPM & renderSVG tests
robin
parents: 3983
diff changeset
   123
    def test2(self):
eea734ecb11d test_graphics_render.p: add renderPM & renderSVG tests
robin
parents: 3983
diff changeset
   124
        from reportlab.graphics.renderPM import test
eea734ecb11d test_graphics_render.p: add renderPM & renderSVG tests
robin
parents: 3983
diff changeset
   125
        assert test(self.outDir) is None
eea734ecb11d test_graphics_render.p: add renderPM & renderSVG tests
robin
parents: 3983
diff changeset
   126
eea734ecb11d test_graphics_render.p: add renderPM & renderSVG tests
robin
parents: 3983
diff changeset
   127
    def test3(self):
eea734ecb11d test_graphics_render.p: add renderPM & renderSVG tests
robin
parents: 3983
diff changeset
   128
        from reportlab.graphics.renderSVG import test
eea734ecb11d test_graphics_render.p: add renderPM & renderSVG tests
robin
parents: 3983
diff changeset
   129
        assert test(self.outDir) is None
3977
06da9dfa6e20 renderPDF/PM.py: make tests configuarble and add a unittest to call test()
robin
parents:
diff changeset
   130
4306
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
   131
    def test4(self):
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
   132
        formats = ('pdf svg ps' + (' png' if _renderPM else '')).split()
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
   133
        for fm in (0,1):
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
   134
            FillModeDrawing(fillMode=fm).save(formats=formats,outDir=self.outDir,fnRoot='fillmode-'+('non-zero' if fm else 'even-odd'))
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
   135
        _410Drawing().save(formats=formats,outDir=self.outDir,fnRoot='410')
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
   136
        for ac in (None,'pdf','svg'):
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
   137
            AutoCloseDrawing(autoclose=ac).save(formats=formats,outDir=self.outDir,fnRoot='autoclose-'+(ac or 'none'))
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4252
diff changeset
   138
3977
06da9dfa6e20 renderPDF/PM.py: make tests configuarble and add a unittest to call test()
robin
parents:
diff changeset
   139
def makeSuite():
06da9dfa6e20 renderPDF/PM.py: make tests configuarble and add a unittest to call test()
robin
parents:
diff changeset
   140
    return makeSuiteForClasses(RenderTestCase)
06da9dfa6e20 renderPDF/PM.py: make tests configuarble and add a unittest to call test()
robin
parents:
diff changeset
   141
06da9dfa6e20 renderPDF/PM.py: make tests configuarble and add a unittest to call test()
robin
parents:
diff changeset
   142
#noruntests
06da9dfa6e20 renderPDF/PM.py: make tests configuarble and add a unittest to call test()
robin
parents:
diff changeset
   143
if __name__ == "__main__":
06da9dfa6e20 renderPDF/PM.py: make tests configuarble and add a unittest to call test()
robin
parents:
diff changeset
   144
    unittest.TextTestRunner().run(makeSuite())
06da9dfa6e20 renderPDF/PM.py: make tests configuarble and add a unittest to call test()
robin
parents:
diff changeset
   145
    printLocation()