diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-11-04 12:34:17 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-11-04 12:42:35 +0100 |
commit | 1704567d7ad0d21dd3b588af7aad40cd244c1799 (patch) | |
tree | 932b42988e482f01125dcbf4d470e9a56107689a /sources/pyside2/tests/pysidetest/qapp_like_a_macro_test.py | |
parent | 1d77cd18510412242384c5b37a00efd5b6ce8a26 (diff) | |
parent | c98ef56544cd54661b61529829caf6a799a1a94f (diff) |
Merge "Merge remote-tracking branch 'origin/5.14' into 5.15"
Diffstat (limited to 'sources/pyside2/tests/pysidetest/qapp_like_a_macro_test.py')
-rw-r--r-- | sources/pyside2/tests/pysidetest/qapp_like_a_macro_test.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sources/pyside2/tests/pysidetest/qapp_like_a_macro_test.py b/sources/pyside2/tests/pysidetest/qapp_like_a_macro_test.py index c58aba82e..1c0d5d55d 100644 --- a/sources/pyside2/tests/pysidetest/qapp_like_a_macro_test.py +++ b/sources/pyside2/tests/pysidetest/qapp_like_a_macro_test.py @@ -33,7 +33,10 @@ import PySide2 # It also uses the qApp variable to finish the instance and start over. class qAppMacroTest(unittest.TestCase): + _test_1093_is_first = True + def test_qApp_is_like_a_macro_and_can_restart(self): + self._test_1093_is_first = False from PySide2 import QtCore try: from PySide2 import QtGui, QtWidgets @@ -72,5 +75,20 @@ class qAppMacroTest(unittest.TestCase): # and they are again all the same self.assertTrue(qApp is QtCore.qApp is QtGui.qApp is QtWidgets.qApp) + def test_1093(self): + # Test that without creating a QApplication staticMetaObject still exists. + # Please see https://bugreports.qt.io/browse/PYSIDE-1093 for explanation. + # Note: This test must run first, otherwise we would be mislead! + assert self._test_1093_is_first + from PySide2 import QtCore + self.assertTrue(QtCore.QObject.staticMetaObject is not None) + app = QtCore.QCoreApplication.instance() + self.assertTrue(QtCore.QObject.staticMetaObject is not None) + if app is None: + app = QtCore.QCoreApplication([]) + self.assertTrue(QtCore.QObject.staticMetaObject is not None) + del __builtins__.qApp + + if __name__ == '__main__': unittest.main() |