aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/tests/pysidetest
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-10-08 08:17:29 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-10-08 08:17:29 +0200
commit66a0fa21efb94ac7cc16032213c91a33c0670e2f (patch)
tree622759bac23da5d32d06aaa56805570698c10cdf /sources/pyside2/tests/pysidetest
parent9698a678937c3dfd23e38b890a29b16ad6885d96 (diff)
parente2774ff5350fa94352858672aa165a8ff22aa3b1 (diff)
Merge remote-tracking branch 'origin/5.13' into 5.14
Diffstat (limited to 'sources/pyside2/tests/pysidetest')
-rw-r--r--sources/pyside2/tests/pysidetest/qapp_like_a_macro_test.py18
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()