diff options
-rw-r--r-- | tests/QtGui/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/QtGui/qpicture_test.py | 35 |
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt index 1dd2a23b4..f4a646de3 100644 --- a/tests/QtGui/CMakeLists.txt +++ b/tests/QtGui/CMakeLists.txt @@ -97,6 +97,7 @@ PYSIDE_TEST(qmenu_test.py) PYSIDE_TEST(qobject_mi_test.py) PYSIDE_TEST(qpainter_test.py) PYSIDE_TEST(qpen_test.py) +PYSIDE_TEST(qpicture_test.py) PYSIDE_TEST(qpixmap_test.py) PYSIDE_TEST(qpixmap_constructor.py) PYSIDE_TEST(qpolygonf_test.py) diff --git a/tests/QtGui/qpicture_test.py b/tests/QtGui/qpicture_test.py new file mode 100644 index 000000000..2aa82c918 --- /dev/null +++ b/tests/QtGui/qpicture_test.py @@ -0,0 +1,35 @@ +import unittest + +import os +from helper import UsesQApplication +from PySide.QtGui import QPicture, QPainter, QWidget + +class MyWidget(QWidget): + def paintEvent(self, e): + p = QPainter(self) + p.drawPicture(0, 0, self._picture) + self._app.quit() + +class QPictureTest(UsesQApplication): + def testFromData(self): + picture = QPicture() + painter = QPainter() + painter.begin(picture) + painter.drawEllipse(10,20, 80,70) + painter.end() + + data = picture.data() + picture2 = QPicture() + picture2.setData(data) + + self.assertEqual(picture2.data(), picture.data()) + + w = MyWidget() + w._picture = picture2 + w._app = self.app + w.show() + self.app.exec_() + +if __name__ == '__main__': + unittest.main() + |