diff options
-rw-r--r-- | sources/pyside6/tests/QtGui/qicon_test.py | 6 | ||||
-rw-r--r-- | sources/pyside6/tests/QtGui/timed_app_and_patching_test.py | 8 | ||||
-rw-r--r-- | sources/pyside6/tests/QtQml/bug_456.py | 4 | ||||
-rw-r--r-- | sources/pyside6/tests/QtQml/bug_726.py | 4 | ||||
-rw-r--r-- | sources/pyside6/tests/QtQml/bug_814.py | 4 | ||||
-rw-r--r-- | sources/pyside6/tests/QtQml/bug_915.py | 4 | ||||
-rw-r--r-- | sources/pyside6/tests/QtQml/bug_951.py | 6 | ||||
-rw-r--r-- | sources/pyside6/tests/QtQml/connect_python_qml.py | 4 | ||||
-rw-r--r-- | sources/pyside6/tests/QtQml/qqmlnetwork_test.py | 6 | ||||
-rw-r--r-- | sources/pyside6/tests/QtQml/qquickitem_grabToImage.py | 6 | ||||
-rw-r--r-- | sources/pyside6/tests/QtQml/qquickview_test.py | 4 | ||||
-rw-r--r-- | sources/pyside6/tests/QtQml/signal_arguments.py | 4 | ||||
-rw-r--r-- | sources/pyside6/tests/util/helper/timedqguiapplication.py | 52 |
13 files changed, 82 insertions, 30 deletions
diff --git a/sources/pyside6/tests/QtGui/qicon_test.py b/sources/pyside6/tests/QtGui/qicon_test.py index 2301793bc..5193ecf6b 100644 --- a/sources/pyside6/tests/QtGui/qicon_test.py +++ b/sources/pyside6/tests/QtGui/qicon_test.py @@ -35,11 +35,11 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.timedqapplication import TimedQApplication +from helper.timedqguiapplication import TimedQGuiApplication from PySide6.QtGui import QIcon -class QIconCtorWithNoneTest(TimedQApplication): +class QIconCtorWithNoneTest(TimedQGuiApplication): '''Test made by seblin, see Bug #944: http://bugs.pyside.org/show_bug.cgi?id=944''' def testQIconCtorWithNone(self): @@ -51,7 +51,7 @@ class QIconCtorWithNoneTest(TimedQApplication): PIX_PATH = os.fspath(Path(__file__).resolve().parents[2] / "doc/tutorials/basictutorial/icons.png") -class QIconAddPixmapTest(TimedQApplication): +class QIconAddPixmapTest(TimedQGuiApplication): '''PYSIDE-1669: check that addPixmap works''' def testQIconSetPixmap(self): diff --git a/sources/pyside6/tests/QtGui/timed_app_and_patching_test.py b/sources/pyside6/tests/QtGui/timed_app_and_patching_test.py index 74a2ed58e..1e254e5d3 100644 --- a/sources/pyside6/tests/QtGui/timed_app_and_patching_test.py +++ b/sources/pyside6/tests/QtGui/timed_app_and_patching_test.py @@ -35,17 +35,17 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.timedqapplication import TimedQApplication +from helper.timedqguiapplication import TimedQGuiApplication from PySide6.support import deprecated from PySide6.support.signature import importhandler from PySide6 import QtGui -class TestTimedApp(TimedQApplication): - '''Simple test case for TimedQApplication''' +class TestTimedApp(TimedQGuiApplication): + '''Simple test case for TimedQGuiApplication''' def testFoo(self): - # Simple test of TimedQApplication + # Simple test of TimedQGuiApplication self.app.exec() diff --git a/sources/pyside6/tests/QtQml/bug_456.py b/sources/pyside6/tests/QtQml/bug_456.py index 92d2dcb79..62e83fa95 100644 --- a/sources/pyside6/tests/QtQml/bug_456.py +++ b/sources/pyside6/tests/QtQml/bug_456.py @@ -36,7 +36,7 @@ from init_paths import init_test_paths init_test_paths(False) from helper.helper import quickview_errorstring -from helper.timedqapplication import TimedQApplication +from helper.timedqguiapplication import TimedQGuiApplication from PySide6.QtCore import QObject, QTimer, QUrl, Property, Slot from PySide6.QtQuick import QQuickView from PySide6.QtQml import QmlElement @@ -62,7 +62,7 @@ class RotateValue(QObject): rotation = Property(int, getRotation, setRotation) -class TestConnectionWithInvalidSignature(TimedQApplication): +class TestConnectionWithInvalidSignature(TimedQGuiApplication): def testSlotRetur(self): view = QQuickView() diff --git a/sources/pyside6/tests/QtQml/bug_726.py b/sources/pyside6/tests/QtQml/bug_726.py index d94e9b086..c1d1fbbb6 100644 --- a/sources/pyside6/tests/QtQml/bug_726.py +++ b/sources/pyside6/tests/QtQml/bug_726.py @@ -36,7 +36,7 @@ from init_paths import init_test_paths init_test_paths(False) from helper.helper import quickview_errorstring -from helper.timedqapplication import TimedQApplication +from helper.timedqguiapplication import TimedQGuiApplication from PySide6.QtCore import QObject, QUrl, Slot from PySide6.QtQuick import QQuickView from PySide6.QtQml import QmlElement @@ -64,7 +64,7 @@ class ProxyObject(QObject): self._receivedName = name -class TestConnectionWithInvalidSignature(TimedQApplication): +class TestConnectionWithInvalidSignature(TimedQGuiApplication): def testSlotRetur(self): view = QQuickView() diff --git a/sources/pyside6/tests/QtQml/bug_814.py b/sources/pyside6/tests/QtQml/bug_814.py index 599a95e87..ed9909bc1 100644 --- a/sources/pyside6/tests/QtQml/bug_814.py +++ b/sources/pyside6/tests/QtQml/bug_814.py @@ -47,7 +47,7 @@ from init_paths import init_test_paths init_test_paths(False) from helper.helper import quickview_errorstring -from helper.timedqapplication import TimedQApplication +from helper.timedqguiapplication import TimedQGuiApplication from PySide6.QtCore import QUrl, QAbstractListModel, QModelIndex, Qt from PySide6.QtQuick import QQuickView @@ -73,7 +73,7 @@ class ListModel(QAbstractListModel): return None -class TestBug814(TimedQApplication): +class TestBug814(TimedQGuiApplication): def testAbstractItemModelTransferToQML(self): view = QQuickView() model = ListModel() diff --git a/sources/pyside6/tests/QtQml/bug_915.py b/sources/pyside6/tests/QtQml/bug_915.py index 312ee341b..51d2d5801 100644 --- a/sources/pyside6/tests/QtQml/bug_915.py +++ b/sources/pyside6/tests/QtQml/bug_915.py @@ -38,12 +38,12 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.timedqapplication import TimedQApplication +from helper.timedqguiapplication import TimedQGuiApplication from PySide6.QtQuick import QQuickView, QQuickItem -class TestBug915(TimedQApplication): +class TestBug915(TimedQGuiApplication): def testReturnPolicy(self): view = QQuickView() diff --git a/sources/pyside6/tests/QtQml/bug_951.py b/sources/pyside6/tests/QtQml/bug_951.py index 75fc0b6eb..3d951a4b3 100644 --- a/sources/pyside6/tests/QtQml/bug_951.py +++ b/sources/pyside6/tests/QtQml/bug_951.py @@ -36,7 +36,7 @@ from init_paths import init_test_paths init_test_paths(False) from helper.helper import quickview_errorstring -from helper.timedqapplication import TimedQApplication +from helper.timedqguiapplication import TimedQGuiApplication from PySide6.QtCore import QUrl from PySide6.QtQml import qmlRegisterType @@ -55,9 +55,9 @@ class MyItem(QQuickItem): super(MyItem, self).componentComplete() -class TestRegisterQMLType(TimedQApplication): +class TestRegisterQMLType(TimedQGuiApplication): def setup(self): - TimedQApplication.setup(self, 100 * 3) # 3s + super.setup(100 * 3) # 3s def testSignalEmission(self): qmlRegisterType(MyItem, "my.item", 1, 0, "MyItem") diff --git a/sources/pyside6/tests/QtQml/connect_python_qml.py b/sources/pyside6/tests/QtQml/connect_python_qml.py index 86273763d..065a60593 100644 --- a/sources/pyside6/tests/QtQml/connect_python_qml.py +++ b/sources/pyside6/tests/QtQml/connect_python_qml.py @@ -43,13 +43,13 @@ from init_paths import init_test_paths init_test_paths(False) from helper.helper import quickview_errorstring -from helper.timedqapplication import TimedQApplication +from helper.timedqguiapplication import TimedQGuiApplication from PySide6.QtCore import QObject, QUrl, SIGNAL from PySide6.QtGui import QColor from PySide6.QtQuick import QQuickItem, QQuickView -class TestConnectionWithInvalidSignature(TimedQApplication): +class TestConnectionWithInvalidSignature(TimedQGuiApplication): def onButtonClicked(self): self.buttonClicked = True self.app.quit() diff --git a/sources/pyside6/tests/QtQml/qqmlnetwork_test.py b/sources/pyside6/tests/QtQml/qqmlnetwork_test.py index 517888c79..601926a07 100644 --- a/sources/pyside6/tests/QtQml/qqmlnetwork_test.py +++ b/sources/pyside6/tests/QtQml/qqmlnetwork_test.py @@ -43,7 +43,7 @@ from PySide6.QtQml import QQmlNetworkAccessManagerFactory from PySide6.QtNetwork import QNetworkAccessManager from helper.helper import quickview_errorstring -from helper.timedqapplication import TimedQApplication +from helper.timedqguiapplication import TimedQGuiApplication class CustomManager(QNetworkAccessManager): @@ -57,9 +57,9 @@ class CustomFactory(QQmlNetworkAccessManagerFactory): return CustomManager() -class TestQQmlNetworkFactory(TimedQApplication): +class TestQQmlNetworkFactory(TimedQGuiApplication): def setUp(self): - TimedQApplication.setUp(self, timeout=1000) + super().setUp(timeout=1000) def testQQuickNetworkFactory(self): view = QQuickView() diff --git a/sources/pyside6/tests/QtQml/qquickitem_grabToImage.py b/sources/pyside6/tests/QtQml/qquickitem_grabToImage.py index 17b01620b..e67785c87 100644 --- a/sources/pyside6/tests/QtQml/qquickitem_grabToImage.py +++ b/sources/pyside6/tests/QtQml/qquickitem_grabToImage.py @@ -36,15 +36,15 @@ from init_paths import init_test_paths init_test_paths(False) from helper.helper import quickview_errorstring -from helper.timedqapplication import TimedQApplication +from helper.timedqguiapplication import TimedQGuiApplication from PySide6.QtCore import QTimer, QUrl from PySide6.QtGui import QColor from PySide6.QtQuick import QQuickItem, QQuickView -class TestGrabToSharedPointerImage(TimedQApplication): +class TestGrabToSharedPointerImage(TimedQGuiApplication): def setUp(self): - TimedQApplication.setUp(self, 1000) + super().setUp(1000) def testQQuickItemGrabToImageSharedPointer(self): view = QQuickView() diff --git a/sources/pyside6/tests/QtQml/qquickview_test.py b/sources/pyside6/tests/QtQml/qquickview_test.py index 412e6dc2d..29bcb9c22 100644 --- a/sources/pyside6/tests/QtQml/qquickview_test.py +++ b/sources/pyside6/tests/QtQml/qquickview_test.py @@ -38,7 +38,7 @@ from init_paths import init_test_paths init_test_paths(False) from helper.helper import quickview_errorstring -from helper.timedqapplication import TimedQApplication +from helper.timedqguiapplication import TimedQGuiApplication from PySide6.QtCore import QUrl, QObject, Property, Slot, Signal from PySide6.QtQml import QQmlEngine @@ -61,7 +61,7 @@ class MyObject(QObject): title = Property(str, getText, notify=titleChanged) -class TestQQuickView(TimedQApplication): +class TestQQuickView(TimedQGuiApplication): def testQQuickViewList(self): view = QQuickView() diff --git a/sources/pyside6/tests/QtQml/signal_arguments.py b/sources/pyside6/tests/QtQml/signal_arguments.py index 9ca94cf1e..cb7c8e37d 100644 --- a/sources/pyside6/tests/QtQml/signal_arguments.py +++ b/sources/pyside6/tests/QtQml/signal_arguments.py @@ -36,7 +36,7 @@ from init_paths import init_test_paths init_test_paths(False) from helper.helper import quickview_errorstring -from helper.timedqapplication import TimedQApplication +from helper.timedqguiapplication import TimedQGuiApplication from PySide6.QtQuick import QQuickView from PySide6.QtCore import QObject, Signal, Slot, QUrl, QTimer, Property @@ -62,7 +62,7 @@ class Obj(QObject): self.value = int(s) -class TestConnectionWithQml(TimedQApplication): +class TestConnectionWithQml(TimedQGuiApplication): def testSignalArguments(self): view = QQuickView() diff --git a/sources/pyside6/tests/util/helper/timedqguiapplication.py b/sources/pyside6/tests/util/helper/timedqguiapplication.py new file mode 100644 index 000000000..b2215b4a2 --- /dev/null +++ b/sources/pyside6/tests/util/helper/timedqguiapplication.py @@ -0,0 +1,52 @@ +############################################################################# +## +## Copyright (C) 2021 The Qt Company Ltd. +## Contact: https://www.qt.io/licensing/ +## +## This file is part of the test suite of Qt for Python. +## +## $QT_BEGIN_LICENSE:GPL-EXCEPT$ +## Commercial License Usage +## Licensees holding valid commercial Qt licenses may use this file in +## accordance with the commercial license agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and The Qt Company. For licensing terms +## and conditions see https://www.qt.io/terms-conditions. For further +## information use the contact form at https://www.qt.io/contact-us. +## +## GNU General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 3 as published by the Free Software +## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +## included in the packaging of this file. Please review the following +## information to ensure the GNU General Public License requirements will +## be met: https://www.gnu.org/licenses/gpl-3.0.html. +## +## $QT_END_LICENSE$ +## +############################################################################# + +'''Helper classes and functions''' + +import gc +import unittest + +from PySide6.QtCore import QTimer +from PySide6.QtGui import QGuiApplication + + +class TimedQGuiApplication(unittest.TestCase): + '''Helper class with timed QGuiApplication exec loop''' + + def setUp(self, timeout=100): + '''Sets up this Application. + + timeout - timeout in millisseconds''' + self.app = QGuiApplication.instance() or QGuiApplication([]) + QTimer.singleShot(timeout, self.app.quit) + + def tearDown(self): + '''Delete resources''' + del self.app + # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion + gc.collect() |