aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/tests
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside6/tests')
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_750.py18
-rw-r--r--sources/pyside6/tests/QtWidgets/qpicture_test.py16
2 files changed, 21 insertions, 13 deletions
diff --git a/sources/pyside6/tests/QtWidgets/bug_750.py b/sources/pyside6/tests/QtWidgets/bug_750.py
index 074f569f6..61356c173 100644
--- a/sources/pyside6/tests/QtWidgets/bug_750.py
+++ b/sources/pyside6/tests/QtWidgets/bug_750.py
@@ -13,24 +13,28 @@ init_test_paths(False)
from helper.usesqapplication import UsesQApplication
-from PySide6.QtCore import QTimer
+from PySide6.QtCore import QCoreApplication, QTimer
from PySide6.QtGui import QPainter
from PySide6.QtWidgets import QWidget
class MyWidget(QWidget):
+ def __init__(self):
+ super().__init__()
+ self._info = None
+
def paintEvent(self, e):
- p = QPainter(self)
- self._info = p.fontInfo()
- self._app.quit()
+ with QPainter(self) as p:
+ self._info = p.fontInfo()
+ QTimer.singleShot(0, qApp.quit) # noqa: F821
class TestQPainter(UsesQApplication):
def testFontInfo(self):
w = MyWidget()
- w._app = self.app
- w._info = None
- QTimer.singleShot(300, w.show)
+ w.show()
+ while not w.windowHandle().isExposed():
+ QCoreApplication.processEvents()
self.app.exec()
self.assertTrue(w._info)
diff --git a/sources/pyside6/tests/QtWidgets/qpicture_test.py b/sources/pyside6/tests/QtWidgets/qpicture_test.py
index 884f391a9..e9b0440c2 100644
--- a/sources/pyside6/tests/QtWidgets/qpicture_test.py
+++ b/sources/pyside6/tests/QtWidgets/qpicture_test.py
@@ -12,16 +12,20 @@ from init_paths import init_test_paths
init_test_paths(False)
from helper.usesqapplication import UsesQApplication
-from PySide6.QtCore import QTimer
+from PySide6.QtCore import QCoreApplication, QTimer
from PySide6.QtGui import QPicture, QPainter
from PySide6.QtWidgets import QWidget
class MyWidget(QWidget):
+ def __init__(self, picture):
+ super().__init__()
+ self._picture = picture
+
def paintEvent(self, e):
with QPainter(self) as p:
p.drawPicture(0, 0, self._picture)
- self._app.quit()
+ QTimer.singleShot(0, qApp.quit) # noqa: F821
class QPictureTest(UsesQApplication):
@@ -36,11 +40,11 @@ class QPictureTest(UsesQApplication):
self.assertEqual(picture2.data(), picture.data())
- w = MyWidget()
- w._picture = picture2
- w._app = self.app
+ w = MyWidget(picture2)
- QTimer.singleShot(300, w.show)
+ w.show()
+ while not w.windowHandle().isExposed():
+ QCoreApplication.processEvents()
self.app.exec()