diff options
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_()) |
