diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-07-21 10:03:52 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-07-21 09:32:53 +0000 |
| commit | b10e77f3e518979c9bae492d2f7a2f03eff06af2 (patch) | |
| tree | 681526af730875804efac1c34599f407abfd0ec5 /sources/pyside2/tests | |
| parent | fb9666f093f09737a0b9b328513d3e468a8b22f8 (diff) | |
Fix the QtUiTools tests
Import QAction from QtGui.
Task-number: PYSIDE-1339
Task-number: PYSIDE-904
Change-Id: I5dadb2dd373ff54002563a63acd9e2c38a6c8b13
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/pyside2/tests')
| -rw-r--r-- | sources/pyside2/tests/QtUiTools/bug_392.py | 17 | ||||
| -rw-r--r-- | sources/pyside2/tests/QtUiTools/bug_426.py | 11 |
2 files changed, 17 insertions, 11 deletions
diff --git a/sources/pyside2/tests/QtUiTools/bug_392.py b/sources/pyside2/tests/QtUiTools/bug_392.py index 07db9802e..1a049b89e 100644 --- a/sources/pyside2/tests/QtUiTools/bug_392.py +++ b/sources/pyside2/tests/QtUiTools/bug_392.py @@ -36,29 +36,31 @@ init_test_paths(False) from helper.usesqapplication import UsesQApplication -from PySide2 import QtWidgets +from PySide2.QtGui import QAction +from PySide2.QtWidgets import QComboBox, QWidget from PySide2.QtUiTools import QUiLoader -class MyWidget(QtWidgets.QComboBox): +class MyWidget(QComboBox): def __init__(self, parent=None): - QtWidgets.QComboBox.__init__(self, parent) + QComboBox.__init__(self, parent) def isPython(self): return True class BugTest(UsesQApplication): def testCase(self): - w = QtWidgets.QWidget() + w = QWidget() loader = QUiLoader() filePath = os.path.join(os.path.dirname(__file__), 'action.ui') result = loader.load(filePath, w) - self.assertTrue(isinstance(result.actionFoo, QtGui.QAction)) + self.assertTrue(isinstance(result.actionFoo, QAction)) def testPythonCustomWidgets(self): - w = QtWidgets.QWidget() + w = QWidget() loader = QUiLoader() loader.registerCustomWidget(MyWidget) + self.assertTrue('MyWidget' in loader.availableWidgets()) filePath = os.path.join(os.path.dirname(__file__), 'pycustomwidget.ui') result = loader.load(filePath, w) @@ -66,9 +68,10 @@ class BugTest(UsesQApplication): self.assertTrue(result.custom.isPython()) def testPythonCustomWidgetsTwice(self): - w = QtWidgets.QWidget() + w = QWidget() loader = QUiLoader() loader.registerCustomWidget(MyWidget) + self.assertTrue('MyWidget' in loader.availableWidgets()) filePath = os.path.join(os.path.dirname(__file__), 'pycustomwidget2.ui') result = loader.load(filePath, w) diff --git a/sources/pyside2/tests/QtUiTools/bug_426.py b/sources/pyside2/tests/QtUiTools/bug_426.py index 15cfeee2b..488ba5c8d 100644 --- a/sources/pyside2/tests/QtUiTools/bug_426.py +++ b/sources/pyside2/tests/QtUiTools/bug_426.py @@ -34,19 +34,22 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from init_paths import init_test_paths init_test_paths(False) -from PySide2 import QtCore, QtWidgets +from PySide2.QtCore import QTimer +from PySide2.QtGui import QAction, QActionGroup +from PySide2.QtWidgets import QApplication, QWidget from PySide2.QtUiTools import QUiLoader + class Window(object): def __init__(self): loader = QUiLoader() filePath = os.path.join(os.path.dirname(__file__), 'bug_426.ui') self.widget = loader.load(filePath) - self.group = QtGui.QActionGroup(self.widget) + self.group = QActionGroup(self.widget) self.widget.show() - QtCore.QTimer.singleShot(0, self.widget.close) + QTimer.singleShot(0, self.widget.close) if __name__ == "__main__": - app = QtWidgets.QApplication(sys.argv) + app = QApplication(sys.argv) win = Window() sys.exit(app.exec_()) |
