diff options
author | Christian Tismer <[email protected]> | 2021-05-16 12:24:00 +0200 |
---|---|---|
committer | Christian Tismer <[email protected]> | 2023-03-16 17:32:29 +0100 |
commit | f668df2e26803989a4d4730ae219767bc9f229a9 (patch) | |
tree | 3da8c28021ec65c4d0e359302d93975ccc5ec6ad /sources/pyside6/tests | |
parent | 6d6f614fdd7510a1b8a00a51bb6232a3d151523b (diff) |
testing: modernize UsesQApplication and remove other versions
The last change to UsesQApplication can be generalized to
be able to remove the QtCore and QtGui versions.
Instead, the module and class to use are computed from the
content of sys.modules .
Task-number: PYSIDE-1564
Change-Id: Iac1fe3a2d6bb5a9f7638eb889f55b079cb55c272
Pick-to: 6.4
Reviewed-by: Friedemann Kleint <[email protected]>
Diffstat (limited to 'sources/pyside6/tests')
71 files changed, 190 insertions, 244 deletions
diff --git a/sources/pyside6/tests/Qt3DExtras/qt3dextras_test.py b/sources/pyside6/tests/Qt3DExtras/qt3dextras_test.py index 6f472def7..23e2d6e7e 100644 --- a/sources/pyside6/tests/Qt3DExtras/qt3dextras_test.py +++ b/sources/pyside6/tests/Qt3DExtras/qt3dextras_test.py @@ -13,7 +13,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication from PySide6.QtCore import (Property, QObject, QPropertyAnimation, QTimer, Signal, Slot) from PySide6.QtGui import (QGuiApplication, QMatrix4x4, QQuaternion, QVector3D, QWindow) @@ -123,7 +123,7 @@ class Window(Qt3DExtras.Qt3DWindow): self.sphereEntity.addComponent(self.material) -class Qt3DExtrasTestCase(UsesQGuiApplication): +class Qt3DExtrasTestCase(UsesQApplication): '''Tests related to Q3DExtras''' def test3DExtras(self): diff --git a/sources/pyside6/tests/QtCore/child_event_test.py b/sources/pyside6/tests/QtCore/child_event_test.py index 356bf0f72..6b17ddc93 100644 --- a/sources/pyside6/tests/QtCore/child_event_test.py +++ b/sources/pyside6/tests/QtCore/child_event_test.py @@ -14,7 +14,7 @@ from init_paths import init_test_paths init_test_paths(False) from PySide6.QtCore import QObject, QTimer, QCoreApplication -from helper.usesqcoreapplication import UsesQCoreApplication +from helper.usesqapplication import UsesQApplication class ExtQObject(QObject): @@ -37,14 +37,14 @@ class ExtQTimer(QTimer): self.child_event_received = True -class TestChildEvent(UsesQCoreApplication): +class TestChildEvent(UsesQApplication): '''Test case for QObject::childEvent and QTimer::childEvent''' def setUp(self): - UsesQCoreApplication.setUp(self) + UsesQApplication.setUp(self) def tearDown(self): - UsesQCoreApplication.tearDown(self) + UsesQApplication.tearDown(self) def testQObject(self): parent = ExtQObject() diff --git a/sources/pyside6/tests/QtCore/deletelater_test.py b/sources/pyside6/tests/QtCore/deletelater_test.py index 18e7dea09..0ee078428 100644 --- a/sources/pyside6/tests/QtCore/deletelater_test.py +++ b/sources/pyside6/tests/QtCore/deletelater_test.py @@ -15,10 +15,10 @@ from init_paths import init_test_paths init_test_paths(False) from PySide6.QtCore import QObject, QTimer, QCoreApplication, SIGNAL -from helper.usesqcoreapplication import UsesQCoreApplication +from helper.usesqapplication import UsesQApplication -class TestDeleteLater(UsesQCoreApplication): +class TestDeleteLater(UsesQApplication): '''Test case for function DeleteLater''' def testCase(self): diff --git a/sources/pyside6/tests/QtCore/duck_punching_test.py b/sources/pyside6/tests/QtCore/duck_punching_test.py index 668ca5751..145863c3e 100644 --- a/sources/pyside6/tests/QtCore/duck_punching_test.py +++ b/sources/pyside6/tests/QtCore/duck_punching_test.py @@ -16,7 +16,7 @@ from init_paths import init_test_paths init_test_paths(False) from PySide6.QtCore import QObject -from helper.usesqcoreapplication import UsesQCoreApplication +from helper.usesqapplication import UsesQApplication def MethodType(func, instance, instanceType): @@ -31,20 +31,20 @@ class Duck(QObject): QObject.childEvent(self, event) -class TestDuckPunchingOnQObjectInstance(UsesQCoreApplication): +class TestDuckPunchingOnQObjectInstance(UsesQApplication): '''Test case for duck punching new implementations of C++ virtual methods into object instances.''' def setUp(self): # Acquire resources self.duck_childEvent_called = False - UsesQCoreApplication.setUp(self) + UsesQApplication.setUp(self) def tearDown(self): # Release resources del self.duck_childEvent_called # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion gc.collect() - UsesQCoreApplication.tearDown(self) + UsesQApplication.tearDown(self) def testChildEventMonkeyPatch(self): # Test if the new childEvent injected on QObject instance is called from C++ diff --git a/sources/pyside6/tests/QtCore/qobject_connect_notify_test.py b/sources/pyside6/tests/QtCore/qobject_connect_notify_test.py index 409b06c3c..b93408d10 100644 --- a/sources/pyside6/tests/QtCore/qobject_connect_notify_test.py +++ b/sources/pyside6/tests/QtCore/qobject_connect_notify_test.py @@ -13,7 +13,7 @@ from init_paths import init_test_paths init_test_paths(False) from PySide6.QtCore import QObject, SIGNAL, SLOT -from helper.usesqcoreapplication import UsesQCoreApplication +from helper.usesqapplication import UsesQApplication def cute_slot(): @@ -39,14 +39,14 @@ class Obj(QObject): self.dis_notified = False -class TestQObjectConnectNotify(UsesQCoreApplication): +class TestQObjectConnectNotify(UsesQApplication): '''Test case for QObject::connectNotify''' def setUp(self): - UsesQCoreApplication.setUp(self) + UsesQApplication.setUp(self) self.called = False def tearDown(self): - UsesQCoreApplication.tearDown(self) + UsesQApplication.tearDown(self) def testBasic(self): sender = Obj() diff --git a/sources/pyside6/tests/QtCore/qobject_event_filter_test.py b/sources/pyside6/tests/QtCore/qobject_event_filter_test.py index a2870221d..1cf07fbab 100644 --- a/sources/pyside6/tests/QtCore/qobject_event_filter_test.py +++ b/sources/pyside6/tests/QtCore/qobject_event_filter_test.py @@ -16,7 +16,7 @@ init_test_paths(False) from PySide6.QtCore import QObject, QTimerEvent -from helper.usesqcoreapplication import UsesQCoreApplication +from helper.usesqapplication import UsesQApplication class FilterObject(QObject): @@ -63,14 +63,14 @@ class FilteredObject(QObject): self.app.quit() -class TestQObjectEventFilterPython(UsesQCoreApplication): +class TestQObjectEventFilterPython(UsesQApplication): '''QObject.eventFilter - Reimplemented in python Filters 5 TimerEvents and then bypasses the other events to the timerEvent method. After 5 runs, the timerEvent method will ask the core application to exit''' def setUp(self): # Acquire resources - UsesQCoreApplication.setUp(self) + UsesQApplication.setUp(self) self.obj_filter = FilterObject(event_type=QTimerEvent) def tearDown(self): @@ -78,7 +78,7 @@ class TestQObjectEventFilterPython(UsesQCoreApplication): del self.obj_filter # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion gc.collect() - UsesQCoreApplication.tearDown(self) + UsesQApplication.tearDown(self) def testEventFilter(self): # QObject.eventFilter reimplemented in python diff --git a/sources/pyside6/tests/QtCore/qobject_timer_event_test.py b/sources/pyside6/tests/QtCore/qobject_timer_event_test.py index f93d036b4..9e657c27f 100644 --- a/sources/pyside6/tests/QtCore/qobject_timer_event_test.py +++ b/sources/pyside6/tests/QtCore/qobject_timer_event_test.py @@ -15,7 +15,7 @@ init_test_paths(False) from PySide6.QtCore import QObject, QCoreApplication -from helper.usesqcoreapplication import UsesQCoreApplication +from helper.usesqapplication import UsesQApplication class Dummy(QObject): @@ -34,7 +34,7 @@ class Dummy(QObject): self.app.exit(0) -class QObjectTimerEvent(UsesQCoreApplication): +class QObjectTimerEvent(UsesQApplication): def setUp(self): # Acquire resources diff --git a/sources/pyside6/tests/QtCore/qobject_tr_as_instance_test.py b/sources/pyside6/tests/QtCore/qobject_tr_as_instance_test.py index 83e8ae1af..9123c5155 100644 --- a/sources/pyside6/tests/QtCore/qobject_tr_as_instance_test.py +++ b/sources/pyside6/tests/QtCore/qobject_tr_as_instance_test.py @@ -17,7 +17,7 @@ init_test_paths(False) from PySide6.QtCore import QObject -#from helper.usesqcoreapplication import UsesQCoreApplication +#from helper.usesqapplication import UsesQApplication class QObjectTrTest(unittest.TestCase): diff --git a/sources/pyside6/tests/QtCore/qrunnable_test.py b/sources/pyside6/tests/QtCore/qrunnable_test.py index 0470a6cd2..d52f50ce1 100644 --- a/sources/pyside6/tests/QtCore/qrunnable_test.py +++ b/sources/pyside6/tests/QtCore/qrunnable_test.py @@ -14,7 +14,7 @@ from init_paths import init_test_paths init_test_paths(False) from PySide6.QtCore import QCoreApplication, QRunnable, QThreadPool, QThread, qDebug -from helper.usesqcoreapplication import UsesQCoreApplication +from helper.usesqapplication import UsesQApplication test_result = "" @@ -23,7 +23,7 @@ def check_test(): test_result = "test works" -class QRunnableTest(UsesQCoreApplication): +class QRunnableTest(UsesQApplication): def testCreateWithAutoDelete(self): global test_result test_result = "" # reset diff --git a/sources/pyside6/tests/QtCore/qthread_test.py b/sources/pyside6/tests/QtCore/qthread_test.py index d81d36db0..4d26e0597 100644 --- a/sources/pyside6/tests/QtCore/qthread_test.py +++ b/sources/pyside6/tests/QtCore/qthread_test.py @@ -16,7 +16,7 @@ init_test_paths(False) from PySide6.QtCore import QThread, QCoreApplication, QObject, QTimer, Slot from PySide6.QtCore import QEventLoop -from helper.usesqcoreapplication import UsesQCoreApplication +from helper.usesqapplication import UsesQApplication class Dummy(QThread): @@ -31,10 +31,10 @@ class Dummy(QThread): self.called = True -class QThreadSimpleCase(UsesQCoreApplication): +class QThreadSimpleCase(UsesQApplication): def setUp(self): - UsesQCoreApplication.setUp(self) + UsesQApplication.setUp(self) self._started_called = False self._finished_called = False self.called = False diff --git a/sources/pyside6/tests/QtCore/qtimer_singleshot_test.py b/sources/pyside6/tests/QtCore/qtimer_singleshot_test.py index e702f4792..770c9c1a9 100644 --- a/sources/pyside6/tests/QtCore/qtimer_singleshot_test.py +++ b/sources/pyside6/tests/QtCore/qtimer_singleshot_test.py @@ -15,7 +15,7 @@ from init_paths import init_test_paths init_test_paths(False) from PySide6.QtCore import QObject, QTimer, QCoreApplication, Signal -from helper.usesqcoreapplication import UsesQCoreApplication +from helper.usesqapplication import UsesQApplication class WatchDog(QObject): @@ -32,12 +32,12 @@ class WatchDog(QObject): self.watched.exit_app_cb() -class TestSingleShot(UsesQCoreApplication): +class TestSingleShot(UsesQApplication): '''Test case for QTimer.singleShot''' def setUp(self): # Acquire resources - UsesQCoreApplication.setUp(self) + UsesQApplication.setUp(self) self.watchdog = WatchDog(self) self.called = False @@ -47,7 +47,7 @@ class TestSingleShot(UsesQCoreApplication): del self.called # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion gc.collect() - UsesQCoreApplication.tearDown(self) + UsesQApplication.tearDown(self) def callback(self): self.called = True @@ -64,11 +64,11 @@ class SigEmitter(QObject): sig1 = Signal() -class TestSingleShotSignal(UsesQCoreApplication): +class TestSingleShotSignal(UsesQApplication): '''Test case for QTimer.singleShot connecting to signals''' def setUp(self): - UsesQCoreApplication.setUp(self) + UsesQApplication.setUp(self) self.watchdog = WatchDog(self) self.called = False @@ -77,7 +77,7 @@ class TestSingleShotSignal(UsesQCoreApplication): del self.called # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion gc.collect() - UsesQCoreApplication.tearDown(self) + UsesQApplication.tearDown(self) def callback(self): self.called = True diff --git a/sources/pyside6/tests/QtCore/qtimer_timeout_test.py b/sources/pyside6/tests/QtCore/qtimer_timeout_test.py index b853ee85d..70f151989 100644 --- a/sources/pyside6/tests/QtCore/qtimer_timeout_test.py +++ b/sources/pyside6/tests/QtCore/qtimer_timeout_test.py @@ -14,7 +14,7 @@ from init_paths import init_test_paths init_test_paths(False) from PySide6.QtCore import QObject, QTimer, SIGNAL -from helper.usesqcoreapplication import UsesQCoreApplication +from helper.usesqapplication import UsesQApplication class WatchDog(QObject): @@ -31,12 +31,12 @@ class WatchDog(QObject): self.watched.exit_app_cb() -class TestTimeoutSignal(UsesQCoreApplication): +class TestTimeoutSignal(UsesQApplication): '''Test case to check if the signals are really being caught''' def setUp(self): # Acquire resources - UsesQCoreApplication.setUp(self) + super().setUp() self.watchdog = WatchDog(self) self.timer = QTimer() self.called = False @@ -48,7 +48,7 @@ class TestTimeoutSignal(UsesQCoreApplication): del self.called # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion gc.collect() - UsesQCoreApplication.tearDown(self) + super().tearDown() def callback(self, *args): # Default callback diff --git a/sources/pyside6/tests/QtCore/signal_sender.py b/sources/pyside6/tests/QtCore/signal_sender.py index 208030058..c85dc6da9 100644 --- a/sources/pyside6/tests/QtCore/signal_sender.py +++ b/sources/pyside6/tests/QtCore/signal_sender.py @@ -10,7 +10,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.usesqcoreapplication import UsesQCoreApplication +from helper.usesqapplication import UsesQApplication from PySide6.QtCore import QCoreApplication, QObject, QTimer, Signal, Slot @@ -39,7 +39,7 @@ class DerivedReceiver(Receiver): pass -class TestSignalSender(UsesQCoreApplication): +class TestSignalSender(UsesQApplication): """Test PYSIDE-2144/1295, check that QObject::sender() works also if it is routed via GlobalReceiverV2 in case of a non-C++ slot (Python callback, as for derived classes).""" diff --git a/sources/pyside6/tests/QtCore/thread_signals_test.py b/sources/pyside6/tests/QtCore/thread_signals_test.py index 80cda6b92..b0a5f0186 100644 --- a/sources/pyside6/tests/QtCore/thread_signals_test.py +++ b/sources/pyside6/tests/QtCore/thread_signals_test.py @@ -13,7 +13,7 @@ from init_paths import init_test_paths init_test_paths(False) from PySide6.QtCore import QObject, SIGNAL, QFile, QThread, QTimer, Qt -from helper.usesqcoreapplication import UsesQCoreApplication +from helper.usesqapplication import UsesQApplication class MyThread(QThread): @@ -22,7 +22,7 @@ class MyThread(QThread): self.emit(SIGNAL("test(const QString&)"), "INdT - PySide") -class TestThreadSignal(UsesQCoreApplication): +class TestThreadSignal(UsesQApplication): __called__ = True diff --git a/sources/pyside6/tests/QtCore/translation_test.py b/sources/pyside6/tests/QtCore/translation_test.py index aad0ce7c8..da09e47b6 100644 --- a/sources/pyside6/tests/QtCore/translation_test.py +++ b/sources/pyside6/tests/QtCore/translation_test.py @@ -15,10 +15,10 @@ init_test_paths(False) from PySide6.QtCore import QObject, QTranslator, QCoreApplication -from helper.usesqcoreapplication import UsesQCoreApplication +from helper.usesqapplication import UsesQApplication -class TranslationTest(UsesQCoreApplication): +class TranslationTest(UsesQApplication): '''Test case for Qt translation facilities.''' def setUp(self): diff --git a/sources/pyside6/tests/QtDBus/test_dbus.py b/sources/pyside6/tests/QtDBus/test_dbus.py index 6b6a892dd..a37db9421 100644 --- a/sources/pyside6/tests/QtDBus/test_dbus.py +++ b/sources/pyside6/tests/QtDBus/test_dbus.py @@ -12,7 +12,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.usesqcoreapplication import UsesQCoreApplication +from helper.usesqapplication import UsesQApplication import sys from PySide6.QtCore import QCoreApplication @@ -32,7 +32,7 @@ def service_names(): return reply.value() -class TestDBus(UsesQCoreApplication): +class TestDBus(UsesQApplication): '''Simple Test case for QDBus''' def test_service_names(self): diff --git a/sources/pyside6/tests/QtDataVisualization/datavisualization_test.py b/sources/pyside6/tests/QtDataVisualization/datavisualization_test.py index 88d1bda75..eb089294b 100644 --- a/sources/pyside6/tests/QtDataVisualization/datavisualization_test.py +++ b/sources/pyside6/tests/QtDataVisualization/datavisualization_test.py @@ -13,7 +13,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication from PySide6.QtCore import QTimer from PySide6.QtDataVisualization import (Q3DBars, QBar3DSeries, QBarDataItem, QBarDataProxy, QCategory3DAxis, @@ -35,7 +35,7 @@ def dataToBarDataArray(data): return result -class QtDataVisualizationTestCase(UsesQGuiApplication): +class QtDataVisualizationTestCase(UsesQApplication): '''Tests related to QtDataVisualization''' def testBars(self): diff --git a/sources/pyside6/tests/QtGui/bug_367.py b/sources/pyside6/tests/QtGui/bug_367.py index facf9179c..771fa5a4b 100644 --- a/sources/pyside6/tests/QtGui/bug_367.py +++ b/sources/pyside6/tests/QtGui/bug_367.py @@ -12,11 +12,11 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication from PySide6.QtGui import QStandardItem, QStandardItemModel -class BugTest(UsesQGuiApplication): +class BugTest(UsesQApplication): @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount") def testCase(self): model = QStandardItemModel() diff --git a/sources/pyside6/tests/QtGui/bug_740.py b/sources/pyside6/tests/QtGui/bug_740.py index c88c48069..ece314cc8 100644 --- a/sources/pyside6/tests/QtGui/bug_740.py +++ b/sources/pyside6/tests/QtGui/bug_740.py @@ -10,12 +10,12 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication from PySide6.QtCore import QSize from PySide6.QtGui import QBitmap, QImage -class TestQBitmap(UsesQGuiApplication): +class TestQBitmap(UsesQApplication): def testFromDataMethod(self): dataBits = bytes('\x38\x28\x38\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\xfe\xfe\x7c\x7c\x38\x38\x10\x10', "UTF-8") bim = QBitmap.fromData(QSize(8, 48), dataBits, QImage.Format_Mono) # missing function diff --git a/sources/pyside6/tests/QtGui/event_filter_test.py b/sources/pyside6/tests/QtGui/event_filter_test.py index c26e74926..01d8fbc02 100644 --- a/sources/pyside6/tests/QtGui/event_filter_test.py +++ b/sources/pyside6/tests/QtGui/event_filter_test.py @@ -10,7 +10,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication from PySide6.QtCore import QObject, QEvent from PySide6.QtGui import QWindow @@ -22,7 +22,7 @@ class MyFilter(QObject): return QObject.eventFilter(self, obj, event) -class EventFilter(UsesQGuiApplication): +class EventFilter(UsesQApplication): @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount") def testRefCount(self): o = QObject() diff --git a/sources/pyside6/tests/QtGui/float_to_int_implicit_conversion_test.py b/sources/pyside6/tests/QtGui/float_to_int_implicit_conversion_test.py index f06c6177b..ba438f8e0 100644 --- a/sources/pyside6/tests/QtGui/float_to_int_implicit_conversion_test.py +++ b/sources/pyside6/tests/QtGui/float_to_int_implicit_conversion_test.py @@ -15,10 +15,10 @@ init_test_paths(False) from PySide6.QtGui import QImage, qRgb -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication -class SetPixelFloat(UsesQGuiApplication): +class SetPixelFloat(UsesQApplication): '''Test case for calling setPixel with float as argument''' def setUp(self): diff --git a/sources/pyside6/tests/QtGui/qbrush_test.py b/sources/pyside6/tests/QtGui/qbrush_test.py index ca685b9b6..800e6f072 100644 --- a/sources/pyside6/tests/QtGui/qbrush_test.py +++ b/sources/pyside6/tests/QtGui/qbrush_test.py @@ -15,10 +15,10 @@ init_test_paths(False) from PySide6.QtCore import Qt from PySide6.QtGui import QColor, QBrush -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication -class Constructor(UsesQGuiApplication): +class Constructor(UsesQApplication): '''Test case for constructor of QBrush''' def testQColor(self): diff --git a/sources/pyside6/tests/QtGui/qcursor_test.py b/sources/pyside6/tests/QtGui/qcursor_test.py index 6a540d73e..1494fe370 100644 --- a/sources/pyside6/tests/QtGui/qcursor_test.py +++ b/sources/pyside6/tests/QtGui/qcursor_test.py @@ -15,10 +15,10 @@ from init_paths import init_test_paths init_test_paths(False) from PySide6.QtGui import QBitmap, QCursor, QPixmap -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication -class TestQCursor(UsesQGuiApplication): +class TestQCursor(UsesQApplication): def testQCursorConstructor(self): bmp = QBitmap(16, 16) cursor = QCursor(bmp, bmp, 16, 16) diff --git a/sources/pyside6/tests/QtGui/qdatastream_gui_operators_test.py b/sources/pyside6/tests/QtGui/qdatastream_gui_operators_test.py index 5687fba87..f2c86abf7 100644 --- a/sources/pyside6/tests/QtGui/qdatastream_gui_operators_test.py +++ b/sources/pyside6/tests/QtGui/qdatastream_gui_operators_test.py @@ -13,10 +13,10 @@ init_test_paths(False) from PySide6.QtCore import QDataStream, QByteArray, QIODevice, Qt from PySide6.QtGui import QPixmap, QColor -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication -class QPixmapQDatastream(UsesQGuiApplication): +class QPixmapQDatastream(UsesQApplication): '''QDataStream <<>> QPixmap''' def setUp(self): diff --git a/sources/pyside6/tests/QtGui/qfont_test.py b/sources/pyside6/tests/QtGui/qfont_test.py index b6eeb27f3..f81d47ec6 100644 --- a/sources/pyside6/tests/QtGui/qfont_test.py +++ b/sources/pyside6/tests/QtGui/qfont_test.py @@ -11,10 +11,10 @@ from init_paths import init_test_paths init_test_paths(False) from PySide6.QtGui import QFont -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication -class QFontTest(UsesQGuiApplication): +class QFontTest(UsesQApplication): def testStringConstruction(self): """PYSIDE-1685: Test that passing str to QFont works after addding diff --git a/sources/pyside6/tests/QtGui/qfontmetrics_test.py b/sources/pyside6/tests/QtGui/qfontmetrics_test.py index 069a41f7d..52ce810d3 100644 --- a/sources/pyside6/tests/QtGui/qfontmetrics_test.py +++ b/sources/pyside6/tests/QtGui/qfontmetrics_test.py @@ -16,10 +16,10 @@ init_test_paths(False) from PySide6.QtGui import QFont, QFontMetrics, QFontMetricsF from PySide6.QtCore import QRect, QRectF, Qt, QSize, QSizeF -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication -class QFontMetricsTest(UsesQGuiApplication): +class QFontMetricsTest(UsesQApplication): '''Base class for QFontMetrics tests''' def setUp(self): @@ -123,7 +123,7 @@ class SizeTest(QFontMetricsTest): 'PySide by INdT', 20, ['aaaa', 'ase']) -class QFontMetricsFTest(UsesQGuiApplication): +class QFontMetricsFTest(UsesQApplication): '''Base class for QFontMetrics tests''' def setUp(self): diff --git a/sources/pyside6/tests/QtGui/qimage_test.py b/sources/pyside6/tests/QtGui/qimage_test.py index 595f85892..5912bf318 100644 --- a/sources/pyside6/tests/QtGui/qimage_test.py +++ b/sources/pyside6/tests/QtGui/qimage_test.py @@ -13,11 +13,11 @@ from init_paths import init_test_paths init_test_paths(False) from PySide6.QtGui import QImage -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication from xpm_data import xpm -class QImageTest(UsesQGuiApplication): +class QImageTest(UsesQApplication): '''Test case for calling setPixel with float as argument''' def testQImageStringBuffer(self): diff --git a/sources/pyside6/tests/QtGui/qimage_win_test.py b/sources/pyside6/tests/QtGui/qimage_win_test.py index 34e4d0daf..2d9cb96f1 100644 --- a/sources/pyside6/tests/QtGui/qimage_win_test.py +++ b/sources/pyside6/tests/QtGui/qimage_win_test.py @@ -14,7 +14,7 @@ init_test_paths(False) from PySide6.QtCore import Qt from PySide6.QtGui import QImage -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication def create_image(): @@ -23,7 +23,7 @@ def create_image(): return result -class QImageWinTest(UsesQGuiApplication): +class QImageWinTest(UsesQApplication): def test_to_hbitmap(self): """Test conversion to/from a Windows HBITMAP.""" diff --git a/sources/pyside6/tests/QtGui/qitemselection_test.py b/sources/pyside6/tests/QtGui/qitemselection_test.py index 52ab589f2..179bff745 100644 --- a/sources/pyside6/tests/QtGui/qitemselection_test.py +++ b/sources/pyside6/tests/QtGui/qitemselection_test.py @@ -10,12 +10,12 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication from PySide6.QtCore import QItemSelection from PySide6.QtGui import QStandardItemModel -class QItemSelectionTest(UsesQGuiApplication): +class QItemSelectionTest(UsesQApplication): def testLen(self): model = QStandardItemModel(2, 2) model.insertRow(0) diff --git a/sources/pyside6/tests/QtGui/qkeysequence_test.py b/sources/pyside6/tests/QtGui/qkeysequence_test.py index 25743ba34..66a4916e7 100644 --- a/sources/pyside6/tests/QtGui/qkeysequence_test.py +++ b/sources/pyside6/tests/QtGui/qkeysequence_test.py @@ -13,10 +13,10 @@ init_test_paths(False) from PySide6.QtCore import Qt from PySide6.QtGui import QKeySequence, qt_set_sequence_auto_mnemonic -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication -class QKeySequenceTest(UsesQGuiApplication): +class QKeySequenceTest(UsesQApplication): def testGetItemOperator(self): # bug #774 diff --git a/sources/pyside6/tests/QtGui/qpainter_test.py b/sources/pyside6/tests/QtGui/qpainter_test.py index ffba42e99..103b91ad6 100644 --- a/sources/pyside6/tests/QtGui/qpainter_test.py +++ b/sources/pyside6/tests/QtGui/qpainter_test.py @@ -11,7 +11,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication from PySide6.QtGui import QPainter, QLinearGradient, QImage from PySide6.QtCore import QLine, QLineF, QPoint, QPointF, QRect, QRectF, Qt @@ -23,7 +23,7 @@ except ModuleNotFoundError: HAVE_NUMPY = False -class QPainterDrawText(UsesQGuiApplication): +class QPainterDrawText(UsesQApplication): def setUp(self): super(QPainterDrawText, self).setUp() self.image = QImage(32, 32, QImage.Format_ARGB32) @@ -100,7 +100,7 @@ class QPainterDrawText(UsesQGuiApplication): self.painter.drawPointsNp(x, y) -class SetBrushWithOtherArgs(UsesQGuiApplication): +class SetBrushWithOtherArgs(UsesQApplication): '''Using qpainter.setBrush with args other than QBrush''' def testSetBrushGradient(self): diff --git a/sources/pyside6/tests/QtGui/qpdfwriter_test.py b/sources/pyside6/tests/QtGui/qpdfwriter_test.py index 671f7acbf..2dca2aca2 100644 --- a/sources/pyside6/tests/QtGui/qpdfwriter_test.py +++ b/sources/pyside6/tests/QtGui/qpdfwriter_test.py @@ -10,12 +10,12 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication from PySide6.QtGui import QPageLayout, QPageSize, QPdfWriter, QTextDocument from PySide6.QtCore import QDir, QMarginsF, QTemporaryFile -class QPdfWriterTest(UsesQGuiApplication): +class QPdfWriterTest(UsesQApplication): def testWrite(self): temporaryFile = QTemporaryFile(QDir.tempPath() + "/pdfwriter_test_XXXXXX.pdf") diff --git a/sources/pyside6/tests/QtGui/qpen_test.py b/sources/pyside6/tests/QtGui/qpen_test.py index 06baf92b0..84df8c499 100644 --- a/sources/pyside6/tests/QtGui/qpen_test.py +++ b/sources/pyside6/tests/QtGui/qpen_test.py @@ -10,7 +10,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication from PySide6.QtCore import Qt, QTimer from PySide6.QtGui import QPen, QPainter, QRasterWindow @@ -32,7 +32,7 @@ class Painting(QRasterWindow): QTimer.singleShot(20, self.close) -class QPenTest(UsesQGuiApplication): +class QPenTest(UsesQApplication): def testCtorWithCreatedEnums(self): '''A simple case of QPen creation using created enums.''' diff --git a/sources/pyside6/tests/QtGui/qpixelformat_test.py b/sources/pyside6/tests/QtGui/qpixelformat_test.py index eaf94426f..869d15952 100644 --- a/sources/pyside6/tests/QtGui/qpixelformat_test.py +++ b/sources/pyside6/tests/QtGui/qpixelformat_test.py @@ -12,12 +12,12 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication from PySide6.QtCore import QSize, Qt from PySide6.QtGui import QColor, QImage, QPixelFormat, qPixelFormatRgba -class QPixelFormatTest(UsesQGuiApplication): +class QPixelFormatTest(UsesQApplication): def test(self): image = QImage(QSize(200, 200), QImage.Format_ARGB32) image.fill(QColor(Qt.red)) diff --git a/sources/pyside6/tests/QtGui/qpixmap_constructor.py b/sources/pyside6/tests/QtGui/qpixmap_constructor.py index afba18841..dd658af52 100644 --- a/sources/pyside6/tests/QtGui/qpixmap_constructor.py +++ b/sources/pyside6/tests/QtGui/qpixmap_constructor.py @@ -13,7 +13,7 @@ init_test_paths(False) from PySide6.QtGui import QPixmap -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication xpm = [ "27 22 206 2", @@ -248,7 +248,7 @@ xpm = [ ] -class QStringSequenceTest(UsesQGuiApplication): +class QStringSequenceTest(UsesQApplication): def testQPixmapConstructor(self): pixmap1 = QPixmap(xpm) self.assertFalse(pixmap1.isNull()) diff --git a/sources/pyside6/tests/QtGui/qpixmap_test.py b/sources/pyside6/tests/QtGui/qpixmap_test.py index d76b0a469..b80ae2ad5 100644 --- a/sources/pyside6/tests/QtGui/qpixmap_test.py +++ b/sources/pyside6/tests/QtGui/qpixmap_test.py @@ -10,12 +10,12 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication from PySide6.QtGui import QColor, QPixmap from PySide6.QtCore import QFile, QIODevice, QObject, QSize, Qt -class QPixmapTest(UsesQGuiApplication): +class QPixmapTest(UsesQApplication): def testQVariantConstructor(self): obj = QObject() pixmap = QPixmap() @@ -43,7 +43,7 @@ class QPixmapTest(UsesQGuiApplication): self.assertTrue(pixmap.loadFromData(data)) -class QPixmapToImage(UsesQGuiApplication): +class QPixmapToImage(UsesQApplication): def testFilledImage(self): '''QPixmap.fill + toImage + image.pixel''' diff --git a/sources/pyside6/tests/QtGui/qpixmapcache_test.py b/sources/pyside6/tests/QtGui/qpixmapcache_test.py index aa55621af..2ecb439d3 100644 --- a/sources/pyside6/tests/QtGui/qpixmapcache_test.py +++ b/sources/pyside6/tests/QtGui/qpixmapcache_test.py @@ -10,11 +10,11 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication from PySide6.QtGui import QPixmapCache, QPixmap -class QPixmapCacheTest(UsesQGuiApplication): +class QPixmapCacheTest(UsesQApplication): def testWithString(self): pm1 = QPixmap() diff --git a/sources/pyside6/tests/QtGui/qrasterwindow_test.py b/sources/pyside6/tests/QtGui/qrasterwindow_test.py index a2b5bcae2..0a37d0f57 100644 --- a/sources/pyside6/tests/QtGui/qrasterwindow_test.py +++ b/sources/pyside6/tests/QtGui/qrasterwindow_test.py @@ -12,7 +12,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication from PySide6.QtCore import QEvent, QPoint, QRect, QSize, QTimer, Qt from PySide6.QtGui import QColor, QBackingStore, QPaintDevice, QPainter, QWindow, QPaintDeviceWindow, QRasterWindow, QRegion, QStaticText @@ -30,7 +30,7 @@ class TestRasterWindow(QRasterWindow): painter.drawStaticText(QPoint(10, 10), self.text) -class QRasterWindowTest(UsesQGuiApplication): +class QRasterWindowTest(UsesQApplication): def test(self): rasterWindow = TestRasterWindow() rasterWindow.setFramePosition(QPoint(100, 100)) diff --git a/sources/pyside6/tests/QtGui/qregion_test.py b/sources/pyside6/tests/QtGui/qregion_test.py index 48da94889..df14fc3e0 100644 --- a/sources/pyside6/tests/QtGui/qregion_test.py +++ b/sources/pyside6/tests/QtGui/qregion_test.py @@ -12,10 +12,10 @@ init_test_paths(False) from PySide6.QtGui import QRegion from PySide6.QtCore import QPoint, QRect, QSize -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication -class QRegionTest(UsesQGuiApplication): +class QRegionTest(UsesQApplication): def testFunctionUnit(self): r = QRegion(0, 0, 10, 10) diff --git a/sources/pyside6/tests/QtGui/qstandarditemmodel_test.py b/sources/pyside6/tests/QtGui/qstandarditemmodel_test.py index 78d55d414..55aca9113 100644 --- a/sources/pyside6/tests/QtGui/qstandarditemmodel_test.py +++ b/sources/pyside6/tests/QtGui/qstandarditemmodel_test.py @@ -14,10 +14,10 @@ init_test_paths(False) from PySide6.QtCore import QObject from PySide6.QtGui import QStandardItemModel, QStandardItem from shiboken6 import Shiboken -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication -class QStandardItemModelTest(UsesQGuiApplication): +class QStandardItemModelTest(UsesQApplication): def setUp(self): super(QStandardItemModelTest, self).setUp() @@ -43,7 +43,7 @@ class QStandardItemModelTest(UsesQGuiApplication): self.assertFalse(Shiboken.isValid(root)) -class QStandardItemModelRef(UsesQGuiApplication): +class QStandardItemModelRef(UsesQApplication): @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount") def testRefCount(self): model = QStandardItemModel(5, 5) diff --git a/sources/pyside6/tests/QtGui/qstring_qkeysequence_test.py b/sources/pyside6/tests/QtGui/qstring_qkeysequence_test.py index 29dcfb34b..f68374263 100644 --- a/sources/pyside6/tests/QtGui/qstring_qkeysequence_test.py +++ b/sources/pyside6/tests/QtGui/qstring_qkeysequence_test.py @@ -13,12 +13,12 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication from PySide6.QtGui import QAction, QKeySequence -class QStringQKeySequenceTest(UsesQGuiApplication): +class QStringQKeySequenceTest(UsesQApplication): '''Tests conversions of QString to and from QKeySequence.''' def testQStringFromQKeySequence(self): diff --git a/sources/pyside6/tests/QtGui/qstylehints_test.py b/sources/pyside6/tests/QtGui/qstylehints_test.py index d962144b6..d2b21d30d 100644 --- a/sources/pyside6/tests/QtGui/qstylehints_test.py +++ b/sources/pyside6/tests/QtGui/qstylehints_test.py @@ -12,11 +12,11 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication from PySide6.QtGui import QStyleHints -class QStyleHintsTest(UsesQGuiApplication): +class QStyleHintsTest(UsesQApplication): def test(self): styleHints = self.app.styleHints() self.assertTrue(styleHints.startDragDistance() > 0) diff --git a/sources/pyside6/tests/QtGui/qtextline_test.py b/sources/pyside6/tests/QtGui/qtextline_test.py index ea39d536d..c34a4c98a 100644 --- a/sources/pyside6/tests/QtGui/qtextline_test.py +++ b/sources/pyside6/tests/QtGui/qtextline_test.py @@ -11,10 +11,10 @@ from init_paths import init_test_paths init_test_paths(False) from PySide6.QtGui import QTextLayout, QTextOption -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication -class QTextLineTest(UsesQGuiApplication): +class QTextLineTest(UsesQApplication): def testCursorToX(self): textLayout = QTextLayout() diff --git a/sources/pyside6/tests/QtMultimedia/audio_test.py b/sources/pyside6/tests/QtMultimedia/audio_test.py index eb144a326..af359e525 100644 --- a/sources/pyside6/tests/QtMultimedia/audio_test.py +++ b/sources/pyside6/tests/QtMultimedia/audio_test.py @@ -12,12 +12,12 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication from PySide6.QtCore import QByteArray from PySide6.QtMultimedia import QAudioBuffer, QAudioFormat, QMediaDevices -class testAudioDevices(UsesQGuiApplication): +class testAudioDevices(UsesQApplication): def setUp(self): super().setUp() diff --git a/sources/pyside6/tests/QtNetwork/accessManager_test.py b/sources/pyside6/tests/QtNetwork/accessManager_test.py index 01e16bd78..87711b278 100644 --- a/sources/pyside6/tests/QtNetwork/accessManager_test.py +++ b/sources/pyside6/tests/QtNetwork/accessManager_test.py @@ -14,11 +14,11 @@ init_test_paths(False) from PySide6.QtCore import QUrl from PySide6.QtNetwork import QNetworkAccessManager, QNetworkReply, QNetworkRequest -from helper.usesqcoreapplication import UsesQCoreApplication +from helper.usesqapplication import UsesQApplication from httpd import TestServer -class AccessManagerCase(UsesQCoreApplication): +class AccessManagerCase(UsesQApplication): def setUp(self): super(AccessManagerCase, self).setUp() diff --git a/sources/pyside6/tests/QtNetwork/bug_446.py b/sources/pyside6/tests/QtNetwork/bug_446.py index 82df4eafc..f28ddb369 100644 --- a/sources/pyside6/tests/QtNetwork/bug_446.py +++ b/sources/pyside6/tests/QtNetwork/bug_446.py @@ -11,10 +11,10 @@ from init_paths import init_test_paths init_test_paths(False) from PySide6.QtNetwork import QHostAddress, QTcpServer, QTcpSocket -from helper.usesqcoreapplication import UsesQCoreApplication +from helper.usesqapplication import UsesQApplication -class HttpSignalsCase(UsesQCoreApplication): +class HttpSignalsCase(UsesQApplication): '''Test case for launching QHttp signals''' DATA = bytes("PySide rocks", "UTF-8") diff --git a/sources/pyside6/tests/QtNetwork/qhostinfo_test.py b/sources/pyside6/tests/QtNetwork/qhostinfo_test.py index ff1a5d954..8d8d2cae4 100644 --- a/sources/pyside6/tests/QtNetwork/qhostinfo_test.py +++ b/sources/pyside6/tests/QtNetwork/qhostinfo_test.py @@ -12,7 +12,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.usesqcoreapplication import UsesQCoreApplication +from helper.usesqapplication import UsesQApplication from PySide6.QtCore import (QCoreApplication, QElapsedTimer, QObject, QThread, Slot, SLOT) from PySide6.QtNetwork import QHostInfo @@ -45,10 +45,10 @@ class Receiver(QObject): self._slot_called = True -class QHostInfoTest(UsesQCoreApplication): +class QHostInfoTest(UsesQApplication): '''Test case for QHostInfo.''' def setUp(self): - UsesQCoreApplication.setUp(self) + UsesQApplication.setUp(self) self._timer = QElapsedTimer() def testStringBasedLookup(self): diff --git a/sources/pyside6/tests/QtNfc/test_nfc.py b/sources/pyside6/tests/QtNfc/test_nfc.py index 72932a5a1..a73c52153 100644 --- a/sources/pyside6/tests/QtNfc/test_nfc.py +++ b/sources/pyside6/tests/QtNfc/test_nfc.py @@ -15,10 +15,10 @@ init_test_paths(False) from PySide6.QtNfc import QNearFieldManager -from helper.usesqcoreapplication import UsesQCoreApplication +from helper.usesqapplication import UsesQApplication -class TestNfc(UsesQCoreApplication): +class TestNfc(UsesQApplication): def test(self): manager = QNearFieldManager() diff --git a/sources/pyside6/tests/QtOpenGL/qopenglbuffer_test.py b/sources/pyside6/tests/QtOpenGL/qopenglbuffer_test.py index cac585834..e4ff6feb4 100644 --- a/sources/pyside6/tests/QtOpenGL/qopenglbuffer_test.py +++ b/sources/pyside6/tests/QtOpenGL/qopenglbuffer_test.py @@ -13,7 +13,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication from PySide6.QtGui import QOffscreenSurface, QOpenGLContext, QSurface, QWindow from PySide6.QtOpenGL import QOpenGLBuffer @@ -45,7 +45,7 @@ def createSurface(surfaceClass): return 0 -class QOpenGLBufferTest(UsesQGuiApplication): +class QOpenGLBufferTest(UsesQApplication): def testBufferCreate(self): surface = createSurface(QSurface.Window) ctx = QOpenGLContext() diff --git a/sources/pyside6/tests/QtOpenGL/qopenglwindow_test.py b/sources/pyside6/tests/QtOpenGL/qopenglwindow_test.py index 3a5cd0bbe..821281761 100644 --- a/sources/pyside6/tests/QtOpenGL/qopenglwindow_test.py +++ b/sources/pyside6/tests/QtOpenGL/qopenglwindow_test.py @@ -12,7 +12,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication from PySide6.QtCore import QSize, QTimer, Qt from PySide6.QtGui import (QColor, QGuiApplication, QImage, QOpenGLContext, @@ -77,7 +77,7 @@ class OpenGLWindow(QOpenGLWindow): self.m_functions.glViewport(0, 0, self.width(), self.height()) -class QOpenGLWindowTest(UsesQGuiApplication): +class QOpenGLWindowTest(UsesQApplication): # On macOS, glClear(), glViewport() are rejected due to GLbitfield/GLint not being resolved properly def test(self): openGlWindow = OpenGLWindow() diff --git a/sources/pyside6/tests/QtQml/bug_847.py b/sources/pyside6/tests/QtQml/bug_847.py index 8ccde82ff..947eb494e 100644 --- a/sources/pyside6/tests/QtQml/bug_847.py +++ b/sources/pyside6/tests/QtQml/bug_847.py @@ -17,7 +17,7 @@ from init_paths import init_test_paths init_test_paths(False) from helper.helper import quickview_errorstring -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication from PySide6.QtCore import Slot, Signal, QUrl, QTimer, QCoreApplication from PySide6.QtQuick import QQuickView @@ -34,7 +34,7 @@ class View(QQuickView): self.called.emit(x, y) -class TestQML(UsesQGuiApplication): +class TestQML(UsesQApplication): def done(self, x, y): self._sucess = True self.app.quit() diff --git a/sources/pyside6/tests/QtQml/bug_995.py b/sources/pyside6/tests/QtQml/bug_995.py index bd1315d52..745dd7dae 100644 --- a/sources/pyside6/tests/QtQml/bug_995.py +++ b/sources/pyside6/tests/QtQml/bug_995.py @@ -11,7 +11,7 @@ from init_paths import init_test_paths init_test_paths(False) from helper.helper import adjust_filename -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication from PySide6.QtCore import QUrl from PySide6.QtGui import QGuiApplication diff --git a/sources/pyside6/tests/QtQml/bug_997.py b/sources/pyside6/tests/QtQml/bug_997.py index cc7cf4d66..501c221c3 100644 --- a/sources/pyside6/tests/QtQml/bug_997.py +++ b/sources/pyside6/tests/QtQml/bug_997.py @@ -11,13 +11,13 @@ from init_paths import init_test_paths init_test_paths(False) from helper.helper import quickview_errorstring -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication from PySide6.QtCore import QCoreApplication, QTimer, QUrl, Slot from PySide6.QtQml import QQmlPropertyMap from PySide6.QtQuick import QQuickView -class TestBug(UsesQGuiApplication): +class TestBug(UsesQApplication): def setUp(self): super().setUp() diff --git a/sources/pyside6/tests/QtQml/javascript_exceptions.py b/sources/pyside6/tests/QtQml/javascript_exceptions.py index ec99c930d..e2b530aaf 100644 --- a/sources/pyside6/tests/QtQml/javascript_exceptions.py +++ b/sources/pyside6/tests/QtQml/javascript_exceptions.py @@ -11,7 +11,7 @@ from init_paths import init_test_paths init_test_paths(False) from helper.helper import quickview_errorstring -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication from PySide6.QtCore import Slot, Property, Signal, QObject, QUrl from PySide6.QtQml import QJSEngine, qmlRegisterType @@ -54,7 +54,7 @@ class TestClass(QObject): test_2 = True -class JavaScriptExceptionsTest(UsesQGuiApplication): +class JavaScriptExceptionsTest(UsesQApplication): def test_jsengine(self): engine = QJSEngine() test_object = TestClass() diff --git a/sources/pyside6/tests/QtStateMachine/qstatemachine_test.py b/sources/pyside6/tests/QtStateMachine/qstatemachine_test.py index 59203a354..5e17b3a1f 100644 --- a/sources/pyside6/tests/QtStateMachine/qstatemachine_test.py +++ b/sources/pyside6/tests/QtStateMachine/qstatemachine_test.py @@ -15,10 +15,10 @@ from PySide6.QtCore import (QObject, QParallelAnimationGroup, QPropertyAnimation, QTimer, SIGNAL) from PySide6.QtStateMachine import (QFinalState, QState, QStateMachine) -from helper.usesqcoreapplication import UsesQCoreApplication +from helper.usesqapplication import UsesQApplication -class QStateMachineTest(UsesQCoreApplication): +class QStateMachineTest(UsesQApplication): def cb(self, *args): self.assertEqual(self.machine.defaultAnimations(), [self.anim]) @@ -44,7 +44,7 @@ class QStateMachineTest(UsesQCoreApplication): self.app.exec() -class QSetConverterTest(UsesQCoreApplication): +class QSetConverterTest(UsesQApplication): '''Test converter of QSet toPython using QStateAnimation.configuration''' def testBasic(self): diff --git a/sources/pyside6/tests/signals/bug_311.py b/sources/pyside6/tests/signals/bug_311.py index 5f8af81c1..f2bbbc093 100644 --- a/sources/pyside6/tests/signals/bug_311.py +++ b/sources/pyside6/tests/signals/bug_311.py @@ -12,7 +12,7 @@ from init_paths import init_test_paths init_test_paths(False) from PySide6.QtCore import QDate, QObject, Signal -from helper.usesqcoreapplication import UsesQCoreApplication +from helper.usesqapplication import UsesQApplication class DerivedDate(QDate): @@ -26,7 +26,7 @@ class Emitter(QObject): tupleSignal = Signal(tuple) -class SignaltoSignalTest(UsesQCoreApplication): +class SignaltoSignalTest(UsesQApplication): def myCb(self, dt): self._dt = dt diff --git a/sources/pyside6/tests/signals/bug_319.py b/sources/pyside6/tests/signals/bug_319.py index aaa5ea991..bae0d8fdb 100644 --- a/sources/pyside6/tests/signals/bug_319.py +++ b/sources/pyside6/tests/signals/bug_319.py @@ -12,7 +12,7 @@ from init_paths import init_test_paths init_test_paths(False) from PySide6.QtCore import QObject, Signal, Slot -from helper.usesqcoreapplication import UsesQCoreApplication +from helper.usesqapplication import UsesQApplication class Listener(QObject): @@ -31,7 +31,7 @@ class Communicate(QObject): speak = Signal(tuple) -class SignaltoSignalTest(UsesQCoreApplication): +class SignaltoSignalTest(UsesQApplication): def testBug(self): someone = Communicate() someone2 = Listener() diff --git a/sources/pyside6/tests/signals/lambda_test.py b/sources/pyside6/tests/signals/lambda_test.py index cc4e61ca1..a91a97959 100644 --- a/sources/pyside6/tests/signals/lambda_test.py +++ b/sources/pyside6/tests/signals/lambda_test.py @@ -15,7 +15,7 @@ init_test_paths(False) from PySide6.QtCore import QObject, SIGNAL, QProcess -from helper.usesqcoreapplication import UsesQCoreApplication +from helper.usesqapplication import UsesQApplication class Dummy(QObject): @@ -44,7 +44,7 @@ class BasicCase(unittest.TestCase): self.assertEqual(obj.arg, arg) -class QtSigLambda(UsesQCoreApplication): +class QtSigLambda(UsesQApplication): qapplication = True diff --git a/sources/pyside6/tests/signals/multiple_connections_test.py b/sources/pyside6/tests/signals/multiple_connections_test.py index 783c9414b..b6aa33f2d 100644 --- a/sources/pyside6/tests/signals/multiple_connections_test.py +++ b/sources/pyside6/tests/signals/multiple_connections_test.py @@ -14,7 +14,7 @@ init_test_paths(False) from PySide6.QtCore import QObject, SIGNAL, QProcess from helper.basicpyslotcase import BasicPySlotCase -from helper.usesqcoreapplication import UsesQCoreApplication +from helper.usesqapplication import UsesQApplication class MultipleSignalConnections(unittest.TestCase): @@ -42,7 +42,7 @@ class MultipleSignalConnections(unittest.TestCase): self.assertTrue(rec.called) -class PythonMultipleSlots(UsesQCoreApplication, MultipleSignalConnections): +class PythonMultipleSlots(UsesQApplication, MultipleSignalConnections): '''Multiple connections to python signals''' def testPythonSignal(self): @@ -57,7 +57,7 @@ class PythonMultipleSlots(UsesQCoreApplication, MultipleSignalConnections): SIGNAL('foobar(int)')), receivers, (0, )) -class QProcessMultipleSlots(UsesQCoreApplication, MultipleSignalConnections): +class QProcessMultipleSlots(UsesQApplication, MultipleSignalConnections): '''Multiple connections to QProcess signals''' def testQProcessStarted(self): diff --git a/sources/pyside6/tests/signals/qobject_sender_test.py b/sources/pyside6/tests/signals/qobject_sender_test.py index 1f01b57e5..a7cda69f7 100644 --- a/sources/pyside6/tests/signals/qobject_sender_test.py +++ b/sources/pyside6/tests/signals/qobject_sender_test.py @@ -14,7 +14,7 @@ from init_paths import init_test_paths init_test_paths(False) from PySide6.QtCore import QCoreApplication, QObject, QTimer, SIGNAL -from helper.usesqcoreapplication import UsesQCoreApplication +from helper.usesqapplication import UsesQApplication class ExtQTimer(QTimer): @@ -55,7 +55,7 @@ class ObjectSenderCheckOnReceiverTest(unittest.TestCase): self.assertEqual(sender, recv.the_sender) -class ObjectSenderWithQAppTest(UsesQCoreApplication): +class ObjectSenderWithQAppTest(UsesQApplication): '''Test case for QObject.sender() method with QApplication.''' def testSenderCppSignal(self): @@ -82,7 +82,7 @@ class ObjectSenderWithQAppTest(UsesQCoreApplication): self.assertEqual(sender, recv.the_sender) -class ObjectSenderWithQAppCheckOnReceiverTest(UsesQCoreApplication): +class ObjectSenderWithQAppCheckOnReceiverTest(UsesQApplication): '''Test case for QObject.sender() method with QApplication.''' def testSenderCppSignal(self): diff --git a/sources/pyside6/tests/signals/ref02_test.py b/sources/pyside6/tests/signals/ref02_test.py index db456b35b..e0d71cff5 100644 --- a/sources/pyside6/tests/signals/ref02_test.py +++ b/sources/pyside6/tests/signals/ref02_test.py @@ -13,13 +13,13 @@ from init_paths import init_test_paths init_test_paths(False) from PySide6.QtCore import QCoreApplication, QTimeLine -from helper.usesqcoreapplication import UsesQCoreApplication +from helper.usesqapplication import UsesQApplication -class NativeSignalsTest(UsesQCoreApplication): +class NativeSignalsTest(UsesQApplication): def setUp(self): - UsesQCoreApplication.setUp(self) + UsesQApplication.setUp(self) self.called = False self.timeline = QTimeLine(100) @@ -28,7 +28,7 @@ class NativeSignalsTest(UsesQCoreApplication): del self.timeline # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion gc.collect() - UsesQCoreApplication.tearDown(self) + UsesQApplication.tearDown(self) def testSignalWithIntArgument(self): diff --git a/sources/pyside6/tests/signals/ref05_test.py b/sources/pyside6/tests/signals/ref05_test.py index 13ab1ff65..b6c5b4a10 100644 --- a/sources/pyside6/tests/signals/ref05_test.py +++ b/sources/pyside6/tests/signals/ref05_test.py @@ -13,7 +13,7 @@ from init_paths import init_test_paths init_test_paths(False) from PySide6.QtCore import QObject, QCoreApplication, QTimeLine, Slot -from helper.usesqcoreapplication import UsesQCoreApplication +from helper.usesqapplication import UsesQApplication class ExtQObject(QObject): @@ -27,10 +27,10 @@ class ExtQObject(QObject): self.counter += 1 -class UserSlotTest(UsesQCoreApplication): +class UserSlotTest(UsesQApplication): def setUp(self): - UsesQCoreApplication.setUp(self) + UsesQApplication.setUp(self) self.receiver = ExtQObject() self.timeline = QTimeLine(100) @@ -39,7 +39,7 @@ class UserSlotTest(UsesQCoreApplication): del self.receiver # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion gc.collect() - UsesQCoreApplication.tearDown(self) + UsesQApplication.tearDown(self) def testUserSlot(self): self.timeline.setUpdateInterval(10) diff --git a/sources/pyside6/tests/signals/ref06_test.py b/sources/pyside6/tests/signals/ref06_test.py index 56d54c1af..21fbe545c 100644 --- a/sources/pyside6/tests/signals/ref06_test.py +++ b/sources/pyside6/tests/signals/ref06_test.py @@ -13,7 +13,7 @@ from init_paths import init_test_paths init_test_paths(False) from PySide6.QtCore import QObject, QCoreApplication, QTimeLine, Signal, Slot -from helper.usesqcoreapplication import UsesQCoreApplication +from helper.usesqapplication import UsesQApplication class ExtQObject(QObject): @@ -28,10 +28,10 @@ class ExtQObject(QObject): self.counter += 1 -class SignaltoSignalTest(UsesQCoreApplication): +class SignaltoSignalTest(UsesQApplication): def setUp(self): - UsesQCoreApplication.setUp(self) + UsesQApplication.setUp(self) self.receiver = ExtQObject() self.timeline = QTimeLine(100) @@ -40,7 +40,7 @@ class SignaltoSignalTest(UsesQCoreApplication): del self.receiver # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion gc.collect() - UsesQCoreApplication.tearDown(self) + UsesQApplication.tearDown(self) def testSignaltoSignal(self): self.timeline.setUpdateInterval(10) diff --git a/sources/pyside6/tests/signals/signal_across_threads.py b/sources/pyside6/tests/signals/signal_across_threads.py index ad4b806ed..91b1ca986 100644 --- a/sources/pyside6/tests/signals/signal_across_threads.py +++ b/sources/pyside6/tests/signals/signal_across_threads.py @@ -14,7 +14,7 @@ from init_paths import init_test_paths init_test_paths(False) from PySide6.QtCore import QObject, QThread, QTimer, Slot -from helper.usesqcoreapplication import UsesQCoreApplication +from helper.usesqapplication import UsesQApplication class ReceiverBase(QObject): @@ -39,9 +39,9 @@ class TestThread(QThread): pass -class SignalAcrossThreads(UsesQCoreApplication): +class SignalAcrossThreads(UsesQApplication): def setUp(self): - UsesQCoreApplication.setUp(self) + UsesQApplication.setUp(self) self._timer_tick = 0 self._timer = QTimer() self._timer.setInterval(20) @@ -49,7 +49,7 @@ class SignalAcrossThreads(UsesQCoreApplication): self._worker_thread = TestThread() def tearDown(self): - UsesQCoreApplication.tearDown(self) + UsesQApplication.tearDown(self) @Slot() def _control_test(self): diff --git a/sources/pyside6/tests/signals/signal_emission_test.py b/sources/pyside6/tests/signals/signal_emission_test.py index 862a03faa..1439432e9 100644 --- a/sources/pyside6/tests/signals/signal_emission_test.py +++ b/sources/pyside6/tests/signals/signal_emission_test.py @@ -17,10 +17,10 @@ init_test_paths(False) from PySide6.QtCore import QObject, SIGNAL, SLOT, QProcess, QTimeLine from helper.basicpyslotcase import BasicPySlotCase -from helper.usesqcoreapplication import UsesQCoreApplication +from helper.usesqapplication import UsesQApplication -class ArgsOnEmptySignal(UsesQCoreApplication): +class ArgsOnEmptySignal(UsesQApplication): '''Trying to emit a signal without arguments passing some arguments''' def testArgsToNoArgsSignal(self): @@ -29,7 +29,7 @@ class ArgsOnEmptySignal(UsesQCoreApplication): self.assertRaises(TypeError, process.emit, SIGNAL('started()'), 42) -class MoreArgsOnEmit(UsesQCoreApplication): +class MoreArgsOnEmit(UsesQApplication): '''Trying to pass more args than needed to emit (signals with args)''' def testMoreArgs(self): @@ -43,7 +43,7 @@ class Dummy(QObject): pass -class PythonSignalToCppSlots(UsesQCoreApplication): +class PythonSignalToCppSlots(UsesQApplication): '''Connect python signals to C++ slots''' def testWithoutArgs(self): @@ -75,7 +75,7 @@ class PythonSignalToCppSlots(UsesQCoreApplication): self.assertEqual(timeline.currentTime(), current + 42) -class CppSignalsToCppSlots(UsesQCoreApplication): +class CppSignalsToCppSlots(UsesQApplication): '''Connection between C++ slots and signals''' def testWithoutArgs(self): @@ -107,7 +107,7 @@ def someSlot(args=None): called = True -class DynamicSignalsToFuncPartial(UsesQCoreApplication): +class DynamicSignalsToFuncPartial(UsesQApplication): def testIt(self): global called @@ -118,14 +118,14 @@ class DynamicSignalsToFuncPartial(UsesQCoreApplication): self.assertTrue(called) -class EmitUnknownType(UsesQCoreApplication): +class EmitUnknownType(UsesQApplication): def testIt(self): a = QObject() a.connect(SIGNAL('foobar(Dummy)'), lambda x: 42) # Just connect with an unknown type self.assertRaises(TypeError, a.emit, SIGNAL('foobar(Dummy)'), 22) -class EmitEnum(UsesQCoreApplication): +class EmitEnum(UsesQApplication): """Test emission of enum arguments""" def slot(self, arg): diff --git a/sources/pyside6/tests/signals/signal_object_test.py b/sources/pyside6/tests/signals/signal_object_test.py index 1f60b4c3a..607f51813 100644 --- a/sources/pyside6/tests/signals/signal_object_test.py +++ b/sources/pyside6/tests/signals/signal_object_test.py @@ -12,7 +12,7 @@ from init_paths import init_test_paths init_test_paths(False) from PySide6.QtCore import QTimer, Signal, QObject, Slot, Qt -from helper.usesqcoreapplication import UsesQCoreApplication +from helper.usesqapplication import UsesQApplication class MyObject(QTimer): @@ -37,7 +37,7 @@ class MyObject(QTimer): self._o = o -class SignalObjectTest(UsesQCoreApplication): +class SignalObjectTest(UsesQApplication): def cb(self): self._cb_called = True self.app.exit() diff --git a/sources/pyside6/tests/signals/signal_signature_test.py b/sources/pyside6/tests/signals/signal_signature_test.py index 7477f6243..59bc1b29f 100644 --- a/sources/pyside6/tests/signals/signal_signature_test.py +++ b/sources/pyside6/tests/signals/signal_signature_test.py @@ -13,7 +13,7 @@ from init_paths import init_test_paths init_test_paths(False) from PySide6.QtCore import QObject, Signal, SIGNAL, SLOT -from helper.usesqcoreapplication import UsesQCoreApplication +from helper.usesqapplication import UsesQApplication called = False @@ -50,7 +50,7 @@ def callback_empty(): pass -class TestConnectNotifyWithNewStyleSignals(UsesQCoreApplication): +class TestConnectNotifyWithNewStyleSignals(UsesQApplication): '''Test case for signal signature received by QObject::connectNotify().''' def testOldStyle(self): diff --git a/sources/pyside6/tests/signals/static_metaobject_test.py b/sources/pyside6/tests/signals/static_metaobject_test.py index 44d10cd7d..6b1372d54 100644 --- a/sources/pyside6/tests/signals/static_metaobject_test.py +++ b/sources/pyside6/tests/signals/static_metaobject_test.py @@ -15,7 +15,7 @@ from init_paths import init_test_paths init_test_paths(False) from PySide6.QtCore import QObject, SIGNAL, Slot -from helper.usesqcoreapplication import UsesQCoreApplication +from helper.usesqapplication import UsesQApplication class MyObject(QObject): @@ -30,7 +30,7 @@ class MyObject(QObject): self._slotCalledCount = self._slotCalledCount + 1 -class StaticMetaObjectTest(UsesQCoreApplication): +class StaticMetaObjectTest(UsesQApplication): def testSignalPropagation(self): o = MyObject() diff --git a/sources/pyside6/tests/util/helper/usesqapplication.py b/sources/pyside6/tests/util/helper/usesqapplication.py index ed46e1e48..d6d070c69 100644 --- a/sources/pyside6/tests/util/helper/usesqapplication.py +++ b/sources/pyside6/tests/util/helper/usesqapplication.py @@ -10,23 +10,33 @@ import unittest # This version avoids explicit import in order to adapt to the # import decision of the main module. # This should work with every compatible library. +# Replaces the QtGui and QtCore versions as well. class UsesQApplication(unittest.TestCase): - '''Helper class to provide QApplication instances''' - - qapplication = True + '''Helper class to provide Q(Core|Gui|)Application instances + Just connect or call self.exit_app_cb. When called, will ask + self.app to exit. + ''' def setUp(self): '''Creates the QApplication instance''' - module = sys.modules[list(_ for _ in sys.modules if _.endswith(".QtWidgets"))[0]] - QApplication = getattr(module, "QApplication") + module = sys.modules[sorted(_ for _ in sys.modules + if _.endswith((".QtCore", ".QtGui", ".QtWidgets")))[-1]] + found = module.__name__.rsplit(".")[-1] + cls = getattr(module, {"QtWidgets": "QApplication", + "QtGui": "QGuiApplication", + "QtCore": "QCoreApplication"}[found]) # Simple way of making instance a singleton - super(UsesQApplication, self).setUp() - self.app = QApplication.instance() or QApplication([]) + super().setUp() + self.app = cls.instance() or cls([]) def tearDown(self): '''Deletes the reference owned by self''' del self.app # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion gc.collect() - super(UsesQApplication, self).tearDown() + super().tearDown() + + def exit_app_cb(self): + '''Quits the application''' + self.app.exit(0) diff --git a/sources/pyside6/tests/util/helper/usesqcoreapplication.py b/sources/pyside6/tests/util/helper/usesqcoreapplication.py deleted file mode 100644 index 85f78d066..000000000 --- a/sources/pyside6/tests/util/helper/usesqcoreapplication.py +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - -'''Helper classes and functions''' - -import gc -import unittest - -from PySide6.QtCore import QCoreApplication - -_core_instance = None - - -class UsesQCoreApplication(unittest.TestCase): - '''Helper class for test cases that require an QCoreApplication - Just connect or call self.exit_app_cb. When called, will ask - self.app to exit. - ''' - - def setUp(self): - '''Set up resources''' - - global _core_instance - if _core_instance is None: - _core_instance = QCoreApplication([]) - - self.app = _core_instance - - def tearDown(self): - '''Release resources''' - del self.app - # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion - gc.collect() - - def exit_app_cb(self): - '''Quits the application''' - self.app.exit(0) diff --git a/sources/pyside6/tests/util/helper/usesqguiapplication.py b/sources/pyside6/tests/util/helper/usesqguiapplication.py deleted file mode 100644 index e02b57476..000000000 --- a/sources/pyside6/tests/util/helper/usesqguiapplication.py +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - -'''Helper classes and functions''' - -import gc -import unittest - -from PySide6.QtGui import QGuiApplication - - -class UsesQGuiApplication(unittest.TestCase): - '''Helper class to provide QGuiApplication instances''' - - def setUp(self): - '''Creates the QGuiApplication instance''' - - # Simple way of making instance a singleton - super(UsesQGuiApplication, self).setUp() - self.app = QGuiApplication.instance() or QGuiApplication([]) - - def tearDown(self): - '''Deletes the reference owned by self''' - del self.app - # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion - gc.collect() - super(UsesQGuiApplication, self).tearDown() |