aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/tests/QtWidgets
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside6/tests/QtWidgets')
-rw-r--r--sources/pyside6/tests/QtWidgets/CMakeLists.txt18
-rw-r--r--sources/pyside6/tests/QtWidgets/QtWidgets.pyproject130
-rw-r--r--sources/pyside6/tests/QtWidgets/action_clear.py40
-rw-r--r--sources/pyside6/tests/QtWidgets/add_action_test.py32
-rw-r--r--sources/pyside6/tests/QtWidgets/api2_test.py31
-rw-r--r--sources/pyside6/tests/QtWidgets/application_test.py30
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_1002.py33
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_1006.py34
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_1048.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_1077.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_172.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_243.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_307.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_324.py69
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_338.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_389.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_400.py31
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_429.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_430.py43
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_433.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_467.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_480.py39
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_493.py58
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_512.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_525.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_546.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_547.py32
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_549.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_569.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_575.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_576.py34
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_585.py30
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_589.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_635.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_640.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_653.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_662.py32
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_667.py31
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_668.py31
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_674.py30
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_675.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_688.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_693.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_696.py30
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_711.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_722.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_728.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_736.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_750.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_778.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_785.py67
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_793.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_811.py30
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_834.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_836.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_844.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_854.py33
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_860.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_862.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_871.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_879.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_919.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_921.py33
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_941.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_964.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_967.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_972.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_979.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_988.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_998.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/customproxywidget_test.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/event_filter_test.py75
-rw-r--r--sources/pyside6/tests/QtWidgets/grandparent_method_test.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/hashabletype_test.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/keep_reference_test.py47
-rw-r--r--sources/pyside6/tests/QtWidgets/missing_symbols_test.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/paint_event_test.py64
-rw-r--r--sources/pyside6/tests/QtWidgets/parent_method_test.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/private_mangle_test.py40
-rw-r--r--sources/pyside6/tests/QtWidgets/python_properties_test.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/qabstracttextdocumentlayout_test.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/qaccessible_test.py138
-rw-r--r--sources/pyside6/tests/QtWidgets/qaction_test.py42
-rw-r--r--sources/pyside6/tests/QtWidgets/qapp_issue_585.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/qapp_test.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/qapplication_exit_segfault_test.py32
-rw-r--r--sources/pyside6/tests/QtWidgets/qapplication_test.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/qbrush_test.py61
-rw-r--r--sources/pyside6/tests/QtWidgets/qcolormap_test.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/qdialog_test.py52
-rw-r--r--sources/pyside6/tests/QtWidgets/qdynamic_signal.py32
-rw-r--r--sources/pyside6/tests/QtWidgets/qfontdialog_test.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/qformlayout_test.py64
-rw-r--r--sources/pyside6/tests/QtWidgets/qgraphicsitem_isblocked_test.py30
-rw-r--r--sources/pyside6/tests/QtWidgets/qgraphicsitem_test.py32
-rw-r--r--sources/pyside6/tests/QtWidgets/qgraphicsobjectreimpl_test.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/qgraphicsproxywidget_test.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/qgraphicsscene_test.py37
-rw-r--r--sources/pyside6/tests/QtWidgets/qimage_test.py314
-rw-r--r--sources/pyside6/tests/QtWidgets/qinputdialog_get_test.py46
-rw-r--r--sources/pyside6/tests/QtWidgets/qkeysequenceedit_test.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/qlabel_test.py43
-rw-r--r--sources/pyside6/tests/QtWidgets/qlayout_ref_test.py83
-rw-r--r--sources/pyside6/tests/QtWidgets/qlayout_test.py43
-rw-r--r--sources/pyside6/tests/QtWidgets/qlcdnumber_test.py34
-rw-r--r--sources/pyside6/tests/QtWidgets/qlistwidget_test.py33
-rw-r--r--sources/pyside6/tests/QtWidgets/qlistwidgetitem_test.py32
-rw-r--r--sources/pyside6/tests/QtWidgets/qmainwindow_test.py31
-rw-r--r--sources/pyside6/tests/QtWidgets/qmenu_test.py42
-rw-r--r--sources/pyside6/tests/QtWidgets/qmenuadd_test.py31
-rw-r--r--sources/pyside6/tests/QtWidgets/qobject_mi_test.py31
-rw-r--r--sources/pyside6/tests/QtWidgets/qpen_test.py81
-rw-r--r--sources/pyside6/tests/QtWidgets/qpicture_test.py39
-rw-r--r--sources/pyside6/tests/QtWidgets/qpixmap_constructor.py288
-rw-r--r--sources/pyside6/tests/QtWidgets/qpushbutton_test.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/qshortcut_test.py88
-rw-r--r--sources/pyside6/tests/QtWidgets/qsplitter_test.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/qstandarditemmodel_test.py106
-rw-r--r--sources/pyside6/tests/QtWidgets/qstring_qkeysequence_test.py69
-rw-r--r--sources/pyside6/tests/QtWidgets/qstyle_test.py32
-rw-r--r--sources/pyside6/tests/QtWidgets/qstyleoption_test.py43
-rw-r--r--sources/pyside6/tests/QtWidgets/qtableview_test.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/qtabwidget_test.py32
-rw-r--r--sources/pyside6/tests/QtWidgets/qtabwidgetclear_test.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/qtextedit_signal_test.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/qtextedit_test.py37
-rw-r--r--sources/pyside6/tests/QtWidgets/qtoolbar_test.py32
-rw-r--r--sources/pyside6/tests/QtWidgets/qtoolbox_test.py32
-rw-r--r--sources/pyside6/tests/QtWidgets/qtreeview_test.py34
-rw-r--r--sources/pyside6/tests/QtWidgets/qtreewidget_test.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/qtreewidgetitem_test.py33
-rw-r--r--sources/pyside6/tests/QtWidgets/qvariant_test.py111
-rw-r--r--sources/pyside6/tests/QtWidgets/qwidget_setlayout_test.py30
-rw-r--r--sources/pyside6/tests/QtWidgets/qwidget_test.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/reference_count_test.py31
-rw-r--r--sources/pyside6/tests/QtWidgets/signature_test.py71
-rw-r--r--sources/pyside6/tests/QtWidgets/standardpixmap_test.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/test_module_template.py29
-rw-r--r--sources/pyside6/tests/QtWidgets/virtual_protected_inheritance_test.py32
-rw-r--r--sources/pyside6/tests/QtWidgets/virtual_pure_override_test.py34
-rw-r--r--sources/pyside6/tests/QtWidgets/wrong_return_test.py29
141 files changed, 1011 insertions, 4784 deletions
diff --git a/sources/pyside6/tests/QtWidgets/CMakeLists.txt b/sources/pyside6/tests/QtWidgets/CMakeLists.txt
index afa5eae0a..01b7d08ea 100644
--- a/sources/pyside6/tests/QtWidgets/CMakeLists.txt
+++ b/sources/pyside6/tests/QtWidgets/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
#Keep this in alphabetical sort
PYSIDE_TEST(action_clear.py)
@@ -7,7 +10,6 @@ PYSIDE_TEST(application_test.py)
PYSIDE_TEST(bug_172.py)
PYSIDE_TEST(bug_243.py)
PYSIDE_TEST(bug_307.py)
-PYSIDE_TEST(bug_324.py)
PYSIDE_TEST(bug_338.py)
PYSIDE_TEST(bug_389.py)
PYSIDE_TEST(bug_400.py)
@@ -15,7 +17,7 @@ PYSIDE_TEST(bug_429.py)
PYSIDE_TEST(bug_430.py)
PYSIDE_TEST(bug_433.py)
PYSIDE_TEST(bug_467.py)
-PYSIDE_TEST(bug_493.py)
+PYSIDE_TEST(bug_480.py)
PYSIDE_TEST(bug_512.py)
PYSIDE_TEST(bug_525.py)
PYSIDE_TEST(bug_546.py)
@@ -43,7 +45,6 @@ PYSIDE_TEST(bug_728.py)
PYSIDE_TEST(bug_736.py)
PYSIDE_TEST(bug_750.py)
PYSIDE_TEST(bug_778.py)
-PYSIDE_TEST(bug_785.py)
PYSIDE_TEST(bug_793.py)
PYSIDE_TEST(bug_811.py)
PYSIDE_TEST(bug_834.py)
@@ -68,7 +69,6 @@ PYSIDE_TEST(bug_1006.py)
PYSIDE_TEST(bug_1048.py)
PYSIDE_TEST(bug_1077.py)
PYSIDE_TEST(customproxywidget_test.py)
-PYSIDE_TEST(event_filter_test.py)
PYSIDE_TEST(grandparent_method_test.py)
PYSIDE_TEST(hashabletype_test.py)
PYSIDE_TEST(keep_reference_test.py)
@@ -78,12 +78,13 @@ PYSIDE_TEST(parent_method_test.py)
PYSIDE_TEST(private_mangle_test.py)
PYSIDE_TEST(python_properties_test.py)
PYSIDE_TEST(qabstracttextdocumentlayout_test.py)
+PYSIDE_TEST(qaccessible_test.py)
PYSIDE_TEST(qaction_test.py)
PYSIDE_TEST(qapp_issue_585.py)
PYSIDE_TEST(qapp_test.py)
PYSIDE_TEST(qapplication_test.py)
PYSIDE_TEST(qapplication_exit_segfault_test.py)
-PYSIDE_TEST(qbrush_test.py)
+PYSIDE_TEST(qdialog_test.py)
PYSIDE_TEST(qdynamic_signal.py)
# TODO: This passes, but requires manual button clicking (at least on mac)
#PYSIDE_TEST(qfontdialog_test.py)
@@ -93,7 +94,6 @@ PYSIDE_TEST(qgraphicsitem_isblocked_test.py)
PYSIDE_TEST(qgraphicsobjectreimpl_test.py)
PYSIDE_TEST(qgraphicsproxywidget_test.py)
PYSIDE_TEST(qgraphicsscene_test.py)
-PYSIDE_TEST(qimage_test.py)
PYSIDE_TEST(qinputdialog_get_test.py)
PYSIDE_TEST(qkeysequenceedit_test.py)
PYSIDE_TEST(qlabel_test.py)
@@ -106,15 +106,11 @@ PYSIDE_TEST(qmainwindow_test.py)
PYSIDE_TEST(qmenu_test.py)
PYSIDE_TEST(qmenuadd_test.py)
PYSIDE_TEST(qobject_mi_test.py)
-PYSIDE_TEST(qpen_test.py)
PYSIDE_TEST(qpicture_test.py)
-PYSIDE_TEST(qpixmap_constructor.py)
PYSIDE_TEST(qpushbutton_test.py)
-PYSIDE_TEST(qshortcut_test.py)
PYSIDE_TEST(qsplitter_test.py)
-PYSIDE_TEST(qstandarditemmodel_test.py)
-PYSIDE_TEST(qstring_qkeysequence_test.py)
PYSIDE_TEST(qstyle_test.py)
+PYSIDE_TEST(qstyleoption_test.py)
PYSIDE_TEST(qtableview_test.py)
PYSIDE_TEST(qtabwidget_test.py)
PYSIDE_TEST(qtabwidgetclear_test.py)
diff --git a/sources/pyside6/tests/QtWidgets/QtWidgets.pyproject b/sources/pyside6/tests/QtWidgets/QtWidgets.pyproject
new file mode 100644
index 000000000..36c000165
--- /dev/null
+++ b/sources/pyside6/tests/QtWidgets/QtWidgets.pyproject
@@ -0,0 +1,130 @@
+{
+ "files": ["action_clear.py",
+ "add_action_test.py",
+ "api2_test.py",
+ "application_test.py",
+ "bug_1002.py",
+ "bug_1006.py",
+ "bug_1048.py",
+ "bug_1077.py",
+ "bug_172.py",
+ "bug_243.py",
+ "bug_307.py",
+ "bug_338.py",
+ "bug_389.py",
+ "bug_400.py",
+ "bug_429.py",
+ "bug_430.py",
+ "bug_433.py",
+ "bug_467.py",
+ "bug_480.py",
+ "bug_512.py",
+ "bug_525.py",
+ "bug_546.py",
+ "bug_547.py",
+ "bug_549.py",
+ "bug_569.py",
+ "bug_575.py",
+ "bug_576.py",
+ "bug_585.py",
+ "bug_589.py",
+ "bug_635.py",
+ "bug_640.py",
+ "bug_653.py",
+ "bug_662.py",
+ "bug_667.py",
+ "bug_668.py",
+ "bug_674.py",
+ "bug_675.py",
+ "bug_688.py",
+ "bug_693.py",
+ "bug_696.py",
+ "bug_711.py",
+ "bug_722.py",
+ "bug_728.py",
+ "bug_736.py",
+ "bug_750.py",
+ "bug_778.py",
+ "bug_793.py",
+ "bug_811.py",
+ "bug_834.py",
+ "bug_836.py",
+ "bug_844.py",
+ "bug_854.py",
+ "bug_860.py",
+ "bug_862.py",
+ "bug_871.py",
+ "bug_879.py",
+ "bug_919.py",
+ "bug_921.py",
+ "bug_941.py",
+ "bug_964.py",
+ "bug_967.py",
+ "bug_972.py",
+ "bug_979.py",
+ "bug_988.py",
+ "bug_998.py",
+ "customproxywidget_test.py",
+ "grandparent_method_test.py",
+ "hashabletype_test.py",
+ "import_test.py",
+ "keep_reference_test.py",
+ "missing_symbols_test.py",
+ "paint_event_test.py",
+ "parent_method_test.py",
+ "private_mangle_test.py",
+ "python_properties_test.py",
+ "qabstracttextdocumentlayout_test.py",
+ "qaccessible_test.py",
+ "qaction_test.py",
+ "qapp_issue_585.py",
+ "qapp_test.py",
+ "qapplication_exit_segfault_test.py",
+ "qapplication_test.py",
+ "qcolormap_test.py",
+ "qdynamic_signal.py",
+ "qfontdialog_test.py",
+ "qformlayout_test.py",
+ "qgraphicsitem_isblocked_test.py",
+ "qgraphicsitem_test.py",
+ "qgraphicsobjectreimpl_test.py",
+ "qgraphicsproxywidget_test.py",
+ "qgraphicsscene_test.py",
+ "qinputdialog_get_test.py",
+ "qkeysequenceedit_test.py",
+ "qlabel_test.py",
+ "qlayout_ref_test.py",
+ "qlayout_test.py",
+ "qlcdnumber_test.py",
+ "qlistwidget_test.py",
+ "qlistwidgetitem_test.py",
+ "qmainwindow_test.py",
+ "qmenu_test.py",
+ "qmenuadd_test.py",
+ "qobject_mi_test.py",
+ "qpicture_test.py",
+ "qpushbutton_test.py",
+ "qsplitter_test.py",
+ "qstyle_test.py",
+ "qstyleoption_test.py",
+ "qtableview_test.py",
+ "qtabwidget_test.py",
+ "qtabwidgetclear_test.py",
+ "qtextedit_signal_test.py",
+ "qtextedit_test.py",
+ "qtoolbar_test.py",
+ "qtoolbox_test.py",
+ "qtreeview_test.py",
+ "qtreewidget_test.py",
+ "qtreewidgetitem_test.py",
+ "qvariant_test.py",
+ "qwidget_setlayout_test.py",
+ "qwidget_test.py",
+ "reference_count_test.py",
+ "signature_test.py",
+ "standardpixmap_test.py",
+ "test_module_template.py",
+ "virtual_protected_inheritance_test.py",
+ "virtual_pure_override_test.py",
+ "wrong_return_test.py"]
+}
diff --git a/sources/pyside6/tests/QtWidgets/action_clear.py b/sources/pyside6/tests/QtWidgets/action_clear.py
index f9f416a9c..5563a4899 100644
--- a/sources/pyside6/tests/QtWidgets/action_clear.py
+++ b/sources/pyside6/tests/QtWidgets/action_clear.py
@@ -1,31 +1,7 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+import gc
import os
import sys
import unittest
@@ -53,6 +29,8 @@ class TestQActionLifeCycle(UsesQApplication):
act = None
self.assertFalse(self._actionDestroyed)
menu.clear()
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertTrue(self._actionDestroyed)
def testMenuBar(self):
@@ -62,8 +40,12 @@ class TestQActionLifeCycle(UsesQApplication):
act = menuBar.addAction("MENU")
_ref = weakref.ref(act, self.actionDestroyed)
act = None
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertFalse(self._actionDestroyed)
menuBar.clear()
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertTrue(self._actionDestroyed)
def testToolBar(self):
@@ -73,8 +55,12 @@ class TestQActionLifeCycle(UsesQApplication):
act = toolBar.addAction("MENU")
_ref = weakref.ref(act, self.actionDestroyed)
act = None
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertFalse(self._actionDestroyed)
toolBar.clear()
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertTrue(self._actionDestroyed)
diff --git a/sources/pyside6/tests/QtWidgets/add_action_test.py b/sources/pyside6/tests/QtWidgets/add_action_test.py
index 5342b9d55..3ca1660a9 100644
--- a/sources/pyside6/tests/QtWidgets/add_action_test.py
+++ b/sources/pyside6/tests/QtWidgets/add_action_test.py
@@ -1,33 +1,9 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
'''Tests for QMenuBar.addAction(identifier, callback) calls'''
+import gc
import os
import sys
import unittest
@@ -52,6 +28,8 @@ class AddActionTest(UsesQApplication):
del self.called
except AttributeError:
pass
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(AddActionTest, self).tearDown()
def _callback(self):
diff --git a/sources/pyside6/tests/QtWidgets/api2_test.py b/sources/pyside6/tests/QtWidgets/api2_test.py
index c71de90d3..e38672016 100644
--- a/sources/pyside6/tests/QtWidgets/api2_test.py
+++ b/sources/pyside6/tests/QtWidgets/api2_test.py
@@ -1,32 +1,5 @@
-# -*- coding: utf-8 -*-
-
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
'''Test cases for PySide API2 support'''
diff --git a/sources/pyside6/tests/QtWidgets/application_test.py b/sources/pyside6/tests/QtWidgets/application_test.py
index 2fea0286b..1b2477fd7 100644
--- a/sources/pyside6/tests/QtWidgets/application_test.py
+++ b/sources/pyside6/tests/QtWidgets/application_test.py
@@ -1,32 +1,6 @@
#!/usr/bin/python
-
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/bug_1002.py b/sources/pyside6/tests/QtWidgets/bug_1002.py
index ab9cee147..98ae66c47 100644
--- a/sources/pyside6/tests/QtWidgets/bug_1002.py
+++ b/sources/pyside6/tests/QtWidgets/bug_1002.py
@@ -1,31 +1,7 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+import gc
import os
import sys
import unittest
@@ -41,6 +17,7 @@ from helper.usesqapplication import UsesQApplication
class TestBug1002 (UsesQApplication):
+ @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
def testReturnWindow(self):
widget = QWidget()
button = QPushButton(widget)
@@ -50,6 +27,8 @@ class TestBug1002 (UsesQApplication):
self.assertEqual(sys.getrefcount(window), 3)
del widget
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
if __name__ == '__main__':
diff --git a/sources/pyside6/tests/QtWidgets/bug_1006.py b/sources/pyside6/tests/QtWidgets/bug_1006.py
index 9a1b7e653..74bf5e2da 100644
--- a/sources/pyside6/tests/QtWidgets/bug_1006.py
+++ b/sources/pyside6/tests/QtWidgets/bug_1006.py
@@ -1,31 +1,7 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+import gc
import os
import sys
import unittest
@@ -60,6 +36,8 @@ class LabelWindow(QDialog):
self.test_layout.removeWidget(old_label)
unit.assertRaises(RuntimeError, old_item.widget)
del old_item
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
label = QLabel("Label New")
old_label.deleteLater()
@@ -91,6 +69,7 @@ class TestBug1006 (TimedQApplication):
item = layout.itemAt(0)
self.assertTrue(isinstance(item.widget(), QWidget))
+ @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
def testRemoveOrphanWidget(self):
widget = QLabel()
layout = QHBoxLayout()
@@ -101,6 +80,7 @@ class TestBug1006 (TimedQApplication):
widget.setObjectName("MyWidget")
self.assertEqual(sys.getrefcount(widget), 2)
+ @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
def testRemoveChildWidget(self):
parent = QLabel()
widget = QLabel(parent)
diff --git a/sources/pyside6/tests/QtWidgets/bug_1048.py b/sources/pyside6/tests/QtWidgets/bug_1048.py
index 0c5cdb0b5..9d83e2f30 100644
--- a/sources/pyside6/tests/QtWidgets/bug_1048.py
+++ b/sources/pyside6/tests/QtWidgets/bug_1048.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/bug_1077.py b/sources/pyside6/tests/QtWidgets/bug_1077.py
index 8aed4e6f5..c9559609f 100644
--- a/sources/pyside6/tests/QtWidgets/bug_1077.py
+++ b/sources/pyside6/tests/QtWidgets/bug_1077.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
''' unit test for BUG #1077 '''
diff --git a/sources/pyside6/tests/QtWidgets/bug_172.py b/sources/pyside6/tests/QtWidgets/bug_172.py
index 49df6c4e9..2637d6d61 100644
--- a/sources/pyside6/tests/QtWidgets/bug_172.py
+++ b/sources/pyside6/tests/QtWidgets/bug_172.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/bug_243.py b/sources/pyside6/tests/QtWidgets/bug_243.py
index dea27888c..af189837f 100644
--- a/sources/pyside6/tests/QtWidgets/bug_243.py
+++ b/sources/pyside6/tests/QtWidgets/bug_243.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
''' Test bug 243: http://bugs.openbossa.org/show_bug.cgi?id=243'''
diff --git a/sources/pyside6/tests/QtWidgets/bug_307.py b/sources/pyside6/tests/QtWidgets/bug_307.py
index 92b0a5973..673d5183d 100644
--- a/sources/pyside6/tests/QtWidgets/bug_307.py
+++ b/sources/pyside6/tests/QtWidgets/bug_307.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import colorsys
import os
diff --git a/sources/pyside6/tests/QtWidgets/bug_324.py b/sources/pyside6/tests/QtWidgets/bug_324.py
deleted file mode 100644
index b3336923f..000000000
--- a/sources/pyside6/tests/QtWidgets/bug_324.py
+++ /dev/null
@@ -1,69 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
-
-''' Test bug 324: http://bugs.openbossa.org/show_bug.cgi?id=324'''
-
-import os
-import sys
-import unittest
-
-from pathlib import Path
-sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide6.QtCore import QObject, Signal
-from PySide6.QtWidgets import QApplication
-
-
-class QBug(QObject):
- def __init__(self, parent=None):
- QObject.__init__(self, parent)
-
- def check(self):
- self.done.emit("abc")
-
- done = Signal(str)
-
-
-class Bug324(unittest.TestCase):
-
- def on_done(self, val):
- self.value = val
-
- def testBug(self):
- app = QApplication([])
- bug = QBug()
- self.value = ''
- bug.done.connect(self.on_done)
- bug.check()
- self.assertEqual(self.value, 'abc')
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_338.py b/sources/pyside6/tests/QtWidgets/bug_338.py
index c47179473..695b4238a 100644
--- a/sources/pyside6/tests/QtWidgets/bug_338.py
+++ b/sources/pyside6/tests/QtWidgets/bug_338.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
''' Test bug 338: http://bugs.openbossa.org/show_bug.cgi?id=338'''
diff --git a/sources/pyside6/tests/QtWidgets/bug_389.py b/sources/pyside6/tests/QtWidgets/bug_389.py
index 4cef736b4..024908e85 100644
--- a/sources/pyside6/tests/QtWidgets/bug_389.py
+++ b/sources/pyside6/tests/QtWidgets/bug_389.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
''' Test bug 389: http://bugs.openbossa.org/show_bug.cgi?id=389'''
diff --git a/sources/pyside6/tests/QtWidgets/bug_400.py b/sources/pyside6/tests/QtWidgets/bug_400.py
index 39eafd23a..79dfa49fc 100644
--- a/sources/pyside6/tests/QtWidgets/bug_400.py
+++ b/sources/pyside6/tests/QtWidgets/bug_400.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
''' Test bug 400: http://bugs.openbossa.org/show_bug.cgi?id=400'''
@@ -52,7 +27,7 @@ class BugTest(UsesQApplication):
treeWidget.insertTopLevelItems(0, items)
_iter = QTreeWidgetItemIterator(treeWidget)
index = 0
- while(_iter.value()):
+ while (_iter.value()):
item = _iter.value()
self.assertTrue(item is items[index])
index += 1
diff --git a/sources/pyside6/tests/QtWidgets/bug_429.py b/sources/pyside6/tests/QtWidgets/bug_429.py
index 5041acb4e..e95c113f3 100644
--- a/sources/pyside6/tests/QtWidgets/bug_429.py
+++ b/sources/pyside6/tests/QtWidgets/bug_429.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/bug_430.py b/sources/pyside6/tests/QtWidgets/bug_430.py
index b6cf49252..6ef9ec7f4 100644
--- a/sources/pyside6/tests/QtWidgets/bug_430.py
+++ b/sources/pyside6/tests/QtWidgets/bug_430.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
@@ -44,9 +19,11 @@ class ListModel(QAbstractListModel):
return 0
-app = QApplication([])
-model = ListModel()
-v = QListView()
-v.setModel(model)
-QTimer.singleShot(0, v.close)
-app.exec()
+if __name__ == '__main__':
+ app = QApplication([])
+ model = ListModel()
+ v = QListView()
+ v.setModel(model)
+ v.show()
+ QTimer.singleShot(0, v.close)
+ app.exec()
diff --git a/sources/pyside6/tests/QtWidgets/bug_433.py b/sources/pyside6/tests/QtWidgets/bug_433.py
index 0c109f40a..c7fbe4b3e 100644
--- a/sources/pyside6/tests/QtWidgets/bug_433.py
+++ b/sources/pyside6/tests/QtWidgets/bug_433.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/bug_467.py b/sources/pyside6/tests/QtWidgets/bug_467.py
index eaa2696d2..af383e811 100644
--- a/sources/pyside6/tests/QtWidgets/bug_467.py
+++ b/sources/pyside6/tests/QtWidgets/bug_467.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
''' Test bug 367: http://bugs.openbossa.org/show_bug.cgi?id=467'''
diff --git a/sources/pyside6/tests/QtWidgets/bug_480.py b/sources/pyside6/tests/QtWidgets/bug_480.py
new file mode 100644
index 000000000..2fc955561
--- /dev/null
+++ b/sources/pyside6/tests/QtWidgets/bug_480.py
@@ -0,0 +1,39 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+import os
+import sys
+import unittest
+
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
+from init_paths import init_test_paths
+init_test_paths(False)
+
+from PySide6.QtWidgets import (QApplication, QGridLayout, QLabel, QVBoxLayout,
+ QWidget)
+
+
+class BuggyWidget(QWidget):
+ def setup(self):
+ self.verticalLayout = QVBoxLayout(self)
+ self.gridLayout = QGridLayout()
+ self.lbl = QLabel(self)
+ self.gridLayout.addWidget(self.lbl, 0, 1, 1, 1)
+
+ # this cause a segfault during the ownership transfer
+ self.verticalLayout.addLayout(self.gridLayout)
+
+
+class LayoutTransferOwnerShip(unittest.TestCase):
+ def testBug(self):
+ app = QApplication([])
+ w = BuggyWidget()
+ w.setup()
+ w.show()
+ self.assertTrue(True)
+
+
+if __name__ == '__main__':
+ unittest.main()
+
diff --git a/sources/pyside6/tests/QtWidgets/bug_493.py b/sources/pyside6/tests/QtWidgets/bug_493.py
deleted file mode 100644
index 52aae39da..000000000
--- a/sources/pyside6/tests/QtWidgets/bug_493.py
+++ /dev/null
@@ -1,58 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
-
-import os
-import sys
-import unittest
-
-from pathlib import Path
-sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide6.QtCore import Qt, QEvent
-from PySide6.QtGui import QKeyEvent, QKeySequence
-from PySide6.QtWidgets import QApplication
-
-
-class TestBug493(unittest.TestCase):
-
- def testIt(self):
- # We need a qapp otherwise Qt will crash when trying to detect the
- # current platform
- app = QApplication([])
- ev1 = QKeyEvent(QEvent.KeyRelease, Qt.Key_Delete, Qt.NoModifier)
- ev2 = QKeyEvent(QEvent.KeyRelease, Qt.Key_Copy, Qt.NoModifier)
- ks = QKeySequence.Delete
-
- self.assertTrue(ev1.matches(ks))
- self.assertFalse(ev2.matches(ks))
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_512.py b/sources/pyside6/tests/QtWidgets/bug_512.py
index d93999833..dab367727 100644
--- a/sources/pyside6/tests/QtWidgets/bug_512.py
+++ b/sources/pyside6/tests/QtWidgets/bug_512.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
''' Test bug 512: http://bugs.openbossa.org/show_bug.cgi?id=512'''
diff --git a/sources/pyside6/tests/QtWidgets/bug_525.py b/sources/pyside6/tests/QtWidgets/bug_525.py
index e86c03ba8..3c49cd377 100644
--- a/sources/pyside6/tests/QtWidgets/bug_525.py
+++ b/sources/pyside6/tests/QtWidgets/bug_525.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/bug_546.py b/sources/pyside6/tests/QtWidgets/bug_546.py
index 4d4f9ed16..fcec2f6d7 100644
--- a/sources/pyside6/tests/QtWidgets/bug_546.py
+++ b/sources/pyside6/tests/QtWidgets/bug_546.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/bug_547.py b/sources/pyside6/tests/QtWidgets/bug_547.py
index 984a0c858..dcbe20ee8 100644
--- a/sources/pyside6/tests/QtWidgets/bug_547.py
+++ b/sources/pyside6/tests/QtWidgets/bug_547.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
""" Unittest for bug #547 """
""" http://bugs.openbossa.org/show_bug.cgi?id=547 """
@@ -45,6 +20,7 @@ from PySide6.QtWidgets import QApplication, QTreeWidget, QTreeWidgetItem
class MyMainWindow(unittest.TestCase):
app = QApplication(sys.argv)
+ @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
def testCase1(self):
self._tree = QTreeWidget()
self._tree.setColumnCount(2)
@@ -62,6 +38,7 @@ class MyMainWindow(unittest.TestCase):
self.assertEqual(sys.getrefcount(self._i1), 3)
self.assertEqual(sys.getrefcount(self._i11), 3)
+ @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
def testCase2(self):
self._tree = QTreeWidget()
self._tree.setColumnCount(2)
@@ -78,6 +55,7 @@ class MyMainWindow(unittest.TestCase):
self.assertEqual(sys.getrefcount(self._i1), 3)
self.assertEqual(sys.getrefcount(self._i11), 3)
+ @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
def _updateTree(self):
self._tree.clear()
if self._i1 and self._i11:
diff --git a/sources/pyside6/tests/QtWidgets/bug_549.py b/sources/pyside6/tests/QtWidgets/bug_549.py
index 30c56a9a8..8efa6e679 100644
--- a/sources/pyside6/tests/QtWidgets/bug_549.py
+++ b/sources/pyside6/tests/QtWidgets/bug_549.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/bug_569.py b/sources/pyside6/tests/QtWidgets/bug_569.py
index cd4874403..0f95aed02 100644
--- a/sources/pyside6/tests/QtWidgets/bug_569.py
+++ b/sources/pyside6/tests/QtWidgets/bug_569.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/bug_575.py b/sources/pyside6/tests/QtWidgets/bug_575.py
index b7318eded..f9a927817 100644
--- a/sources/pyside6/tests/QtWidgets/bug_575.py
+++ b/sources/pyside6/tests/QtWidgets/bug_575.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
""" Unittest for bug #575 """
""" http://bugs.openbossa.org/show_bug.cgi?id=575 """
diff --git a/sources/pyside6/tests/QtWidgets/bug_576.py b/sources/pyside6/tests/QtWidgets/bug_576.py
index b148f7c89..4a17e7aa8 100644
--- a/sources/pyside6/tests/QtWidgets/bug_576.py
+++ b/sources/pyside6/tests/QtWidgets/bug_576.py
@@ -1,35 +1,10 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
""" Unittest for bug #576 """
""" http://bugs.openbossa.org/show_bug.cgi?id=576 """
-import sys
+import gc
import os
import sys
import unittest
@@ -48,6 +23,7 @@ class Bug576(unittest.TestCase):
self._destroyed = True
self.assertTrue(isinstance(button, QPushButton))
+ @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
def testWidgetParent(self):
self._destroyed = False
app = QApplication(sys.argv)
@@ -63,6 +39,8 @@ class Bug576(unittest.TestCase):
b.setParent(None)
self.assertEqual(sys.getrefcount(b), 2)
del b
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertTrue(self._destroyed)
diff --git a/sources/pyside6/tests/QtWidgets/bug_585.py b/sources/pyside6/tests/QtWidgets/bug_585.py
index 82d581af9..e26ca9ce0 100644
--- a/sources/pyside6/tests/QtWidgets/bug_585.py
+++ b/sources/pyside6/tests/QtWidgets/bug_585.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
'''Test bug 585: http://bugs.openbossa.org/show_bug.cgi?id=585'''
@@ -41,6 +16,7 @@ from PySide6.QtWidgets import QApplication, QTreeWidget, QTreeWidgetItem
class Bug585(unittest.TestCase):
+ @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
def testCase(self):
app = QApplication([])
self._tree = QTreeWidget()
diff --git a/sources/pyside6/tests/QtWidgets/bug_589.py b/sources/pyside6/tests/QtWidgets/bug_589.py
index 6b4afc74b..a19f544a5 100644
--- a/sources/pyside6/tests/QtWidgets/bug_589.py
+++ b/sources/pyside6/tests/QtWidgets/bug_589.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
# trimmed down diagramscene.py to demonstrate crash in sizeHint()
diff --git a/sources/pyside6/tests/QtWidgets/bug_635.py b/sources/pyside6/tests/QtWidgets/bug_635.py
index 2def84299..66a8c58c6 100644
--- a/sources/pyside6/tests/QtWidgets/bug_635.py
+++ b/sources/pyside6/tests/QtWidgets/bug_635.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
''' Test bug 635: http://bugs.openbossa.org/show_bug.cgi?id=635'''
diff --git a/sources/pyside6/tests/QtWidgets/bug_640.py b/sources/pyside6/tests/QtWidgets/bug_640.py
index b050cf69b..b2620b541 100644
--- a/sources/pyside6/tests/QtWidgets/bug_640.py
+++ b/sources/pyside6/tests/QtWidgets/bug_640.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/bug_653.py b/sources/pyside6/tests/QtWidgets/bug_653.py
index 3412caa31..1cf8390df 100644
--- a/sources/pyside6/tests/QtWidgets/bug_653.py
+++ b/sources/pyside6/tests/QtWidgets/bug_653.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/bug_662.py b/sources/pyside6/tests/QtWidgets/bug_662.py
index ebc91697b..e3a3130d0 100644
--- a/sources/pyside6/tests/QtWidgets/bug_662.py
+++ b/sources/pyside6/tests/QtWidgets/bug_662.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
''' Test bug 662: http://bugs.openbossa.org/show_bug.cgi?id=662'''
@@ -42,7 +17,8 @@ import sys
class testQTextBlock(unittest.TestCase):
- def tesIterator(self):
+
+ def testIterator(self):
edit = QTextEdit()
cursor = edit.textCursor()
fmt = QTextCharFormat()
diff --git a/sources/pyside6/tests/QtWidgets/bug_667.py b/sources/pyside6/tests/QtWidgets/bug_667.py
index 03f125c6a..be6700d83 100644
--- a/sources/pyside6/tests/QtWidgets/bug_667.py
+++ b/sources/pyside6/tests/QtWidgets/bug_667.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
@@ -42,7 +17,7 @@ from PySide6.QtWidgets import QApplication, QGraphicsView, QGraphicsScene, QGrap
class Ball(QGraphicsEllipseItem):
def __init__(self, d, parent=None):
super().__init__(0, 0, d, d, parent)
- self.vel = QPointF(0, 0) #commenting this out prevents the crash
+ self.vel = QPointF(0, 0) # commenting this out prevents the crash
class Foo(QGraphicsView):
diff --git a/sources/pyside6/tests/QtWidgets/bug_668.py b/sources/pyside6/tests/QtWidgets/bug_668.py
index 1f0d49ada..0c22436b3 100644
--- a/sources/pyside6/tests/QtWidgets/bug_668.py
+++ b/sources/pyside6/tests/QtWidgets/bug_668.py
@@ -1,32 +1,5 @@
-# coding: utf-8
-
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/bug_674.py b/sources/pyside6/tests/QtWidgets/bug_674.py
index 95e32edd1..901b29275 100644
--- a/sources/pyside6/tests/QtWidgets/bug_674.py
+++ b/sources/pyside6/tests/QtWidgets/bug_674.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
@@ -40,6 +15,7 @@ from PySide6.QtWidgets import QApplication, QGraphicsScene
class TestBug679(unittest.TestCase):
'''QGraphicsScene::clear() is missing'''
+ @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
def testIt(self):
app = QApplication([])
diff --git a/sources/pyside6/tests/QtWidgets/bug_675.py b/sources/pyside6/tests/QtWidgets/bug_675.py
index dfe8e7437..221df88b0 100644
--- a/sources/pyside6/tests/QtWidgets/bug_675.py
+++ b/sources/pyside6/tests/QtWidgets/bug_675.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/bug_688.py b/sources/pyside6/tests/QtWidgets/bug_688.py
index 1120c38f6..3180d08bf 100644
--- a/sources/pyside6/tests/QtWidgets/bug_688.py
+++ b/sources/pyside6/tests/QtWidgets/bug_688.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
''' Test bug 688: http://bugs.openbossa.org/show_bug.cgi?id=688'''
diff --git a/sources/pyside6/tests/QtWidgets/bug_693.py b/sources/pyside6/tests/QtWidgets/bug_693.py
index dea191aaf..95981e272 100644
--- a/sources/pyside6/tests/QtWidgets/bug_693.py
+++ b/sources/pyside6/tests/QtWidgets/bug_693.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/bug_696.py b/sources/pyside6/tests/QtWidgets/bug_696.py
index e59b87bc0..19e9978a6 100644
--- a/sources/pyside6/tests/QtWidgets/bug_696.py
+++ b/sources/pyside6/tests/QtWidgets/bug_696.py
@@ -1,32 +1,6 @@
#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/bug_711.py b/sources/pyside6/tests/QtWidgets/bug_711.py
index 9f6217379..fed330fb9 100644
--- a/sources/pyside6/tests/QtWidgets/bug_711.py
+++ b/sources/pyside6/tests/QtWidgets/bug_711.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/bug_722.py b/sources/pyside6/tests/QtWidgets/bug_722.py
index 968e2c2dd..dc20e14cf 100644
--- a/sources/pyside6/tests/QtWidgets/bug_722.py
+++ b/sources/pyside6/tests/QtWidgets/bug_722.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/bug_728.py b/sources/pyside6/tests/QtWidgets/bug_728.py
index 4d1b37593..531adbb25 100644
--- a/sources/pyside6/tests/QtWidgets/bug_728.py
+++ b/sources/pyside6/tests/QtWidgets/bug_728.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/bug_736.py b/sources/pyside6/tests/QtWidgets/bug_736.py
index 61ec3f9da..af4bcbda8 100644
--- a/sources/pyside6/tests/QtWidgets/bug_736.py
+++ b/sources/pyside6/tests/QtWidgets/bug_736.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/bug_750.py b/sources/pyside6/tests/QtWidgets/bug_750.py
index 08327a0d0..999f6a3db 100644
--- a/sources/pyside6/tests/QtWidgets/bug_750.py
+++ b/sources/pyside6/tests/QtWidgets/bug_750.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/bug_778.py b/sources/pyside6/tests/QtWidgets/bug_778.py
index 5fbbd07fa..1a7def6c7 100644
--- a/sources/pyside6/tests/QtWidgets/bug_778.py
+++ b/sources/pyside6/tests/QtWidgets/bug_778.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/bug_785.py b/sources/pyside6/tests/QtWidgets/bug_785.py
deleted file mode 100644
index 019dbc0cb..000000000
--- a/sources/pyside6/tests/QtWidgets/bug_785.py
+++ /dev/null
@@ -1,67 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
-
-import os
-import sys
-import unittest
-
-from pathlib import Path
-sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide6.QtCore import QItemSelection
-from PySide6.QtGui import QStandardItemModel, QStandardItem
-from PySide6.QtWidgets import QApplication
-
-
-class Bug324(unittest.TestCase):
- def testOperators(self):
- model = QStandardItemModel()
- for i in range(100):
- model.appendRow(QStandardItem(f"Item: {i}"))
-
- first = model.index(0, 0)
- second = model.index(10, 0)
- third = model.index(20, 0)
- fourth = model.index(30, 0)
-
- sel = QItemSelection(first, second)
- sel2 = QItemSelection()
- sel2.select(third, fourth)
-
- sel3 = sel + sel2 # check operator +
- self.assertEqual(len(sel3), 2)
- sel4 = sel
- sel4 += sel2 # check operator +=
- self.assertEqual(len(sel4), 2)
- self.assertEqual(sel4, sel3)
-
-
-if __name__ == "__main__":
- unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_793.py b/sources/pyside6/tests/QtWidgets/bug_793.py
index 2a87a8750..94f42a5d3 100644
--- a/sources/pyside6/tests/QtWidgets/bug_793.py
+++ b/sources/pyside6/tests/QtWidgets/bug_793.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/bug_811.py b/sources/pyside6/tests/QtWidgets/bug_811.py
index 38fbd652c..b3537e1f7 100644
--- a/sources/pyside6/tests/QtWidgets/bug_811.py
+++ b/sources/pyside6/tests/QtWidgets/bug_811.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
@@ -49,6 +24,7 @@ class TestUserData(QTextBlockUserData):
class TestUserDataRefCount(UsesQApplication):
+ @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
def testRefcount(self):
textedit = QTextEdit()
textedit.setReadOnly(True)
diff --git a/sources/pyside6/tests/QtWidgets/bug_834.py b/sources/pyside6/tests/QtWidgets/bug_834.py
index b01049dce..685f17e56 100644
--- a/sources/pyside6/tests/QtWidgets/bug_834.py
+++ b/sources/pyside6/tests/QtWidgets/bug_834.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/bug_836.py b/sources/pyside6/tests/QtWidgets/bug_836.py
index 7df90e7a7..c2d3d5609 100644
--- a/sources/pyside6/tests/QtWidgets/bug_836.py
+++ b/sources/pyside6/tests/QtWidgets/bug_836.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/bug_844.py b/sources/pyside6/tests/QtWidgets/bug_844.py
index fdf045dba..913b4235c 100644
--- a/sources/pyside6/tests/QtWidgets/bug_844.py
+++ b/sources/pyside6/tests/QtWidgets/bug_844.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import sys
import os
diff --git a/sources/pyside6/tests/QtWidgets/bug_854.py b/sources/pyside6/tests/QtWidgets/bug_854.py
index 5c88237b5..1dbfd4b3a 100644
--- a/sources/pyside6/tests/QtWidgets/bug_854.py
+++ b/sources/pyside6/tests/QtWidgets/bug_854.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
@@ -35,8 +10,8 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
-from PySide6.QtWidgets import QTableView, QVBoxLayout, QApplication
-from PySide6.QtCore import QAbstractItemModel
+from PySide6.QtWidgets import QTableView, QApplication
+from PySide6.QtCore import QAbstractItemModel, QModelIndex
from helper.usesqapplication import UsesQApplication
diff --git a/sources/pyside6/tests/QtWidgets/bug_860.py b/sources/pyside6/tests/QtWidgets/bug_860.py
index b5ce9419d..779feaa14 100644
--- a/sources/pyside6/tests/QtWidgets/bug_860.py
+++ b/sources/pyside6/tests/QtWidgets/bug_860.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/bug_862.py b/sources/pyside6/tests/QtWidgets/bug_862.py
index d16357081..49d9e24b2 100644
--- a/sources/pyside6/tests/QtWidgets/bug_862.py
+++ b/sources/pyside6/tests/QtWidgets/bug_862.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#
diff --git a/sources/pyside6/tests/QtWidgets/bug_871.py b/sources/pyside6/tests/QtWidgets/bug_871.py
index 487f46494..4ee9b575a 100644
--- a/sources/pyside6/tests/QtWidgets/bug_871.py
+++ b/sources/pyside6/tests/QtWidgets/bug_871.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/bug_879.py b/sources/pyside6/tests/QtWidgets/bug_879.py
index 435cc4190..31c656543 100644
--- a/sources/pyside6/tests/QtWidgets/bug_879.py
+++ b/sources/pyside6/tests/QtWidgets/bug_879.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/bug_919.py b/sources/pyside6/tests/QtWidgets/bug_919.py
index 1ca2c220b..67387ed26 100644
--- a/sources/pyside6/tests/QtWidgets/bug_919.py
+++ b/sources/pyside6/tests/QtWidgets/bug_919.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/bug_921.py b/sources/pyside6/tests/QtWidgets/bug_921.py
index 35752e273..dafc1faef 100644
--- a/sources/pyside6/tests/QtWidgets/bug_921.py
+++ b/sources/pyside6/tests/QtWidgets/bug_921.py
@@ -1,33 +1,8 @@
#!/usr/bin/env python
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
-
+import gc
import os
import sys
import unittest
@@ -80,6 +55,8 @@ class TestTimedApp(TimedQApplication):
midleFunction()
self.app.exec()
del w
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
s.s1.emit()
s.s2.emit()
diff --git a/sources/pyside6/tests/QtWidgets/bug_941.py b/sources/pyside6/tests/QtWidgets/bug_941.py
index 6f200b281..336aa2f58 100644
--- a/sources/pyside6/tests/QtWidgets/bug_941.py
+++ b/sources/pyside6/tests/QtWidgets/bug_941.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/bug_964.py b/sources/pyside6/tests/QtWidgets/bug_964.py
index fdf74e324..86bbddf16 100644
--- a/sources/pyside6/tests/QtWidgets/bug_964.py
+++ b/sources/pyside6/tests/QtWidgets/bug_964.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/bug_967.py b/sources/pyside6/tests/QtWidgets/bug_967.py
index a27a046d3..03af030ca 100644
--- a/sources/pyside6/tests/QtWidgets/bug_967.py
+++ b/sources/pyside6/tests/QtWidgets/bug_967.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/bug_972.py b/sources/pyside6/tests/QtWidgets/bug_972.py
index fe6662ee9..895cea128 100644
--- a/sources/pyside6/tests/QtWidgets/bug_972.py
+++ b/sources/pyside6/tests/QtWidgets/bug_972.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/bug_979.py b/sources/pyside6/tests/QtWidgets/bug_979.py
index e6607d260..a6c17385e 100644
--- a/sources/pyside6/tests/QtWidgets/bug_979.py
+++ b/sources/pyside6/tests/QtWidgets/bug_979.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/bug_988.py b/sources/pyside6/tests/QtWidgets/bug_988.py
index 02bc9f741..f82ba6d27 100644
--- a/sources/pyside6/tests/QtWidgets/bug_988.py
+++ b/sources/pyside6/tests/QtWidgets/bug_988.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/bug_998.py b/sources/pyside6/tests/QtWidgets/bug_998.py
index 0cea3296b..0f6311515 100644
--- a/sources/pyside6/tests/QtWidgets/bug_998.py
+++ b/sources/pyside6/tests/QtWidgets/bug_998.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/customproxywidget_test.py b/sources/pyside6/tests/QtWidgets/customproxywidget_test.py
index 1e7351dc3..f7a1a1b1d 100644
--- a/sources/pyside6/tests/QtWidgets/customproxywidget_test.py
+++ b/sources/pyside6/tests/QtWidgets/customproxywidget_test.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/event_filter_test.py b/sources/pyside6/tests/QtWidgets/event_filter_test.py
deleted file mode 100644
index aee5a2926..000000000
--- a/sources/pyside6/tests/QtWidgets/event_filter_test.py
+++ /dev/null
@@ -1,75 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
-
-import os
-import sys
-import unittest
-
-from pathlib import Path
-sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from helper.usesqapplication import UsesQApplication
-from PySide6.QtCore import QObject, QEvent
-from PySide6.QtWidgets import QWidget
-
-
-class MyFilter(QObject):
- def eventFilter(self, obj, event):
- if event.type() == QEvent.KeyPress:
- pass
- return QObject.eventFilter(self, obj, event)
-
-
-class EventFilter(UsesQApplication):
- def testRefCount(self):
- o = QObject()
- filt = MyFilter()
- o.installEventFilter(filt)
- self.assertEqual(sys.getrefcount(o), 2)
-
- o.installEventFilter(filt)
- self.assertEqual(sys.getrefcount(o), 2)
-
- o.removeEventFilter(filt)
- self.assertEqual(sys.getrefcount(o), 2)
-
- def testObjectDestructorOrder(self):
- w = QWidget()
- filt = MyFilter()
- filt.app = self.app
- w.installEventFilter(filt)
- w.show()
- w.close()
- w = None
- self.assertTrue(True)
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/grandparent_method_test.py b/sources/pyside6/tests/QtWidgets/grandparent_method_test.py
index 67d56e156..ef848e22d 100644
--- a/sources/pyside6/tests/QtWidgets/grandparent_method_test.py
+++ b/sources/pyside6/tests/QtWidgets/grandparent_method_test.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
'''Tests for calling methods further than the direct parent'''
diff --git a/sources/pyside6/tests/QtWidgets/hashabletype_test.py b/sources/pyside6/tests/QtWidgets/hashabletype_test.py
index 4a56a1045..f12cceb5a 100644
--- a/sources/pyside6/tests/QtWidgets/hashabletype_test.py
+++ b/sources/pyside6/tests/QtWidgets/hashabletype_test.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
'''Test cases for __hash__'''
diff --git a/sources/pyside6/tests/QtWidgets/keep_reference_test.py b/sources/pyside6/tests/QtWidgets/keep_reference_test.py
index 1766f16ee..9d21c4580 100644
--- a/sources/pyside6/tests/QtWidgets/keep_reference_test.py
+++ b/sources/pyside6/tests/QtWidgets/keep_reference_test.py
@@ -1,32 +1,6 @@
#!/usr/bin/env python
-
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
@@ -37,7 +11,6 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
-from sys import getrefcount
from helper.usesqapplication import UsesQApplication
from PySide6.QtCore import QAbstractTableModel
from PySide6.QtWidgets import QTableView
@@ -73,32 +46,34 @@ class KeepReferenceTest(UsesQApplication):
samemodel = view.model()
self.assertEqual(model, samemodel)
+ @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
def testReferenceCounting(self):
'''Tests reference count of model object referred by view objects.'''
model1 = TestModel()
- refcount1 = getrefcount(model1)
+ refcount1 = sys.getrefcount(model1)
view1 = QTableView()
view1.setModel(model1)
- self.assertEqual(getrefcount(view1.model()), refcount1 + 1)
+ self.assertEqual(sys.getrefcount(view1.model()), refcount1 + 1)
view2 = QTableView()
view2.setModel(model1)
- self.assertEqual(getrefcount(view2.model()), refcount1 + 2)
+ self.assertEqual(sys.getrefcount(view2.model()), refcount1 + 2)
model2 = TestModel()
view2.setModel(model2)
- self.assertEqual(getrefcount(view1.model()), refcount1 + 1)
+ self.assertEqual(sys.getrefcount(view1.model()), refcount1 + 1)
+ @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
def testReferenceCountingWhenDeletingReferrer(self):
'''Tests reference count of model object referred by deceased view object.'''
model = TestModel()
- refcount1 = getrefcount(model)
+ refcount1 = sys.getrefcount(model)
view = QTableView()
view.setModel(model)
- self.assertEqual(getrefcount(view.model()), refcount1 + 1)
+ self.assertEqual(sys.getrefcount(view.model()), refcount1 + 1)
del view
- self.assertEqual(getrefcount(model), refcount1)
+ self.assertEqual(sys.getrefcount(model), refcount1)
def testReferreedObjectSurvivalAfterContextEnd(self):
'''Model object assigned to a view object must survive after getting out of context.'''
diff --git a/sources/pyside6/tests/QtWidgets/missing_symbols_test.py b/sources/pyside6/tests/QtWidgets/missing_symbols_test.py
index d30f77fc5..076c9e7e1 100644
--- a/sources/pyside6/tests/QtWidgets/missing_symbols_test.py
+++ b/sources/pyside6/tests/QtWidgets/missing_symbols_test.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
'''(Very) Simple test case for missing names from QtGui and QtWidgets'''
diff --git a/sources/pyside6/tests/QtWidgets/paint_event_test.py b/sources/pyside6/tests/QtWidgets/paint_event_test.py
index 66dd3d084..d995c2a37 100644
--- a/sources/pyside6/tests/QtWidgets/paint_event_test.py
+++ b/sources/pyside6/tests/QtWidgets/paint_event_test.py
@@ -1,43 +1,21 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
'''Test paint event override in python'''
+import gc
import os
import sys
import unittest
+from textwrap import dedent
+
from pathlib import Path
sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
-from PySide6.QtCore import QTimerEvent
+from PySide6.QtCore import QTimer
from PySide6.QtWidgets import QApplication, QWidget
from helper.usesqapplication import UsesQApplication
@@ -46,33 +24,19 @@ from helper.usesqapplication import UsesQApplication
class MyWidget(QWidget):
'''Sample widget'''
- def __init__(self, app=None):
+ def __init__(self, app):
# Creates a new widget
- if app is None:
- app = QApplication([])
+ assert (app)
super().__init__()
self.app = app
- self.runs = 0
- self.max_runs = 5
self.paint_event_called = False
- def timerEvent(self, event):
- # Timer event method
- self.runs += 1
-
- if self.runs == self.max_runs:
- self.app.quit()
-
- if not isinstance(event, QTimerEvent):
- raise TypeError('Invalid event type. Must be QTimerEvent')
-
def paintEvent(self, event):
# Empty paint event method
- # XXX: should be using super here, but somehow PyQt4
- # complains about paintEvent not present in super
- QWidget.paintEvent(self, event)
+ super().paintEvent(event)
self.paint_event_called = True
+ QTimer.singleShot(20, self.close)
class PaintEventOverride(UsesQApplication):
@@ -88,18 +52,16 @@ class PaintEventOverride(UsesQApplication):
def tearDown(self):
# Release resources
del self.widget
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(PaintEventOverride, self).tearDown()
def testPaintEvent(self):
# Test QWidget.paintEvent override
- timer_id = self.widget.startTimer(100)
self.widget.show()
+ self.widget.setWindowTitle("paint_event_test")
self.app.exec()
-
- self.widget.killTimer(timer_id)
-
self.assertTrue(self.widget.paint_event_called)
- self.assertEqual(self.widget.runs, 5)
if __name__ == '__main__':
diff --git a/sources/pyside6/tests/QtWidgets/parent_method_test.py b/sources/pyside6/tests/QtWidgets/parent_method_test.py
index 4f2ab2f9a..0ab09eead 100644
--- a/sources/pyside6/tests/QtWidgets/parent_method_test.py
+++ b/sources/pyside6/tests/QtWidgets/parent_method_test.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/private_mangle_test.py b/sources/pyside6/tests/QtWidgets/private_mangle_test.py
index 94bbfa231..67ad14d68 100644
--- a/sources/pyside6/tests/QtWidgets/private_mangle_test.py
+++ b/sources/pyside6/tests/QtWidgets/private_mangle_test.py
@@ -1,41 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2018 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:LGPL$
-## 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 Lesser General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU Lesser
-## General Public License version 3 as published by the Free Software
-## Foundation and appearing in the file LICENSE.LGPL3 included in the
-## packaging of this file. Please review the following information to
-## ensure the GNU Lesser General Public License version 3 requirements
-## will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 2.0 or (at your option) the GNU General
-## Public license version 3 or any later version approved by the KDE Free
-## Qt Foundation. The licenses are as published by the Free Software
-## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-## 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-2.0.html and
-## https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
"""
This is the example from https://bugreports.qt.io/browse/PYSIDE-772
diff --git a/sources/pyside6/tests/QtWidgets/python_properties_test.py b/sources/pyside6/tests/QtWidgets/python_properties_test.py
index 72adc7517..ee8a38014 100644
--- a/sources/pyside6/tests/QtWidgets/python_properties_test.py
+++ b/sources/pyside6/tests/QtWidgets/python_properties_test.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/qabstracttextdocumentlayout_test.py b/sources/pyside6/tests/QtWidgets/qabstracttextdocumentlayout_test.py
index 7d4f5c786..1ae3b0a35 100644
--- a/sources/pyside6/tests/QtWidgets/qabstracttextdocumentlayout_test.py
+++ b/sources/pyside6/tests/QtWidgets/qabstracttextdocumentlayout_test.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/qaccessible_test.py b/sources/pyside6/tests/QtWidgets/qaccessible_test.py
new file mode 100644
index 000000000..021cf9c6b
--- /dev/null
+++ b/sources/pyside6/tests/QtWidgets/qaccessible_test.py
@@ -0,0 +1,138 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+'''Test cases for QAccessible::installFactory().'''
+
+import os
+import sys
+import unittest
+
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
+from init_paths import init_test_paths
+init_test_paths(False)
+
+from PySide6.QtCore import QCoreApplication, Qt
+from PySide6.QtGui import QAccessible, QAccessibleInterface, QColor
+from PySide6.QtWidgets import QWidget, QLineEdit, QVBoxLayout
+
+from helper.usesqapplication import UsesQApplication
+
+
+class LineEditAccessible(QAccessibleInterface):
+ """Mimick a QAccessibleInterface implementation for QLineEdit."""
+
+ instance_count = 0
+
+ def __init__(self, widget):
+ super().__init__()
+ LineEditAccessible.instance_count += 1
+ self._widget = widget
+ self._name = self._widget.objectName()
+ print('LineEditAccessible', self._name)
+
+ def __del__(self):
+ LineEditAccessible.instance_count -= 1
+ print('~LineEditAccessible', self._name)
+
+ def actionInterface(self):
+ return None
+
+ def backgroundColor(self):
+ return QColor(Qt.white)
+
+ def child(self, index):
+ return None
+
+ def childAt(self, x, y):
+ return None
+
+ def childCount(self):
+ return 0
+
+ def focusChild(self):
+ return None
+
+ def foregroundColor(self):
+ return QColor(Qt.black)
+
+ def indexOfChild(self, child):
+ return -1
+
+ def isValid(self):
+ return True
+
+ def object(self):
+ return self._widget
+
+ def parent(self):
+ return None
+
+ def rect(self):
+ return self._widget.geometry()
+
+ def role(self):
+ return QAccessible.EditableText
+
+ def setText(self, t, text):
+ pass
+
+ def state(self):
+ return QAccessible.State()
+
+ def tableCellInterface(self):
+ return None
+
+ def tableInterface(self):
+ return None
+
+ def text(self, t):
+ return self._widget.text() if t == QAccessible.Value else ''
+
+ def textInterface(self):
+ return None
+
+ def valueInterface(self):
+ return None
+
+ def window(self):
+ return self._widget.window().windowHandle()
+
+
+def accessible_factory(key, obj):
+ """Factory function for QAccessibleInterface for QLineEdit's."""
+ if obj.metaObject().className() == 'QLineEdit':
+ return LineEditAccessible(obj)
+ return None
+
+
+class Window(QWidget):
+ """Test window with 2 QLineEdit's."""
+ def __init__(self):
+ super().__init__()
+ self.setObjectName('top')
+ layout = QVBoxLayout(self)
+ self.m_line_edit1 = QLineEdit("bla")
+ layout.addWidget(self.m_line_edit1)
+ self.m_line_edit2 = QLineEdit("bla")
+ layout.addWidget(self.m_line_edit2)
+
+
+class QAccessibleTest(UsesQApplication):
+ """Test that LineEditAccessible instances are created for QLineEdit's."""
+
+ def setUp(self):
+ super().setUp()
+ QAccessible.installFactory(accessible_factory)
+ window = Window()
+
+ def testLineEdits(self):
+ window = Window()
+ window.show()
+ while not window.windowHandle().isExposed():
+ QCoreApplication.processEvents()
+ self.assertEqual(LineEditAccessible.instance_count, 2)
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qaction_test.py b/sources/pyside6/tests/QtWidgets/qaction_test.py
index 6f9b1afec..a0049421f 100644
--- a/sources/pyside6/tests/QtWidgets/qaction_test.py
+++ b/sources/pyside6/tests/QtWidgets/qaction_test.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
@@ -36,7 +11,7 @@ from init_paths import init_test_paths
init_test_paths(False)
from PySide6.QtGui import QAction
-from PySide6.QtWidgets import QWidget
+from PySide6.QtWidgets import QWidget, QMenu
from helper.usesqapplication import UsesQApplication
@@ -73,6 +48,17 @@ class SetShortcutTest(UsesQApplication):
s2 = action.shortcut()
self.assertEqual(s2, shortcut)
+ def testMenu(self):
+ # Test the setMenu()/menu() old functionality removed in Qt6
+ # that was added via helper functions.
+ menu = QMenu("menu")
+ action = QAction("action")
+
+ # Using QAction::setMenu(QObject*)
+ action.setMenu(menu)
+
+ self.assertEqual(action.menu(), menu)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qapp_issue_585.py b/sources/pyside6/tests/QtWidgets/qapp_issue_585.py
index 9e3674374..0b5453af5 100644
--- a/sources/pyside6/tests/QtWidgets/qapp_issue_585.py
+++ b/sources/pyside6/tests/QtWidgets/qapp_issue_585.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2018 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
"""
The bug was caused by this commit:
diff --git a/sources/pyside6/tests/QtWidgets/qapp_test.py b/sources/pyside6/tests/QtWidgets/qapp_test.py
index dec6034f1..5a66b8e33 100644
--- a/sources/pyside6/tests/QtWidgets/qapp_test.py
+++ b/sources/pyside6/tests/QtWidgets/qapp_test.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
''' Test the presence of qApp Macro'''
diff --git a/sources/pyside6/tests/QtWidgets/qapplication_exit_segfault_test.py b/sources/pyside6/tests/QtWidgets/qapplication_exit_segfault_test.py
index 57b1e410a..8bb47bc1c 100644
--- a/sources/pyside6/tests/QtWidgets/qapplication_exit_segfault_test.py
+++ b/sources/pyside6/tests/QtWidgets/qapplication_exit_segfault_test.py
@@ -1,31 +1,7 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+import gc
import os
import sys
import unittest
@@ -46,6 +22,8 @@ class QApplicationDelete(unittest.TestCase):
a = QApplication([])
b = QPushButton('aaaa')
del a
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
if __name__ == '__main__':
diff --git a/sources/pyside6/tests/QtWidgets/qapplication_test.py b/sources/pyside6/tests/QtWidgets/qapplication_test.py
index 4d62f8179..7c5b61fd9 100644
--- a/sources/pyside6/tests/QtWidgets/qapplication_test.py
+++ b/sources/pyside6/tests/QtWidgets/qapplication_test.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2018 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/qbrush_test.py b/sources/pyside6/tests/QtWidgets/qbrush_test.py
deleted file mode 100644
index 2083a6c56..000000000
--- a/sources/pyside6/tests/QtWidgets/qbrush_test.py
+++ /dev/null
@@ -1,61 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
-
-'''Test cases for QBrush'''
-
-import os
-import sys
-import unittest
-
-from pathlib import Path
-sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide6.QtCore import Qt
-from PySide6.QtGui import QColor, QBrush
-from PySide6.QtWidgets import QApplication
-
-from helper.usesqapplication import UsesQApplication
-
-
-class Constructor(UsesQApplication):
- '''Test case for constructor of QBrush'''
-
- def testQColor(self):
- # QBrush(QColor) constructor
- color = QColor('black')
- obj = QBrush(color)
- self.assertEqual(obj.color(), color)
-
- obj = QBrush(Qt.blue)
- self.assertEqual(obj.color(), Qt.blue)
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qcolormap_test.py b/sources/pyside6/tests/QtWidgets/qcolormap_test.py
index a6999de95..f63a9486f 100644
--- a/sources/pyside6/tests/QtWidgets/qcolormap_test.py
+++ b/sources/pyside6/tests/QtWidgets/qcolormap_test.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2018 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/qdialog_test.py b/sources/pyside6/tests/QtWidgets/qdialog_test.py
new file mode 100644
index 000000000..cb85ce7e2
--- /dev/null
+++ b/sources/pyside6/tests/QtWidgets/qdialog_test.py
@@ -0,0 +1,52 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+import os
+import sys
+import unittest
+import weakref
+
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
+from init_paths import init_test_paths
+init_test_paths(False)
+
+from PySide6.QtCore import Slot, QTimer
+from PySide6.QtWidgets import QDialog, QMainWindow
+from helper.timedqapplication import TimedQApplication
+
+
+class Window(QMainWindow):
+ def __init__(self):
+ super().__init__()
+ self.setWindowTitle("Main")
+ self.dialog = None
+
+ @Slot()
+ def execDialog(self):
+ dialog = QDialog(self)
+ self.dialog = weakref.ref(dialog)
+ dialog.setWindowTitle("Dialog")
+ dialog.setMinimumWidth(200)
+ QTimer.singleShot(500, dialog.reject)
+ dialog.exec()
+ self.close()
+
+
+class DialogExecTest(TimedQApplication):
+ """Test whether the parent-child relationship (dialog/main window) is removed when
+ using QDialog.exec() (instead show()), preventing the dialog from leaking."""
+
+ def setUp(self):
+ super().setUp(10000)
+ self._window = Window()
+
+ def testExec(self):
+ self._window.show()
+ QTimer.singleShot(500, self._window.execDialog)
+ self.app.exec()
+ self.assertTrue(self._window.dialog() is None)
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qdynamic_signal.py b/sources/pyside6/tests/QtWidgets/qdynamic_signal.py
index 89caf2906..83d6af383 100644
--- a/sources/pyside6/tests/QtWidgets/qdynamic_signal.py
+++ b/sources/pyside6/tests/QtWidgets/qdynamic_signal.py
@@ -1,31 +1,7 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+import gc
import os
import sys
import unittest
@@ -56,6 +32,8 @@ class DynamicSignalTest(UsesQApplication):
obj.destroyed[QObject].connect(self.cb)
obj = None
del dlg
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertTrue(self._called)
diff --git a/sources/pyside6/tests/QtWidgets/qfontdialog_test.py b/sources/pyside6/tests/QtWidgets/qfontdialog_test.py
index c503873ad..764329732 100644
--- a/sources/pyside6/tests/QtWidgets/qfontdialog_test.py
+++ b/sources/pyside6/tests/QtWidgets/qfontdialog_test.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/qformlayout_test.py b/sources/pyside6/tests/QtWidgets/qformlayout_test.py
index 1bb89d61c..f87ea6935 100644
--- a/sources/pyside6/tests/QtWidgets/qformlayout_test.py
+++ b/sources/pyside6/tests/QtWidgets/qformlayout_test.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
@@ -35,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 PySide6.QtWidgets import QFormLayout, QWidget
+from PySide6.QtWidgets import QFormLayout, QWidget, QLabel, QMainWindow
from helper.usesqapplication import UsesQApplication
@@ -44,6 +19,7 @@ class QFormLayoutTest(UsesQApplication):
def testGetItemPosition(self):
formlayout = QFormLayout()
+
row, role = formlayout.getItemPosition(0)
self.assertTrue(isinstance(row, int))
self.assertTrue(isinstance(role, QFormLayout.ItemRole))
@@ -60,6 +36,7 @@ class QFormLayoutTest(UsesQApplication):
def testGetWidgetPosition(self):
formlayout = QFormLayout()
widget = QWidget()
+
row, role = formlayout.getWidgetPosition(widget)
self.assertTrue(isinstance(row, int))
self.assertTrue(isinstance(role, QFormLayout.ItemRole))
@@ -75,6 +52,7 @@ class QFormLayoutTest(UsesQApplication):
def testGetLayoutPosition(self):
formlayout = QFormLayout()
layout = QFormLayout()
+
row, role = formlayout.getLayoutPosition(layout)
self.assertTrue(isinstance(row, int))
self.assertTrue(isinstance(role, QFormLayout.ItemRole))
@@ -87,7 +65,35 @@ class QFormLayoutTest(UsesQApplication):
self.assertEqual(row, 0)
self.assertEqual(role, QFormLayout.SpanningRole)
+ def testTakeRow(self):
+ window = QMainWindow()
+ window.setCentralWidget(QWidget())
+ formlayout = QFormLayout(window.centralWidget())
+
+ widget_label = "blub"
+ widget = QLabel(widget_label)
+
+ self.assertEqual(formlayout.count(), 0)
+ formlayout.addRow(widget)
+ self.assertEqual(formlayout.count(), 1)
+ self.assertEqual(formlayout.itemAt(0).widget(), widget)
+
+ widget_id = id(widget)
+
+ # Now there are no more references to the original widget on the
+ # Python side. Assert that this does not break the references to
+ # the widget on the C++ side so that "taking" the row will work.
+ del widget
+
+ takeRowResult = formlayout.takeRow(0)
+ self.assertEqual(formlayout.count(), 0)
+
+ widget = takeRowResult.fieldItem.widget()
+
+ self.assertIsNotNone(widget)
+ self.assertEqual(widget_id, id(widget))
+ self.assertEqual(widget.text(), widget_label)
+
if __name__ == "__main__":
unittest.main()
-
diff --git a/sources/pyside6/tests/QtWidgets/qgraphicsitem_isblocked_test.py b/sources/pyside6/tests/QtWidgets/qgraphicsitem_isblocked_test.py
index 2ee6cd96f..cb4115b55 100644
--- a/sources/pyside6/tests/QtWidgets/qgraphicsitem_isblocked_test.py
+++ b/sources/pyside6/tests/QtWidgets/qgraphicsitem_isblocked_test.py
@@ -1,32 +1,6 @@
#!/usr/bin/python
-
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/qgraphicsitem_test.py b/sources/pyside6/tests/QtWidgets/qgraphicsitem_test.py
index 4ce395e0e..1114ad4fe 100644
--- a/sources/pyside6/tests/QtWidgets/qgraphicsitem_test.py
+++ b/sources/pyside6/tests/QtWidgets/qgraphicsitem_test.py
@@ -1,33 +1,9 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
''' Test cases related to QGraphicsItem and subclasses'''
+import gc
import os
import sys
import unittest
@@ -60,6 +36,8 @@ class QColorOnSetBrush(UsesQApplication):
del self.color
del self.item
del self.scene
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(QColorOnSetBrush, self).tearDown()
def testQColor(self):
diff --git a/sources/pyside6/tests/QtWidgets/qgraphicsobjectreimpl_test.py b/sources/pyside6/tests/QtWidgets/qgraphicsobjectreimpl_test.py
index 92d89b44d..a3d28b4d3 100644
--- a/sources/pyside6/tests/QtWidgets/qgraphicsobjectreimpl_test.py
+++ b/sources/pyside6/tests/QtWidgets/qgraphicsobjectreimpl_test.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2018 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
''' Test cases related to QGraphicsItem and subclasses'''
diff --git a/sources/pyside6/tests/QtWidgets/qgraphicsproxywidget_test.py b/sources/pyside6/tests/QtWidgets/qgraphicsproxywidget_test.py
index 63ac4d791..dee616bbe 100644
--- a/sources/pyside6/tests/QtWidgets/qgraphicsproxywidget_test.py
+++ b/sources/pyside6/tests/QtWidgets/qgraphicsproxywidget_test.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/qgraphicsscene_test.py b/sources/pyside6/tests/QtWidgets/qgraphicsscene_test.py
index b8a5a3945..86604f27b 100644
--- a/sources/pyside6/tests/QtWidgets/qgraphicsscene_test.py
+++ b/sources/pyside6/tests/QtWidgets/qgraphicsscene_test.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
'''Basic test cases for QGraphicsScene'''
@@ -87,6 +62,8 @@ class ConstructorWithRect(unittest.TestCase):
def tearDown(self):
# Release resources
del self.scene
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def testHeight(self):
# QGraphicsScene.height()
@@ -112,6 +89,8 @@ class AddItem(UsesQApplication):
def tearDown(self):
# Release resources
del self.scene
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(AddItem, self).tearDown()
def testEllipse(self):
@@ -186,6 +165,8 @@ class ItemRetrieve(UsesQApplication):
def tearDown(self):
# Release resources
del self.scene
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(ItemRetrieve, self).tearDown()
def testItems(self):
@@ -213,6 +194,8 @@ class TestGraphicsGroup(UsesQApplication):
group = scene.createItemGroup((i2, i3, i4))
scene.removeItem(i1)
del i1 # this shouldn't delete i2
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertEqual(i2.scene(), scene)
scene.destroyItemGroup(group)
self.assertRaises(RuntimeError, group.type)
diff --git a/sources/pyside6/tests/QtWidgets/qimage_test.py b/sources/pyside6/tests/QtWidgets/qimage_test.py
deleted file mode 100644
index 6d15d8c3e..000000000
--- a/sources/pyside6/tests/QtWidgets/qimage_test.py
+++ /dev/null
@@ -1,314 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
-
-'''Test cases for QImage'''
-
-import os
-import sys
-import unittest
-
-from pathlib import Path
-sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide6.QtGui import QImage
-from PySide6.QtWidgets import QLabel
-from helper.usesqapplication import UsesQApplication
-
-
-xpm = [
- "27 22 206 2",
- " c None",
- ". c #FEFEFE",
- "+ c #FFFFFF",
- "@ c #F9F9F9",
- "# c #ECECEC",
- "$ c #D5D5D5",
- "% c #A0A0A0",
- "& c #767676",
- "* c #525252",
- "= c #484848",
- "- c #4E4E4E",
- "; c #555555",
- "> c #545454",
- ", c #5A5A5A",
- "' c #4B4B4B",
- ") c #4A4A4A",
- "! c #4F4F4F",
- "~ c #585858",
- "{ c #515151",
- "] c #4C4C4C",
- "^ c #B1B1B1",
- "/ c #FCFCFC",
- "( c #FDFDFD",
- "_ c #C1C1C1",
- ": c #848484",
- "< c #616161",
- "[ c #5E5E5E",
- "} c #CECECE",
- "| c #E2E2E2",
- "1 c #E4E4E4",
- "2 c #DFDFDF",
- "3 c #D2D2D2",
- "4 c #D8D8D8",
- "5 c #D4D4D4",
- "6 c #E6E6E6",
- "7 c #F1F1F1",
- "8 c #838383",
- "9 c #8E8E8E",
- "0 c #8F8F8F",
- "a c #CBCBCB",
- "b c #CCCCCC",
- "c c #E9E9E9",
- "d c #F2F2F2",
- "e c #EDEDED",
- "f c #B5B5B5",
- "g c #A6A6A6",
- "h c #ABABAB",
- "i c #BBBBBB",
- "j c #B0B0B0",
- "k c #EAEAEA",
- "l c #6C6C6C",
- "m c #BCBCBC",
- "n c #F5F5F5",
- "o c #FAFAFA",
- "p c #B6B6B6",
- "q c #F3F3F3",
- "r c #CFCFCF",
- "s c #FBFBFB",
- "t c #CDCDCD",
- "u c #DDDDDD",
- "v c #999999",
- "w c #F0F0F0",
- "x c #2B2B2B",
- "y c #C3C3C3",
- "z c #A4A4A4",
- "A c #D7D7D7",
- "B c #E7E7E7",
- "C c #6E6E6E",
- "D c #9D9D9D",
- "E c #BABABA",
- "F c #AEAEAE",
- "G c #898989",
- "H c #646464",
- "I c #BDBDBD",
- "J c #CACACA",
- "K c #2A2A2A",
- "L c #212121",
- "M c #B7B7B7",
- "N c #F4F4F4",
- "O c #737373",
- "P c #828282",
- "Q c #4D4D4D",
- "R c #000000",
- "S c #151515",
- "T c #B2B2B2",
- "U c #D6D6D6",
- "V c #D3D3D3",
- "W c #2F2F2F",
- "X c #636363",
- "Y c #A1A1A1",
- "Z c #BFBFBF",
- "` c #E0E0E0",
- " . c #6A6A6A",
- ".. c #050505",
- "+. c #A3A3A3",
- "@. c #202020",
- "#. c #5F5F5F",
- "$. c #B9B9B9",
- "%. c #C7C7C7",
- "&. c #D0D0D0",
- "*. c #3E3E3E",
- "=. c #666666",
- "-. c #DBDBDB",
- ";. c #424242",
- ">. c #C2C2C2",
- ",. c #1A1A1A",
- "'. c #2C2C2C",
- "). c #F6F6F6",
- "!. c #AAAAAA",
- "~. c #DCDCDC",
- "{. c #2D2D2D",
- "]. c #2E2E2E",
- "^. c #A7A7A7",
- "/. c #656565",
- "(. c #333333",
- "_. c #464646",
- ":. c #C4C4C4",
- "<. c #B8B8B8",
- "[. c #292929",
- "}. c #979797",
- "|. c #EFEFEF",
- "1. c #909090",
- "2. c #8A8A8A",
- "3. c #575757",
- "4. c #676767",
- "5. c #C5C5C5",
- "6. c #7A7A7A",
- "7. c #797979",
- "8. c #989898",
- "9. c #EEEEEE",
- "0. c #707070",
- "a. c #C8C8C8",
- "b. c #111111",
- "c. c #AFAFAF",
- "d. c #474747",
- "e. c #565656",
- "f. c #E3E3E3",
- "g. c #494949",
- "h. c #5B5B5B",
- "i. c #222222",
- "j. c #353535",
- "k. c #D9D9D9",
- "l. c #0A0A0A",
- "m. c #858585",
- "n. c #E5E5E5",
- "o. c #0E0E0E",
- "p. c #9A9A9A",
- "q. c #6F6F6F",
- "r. c #868686",
- "s. c #060606",
- "t. c #1E1E1E",
- "u. c #E8E8E8",
- "v. c #A5A5A5",
- "w. c #0D0D0D",
- "x. c #030303",
- "y. c #272727",
- "z. c #131313",
- "A. c #1F1F1F",
- "B. c #757575",
- "C. c #F7F7F7",
- "D. c #414141",
- "E. c #080808",
- "F. c #6B6B6B",
- "G. c #313131",
- "H. c #C0C0C0",
- "I. c #C9C9C9",
- "J. c #0B0B0B",
- "K. c #232323",
- "L. c #434343",
- "M. c #3D3D3D",
- "N. c #282828",
- "O. c #7C7C7C",
- "P. c #252525",
- "Q. c #3A3A3A",
- "R. c #F8F8F8",
- "S. c #1B1B1B",
- "T. c #949494",
- "U. c #3B3B3B",
- "V. c #242424",
- "W. c #383838",
- "X. c #6D6D6D",
- "Y. c #818181",
- "Z. c #939393",
- "`. c #9E9E9E",
- " + c #929292",
- ".+ c #7D7D7D",
- "++ c #ADADAD",
- "@+ c #DADADA",
- "#+ c #919191",
- "$+ c #E1E1E1",
- "%+ c #BEBEBE",
- "&+ c #ACACAC",
- "*+ c #9C9C9C",
- "=+ c #B3B3B3",
- "-+ c #808080",
- ";+ c #A8A8A8",
- ">+ c #393939",
- ",+ c #747474",
- "'+ c #7F7F7F",
- ")+ c #D1D1D1",
- "!+ c #606060",
- "~+ c #5C5C5C",
- "{+ c #686868",
- "]+ c #7E7E7E",
- "^+ c #787878",
- "/+ c #595959",
- ". . . + @ # $ % & * = - ; > , ' ) ! ~ { ] ^ / . . + + ",
- ". ( + _ : < [ & } | 1 2 $ 3 4 5 3 6 7 + + 8 9 + . + . ",
- ". + 0 9 a ( 3 a b c d e c f g h i g j $ k + l m + . + ",
- "+ 2 8 n o p | ( q r s . # t + + + u ^ v e w + x + + + ",
- "+ y z . @ A k B 7 n + ( s | p 8 C D 2 E 4 + + F G + . ",
- "# H I $ J G K L - M N . 2 O P Q R R S T U s s V W j + ",
- "X Y Z @ o ` _ g ...+.( 4 @.#.m G $.%.7 &.X *.=.-.;.&.",
- "Q >.C ,.'.} e + ).!.k + . + + . ~.{.> ].x f 7 ^./.k (.",
- "_.:.4 @ <.[.}.|.1.2.+ + + >.} 4 B + ( @ _ 3.4.5.6.r 7.",
- "3.8.9.~ 0.+ a.Q b.+ + c.d.#.=.$ |.b #.e.z ^ ; ^. .f.g.",
- "-.h.+ i.S M + # p j.% n 9.5.k.H l.m.V ^.n.o.M + M p.q.",
- "7 r.N s.1.R t.<.|.| u.v.~ w.x.E + s y.z.A.B.C.+ 5 D.q ",
- ").p.2 E.0.9 F.%.O {._ @.+ + i { [ i.G.H.P I.+ s q.} + ",
- ").p.6 J.R b.K.L.M.A.! b.g.K [.R M k + N.I + + >.O.+ . ",
- ").8.9.N.P...R R R R E.t.W n.+ Q.R.6 @.| + . + S.+ + . ",
- "n }.w T.U.B.<.i.@ Y + + U.+ c u V.= B B 7 u.W.c + . + ",
- "N T.# + }.X.Y.,.8.F.8 Z.[.`. +.+}.4 ++@+O.< ~.+ ( . + ",
- "d #+1 + _ ~.u.$+b $.y @+| $+%+I.&+k.h W +.9.+ ( . + . ",
- "w 0 |.*+. >.<.=+++++p a.p -+;+5.k.>+,+@ + . . + . + + ",
- "q '+9.R.^ I.t b %.I.)+4 $+n.I.,+ .|.+ . . . + . + + + ",
- ". p !+( + + + + + + E 0. .-+8.f.+ + . . + + . + + + + ",
- ". ( A ~+{+]+^+l > /+D f.c q . + . . + + . + + + + + + "
-]
-
-
-class QImageTest(UsesQApplication):
- '''Test case for calling setPixel with float as argument'''
-
- def testQImageStringBuffer(self):
- '''Test if the QImage signatures receiving string buffers exist.'''
- file = Path(__file__).resolve().parent / 'sample.png'
- self.assertTrue(file.is_file())
- img0 = QImage(file)
-
- # btw let's test the bits() method
- img1 = QImage(img0.bits(), img0.width(), img0.height(), img0.format())
- self.assertEqual(img0, img1)
- img2 = QImage(img0.bits(), img0.width(), img0.height(), img0.bytesPerLine(), img0.format())
- self.assertEqual(img0, img2)
-
- ## test scanLine method
- data1 = img0.scanLine(0)
- data2 = img1.scanLine(0)
- self.assertEqual(data1, data2)
-
- def testEmptyBuffer(self):
- img = QImage(bytes('', "UTF-8"), 100, 100, QImage.Format_ARGB32)
-
- def testEmptyStringAsBuffer(self):
- img = QImage(bytes('', "UTF-8"), 100, 100, QImage.Format_ARGB32)
-
- def testXpmConstructor(self):
- label = QLabel()
- img = QImage(xpm)
- self.assertFalse(img.isNull())
- self.assertEqual(img.width(), 27)
- self.assertEqual(img.height(), 22)
-
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/sources/pyside6/tests/QtWidgets/qinputdialog_get_test.py b/sources/pyside6/tests/QtWidgets/qinputdialog_get_test.py
index c558e291b..260653ae7 100644
--- a/sources/pyside6/tests/QtWidgets/qinputdialog_get_test.py
+++ b/sources/pyside6/tests/QtWidgets/qinputdialog_get_test.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
@@ -35,23 +10,34 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
-from PySide6.QtWidgets import QInputDialog
-from helper.timedqapplication import TimedQApplication
+from PySide6.QtCore import QTimer
+from PySide6.QtWidgets import QApplication, QInputDialog, QDialog
+from helper.usesqapplication import UsesQApplication
-class TestInputDialog(TimedQApplication):
+def close_dialog():
+ for w in QApplication.topLevelWidgets():
+ if isinstance(w, QDialog):
+ w.reject()
+
+
+class TestInputDialog(UsesQApplication):
def testGetDouble(self):
+ QTimer.singleShot(500, close_dialog)
self.assertEqual(QInputDialog.getDouble(None, "title", "label"), (0.0, False))
def testGetInt(self):
+ QTimer.singleShot(500, close_dialog)
self.assertEqual(QInputDialog.getInt(None, "title", "label"), (0, False))
def testGetItem(self):
+ QTimer.singleShot(500, close_dialog)
(item, bool) = QInputDialog.getItem(None, "title", "label", ["1", "2", "3"])
self.assertEqual(str(item), "1")
def testGetText(self):
+ QTimer.singleShot(500, close_dialog)
(text, bool) = QInputDialog.getText(None, "title", "label")
self.assertEqual(str(text), "")
diff --git a/sources/pyside6/tests/QtWidgets/qkeysequenceedit_test.py b/sources/pyside6/tests/QtWidgets/qkeysequenceedit_test.py
index 789607231..bcb4c7a61 100644
--- a/sources/pyside6/tests/QtWidgets/qkeysequenceedit_test.py
+++ b/sources/pyside6/tests/QtWidgets/qkeysequenceedit_test.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2017 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
'''Test cases for QKeySequenceEdit.'''
diff --git a/sources/pyside6/tests/QtWidgets/qlabel_test.py b/sources/pyside6/tests/QtWidgets/qlabel_test.py
index b8bbb2902..aba90b7b8 100644
--- a/sources/pyside6/tests/QtWidgets/qlabel_test.py
+++ b/sources/pyside6/tests/QtWidgets/qlabel_test.py
@@ -1,33 +1,9 @@
-#############################################################################
-##
-## Copyright (C) 2018 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
'''Test cases for QLabel'''
+import gc
import os
import sys
import unittest
@@ -37,6 +13,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(True)
+from PySide6.QtCore import Qt
from PySide6.QtGui import QPixmap
from PySide6.QtWidgets import QLabel
from shiboken6 import Shiboken
@@ -53,6 +30,8 @@ class QLabelTest(UsesQApplication):
def tearDown(self):
del self.label
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(QLabelTest, self).tearDown()
def testSetPixmap(self):
@@ -76,6 +55,8 @@ class QLabelTest(UsesQApplication):
ret_p_addr = Shiboken.getCppPointer(ret_p)
# Remove the QPixmap
del ret_p
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
# Set new QPixmap
self.label.setPixmap(p2)
@@ -83,7 +64,13 @@ class QLabelTest(UsesQApplication):
# address that our QPixmap p1 because it was deleted
# using `del ret_p`
self.assertTrue(all(Shiboken.getCppPointer(o) != ret_p_addr
- for o in Shiboken.getAllValidWrappers()))
+ for o in Shiboken.getAllValidWrappers()))
+
+ # Test for PYSIDE-1673, QObject.property() returning a QFlags<> property.
+ def testQObjectProperty(self):
+ a = self.label.property("alignment")
+ self.assertEqual(type(a), Qt.Alignment)
+ print("alignment=", a)
if __name__ == '__main__':
diff --git a/sources/pyside6/tests/QtWidgets/qlayout_ref_test.py b/sources/pyside6/tests/QtWidgets/qlayout_ref_test.py
index 255119562..df9bd7f90 100644
--- a/sources/pyside6/tests/QtWidgets/qlayout_ref_test.py
+++ b/sources/pyside6/tests/QtWidgets/qlayout_ref_test.py
@@ -1,36 +1,11 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
'''Test cases for QLayout handling of child widgets references'''
+import gc
import os
import sys
-from sys import getrefcount
import unittest
from pathlib import Path
@@ -62,30 +37,34 @@ class SaveReference(UsesQApplication):
# Release resources
del self.widget2
del self.widget1
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(SaveReference, self).tearDown()
+ @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
def checkLayoutReference(self, layout):
# Checks the reference cound handling of layout.addWidget
- self.assertEqual(getrefcount(self.widget1), 2)
+ self.assertEqual(sys.getrefcount(self.widget1), 2)
layout.addWidget(self.widget1)
- self.assertEqual(getrefcount(self.widget1), 3)
+ self.assertEqual(sys.getrefcount(self.widget1), 3)
- self.assertEqual(getrefcount(self.widget2), 2)
+ self.assertEqual(sys.getrefcount(self.widget2), 2)
layout.addWidget(self.widget2)
- self.assertEqual(getrefcount(self.widget2), 3)
+ self.assertEqual(sys.getrefcount(self.widget2), 3)
# Check if doesn't mess around with previous widget refcount
- self.assertEqual(getrefcount(self.widget1), 3)
+ self.assertEqual(sys.getrefcount(self.widget1), 3)
+ @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
def testMoveLayout(self):
l = QHBoxLayout()
- self.assertEqual(getrefcount(self.widget1), 2)
+ self.assertEqual(sys.getrefcount(self.widget1), 2)
l.addWidget(self.widget1)
- self.assertEqual(getrefcount(self.widget1), 3)
+ self.assertEqual(sys.getrefcount(self.widget1), 3)
w = QWidget()
w.setLayout(l)
- self.assertEqual(getrefcount(self.widget1), 3)
+ self.assertEqual(sys.getrefcount(self.widget1), 3)
def testHBoxReference(self):
# QHBoxLayout.addWidget reference count
@@ -131,20 +110,24 @@ class MultipleAdd(UsesQApplication):
del self.widget
del self.layout
del self.win
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(MultipleAdd, self).tearDown()
+ @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
def testRefCount(self):
# Multiple QLayout.addWidget calls on the same widget
- self.assertEqual(getrefcount(self.widget), 2)
+ self.assertEqual(sys.getrefcount(self.widget), 2)
self.layout.addWidget(self.widget)
- self.assertEqual(getrefcount(self.widget), 3)
+ self.assertEqual(sys.getrefcount(self.widget), 3)
self.layout.addWidget(self.widget)
- self.assertEqual(getrefcount(self.widget), 3)
+ self.assertEqual(sys.getrefcount(self.widget), 3)
self.layout.addWidget(self.widget)
- self.assertEqual(getrefcount(self.widget), 3)
+ self.assertEqual(sys.getrefcount(self.widget), 3)
class InternalAdd(UsesQApplication):
+ @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
def testInternalRef(self):
mw = QWidget()
w = QWidget()
@@ -153,35 +136,35 @@ class InternalAdd(UsesQApplication):
topLayout = QGridLayout()
# unique reference
- self.assertEqual(getrefcount(w), 2)
- self.assertEqual(getrefcount(ow), 2)
+ self.assertEqual(sys.getrefcount(w), 2)
+ self.assertEqual(sys.getrefcount(ow), 2)
topLayout.addWidget(w, 0, 0)
topLayout.addWidget(ow, 1, 0)
# layout keep the referemce
- self.assertEqual(getrefcount(w), 3)
- self.assertEqual(getrefcount(ow), 3)
+ self.assertEqual(sys.getrefcount(w), 3)
+ self.assertEqual(sys.getrefcount(ow), 3)
mainLayout = QGridLayout()
mainLayout.addLayout(topLayout, 1, 0, 1, 4)
# the same reference
- self.assertEqual(getrefcount(w), 3)
- self.assertEqual(getrefcount(ow), 3)
+ self.assertEqual(sys.getrefcount(w), 3)
+ self.assertEqual(sys.getrefcount(ow), 3)
mw.setLayout(mainLayout)
# now trasfer the ownership to mw
- self.assertEqual(getrefcount(w), 3)
- self.assertEqual(getrefcount(ow), 3)
+ self.assertEqual(sys.getrefcount(w), 3)
+ self.assertEqual(sys.getrefcount(ow), 3)
del mw
# remove the ref and invalidate the widget
- self.assertEqual(getrefcount(w), 2)
- self.assertEqual(getrefcount(ow), 2)
+ self.assertEqual(sys.getrefcount(w), 2)
+ self.assertEqual(sys.getrefcount(ow), 2)
if __name__ == '__main__':
diff --git a/sources/pyside6/tests/QtWidgets/qlayout_test.py b/sources/pyside6/tests/QtWidgets/qlayout_test.py
index 4230470b7..cc41f78b1 100644
--- a/sources/pyside6/tests/QtWidgets/qlayout_test.py
+++ b/sources/pyside6/tests/QtWidgets/qlayout_test.py
@@ -1,31 +1,7 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+import gc
import os
import sys
import unittest
@@ -89,6 +65,7 @@ class MissingItemAtLayout(QLayout):
class QLayoutTest(UsesQApplication):
+ @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
def testOwnershipTransfer(self):
b = QPushButton("teste")
l = MyLayout()
@@ -104,6 +81,7 @@ class QLayoutTest(UsesQApplication):
self.assertEqual(sys.getrefcount(b), 3)
+ @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
def testReferenceTransfer(self):
b = QPushButton("teste")
l = QHBoxLayout()
@@ -143,8 +121,19 @@ class QLayoutTest(UsesQApplication):
QTimer.singleShot(10, w.close)
self.app.exec()
del w
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
+ # PYSIDE-535: Why do I need to do it twice, here?
+ gc.collect()
self.assertRaises(RuntimeError, spacer.isEmpty)
+ def testConstructorProperties(self):
+ """PYSIDE-1986, test passing properties to the constructor of
+ QHBoxLayout, which does not have default arguments."""
+ layout = QHBoxLayout(objectName="layout", spacing=30)
+ self.assertEqual(layout.spacing(), 30)
+ self.assertEqual(layout.objectName(), "layout")
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qlcdnumber_test.py b/sources/pyside6/tests/QtWidgets/qlcdnumber_test.py
index fb7c4b578..bc186f755 100644
--- a/sources/pyside6/tests/QtWidgets/qlcdnumber_test.py
+++ b/sources/pyside6/tests/QtWidgets/qlcdnumber_test.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
@@ -41,6 +16,11 @@ from PySide6.QtWidgets import QApplication, QLCDNumber
class QLCDNumberOverflow(unittest.TestCase):
'''Test case for unhandled overflow on QLCDNumber() numDigits argument (see bug #215).'''
+ def assertRaises(self, *args, **kwds):
+ if not hasattr(sys, "pypy_version_info"):
+ # PYSIDE-535: PyPy complains "Fatal RPython error: NotImplementedError"
+ return super().assertRaises(*args, **kwds)
+
def setUp(self):
self.app = QApplication([])
diff --git a/sources/pyside6/tests/QtWidgets/qlistwidget_test.py b/sources/pyside6/tests/QtWidgets/qlistwidget_test.py
index 3746d3675..377e63ffb 100644
--- a/sources/pyside6/tests/QtWidgets/qlistwidget_test.py
+++ b/sources/pyside6/tests/QtWidgets/qlistwidget_test.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
@@ -42,6 +17,7 @@ from helper.usesqapplication import UsesQApplication
class QListWidgetTest(UsesQApplication):
+ @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
def populateList(self, lst):
o = QObject()
o.setObjectName("obj")
@@ -54,10 +30,12 @@ class QListWidgetTest(UsesQApplication):
lst.addItem(item)
self.assertTrue(sys.getrefcount(item), 3)
+ @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
def checkCurrentItem(self, lst):
item = lst.currentItem()
self.assertTrue(sys.getrefcount(item), 3)
+ @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
def checkItemData(self, lst):
item = lst.currentItem()
o = item.data(Qt.UserRole)
@@ -65,6 +43,7 @@ class QListWidgetTest(UsesQApplication):
self.assertEqual(o, item._data)
self.assertTrue(sys.getrefcount(o), 2)
+ @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
def testConstructorWithParent(self):
lst = QListWidget()
self.populateList(lst)
diff --git a/sources/pyside6/tests/QtWidgets/qlistwidgetitem_test.py b/sources/pyside6/tests/QtWidgets/qlistwidgetitem_test.py
index 5bfdcf496..a85c1b48f 100644
--- a/sources/pyside6/tests/QtWidgets/qlistwidgetitem_test.py
+++ b/sources/pyside6/tests/QtWidgets/qlistwidgetitem_test.py
@@ -1,31 +1,7 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+import gc
import os
import sys
import unittest
@@ -47,6 +23,8 @@ class QListWidgetItemConstructor(UsesQApplication):
def tearDown(self):
del self.widgetList
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(QListWidgetItemConstructor, self).tearDown()
def testConstructorWithParent(self):
diff --git a/sources/pyside6/tests/QtWidgets/qmainwindow_test.py b/sources/pyside6/tests/QtWidgets/qmainwindow_test.py
index 5d6018b28..2f245c8ff 100644
--- a/sources/pyside6/tests/QtWidgets/qmainwindow_test.py
+++ b/sources/pyside6/tests/QtWidgets/qmainwindow_test.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
@@ -73,6 +48,7 @@ class TestMainWindow(UsesQApplication):
def objDel(self, obj):
self.app.quit()
+ @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
def testRefCountToNull(self):
w = QMainWindow()
c = QWidget()
@@ -84,6 +60,7 @@ class TestMainWindow(UsesQApplication):
c = None
self.app.exec()
+ @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
def testRefCountToAnother(self):
w = QMainWindow()
c = QWidget()
diff --git a/sources/pyside6/tests/QtWidgets/qmenu_test.py b/sources/pyside6/tests/QtWidgets/qmenu_test.py
index 0033cd35d..a6976a637 100644
--- a/sources/pyside6/tests/QtWidgets/qmenu_test.py
+++ b/sources/pyside6/tests/QtWidgets/qmenu_test.py
@@ -1,31 +1,7 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+import gc
import os
import sys
import unittest
@@ -50,6 +26,8 @@ class QMenuAddAction(UsesQApplication):
def tearDown(self):
del self.menu
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(QMenuAddAction, self).tearDown()
def testAddActionWithoutKeySequenceCallable(self):
@@ -59,11 +37,11 @@ class QMenuAddAction(UsesQApplication):
def testAddActionKeySequenceCallable(self):
# bug #228
action = self.menu.addAction(self.app.tr('aaa'), lambda: 1,
- QKeySequence(self.app.tr('Ctrl+O')))
+ QKeySequence(self.app.tr('Ctrl+O')))
def testAddActionKeySequenceSlot(self):
action = self.menu.addAction('Quit', self.app, SLOT('quit()'),
- QKeySequence('Ctrl+O'))
+ QKeySequence('Ctrl+O'))
class QMenuAddActionWithIcon(UsesQApplication):
@@ -76,6 +54,8 @@ class QMenuAddActionWithIcon(UsesQApplication):
def tearDown(self):
del self.menu
del self.icon
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(QMenuAddActionWithIcon, self).tearDown()
def testAddActionWithoutKeySequenceCallable(self):
@@ -85,11 +65,11 @@ class QMenuAddActionWithIcon(UsesQApplication):
def testAddActionKeySequenceCallable(self):
# bug #228
action = self.menu.addAction(self.icon, self.app.tr('aaa'), lambda: 1,
- QKeySequence(self.app.tr('Ctrl+O')))
+ QKeySequence(self.app.tr('Ctrl+O')))
def testAddActionKeySequenceSlot(self):
action = self.menu.addAction(self.icon, 'Quit', self.app, SLOT('quit()'),
- QKeySequence('Ctrl+O'))
+ QKeySequence('Ctrl+O'))
if __name__ == '__main__':
diff --git a/sources/pyside6/tests/QtWidgets/qmenuadd_test.py b/sources/pyside6/tests/QtWidgets/qmenuadd_test.py
index c7f2ff74f..5b42e755f 100644
--- a/sources/pyside6/tests/QtWidgets/qmenuadd_test.py
+++ b/sources/pyside6/tests/QtWidgets/qmenuadd_test.py
@@ -1,32 +1,5 @@
-# -*- coding: utf-8 -*-
-
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
''' Test the QMenu.addAction() method'''
diff --git a/sources/pyside6/tests/QtWidgets/qobject_mi_test.py b/sources/pyside6/tests/QtWidgets/qobject_mi_test.py
index 169ee5279..d90961495 100644
--- a/sources/pyside6/tests/QtWidgets/qobject_mi_test.py
+++ b/sources/pyside6/tests/QtWidgets/qobject_mi_test.py
@@ -1,32 +1,5 @@
-# -*- coding: utf-8 -*-
-
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
'''Test cases for multiple inheritance from 2 QObjects'''
diff --git a/sources/pyside6/tests/QtWidgets/qpen_test.py b/sources/pyside6/tests/QtWidgets/qpen_test.py
deleted file mode 100644
index c06102e1c..000000000
--- a/sources/pyside6/tests/QtWidgets/qpen_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
-
-import os
-import sys
-import unittest
-
-from pathlib import Path
-sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from helper.usesqapplication import UsesQApplication
-
-from PySide6.QtCore import Qt, QTimer
-from PySide6.QtGui import QPen, QPainter
-from PySide6.QtWidgets import QWidget
-
-
-class Painting(QWidget):
- def __init__(self):
- super().__init__()
- self.penFromEnum = None
- self.penFromInteger = None
-
- def paintEvent(self, event):
- painter = QPainter(self)
- painter.setPen(Qt.NoPen)
- self.penFromEnum = painter.pen()
- painter.setPen(int(Qt.NoPen))
- self.penFromInteger = painter.pen()
-
-
-class QPenTest(UsesQApplication):
-
- def testCtorWithCreatedEnums(self):
- '''A simple case of QPen creation using created enums.'''
- width = 0
- style = Qt.PenStyle(0)
- cap = Qt.PenCapStyle(0)
- join = Qt.PenJoinStyle(0)
- pen = QPen(Qt.blue, width, style, cap, join)
-
- def testSetPenWithPenStyleEnum(self):
- '''Calls QPainter.setPen with both enum and integer. Bug #511.'''
- w = Painting()
- w.show()
- QTimer.singleShot(1000, self.app.quit)
- self.app.exec()
- self.assertEqual(w.penFromEnum.style(), Qt.NoPen)
- self.assertEqual(w.penFromInteger.style(), Qt.SolidLine)
-
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/sources/pyside6/tests/QtWidgets/qpicture_test.py b/sources/pyside6/tests/QtWidgets/qpicture_test.py
index 9e1479dd8..b81713b57 100644
--- a/sources/pyside6/tests/QtWidgets/qpicture_test.py
+++ b/sources/pyside6/tests/QtWidgets/qpicture_test.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
@@ -43,18 +18,16 @@ from PySide6.QtWidgets import QWidget
class MyWidget(QWidget):
def paintEvent(self, e):
- p = QPainter(self)
- p.drawPicture(0, 0, self._picture)
+ with QPainter(self) as p:
+ p.drawPicture(0, 0, self._picture)
self._app.quit()
class QPictureTest(UsesQApplication):
def testFromData(self):
picture = QPicture()
- painter = QPainter()
- painter.begin(picture)
- painter.drawEllipse(10, 20, 80, 70)
- painter.end()
+ with QPainter(picture) as painter:
+ painter.drawEllipse(10, 20, 80, 70)
data = picture.data()
picture2 = QPicture()
diff --git a/sources/pyside6/tests/QtWidgets/qpixmap_constructor.py b/sources/pyside6/tests/QtWidgets/qpixmap_constructor.py
deleted file mode 100644
index 81afc3792..000000000
--- a/sources/pyside6/tests/QtWidgets/qpixmap_constructor.py
+++ /dev/null
@@ -1,288 +0,0 @@
-#!/usr/bin/python
-
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
-
-import os
-import sys
-import unittest
-
-from pathlib import Path
-sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide6.QtGui import QPixmap
-from PySide6.QtWidgets import QLabel
-
-from helper.usesqapplication import UsesQApplication
-
-xpm = [
- "27 22 206 2",
- " c None",
- ". c #FEFEFE",
- "+ c #FFFFFF",
- "@ c #F9F9F9",
- "# c #ECECEC",
- "$ c #D5D5D5",
- "% c #A0A0A0",
- "& c #767676",
- "* c #525252",
- "= c #484848",
- "- c #4E4E4E",
- "; c #555555",
- "> c #545454",
- ", c #5A5A5A",
- "' c #4B4B4B",
- ") c #4A4A4A",
- "! c #4F4F4F",
- "~ c #585858",
- "{ c #515151",
- "] c #4C4C4C",
- "^ c #B1B1B1",
- "/ c #FCFCFC",
- "( c #FDFDFD",
- "_ c #C1C1C1",
- ": c #848484",
- "< c #616161",
- "[ c #5E5E5E",
- "} c #CECECE",
- "| c #E2E2E2",
- "1 c #E4E4E4",
- "2 c #DFDFDF",
- "3 c #D2D2D2",
- "4 c #D8D8D8",
- "5 c #D4D4D4",
- "6 c #E6E6E6",
- "7 c #F1F1F1",
- "8 c #838383",
- "9 c #8E8E8E",
- "0 c #8F8F8F",
- "a c #CBCBCB",
- "b c #CCCCCC",
- "c c #E9E9E9",
- "d c #F2F2F2",
- "e c #EDEDED",
- "f c #B5B5B5",
- "g c #A6A6A6",
- "h c #ABABAB",
- "i c #BBBBBB",
- "j c #B0B0B0",
- "k c #EAEAEA",
- "l c #6C6C6C",
- "m c #BCBCBC",
- "n c #F5F5F5",
- "o c #FAFAFA",
- "p c #B6B6B6",
- "q c #F3F3F3",
- "r c #CFCFCF",
- "s c #FBFBFB",
- "t c #CDCDCD",
- "u c #DDDDDD",
- "v c #999999",
- "w c #F0F0F0",
- "x c #2B2B2B",
- "y c #C3C3C3",
- "z c #A4A4A4",
- "A c #D7D7D7",
- "B c #E7E7E7",
- "C c #6E6E6E",
- "D c #9D9D9D",
- "E c #BABABA",
- "F c #AEAEAE",
- "G c #898989",
- "H c #646464",
- "I c #BDBDBD",
- "J c #CACACA",
- "K c #2A2A2A",
- "L c #212121",
- "M c #B7B7B7",
- "N c #F4F4F4",
- "O c #737373",
- "P c #828282",
- "Q c #4D4D4D",
- "R c #000000",
- "S c #151515",
- "T c #B2B2B2",
- "U c #D6D6D6",
- "V c #D3D3D3",
- "W c #2F2F2F",
- "X c #636363",
- "Y c #A1A1A1",
- "Z c #BFBFBF",
- "` c #E0E0E0",
- " . c #6A6A6A",
- ".. c #050505",
- "+. c #A3A3A3",
- "@. c #202020",
- "#. c #5F5F5F",
- "$. c #B9B9B9",
- "%. c #C7C7C7",
- "&. c #D0D0D0",
- "*. c #3E3E3E",
- "=. c #666666",
- "-. c #DBDBDB",
- ";. c #424242",
- ">. c #C2C2C2",
- ",. c #1A1A1A",
- "'. c #2C2C2C",
- "). c #F6F6F6",
- "!. c #AAAAAA",
- "~. c #DCDCDC",
- "{. c #2D2D2D",
- "]. c #2E2E2E",
- "^. c #A7A7A7",
- "/. c #656565",
- "(. c #333333",
- "_. c #464646",
- ":. c #C4C4C4",
- "<. c #B8B8B8",
- "[. c #292929",
- "}. c #979797",
- "|. c #EFEFEF",
- "1. c #909090",
- "2. c #8A8A8A",
- "3. c #575757",
- "4. c #676767",
- "5. c #C5C5C5",
- "6. c #7A7A7A",
- "7. c #797979",
- "8. c #989898",
- "9. c #EEEEEE",
- "0. c #707070",
- "a. c #C8C8C8",
- "b. c #111111",
- "c. c #AFAFAF",
- "d. c #474747",
- "e. c #565656",
- "f. c #E3E3E3",
- "g. c #494949",
- "h. c #5B5B5B",
- "i. c #222222",
- "j. c #353535",
- "k. c #D9D9D9",
- "l. c #0A0A0A",
- "m. c #858585",
- "n. c #E5E5E5",
- "o. c #0E0E0E",
- "p. c #9A9A9A",
- "q. c #6F6F6F",
- "r. c #868686",
- "s. c #060606",
- "t. c #1E1E1E",
- "u. c #E8E8E8",
- "v. c #A5A5A5",
- "w. c #0D0D0D",
- "x. c #030303",
- "y. c #272727",
- "z. c #131313",
- "A. c #1F1F1F",
- "B. c #757575",
- "C. c #F7F7F7",
- "D. c #414141",
- "E. c #080808",
- "F. c #6B6B6B",
- "G. c #313131",
- "H. c #C0C0C0",
- "I. c #C9C9C9",
- "J. c #0B0B0B",
- "K. c #232323",
- "L. c #434343",
- "M. c #3D3D3D",
- "N. c #282828",
- "O. c #7C7C7C",
- "P. c #252525",
- "Q. c #3A3A3A",
- "R. c #F8F8F8",
- "S. c #1B1B1B",
- "T. c #949494",
- "U. c #3B3B3B",
- "V. c #242424",
- "W. c #383838",
- "X. c #6D6D6D",
- "Y. c #818181",
- "Z. c #939393",
- "`. c #9E9E9E",
- " + c #929292",
- ".+ c #7D7D7D",
- "++ c #ADADAD",
- "@+ c #DADADA",
- "#+ c #919191",
- "$+ c #E1E1E1",
- "%+ c #BEBEBE",
- "&+ c #ACACAC",
- "*+ c #9C9C9C",
- "=+ c #B3B3B3",
- "-+ c #808080",
- ";+ c #A8A8A8",
- ">+ c #393939",
- ",+ c #747474",
- "'+ c #7F7F7F",
- ")+ c #D1D1D1",
- "!+ c #606060",
- "~+ c #5C5C5C",
- "{+ c #686868",
- "]+ c #7E7E7E",
- "^+ c #787878",
- "/+ c #595959",
- ". . . + @ # $ % & * = - ; > , ' ) ! ~ { ] ^ / . . + + ",
- ". ( + _ : < [ & } | 1 2 $ 3 4 5 3 6 7 + + 8 9 + . + . ",
- ". + 0 9 a ( 3 a b c d e c f g h i g j $ k + l m + . + ",
- "+ 2 8 n o p | ( q r s . # t + + + u ^ v e w + x + + + ",
- "+ y z . @ A k B 7 n + ( s | p 8 C D 2 E 4 + + F G + . ",
- "# H I $ J G K L - M N . 2 O P Q R R S T U s s V W j + ",
- "X Y Z @ o ` _ g ...+.( 4 @.#.m G $.%.7 &.X *.=.-.;.&.",
- "Q >.C ,.'.} e + ).!.k + . + + . ~.{.> ].x f 7 ^./.k (.",
- "_.:.4 @ <.[.}.|.1.2.+ + + >.} 4 B + ( @ _ 3.4.5.6.r 7.",
- "3.8.9.~ 0.+ a.Q b.+ + c.d.#.=.$ |.b #.e.z ^ ; ^. .f.g.",
- "-.h.+ i.S M + # p j.% n 9.5.k.H l.m.V ^.n.o.M + M p.q.",
- "7 r.N s.1.R t.<.|.| u.v.~ w.x.E + s y.z.A.B.C.+ 5 D.q ",
- ").p.2 E.0.9 F.%.O {._ @.+ + i { [ i.G.H.P I.+ s q.} + ",
- ").p.6 J.R b.K.L.M.A.! b.g.K [.R M k + N.I + + >.O.+ . ",
- ").8.9.N.P...R R R R E.t.W n.+ Q.R.6 @.| + . + S.+ + . ",
- "n }.w T.U.B.<.i.@ Y + + U.+ c u V.= B B 7 u.W.c + . + ",
- "N T.# + }.X.Y.,.8.F.8 Z.[.`. +.+}.4 ++@+O.< ~.+ ( . + ",
- "d #+1 + _ ~.u.$+b $.y @+| $+%+I.&+k.h W +.9.+ ( . + . ",
- "w 0 |.*+. >.<.=+++++p a.p -+;+5.k.>+,+@ + . . + . + + ",
- "q '+9.R.^ I.t b %.I.)+4 $+n.I.,+ .|.+ . . . + . + + + ",
- ". p !+( + + + + + + E 0. .-+8.f.+ + . . + + . + + + + ",
- ". ( A ~+{+]+^+l > /+D f.c q . + . . + + . + + + + + + "
-]
-
-
-class QStringSequenceTest(UsesQApplication):
- def testQPixmapConstructor(self):
- label = QLabel()
- pixmap1 = QPixmap(xpm)
- self.assertFalse(pixmap1.isNull())
- self.assertEqual(pixmap1.width(), 27)
- self.assertEqual(pixmap1.height(), 22)
-
-
-if __name__ == "__main__":
- unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qpushbutton_test.py b/sources/pyside6/tests/QtWidgets/qpushbutton_test.py
index 859202bb4..bfc04130e 100644
--- a/sources/pyside6/tests/QtWidgets/qpushbutton_test.py
+++ b/sources/pyside6/tests/QtWidgets/qpushbutton_test.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/qshortcut_test.py b/sources/pyside6/tests/QtWidgets/qshortcut_test.py
deleted file mode 100644
index b9bed5a72..000000000
--- a/sources/pyside6/tests/QtWidgets/qshortcut_test.py
+++ /dev/null
@@ -1,88 +0,0 @@
-# -*- coding: utf-8 -*-
-
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
-
-''' Test the QShortcut constructor'''
-
-import os
-import sys
-import unittest
-
-from pathlib import Path
-sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide6.QtCore import Qt, QTimer
-from PySide6.QtGui import QKeySequence, QShortcut
-from PySide6.QtWidgets import QApplication, QWidget
-
-
-class Foo(QWidget):
- def __init__(self):
- super().__init__()
- self.ok = False
- self.copy = False
-
- def slot_of_foo(self):
- self.ok = True
-
- def slot_of_copy(self):
- self.copy = True
-
-
-class MyShortcut(QShortcut):
- def __init__(self, keys, wdg, slot):
- QShortcut.__init__(self, keys, wdg, slot)
-
- def emit_signal(self):
- self.activated.emit()
-
-
-class QAppPresence(unittest.TestCase):
-
- def testQShortcut(self):
- self.qapp = QApplication([])
- f = Foo()
-
- self.sc = MyShortcut(QKeySequence(Qt.Key_Return), f, f.slot_of_foo)
- self.scstd = MyShortcut(QKeySequence.Copy, f, f.slot_of_copy)
- QTimer.singleShot(0, self.init)
- self.qapp.exec()
- self.assertEqual(f.ok, True)
- self.assertEqual(f.copy, True)
-
- def init(self):
- self.sc.emit_signal()
- self.scstd.emit_signal()
- self.qapp.quit()
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qsplitter_test.py b/sources/pyside6/tests/QtWidgets/qsplitter_test.py
index cce68f2d7..ae383f425 100644
--- a/sources/pyside6/tests/QtWidgets/qsplitter_test.py
+++ b/sources/pyside6/tests/QtWidgets/qsplitter_test.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/qstandarditemmodel_test.py b/sources/pyside6/tests/QtWidgets/qstandarditemmodel_test.py
deleted file mode 100644
index ddc9d2245..000000000
--- a/sources/pyside6/tests/QtWidgets/qstandarditemmodel_test.py
+++ /dev/null
@@ -1,106 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
-
-import os
-import sys
-import unittest
-
-from pathlib import Path
-sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide6.QtGui import QStandardItemModel, QStandardItem
-from PySide6.QtWidgets import QWidget
-from shiboken6 import Shiboken
-from helper.usesqapplication import UsesQApplication
-
-
-class QStandardItemModelTest(UsesQApplication):
-
- def setUp(self):
- super(QStandardItemModelTest, self).setUp()
- self.window = QWidget()
- self.model = QStandardItemModel(0, 3, self.window)
-
- def tearDown(self):
- del self.window
- del self.model
- super(QStandardItemModelTest, self).tearDown()
-
- def testInsertRow(self):
- # bug #227
- self.model.insertRow(0)
-
- def testClear(self):
-
- model = QStandardItemModel()
- root = model.invisibleRootItem()
- model.clear()
- self.assertFalse(Shiboken.isValid(root))
-
-
-class QStandardItemModelRef(UsesQApplication):
- def testRefCount(self):
- model = QStandardItemModel(5, 5)
- items = []
- for r in range(5):
- row = []
- for c in range(5):
- row.append(QStandardItem(f"{r},{c}"))
- self.assertEqual(sys.getrefcount(row[c]), 2)
-
- model.insertRow(r, row)
-
- for c in range(5):
- ref_after = sys.getrefcount(row[c])
- # check if the ref count was incremented after insertRow
- self.assertEqual(ref_after, 3)
-
- items.append(row)
- row = None
-
- for r in range(3):
- my_row = model.takeRow(0)
- my_row = None
- for c in range(5):
- # only rest 1 reference
- self.assertEqual(sys.getrefcount(items[r][c]), 2)
-
- my_i = model.item(0, 0)
- # ref(my_i) + parent_ref + items list ref
- self.assertEqual(sys.getrefcount(my_i), 4)
-
- model.clear()
- # ref(my_i)
- self.assertEqual(sys.getrefcount(my_i), 3)
-
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/sources/pyside6/tests/QtWidgets/qstring_qkeysequence_test.py b/sources/pyside6/tests/QtWidgets/qstring_qkeysequence_test.py
deleted file mode 100644
index 85ae7b65b..000000000
--- a/sources/pyside6/tests/QtWidgets/qstring_qkeysequence_test.py
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
-
-'''Tests conversions of QString to and from QKeySequence.'''
-
-import os
-import sys
-import unittest
-
-from pathlib import Path
-sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from helper.usesqapplication import UsesQApplication
-
-from PySide6.QtGui import QAction, QKeySequence
-
-
-class QStringQKeySequenceTest(UsesQApplication):
- '''Tests conversions of QString to and from QKeySequence.'''
-
- def testQStringFromQKeySequence(self):
- '''Creates a QString from a QKeySequence.'''
- keyseq = 'Ctrl+A'
- a = QKeySequence(keyseq)
- self.assertEqual(a, keyseq)
-
- def testPythonStringAsQKeySequence(self):
- '''Passes a Python string to an argument expecting a QKeySequence.'''
- keyseq = 'Ctrl+A'
- action = QAction(None)
- action.setShortcut(keyseq)
- shortcut = action.shortcut()
- self.assertTrue(isinstance(shortcut, QKeySequence))
- self.assertEqual(shortcut.toString(), keyseq)
-
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/sources/pyside6/tests/QtWidgets/qstyle_test.py b/sources/pyside6/tests/QtWidgets/qstyle_test.py
index 6993e8b90..5a9b29dc6 100644
--- a/sources/pyside6/tests/QtWidgets/qstyle_test.py
+++ b/sources/pyside6/tests/QtWidgets/qstyle_test.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import sys
import os
@@ -40,7 +15,7 @@ from helper.usesqapplication import UsesQApplication
from PySide6.QtGui import QWindow
from PySide6.QtWidgets import (QApplication, QFontComboBox, QLabel, QProxyStyle,
- QStyleFactory, QWidget)
+ QStyleFactory, QWidget)
class ProxyStyle(QProxyStyle):
@@ -88,6 +63,7 @@ class SetStyleTest(UsesQApplication):
QApplication.instance().processEvents()
self.assertTrue(proxyStyle.polished > 0)
+ @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
def testSetStyleOwnership(self):
style = QStyleFactory.create(QStyleFactory.keys()[0])
self.assertEqual(sys.getrefcount(style), 2)
diff --git a/sources/pyside6/tests/QtWidgets/qstyleoption_test.py b/sources/pyside6/tests/QtWidgets/qstyleoption_test.py
new file mode 100644
index 000000000..06798b9e9
--- /dev/null
+++ b/sources/pyside6/tests/QtWidgets/qstyleoption_test.py
@@ -0,0 +1,43 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+import sys
+import os
+import unittest
+
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
+from init_paths import init_test_paths
+init_test_paths(False)
+
+from helper.usesqapplication import UsesQApplication
+
+from PySide6.QtWidgets import (QApplication, QCommonStyle, QPushButton)
+
+
+text = ''
+
+
+class Style(QCommonStyle):
+
+ def drawControl(self, element, option, painter, widget=None):
+ # This should be a QStyleOptionButton with a "text" field
+ global text
+ text = option.text
+
+
+class StyleOptionTest(UsesQApplication):
+ '''PYSIDE-1909: Test cast to derived style option classes.'''
+
+ def testStyle(self):
+ global text
+ button = QPushButton("Hello World")
+ button.setStyle(Style())
+ button.show()
+ while not text:
+ QApplication.processEvents()
+ self.assertEqual(text, button.text())
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qtableview_test.py b/sources/pyside6/tests/QtWidgets/qtableview_test.py
index 8e457d781..c43666f23 100644
--- a/sources/pyside6/tests/QtWidgets/qtableview_test.py
+++ b/sources/pyside6/tests/QtWidgets/qtableview_test.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/qtabwidget_test.py b/sources/pyside6/tests/QtWidgets/qtabwidget_test.py
index aeccf6118..8db45f24b 100644
--- a/sources/pyside6/tests/QtWidgets/qtabwidget_test.py
+++ b/sources/pyside6/tests/QtWidgets/qtabwidget_test.py
@@ -1,31 +1,7 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+import gc
import os
import sys
import unittest
@@ -51,6 +27,8 @@ class RemoveTabMethod(TimedQApplication):
def tearDown(self):
del self.tab
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
TimedQApplication.tearDown(self)
def testRemoveTabPresence(self):
diff --git a/sources/pyside6/tests/QtWidgets/qtabwidgetclear_test.py b/sources/pyside6/tests/QtWidgets/qtabwidgetclear_test.py
index cc3282361..49e16e8d2 100644
--- a/sources/pyside6/tests/QtWidgets/qtabwidgetclear_test.py
+++ b/sources/pyside6/tests/QtWidgets/qtabwidgetclear_test.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2018 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/qtextedit_signal_test.py b/sources/pyside6/tests/QtWidgets/qtextedit_signal_test.py
index 534527cac..16929f0f2 100644
--- a/sources/pyside6/tests/QtWidgets/qtextedit_signal_test.py
+++ b/sources/pyside6/tests/QtWidgets/qtextedit_signal_test.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/qtextedit_test.py b/sources/pyside6/tests/QtWidgets/qtextedit_test.py
index 28f435f94..b82350293 100644
--- a/sources/pyside6/tests/QtWidgets/qtextedit_test.py
+++ b/sources/pyside6/tests/QtWidgets/qtextedit_test.py
@@ -1,36 +1,10 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
'''Test cases for QTextEdit and ownership problems.'''
import os
import sys
-from sys import getrefcount
import unittest
from pathlib import Path
@@ -53,16 +27,17 @@ class DontTouchReference(UsesQApplication):
self.cursor = self.editor.textCursor()
self.table = self.cursor.insertTable(1, 1)
+ @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
def testQTextTable(self):
# methods which return QTextTable should not increment its reference
- self.assertEqual(getrefcount(self.table), 2)
+ self.assertEqual(sys.getrefcount(self.table), 2)
f = self.cursor.currentFrame()
del f
- self.assertEqual(getrefcount(self.table), 2)
+ self.assertEqual(sys.getrefcount(self.table), 2)
# destroying the cursor should not raise any "RuntimeError: internal
# C++ object already deleted." when accessing the QTextTable
del self.cursor
- self.assertEqual(getrefcount(self.table), 2)
+ self.assertEqual(sys.getrefcount(self.table), 2)
cell = self.table.cellAt(0, 0)
diff --git a/sources/pyside6/tests/QtWidgets/qtoolbar_test.py b/sources/pyside6/tests/QtWidgets/qtoolbar_test.py
index 3f86c3f98..6fa5865cf 100644
--- a/sources/pyside6/tests/QtWidgets/qtoolbar_test.py
+++ b/sources/pyside6/tests/QtWidgets/qtoolbar_test.py
@@ -1,33 +1,9 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
'''Test cases for QToolbar'''
+import gc
import os
import sys
import unittest
@@ -58,6 +34,8 @@ class AddActionText(UsesQApplication):
super(AddActionText, self).tearDown()
del self.toolbar
del self.window
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def testText(self):
# QToolBar.addAction(text) - add a QToolButton
diff --git a/sources/pyside6/tests/QtWidgets/qtoolbox_test.py b/sources/pyside6/tests/QtWidgets/qtoolbox_test.py
index 79c447fd7..d069416b7 100644
--- a/sources/pyside6/tests/QtWidgets/qtoolbox_test.py
+++ b/sources/pyside6/tests/QtWidgets/qtoolbox_test.py
@@ -1,31 +1,7 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+import gc
import os
import sys
import unittest
@@ -49,6 +25,8 @@ class OwnershipControl(UsesQApplication):
def tearDown(self):
del self.toolbox
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(OwnershipControl, self).tearDown()
def testAddItem(self):
diff --git a/sources/pyside6/tests/QtWidgets/qtreeview_test.py b/sources/pyside6/tests/QtWidgets/qtreeview_test.py
index fbbbd6cef..fd535bfad 100644
--- a/sources/pyside6/tests/QtWidgets/qtreeview_test.py
+++ b/sources/pyside6/tests/QtWidgets/qtreeview_test.py
@@ -1,31 +1,7 @@
-#############################################################################
-##
-## Copyright (C) 2018 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+import gc
import os
import sys
import unittest
@@ -37,7 +13,7 @@ init_test_paths(False)
from PySide6.QtGui import QStandardItemModel
from PySide6.QtWidgets import (QWidget, QTreeView, QVBoxLayout,
- QStyledItemDelegate, QHeaderView)
+ QStyledItemDelegate, QHeaderView)
from PySide6.QtCore import Qt
from helper.usesqapplication import UsesQApplication
@@ -76,6 +52,8 @@ class QWidgetTest(UsesQApplication):
# This raised the Segmentation Fault too, because manually destroying
# the object caused a missing refrence.
del d
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
# Getting the delegates
a = t.itemDelegateForColumn(0)
diff --git a/sources/pyside6/tests/QtWidgets/qtreewidget_test.py b/sources/pyside6/tests/QtWidgets/qtreewidget_test.py
index 2ed85b5c5..6c2db32b9 100644
--- a/sources/pyside6/tests/QtWidgets/qtreewidget_test.py
+++ b/sources/pyside6/tests/QtWidgets/qtreewidget_test.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2018 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/qtreewidgetitem_test.py b/sources/pyside6/tests/QtWidgets/qtreewidgetitem_test.py
index d9813b23a..432aba2ed 100644
--- a/sources/pyside6/tests/QtWidgets/qtreewidgetitem_test.py
+++ b/sources/pyside6/tests/QtWidgets/qtreewidgetitem_test.py
@@ -1,32 +1,6 @@
#!/usr/bin/python
-
-#############################################################################
-##
-## Copyright (C) 2020 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of PySide6.
-##
-## $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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
"""
Unit tests for QTreeWidgetItem
@@ -66,9 +40,6 @@ class QTreeWidgetItemTest(unittest.TestCase):
self.assertTrue(item not in dummy_list)
self.assertFalse(item == item2)
self.assertTrue(item != item2)
- treewidget.show()
- QTimer.singleShot(500, app.quit)
- app.exec()
if __name__ == "__main__":
diff --git a/sources/pyside6/tests/QtWidgets/qvariant_test.py b/sources/pyside6/tests/QtWidgets/qvariant_test.py
index 2907fb966..fe0266309 100644
--- a/sources/pyside6/tests/QtWidgets/qvariant_test.py
+++ b/sources/pyside6/tests/QtWidgets/qvariant_test.py
@@ -1,31 +1,7 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+import gc
import os
import sys
import unittest
@@ -35,8 +11,9 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
-from PySide6.QtWidgets import (QApplication, QComboBox, QGraphicsScene,
- QGraphicsRectItem)
+from PySide6.QtCore import Qt, QObject
+from PySide6.QtWidgets import (QComboBox, QGraphicsScene,
+ QGraphicsRectItem)
from helper.usesqapplication import UsesQApplication
@@ -73,6 +50,8 @@ class QGraphicsSceneOnQVariantTest(UsesQApplication):
del self.s
del self.i
del self.combo
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(QGraphicsSceneOnQVariantTest, self).tearDown()
def testIt(self):
@@ -85,5 +64,79 @@ class QGraphicsSceneOnQVariantTest(UsesQApplication):
self.assertTrue(isinstance(self.combo.itemData(0), Sequence))
+class QVariantConversionTest(UsesQApplication):
+ """
+ Tests conversion from QVariant to supported type held by QVariant
+ """
+ def setUp(self):
+ super(QVariantConversionTest, self).setUp()
+ self.obj = QObject()
+
+ def tearDown(self):
+ del self.obj
+ super(QVariantConversionTest, self).tearDown()
+
+ def testEnum(self):
+ """
+ PYSIDE-1798: Test enum is obtained correctly when return through QVariant
+ """
+ self.obj.setProperty("test", Qt.SolidLine)
+ self.assertTrue(isinstance(self.obj.property("test"), Qt.PenStyle))
+ self.assertEqual(self.obj.property("test"), Qt.SolidLine)
+
+ def testString(self):
+ self.obj.setProperty("test", "test")
+ self.assertEqual(self.obj.property("test"), "test")
+ self.assertTrue(isinstance(self.obj.property("test"), str))
+
+ def testBytes(self):
+ byte_message = bytes("test", 'utf-8')
+ self.obj.setProperty("test", byte_message)
+ self.assertEqual(self.obj.property("test"), byte_message)
+ self.assertTrue(isinstance(self.obj.property("test"), bytes))
+
+ def testBasicTypes(self):
+ #bool
+ self.obj.setProperty("test", True)
+ self.assertEqual(self.obj.property("test"), True)
+ self.assertTrue(isinstance(self.obj.property("test"), bool))
+ #long
+ self.obj.setProperty("test", 2)
+ self.assertEqual(self.obj.property("test"), 2)
+ self.assertTrue(isinstance(self.obj.property("test"), int))
+ #float
+ self.obj.setProperty("test", 2.5)
+ self.assertEqual(self.obj.property("test"), 2.5)
+ self.assertTrue(isinstance(self.obj.property("test"), float))
+ #None
+ self.obj.setProperty("test", None)
+ self.assertEqual(self.obj.property("test"), None)
+
+ def testContainerTypes(self):
+ #list
+ self.obj.setProperty("test", [1, 2, 3])
+ self.assertEqual(self.obj.property("test"), [1, 2, 3])
+ self.assertTrue(isinstance(self.obj.property("test"), list))
+ #dict
+ self.obj.setProperty("test", {1: "one"})
+ self.assertEqual(self.obj.property("test"), {1: "one"})
+ self.assertTrue(isinstance(self.obj.property("test"), dict))
+
+ def testPyObject(self):
+ class Test:
+ pass
+ test = Test()
+ self.obj.setProperty("test", test)
+ self.assertEqual(self.obj.property("test"), test)
+ self.assertTrue(isinstance(self.obj.property("test"), Test))
+
+ def testQMetaPropertyWrite(self):
+ combo_box = QComboBox()
+ meta_obj = combo_box.metaObject()
+ i = meta_obj.indexOfProperty("sizeAdjustPolicy")
+ success = meta_obj.property(i).write(combo_box, QComboBox.SizeAdjustPolicy.AdjustToContents)
+ self.assertTrue(success)
+
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qwidget_setlayout_test.py b/sources/pyside6/tests/QtWidgets/qwidget_setlayout_test.py
index 02ab052ee..1d9128789 100644
--- a/sources/pyside6/tests/QtWidgets/qwidget_setlayout_test.py
+++ b/sources/pyside6/tests/QtWidgets/qwidget_setlayout_test.py
@@ -1,32 +1,6 @@
#!/usr/bin/python
-
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/qwidget_test.py b/sources/pyside6/tests/QtWidgets/qwidget_test.py
index 4a90648f6..2d503f0d4 100644
--- a/sources/pyside6/tests/QtWidgets/qwidget_test.py
+++ b/sources/pyside6/tests/QtWidgets/qwidget_test.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2019 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import sys
import os
diff --git a/sources/pyside6/tests/QtWidgets/reference_count_test.py b/sources/pyside6/tests/QtWidgets/reference_count_test.py
index 00ebab4c3..b7d3908dd 100644
--- a/sources/pyside6/tests/QtWidgets/reference_count_test.py
+++ b/sources/pyside6/tests/QtWidgets/reference_count_test.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
'''Test cases for Reference count when the object is created in c++ side'''
@@ -68,6 +43,7 @@ class ReferenceCount(UsesQApplication):
def tearDown(self):
super(ReferenceCount, self).tearDown()
+ @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
def beforeTest(self):
points = [QPointF(0, 0), QPointF(100, 100), QPointF(0, 100)]
pol = self.scene.addPolygon(QPolygonF(points))
@@ -77,6 +53,7 @@ class ReferenceCount(UsesQApplication):
# refcount need be 3 because one ref for QGraphicsScene, and one to rect obj
self.assertEqual(sys.getrefcount(pol), 3)
+ @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
def testReferenceCount(self):
global destroyedRect
global destroyedPol
diff --git a/sources/pyside6/tests/QtWidgets/signature_test.py b/sources/pyside6/tests/QtWidgets/signature_test.py
index 94224c6ae..f156b6717 100644
--- a/sources/pyside6/tests/QtWidgets/signature_test.py
+++ b/sources/pyside6/tests/QtWidgets/signature_test.py
@@ -1,41 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2017 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:LGPL$
-## 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 Lesser General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU Lesser
-## General Public License version 3 as published by the Free Software
-## Foundation and appearing in the file LICENSE.LGPL3 included in the
-## packaging of this file. Please review the following information to
-## ensure the GNU Lesser General Public License version 3 requirements
-## will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 2.0 or (at your option) the GNU General
-## Public license version 3 or any later version approved by the KDE Free
-## Qt Foundation. The licenses are as published by the Free Software
-## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-## 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-2.0.html and
-## https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
import inspect
import os
@@ -49,43 +13,44 @@ init_test_paths(False)
import PySide6.QtCore
import PySide6.QtWidgets
+from PySide6.support.signature import get_signature
class PySideSignatureTest(unittest.TestCase):
def testSignatureExist(self):
- t1 = type(PySide6.QtCore.QObject.children.__signature__)
+ t1 = type(get_signature(PySide6.QtCore.QObject.children))
self.assertEqual(t1, inspect.Signature)
- t2 = type(PySide6.QtCore.QObject.__dict__["children"].__signature__)
+ t2 = type(get_signature(PySide6.QtCore.QObject.__dict__["children"]))
self.assertEqual(t2, t1)
obj = PySide6.QtWidgets.QApplication.palette
- t3 = type(obj.__signature__)
+ t3 = type(get_signature(obj))
self.assertEqual(t3, list)
- self.assertEqual(len(obj.__signature__), 3)
- for thing in obj.__signature__:
+ self.assertEqual(len(get_signature(obj)), 3)
+ for thing in get_signature(obj):
self.assertEqual(type(thing), inspect.Signature)
sm = PySide6.QtWidgets.QApplication.__dict__["palette"]
- self.assertFalse(callable(sm))
- self.assertEqual(sm.__func__, obj)
- self.assertTrue(hasattr(sm, "__signature__") and
- sm.__signature__ is not None)
+ # PYSIDE-1436: staticmethod is a callable since Python 3.10
+ # Instead of checking callable(sm), we check the type:
+ self.assertEqual(type(sm), staticmethod)
+ self.assertTrue(get_signature(sm) is not None)
def testSignatureIsCached(self):
# see if we get the same object
- ob1 = PySide6.QtCore.QObject.children.__signature__
- ob2 = PySide6.QtCore.QObject.children.__signature__
+ ob1 = get_signature(PySide6.QtCore.QObject.children)
+ ob2 = get_signature(PySide6.QtCore.QObject.children)
self.assertTrue(ob1 is ob2)
# same with multi signature
- ob1 = PySide6.QtWidgets.QApplication.palette.__signature__
- ob2 = PySide6.QtWidgets.QApplication.palette.__signature__
+ ob1 = get_signature(PySide6.QtWidgets.QApplication.palette)
+ ob2 = get_signature(PySide6.QtWidgets.QApplication.palette)
self.assertTrue(ob1 is ob2)
def testModuleIsInitialized(self):
- self.assertTrue(PySide6.QtWidgets.QApplication.__signature__ is not None)
+ self.assertTrue(get_signature(PySide6.QtWidgets.QApplication) is not None)
def test_NotCalled_is_callable_and_correct(self):
# A signature that has a default value with some "Default(...)"
# wrapper is callable and creates an object of the right type.
- sig = PySide6.QtCore.QByteArray().toPercentEncoding.__signature__
+ sig = get_signature(PySide6.QtCore.QByteArray().toPercentEncoding)
called_default = sig.parameters["exclude"].default()
self.assertEqual(type(called_default), PySide6.QtCore.QByteArray)
diff --git a/sources/pyside6/tests/QtWidgets/standardpixmap_test.py b/sources/pyside6/tests/QtWidgets/standardpixmap_test.py
index c6e696807..564f3ff2e 100644
--- a/sources/pyside6/tests/QtWidgets/standardpixmap_test.py
+++ b/sources/pyside6/tests/QtWidgets/standardpixmap_test.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/test_module_template.py b/sources/pyside6/tests/QtWidgets/test_module_template.py
index 83c1fce4b..92661cdff 100644
--- a/sources/pyside6/tests/QtWidgets/test_module_template.py
+++ b/sources/pyside6/tests/QtWidgets/test_module_template.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtWidgets/virtual_protected_inheritance_test.py b/sources/pyside6/tests/QtWidgets/virtual_protected_inheritance_test.py
index c22648551..911fed475 100644
--- a/sources/pyside6/tests/QtWidgets/virtual_protected_inheritance_test.py
+++ b/sources/pyside6/tests/QtWidgets/virtual_protected_inheritance_test.py
@@ -1,33 +1,9 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
'''Test cases for overriding inherited protected virtual methods'''
+import gc
import os
import sys
import unittest
@@ -83,6 +59,8 @@ class TimerEventTest(UsesQApplication):
def tearDown(self):
# Release resources
del self.widget
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(TimerEventTest, self).tearDown()
def testMethod(self):
diff --git a/sources/pyside6/tests/QtWidgets/virtual_pure_override_test.py b/sources/pyside6/tests/QtWidgets/virtual_pure_override_test.py
index 68d366c36..b7d1e4f3f 100644
--- a/sources/pyside6/tests/QtWidgets/virtual_pure_override_test.py
+++ b/sources/pyside6/tests/QtWidgets/virtual_pure_override_test.py
@@ -1,32 +1,6 @@
#!/usr/bin/python
-
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
@@ -53,6 +27,8 @@ class RoundRectItem(QGraphicsRectItem):
def paint(self, painter, qstyleoptiongraphicsitem, qwidget):
global qgraphics_item_painted
qgraphics_item_painted = True
+ view = self.scene().views()[0]
+ QTimer.singleShot(20, view.close)
class QGraphicsItemTest(UsesQApplication):
@@ -72,10 +48,10 @@ class QGraphicsItemTest(UsesQApplication):
scene = QGraphicsScene()
scene.addText("test")
view = QGraphicsView(scene)
+ view.setWindowTitle("virtual_pure_override_test")
rect = self.createRoundRect(scene)
view.show()
- QTimer.singleShot(1000, self.quit_app)
self.app.exec()
self.assertTrue(qgraphics_item_painted)
diff --git a/sources/pyside6/tests/QtWidgets/wrong_return_test.py b/sources/pyside6/tests/QtWidgets/wrong_return_test.py
index f9267f3fa..009078ac1 100644
--- a/sources/pyside6/tests/QtWidgets/wrong_return_test.py
+++ b/sources/pyside6/tests/QtWidgets/wrong_return_test.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
'''Test cases for Virtual functions with wrong return type'''