aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2011-04-20 18:43:51 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:54:13 -0300
commitc9a260df4b5d9b07e398c0dc1a3168371e71ccfb (patch)
tree3790df761a59256a52217b45eb399867583862cf
parentfc47ed069ee60fff932e2b6e06c4f8acd7faa0fb (diff)
Created unit test for function QPicture.setData
Reviewer: Lauro Moura <lauro.neto@openbossa.org> Hugo Parente Lima <hugo.pl@gmail.com>
-rw-r--r--tests/QtGui/CMakeLists.txt1
-rw-r--r--tests/QtGui/qpicture_test.py35
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()
+