From 74e10eef63b7ce30e5b31f1d47f1c4454e488120 Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Fri, 19 Aug 2011 16:37:38 -0300 Subject: Created unitest for bug #972. Reviewer: Luciano Wolf Lauro Neto --- tests/QtGui/CMakeLists.txt | 1 + tests/QtGui/bug_972.py | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 tests/QtGui/bug_972.py (limited to 'tests') 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() -- cgit v1.2.3