diff options
Diffstat (limited to 'sources/pyside2/tests/QtWidgets/bug_972.py')
-rw-r--r-- | sources/pyside2/tests/QtWidgets/bug_972.py | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/sources/pyside2/tests/QtWidgets/bug_972.py b/sources/pyside2/tests/QtWidgets/bug_972.py new file mode 100644 index 000000000..09d0bee51 --- /dev/null +++ b/sources/pyside2/tests/QtWidgets/bug_972.py @@ -0,0 +1,67 @@ +############################################################################# +## +## Copyright (C) 2016 The Qt Company Ltd. +## Contact: https://www.qt.io/licensing/ +## +## This file is part of the test suite of PySide2. +## +## $QT_BEGIN_LICENSE:GPL-EXCEPT$ +## Commercial License Usage +## Licensees holding valid commercial Qt licenses may use this file in +## accordance with the commercial license agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and The Qt Company. For licensing terms +## and conditions see https://www.qt.io/terms-conditions. For further +## information use the contact form at https://www.qt.io/contact-us. +## +## GNU General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 3 as published by the Free Software +## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +## included in the packaging of this file. Please review the following +## information to ensure the GNU General Public License requirements will +## be met: https://www.gnu.org/licenses/gpl-3.0.html. +## +## $QT_END_LICENSE$ +## +############################################################################# + +import unittest +from PySide2.QtCore import QSizeF +from PySide2.QtWidgets 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() |