aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2011-08-19 16:37:38 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:54:46 -0300
commit74e10eef63b7ce30e5b31f1d47f1c4454e488120 (patch)
tree958f111ce58c6f9e35e0ae091362be7ba29f54fc
parent88acbd47dbc745f4d80b884022f27b899050680c (diff)
Created unitest for bug #972.
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Lauro Neto <lauro.neto@openbossa.org>
-rw-r--r--tests/QtGui/CMakeLists.txt1
-rw-r--r--tests/QtGui/bug_972.py39
2 files changed, 40 insertions, 0 deletions
diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt
index 4e621c84c..96920b4fb 100644
--- a/tests/QtGui/CMakeLists.txt
+++ b/tests/QtGui/CMakeLists.txt
@@ -70,6 +70,7 @@ PYSIDE_TEST(bug_919.py)
PYSIDE_TEST(bug_921.py)
PYSIDE_TEST(bug_941.py)
PYSIDE_TEST(bug_964.py)
+PYSIDE_TEST(bug_972.py)
PYSIDE_TEST(customproxywidget_test.py)
PYSIDE_TEST(deepcopy_test.py)
PYSIDE_TEST(event_filter_test.py)
diff --git a/tests/QtGui/bug_972.py b/tests/QtGui/bug_972.py
new file mode 100644
index 000000000..f3ecf327a
--- /dev/null
+++ b/tests/QtGui/bug_972.py
@@ -0,0 +1,39 @@
+import unittest
+from PySide.QtCore import QSizeF
+from PySide.QtGui import QGraphicsProxyWidget, QSizePolicy, QPushButton, QGraphicsScene, QGraphicsView
+
+from helper import TimedQApplication
+
+def createItem(minimum, preferred, maximum, name):
+ w = QGraphicsProxyWidget()
+
+ w.setWidget(QPushButton(name))
+ w.setMinimumSize(minimum)
+ w.setPreferredSize(preferred)
+ w.setMaximumSize(maximum)
+ w.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
+
+ return w
+
+class TestBug972 (TimedQApplication):
+
+ # Test if the function QGraphicsProxyWidget.setWidget have the correct behavior
+ def testIt(self):
+ scene = QGraphicsScene()
+
+ minSize = QSizeF(30, 100)
+ prefSize = QSizeF(210, 100)
+ maxSize = QSizeF(300, 100)
+
+ a = createItem(minSize, prefSize, maxSize, "A")
+ b = createItem(minSize, prefSize, maxSize, "B")
+ c = createItem(minSize, prefSize, maxSize, "C")
+ d = createItem(minSize, prefSize, maxSize, "D")
+
+ view = QGraphicsView(scene)
+ view.show()
+ self.app.exec_()
+
+
+if __name__ == "__main__":
+ unittest.main()