~ubuntu-branches/ubuntu/natty/pyside/natty

« back to all changes in this revision

Viewing changes to tests/QtGui/qpainter_test.py

  • Committer: Bazaar Package Importer
  • Author(s): Didier Raboud
  • Date: 2011-02-18 18:01:00 UTC
  • mfrom: (1.1.6 upstream)
  • mto: This revision was merged to the branch mainline in revision 9.
  • Revision ID: james.westby@ubuntu.com-20110218180100-y8aqmcdbcbd6gpeh
Tags: upstream-1.0.0~rc1
ImportĀ upstreamĀ versionĀ 1.0.0~rc1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
import unittest
2
2
 
3
 
from PySide.QtGui import QPainter, QBrush, QLinearGradient
4
 
from PySide.QtCore import QRect, QRectF, Qt
 
3
from PySide.QtGui import QPainter, QLinearGradient
 
4
from PySide.QtCore import QLine, QLineF, QPoint, QPointF, QRect, QRectF, Qt
5
5
 
6
6
class QPainterDrawText(unittest.TestCase):
7
7
 
16
16
    def testDrawText(self):
17
17
        # bug #254
18
18
        rect = self.painter.drawText(100, 100, 100, 100,
19
 
                                    Qt.AlignCenter | Qt.TextWordWrap,
20
 
                                    self.text)
 
19
                                     Qt.AlignCenter | Qt.TextWordWrap,
 
20
                                     self.text)
21
21
        self.assert_(isinstance(rect, QRect))
22
22
 
23
23
    def testDrawTextWithRect(self):
24
24
        # bug #225
25
25
        rect = QRect(100, 100, 100, 100)
26
26
        newRect = self.painter.drawText(rect, Qt.AlignCenter | Qt.TextWordWrap,
27
 
                              self.text)
 
27
                                        self.text)
28
28
 
29
29
        self.assert_(isinstance(newRect, QRect))
30
30
 
32
32
        '''QPainter.drawText(QRectF, ... ,QRectF*) inject code'''
33
33
        rect = QRectF(100, 52.3, 100, 100)
34
34
        newRect = self.painter.drawText(rect, Qt.AlignCenter | Qt.TextWordWrap,
35
 
                              self.text)
 
35
                                        self.text)
36
36
 
37
37
        self.assert_(isinstance(newRect, QRectF))
38
38
 
 
39
    def testDrawLinesOverloads(self):
 
40
        '''Calls QPainter.drawLines overloads, if something is
 
41
           wrong Exception and chaos ensues. Bug #395'''
 
42
        self.painter.drawLines([QLine(QPoint(0,0), QPoint(1,1))])
 
43
        self.painter.drawLines([QPoint(0,0), QPoint(1,1)])
 
44
        self.painter.drawLines([QPointF(0,0), QPointF(1,1)])
 
45
        self.painter.drawLines([QLineF(QPointF(0,0), QPointF(1,1))])
 
46
 
39
47
class SetBrushWithOtherArgs(unittest.TestCase):
40
48
    '''Using qpainter.setBrush with args other than QBrush'''
41
49