summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/QtGui/qpen_test.py30
1 files changed, 27 insertions, 3 deletions
diff --git a/tests/QtGui/qpen_test.py b/tests/QtGui/qpen_test.py
index f9e9b18..b1e0b7a 100644
--- a/tests/QtGui/qpen_test.py
+++ b/tests/QtGui/qpen_test.py
@@ -1,10 +1,25 @@
import unittest
+from helper import UsesQApplication
-from PySide.QtCore import Qt
-from PySide.QtGui import QPen
+from PySide.QtCore import Qt, QTimer
+from PySide.QtGui import QPen, QPainter, QWidget
-class QPenTest(unittest.TestCase):
+class Painting(QWidget):
+ def __init__(self):
+ QWidget.__init__(self)
+ self.penFromEnum = None
+ self.penFromInteger = None
+
+ def paintEvent(self, event):
+ painter = QPainter(self)
+ painter.setPen(Qt.NoPen)
+ self.penFromEnum = painter.pen()
+ painter.setPen(int(Qt.NoPen))
+ self.penFromInteger = painter.pen()
+
+
+class QPenTest(UsesQApplication):
def testCtorWithCreatedEnums(self):
'''A simple case of QPen creation using created enums.'''
@@ -14,6 +29,15 @@ class QPenTest(unittest.TestCase):
join = Qt.PenJoinStyle(0)
pen = QPen(Qt.blue, width, style, cap, join)
+ def testSetPenWithPenStyleEnum(self):
+ '''Calls QPainter.setPen with both enum and integer. Bug #511.'''
+ w = Painting()
+ w.show()
+ QTimer.singleShot(1000, self.app.quit)
+ self.app.exec_()
+ self.assertEqual(w.penFromEnum.style(), Qt.NoPen)
+ self.assertEqual(w.penFromInteger.style(), Qt.SolidLine)
+
if __name__ == '__main__':
unittest.main()