aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/tests/QtGui
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside6/tests/QtGui')
-rw-r--r--sources/pyside6/tests/QtGui/CMakeLists.txt20
-rw-r--r--sources/pyside6/tests/QtGui/QtGui.pyproject56
-rw-r--r--sources/pyside6/tests/QtGui/bug_1091.py38
-rw-r--r--sources/pyside6/tests/QtGui/bug_300_test.py53
-rw-r--r--sources/pyside6/tests/QtGui/bug_367.py43
-rw-r--r--sources/pyside6/tests/QtGui/bug_480.py60
-rw-r--r--sources/pyside6/tests/QtGui/bug_493.py33
-rw-r--r--sources/pyside6/tests/QtGui/bug_606.py43
-rw-r--r--sources/pyside6/tests/QtGui/bug_617.py35
-rw-r--r--sources/pyside6/tests/QtGui/bug_652.py40
-rw-r--r--sources/pyside6/tests/QtGui/bug_660.py47
-rw-r--r--sources/pyside6/tests/QtGui/bug_716.py30
-rw-r--r--sources/pyside6/tests/QtGui/bug_740.py34
-rw-r--r--sources/pyside6/tests/QtGui/bug_743.py36
-rw-r--r--sources/pyside6/tests/QtGui/bug_785.py42
-rw-r--r--sources/pyside6/tests/QtGui/bug_991.py32
-rw-r--r--sources/pyside6/tests/QtGui/bug_PYSIDE-344.py39
-rw-r--r--sources/pyside6/tests/QtGui/bug_PYSIDE-41.py79
-rw-r--r--sources/pyside6/tests/QtGui/deepcopy_test.py43
-rw-r--r--sources/pyside6/tests/QtGui/event_filter_test.py52
-rw-r--r--sources/pyside6/tests/QtGui/float_to_int_implicit_conversion_test.py40
-rw-r--r--sources/pyside6/tests/QtGui/pyside_reload_test.py33
-rw-r--r--sources/pyside6/tests/QtGui/qbrush_test.py44
-rw-r--r--sources/pyside6/tests/QtGui/qcolor_reduce_test.py32
-rw-r--r--sources/pyside6/tests/QtGui/qcolor_test.py56
-rw-r--r--sources/pyside6/tests/QtGui/qcursor_test.py32
-rw-r--r--sources/pyside6/tests/QtGui/qdatastream_gui_operators_test.py43
-rw-r--r--sources/pyside6/tests/QtGui/qdesktopservices_test.py32
-rw-r--r--sources/pyside6/tests/QtGui/qfont_test.py36
-rw-r--r--sources/pyside6/tests/QtGui/qfontmetrics_test.py44
-rw-r--r--sources/pyside6/tests/QtGui/qguiapplication_test.py31
-rw-r--r--sources/pyside6/tests/QtGui/qicon_test.py58
-rw-r--r--sources/pyside6/tests/QtGui/qimage_test.py57
-rw-r--r--sources/pyside6/tests/QtGui/qimage_win_test.py42
-rw-r--r--sources/pyside6/tests/QtGui/qitemselection_test.py34
-rw-r--r--sources/pyside6/tests/QtGui/qkeysequence_test.py48
-rw-r--r--sources/pyside6/tests/QtGui/qpainter_test.py78
-rw-r--r--sources/pyside6/tests/QtGui/qpdfwriter_test.py32
-rw-r--r--sources/pyside6/tests/QtGui/qpen_test.py58
-rw-r--r--sources/pyside6/tests/QtGui/qpixelformat_test.py40
-rw-r--r--sources/pyside6/tests/QtGui/qpixmap_constructor.py261
-rw-r--r--sources/pyside6/tests/QtGui/qpixmap_test.py43
-rw-r--r--sources/pyside6/tests/QtGui/qpixmapcache_test.py31
-rw-r--r--sources/pyside6/tests/QtGui/qpolygonf_test.py30
-rw-r--r--sources/pyside6/tests/QtGui/qradialgradient_test.py32
-rw-r--r--sources/pyside6/tests/QtGui/qrasterwindow_test.py81
-rw-r--r--sources/pyside6/tests/QtGui/qregion_test.py50
-rw-r--r--sources/pyside6/tests/QtGui/qshortcut_test.py61
-rw-r--r--sources/pyside6/tests/QtGui/qstandarditemmodel_test.py86
-rw-r--r--sources/pyside6/tests/QtGui/qstring_qkeysequence_test.py43
-rw-r--r--sources/pyside6/tests/QtGui/qstylehints_test.py32
-rw-r--r--sources/pyside6/tests/QtGui/qtextdocument_functions.py43
-rw-r--r--sources/pyside6/tests/QtGui/qtextdocument_undoredo_test.py32
-rw-r--r--sources/pyside6/tests/QtGui/qtextdocumentwriter_test.py35
-rw-r--r--sources/pyside6/tests/QtGui/qtextline_test.py39
-rw-r--r--sources/pyside6/tests/QtGui/qtransform_test.py42
-rw-r--r--sources/pyside6/tests/QtGui/repr_test.py36
-rw-r--r--sources/pyside6/tests/QtGui/timed_app_and_patching_test.py59
-rw-r--r--sources/pyside6/tests/QtGui/xpm_data.py238
59 files changed, 1574 insertions, 1425 deletions
diff --git a/sources/pyside6/tests/QtGui/CMakeLists.txt b/sources/pyside6/tests/QtGui/CMakeLists.txt
index 179e88fd6..71a5c7eb9 100644
--- a/sources/pyside6/tests/QtGui/CMakeLists.txt
+++ b/sources/pyside6/tests/QtGui/CMakeLists.txt
@@ -1,8 +1,10 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
#Keep this in alphabetical sort
-PYSIDE_TEST(bug_300_test.py)
PYSIDE_TEST(bug_367.py)
-PYSIDE_TEST(bug_480.py)
+PYSIDE_TEST(bug_493.py)
PYSIDE_TEST(bug_606.py)
PYSIDE_TEST(bug_617.py)
PYSIDE_TEST(bug_652.py)
@@ -10,25 +12,34 @@ PYSIDE_TEST(bug_660.py)
PYSIDE_TEST(bug_716.py)
PYSIDE_TEST(bug_740.py)
PYSIDE_TEST(bug_743.py)
+PYSIDE_TEST(bug_785.py)
PYSIDE_TEST(bug_991.py)
PYSIDE_TEST(bug_1091.py)
-PYSIDE_TEST(bug_PYSIDE-41.py)
PYSIDE_TEST(bug_PYSIDE-344.py)
PYSIDE_TEST(deepcopy_test.py)
+PYSIDE_TEST(event_filter_test.py)
PYSIDE_TEST(float_to_int_implicit_conversion_test.py)
PYSIDE_TEST(pyside_reload_test.py)
+PYSIDE_TEST(qbrush_test.py)
PYSIDE_TEST(qcolor_test.py)
PYSIDE_TEST(qcolor_reduce_test.py)
PYSIDE_TEST(qcursor_test.py)
PYSIDE_TEST(qdatastream_gui_operators_test.py)
PYSIDE_TEST(qdesktopservices_test.py)
+PYSIDE_TEST(qfont_test.py)
PYSIDE_TEST(qfontmetrics_test.py)
PYSIDE_TEST(qguiapplication_test.py)
PYSIDE_TEST(qicon_test.py)
+PYSIDE_TEST(qimage_test.py)
+if(WIN32)
+ PYSIDE_TEST(qimage_win_test.py)
+endif()
PYSIDE_TEST(qitemselection_test.py)
PYSIDE_TEST(qpainter_test.py)
+PYSIDE_TEST(qpen_test.py)
PYSIDE_TEST(qpdfwriter_test.py)
PYSIDE_TEST(qpixelformat_test.py)
+PYSIDE_TEST(qpixmap_constructor.py)
PYSIDE_TEST(qpixmap_test.py)
PYSIDE_TEST(qpixmapcache_test.py)
PYSIDE_TEST(qpolygonf_test.py)
@@ -36,6 +47,9 @@ PYSIDE_TEST(qkeysequence_test.py)
PYSIDE_TEST(qradialgradient_test.py)
PYSIDE_TEST(qrasterwindow_test.py)
PYSIDE_TEST(qregion_test.py)
+PYSIDE_TEST(qshortcut_test.py)
+PYSIDE_TEST(qstandarditemmodel_test.py)
+PYSIDE_TEST(qstring_qkeysequence_test.py)
PYSIDE_TEST(qstylehints_test.py)
PYSIDE_TEST(qtextdocument_functions.py)
PYSIDE_TEST(qtextdocument_undoredo_test.py)
diff --git a/sources/pyside6/tests/QtGui/QtGui.pyproject b/sources/pyside6/tests/QtGui/QtGui.pyproject
new file mode 100644
index 000000000..75b5e084f
--- /dev/null
+++ b/sources/pyside6/tests/QtGui/QtGui.pyproject
@@ -0,0 +1,56 @@
+{
+ "files": ["bug_1091.py",
+ "bug_367.py",
+ "bug_493.py",
+ "bug_606.py",
+ "bug_617.py",
+ "bug_652.py",
+ "bug_660.py",
+ "bug_716.py",
+ "bug_740.py",
+ "bug_743.py",
+ "bug_785.py",
+ "bug_991.py",
+ "bug_PYSIDE-344.py",
+ "deepcopy_test.py",
+ "event_filter_test.py",
+ "float_to_int_implicit_conversion_test.py",
+ "pyside_reload_test.py",
+ "qbrush_test.py",
+ "qcolor_reduce_test.py",
+ "qcolor_test.py",
+ "qcursor_test.py",
+ "qdatastream_gui_operators_test.py",
+ "qdesktopservices_test.py",
+ "qfont_test.py",
+ "qfontmetrics_test.py",
+ "qguiapplication_test.py",
+ "qicon_test.py",
+ "qimage_test.py",
+ "qimage_win_test.py",
+ "qitemselection_test.py",
+ "qkeysequence_test.py",
+ "qpainter_test.py",
+ "qpdfwriter_test.py",
+ "qpen_test.py",
+ "qpixelformat_test.py",
+ "qpixmap_constructor.py",
+ "qpixmap_test.py",
+ "qpixmapcache_test.py",
+ "qpolygonf_test.py",
+ "qradialgradient_test.py",
+ "qrasterwindow_test.py",
+ "qregion_test.py",
+ "qshortcut_test.py",
+ "qstandarditemmodel_test.py",
+ "qstring_qkeysequence_test.py",
+ "qstylehints_test.py",
+ "qtextdocument_functions.py",
+ "qtextdocument_undoredo_test.py",
+ "qtextdocumentwriter_test.py",
+ "qtextline_test.py",
+ "qtransform_test.py",
+ "repr_test.py",
+ "timed_app_and_patching_test.py",
+ "xpm_data.py"]
+}
diff --git a/sources/pyside6/tests/QtGui/bug_1091.py b/sources/pyside6/tests/QtGui/bug_1091.py
index 22788fea0..b1e2f0b09 100644
--- a/sources/pyside6/tests/QtGui/bug_1091.py
+++ b/sources/pyside6/tests/QtGui/bug_1091.py
@@ -1,30 +1,6 @@
-#############################################################################
-##
-## 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
+from __future__ import annotations
''' unit test for BUG #1091 '''
@@ -37,12 +13,14 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
-from PySide6 import QtGui
+from PySide6.QtGui import QPainter
+
class QPainterTestCase(unittest.TestCase):
def testIt(self):
- self.assertTrue("PixmapFragment" in dir(QtGui.QPainter))
- self.assertTrue("drawPixmapFragments" in dir(QtGui.QPainter))
+ self.assertTrue("PixmapFragment" in dir(QPainter))
+ self.assertTrue("drawPixmapFragments" in dir(QPainter))
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/bug_300_test.py b/sources/pyside6/tests/QtGui/bug_300_test.py
deleted file mode 100644
index 8d944840c..000000000
--- a/sources/pyside6/tests/QtGui/bug_300_test.py
+++ /dev/null
@@ -1,53 +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 QModelIndex, QStringListModel
-
-
-class TestQAbstractItemModelSignals(unittest.TestCase):
- def sigCallback(self, index, r, c):
- self._called = True
-
- def testSignals(self):
- self._called = False
- m = QStringListModel()
- m.rowsAboutToBeInserted[QModelIndex,int,int].connect(self.sigCallback)
- m.insertRows(0, 3)
- self.assertTrue(self._called)
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside6/tests/QtGui/bug_367.py b/sources/pyside6/tests/QtGui/bug_367.py
index 0fd676d8b..1b447be72 100644
--- a/sources/pyside6/tests/QtGui/bug_367.py
+++ b/sources/pyside6/tests/QtGui/bug_367.py
@@ -1,30 +1,6 @@
-#############################################################################
-##
-## 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
+from __future__ import annotations
''' Test bug 367: http://bugs.openbossa.org/show_bug.cgi?id=367'''
@@ -38,20 +14,23 @@ from init_paths import init_test_paths
init_test_paths(False)
from helper.usesqapplication import UsesQApplication
-from PySide6 import QtCore,QtGui
+from PySide6.QtGui import QStandardItem, QStandardItemModel
+
class BugTest(UsesQApplication):
+ @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
def testCase(self):
- model = QtGui.QStandardItemModel()
+ model = QStandardItemModel()
parentItem = model.invisibleRootItem()
for i in range(10):
- item = QtGui.QStandardItem()
- rcount = sys.getrefcount(item)
+ item = QStandardItem()
+ rcount = sys.getrefcount(item)
parentItem.appendRow(item)
- self.assertEqual(rcount+1, sys.getrefcount(item))
+ self.assertEqual(rcount + 1, sys.getrefcount(item))
parentItem = item
self.assertTrue(True)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/bug_480.py b/sources/pyside6/tests/QtGui/bug_480.py
deleted file mode 100644
index a7c863ba6..000000000
--- a/sources/pyside6/tests/QtGui/bug_480.py
+++ /dev/null
@@ -1,60 +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 import QtWidgets
-
-class BuggyWidget(QtWidgets.QWidget):
- def setup(self):
- self.verticalLayout = QtWidgets.QVBoxLayout(self)
- self.gridLayout = QtWidgets.QGridLayout()
- self.lbl = QtWidgets.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 = QtWidgets.QApplication([])
- w = BuggyWidget()
- w.setup()
- w.show()
- self.assertTrue(True)
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/sources/pyside6/tests/QtGui/bug_493.py b/sources/pyside6/tests/QtGui/bug_493.py
new file mode 100644
index 000000000..faf265755
--- /dev/null
+++ b/sources/pyside6/tests/QtGui/bug_493.py
@@ -0,0 +1,33 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+from __future__ import annotations
+
+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 QGuiApplication, QKeyEvent, QKeySequence
+
+
+class TestBug493(unittest.TestCase):
+
+ def testIt(self):
+ # We need a qapp otherwise Qt will crash when trying to detect the
+ # current platform
+ app = QGuiApplication([])
+ 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/QtGui/bug_606.py b/sources/pyside6/tests/QtGui/bug_606.py
index 918960612..332c207c6 100644
--- a/sources/pyside6/tests/QtGui/bug_606.py
+++ b/sources/pyside6/tests/QtGui/bug_606.py
@@ -1,30 +1,6 @@
-#############################################################################
-##
-## 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
+from __future__ import annotations
import os
import sys
@@ -35,27 +11,36 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
-import PySide6
-from PySide6.QtGui import QVector2D, QVector3D, QVector4D
+from PySide6.QtGui import QVector2D, QVector3D, QVector4D, qFuzzyCompare
from PySide6.QtGui import QColor
+
class testCases(unittest.TestCase):
def testQVector2DToTuple(self):
vec = QVector2D(1, 2)
self.assertEqual((1, 2), vec.toTuple())
+ self.assertTrue(qFuzzyCompare(vec, vec))
+ vec2 = QVector2D(1, 3)
+ self.assertFalse(qFuzzyCompare(vec, vec2))
def testQVector3DToTuple(self):
vec = QVector3D(1, 2, 3)
self.assertEqual((1, 2, 3), vec.toTuple())
+ vec2 = QVector3D(1, 3, 4)
+ self.assertFalse(qFuzzyCompare(vec, vec2))
def testQVector4DToTuple(self):
vec = QVector4D(1, 2, 3, 4)
self.assertEqual((1, 2, 3, 4), vec.toTuple())
+ self.assertTrue(qFuzzyCompare(vec, vec))
+ vec2 = QVector4D(1, 3, 4, 5)
+ self.assertFalse(qFuzzyCompare(vec, vec2))
def testQColorToTuple(self):
c = QColor(0, 0, 255)
c.setRgb(1, 2, 3)
self.assertEqual((1, 2, 3, 255), c.toTuple())
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/bug_617.py b/sources/pyside6/tests/QtGui/bug_617.py
index 008ab488f..fb793e6ee 100644
--- a/sources/pyside6/tests/QtGui/bug_617.py
+++ b/sources/pyside6/tests/QtGui/bug_617.py
@@ -1,30 +1,6 @@
-#############################################################################
-##
-## 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
+from __future__ import annotations
import os
import sys
@@ -52,7 +28,8 @@ class Bug617(unittest.TestCase):
def testOutOfBounds(self):
e = MyEvent()
- self.assertEqual(repr(e.type()), 'PySide6.QtCore.QEvent.Type(999)')
+ self.assertEqual(repr(e.type()), "<Type.999: 999>")
+
if __name__ == "__main__":
- unittest.main()
+ unittest.main()
diff --git a/sources/pyside6/tests/QtGui/bug_652.py b/sources/pyside6/tests/QtGui/bug_652.py
index 50aa7e7c7..77b5d5251 100644
--- a/sources/pyside6/tests/QtGui/bug_652.py
+++ b/sources/pyside6/tests/QtGui/bug_652.py
@@ -1,31 +1,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
+from __future__ import annotations
+import gc
import os
import sys
import unittest
@@ -35,16 +12,18 @@ 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 *
+from PySide6.QtGui import QTextBlockUserData, QTextCursor, QTextDocument
+
class MyData(QTextBlockUserData):
def __init__(self, data):
- QTextBlockUserData.__init__(self)
+ super().__init__()
self.data = data
def getMyNiceData(self):
return self.data
+
class TestBug652(unittest.TestCase):
"""Segfault when using QTextBlock::setUserData due to missing ownership transfer"""
def testIt(self):
@@ -57,10 +36,13 @@ class TestBug652(unittest.TestCase):
self.assertEqual(tc.block().userData().getMyNiceData(), heyHo)
del tc
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
tc = QTextCursor(td)
blk = tc.block()
self.assertEqual(type(blk.userData()), MyData)
self.assertEqual(blk.userData().getMyNiceData(), heyHo)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/bug_660.py b/sources/pyside6/tests/QtGui/bug_660.py
index 9fb2cd6db..e45b40596 100644
--- a/sources/pyside6/tests/QtGui/bug_660.py
+++ b/sources/pyside6/tests/QtGui/bug_660.py
@@ -1,30 +1,6 @@
-#############################################################################
-##
-## 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
+from __future__ import annotations
import os
import sys
@@ -37,26 +13,29 @@ init_test_paths(False)
from PySide6.QtGui import QStandardItemModel, QStandardItem
+
class MyItemModel(QStandardItemModel):
- def __init__(self,parent=None):
- super(MyItemModel,self).__init__(parent)
+ def __init__(self, parent=None):
+ super().__init__(parent)
self.appendRow([QStandardItem('Item 1'),])
def mimeTypes(self):
- mtypes = super(MyItemModel,self).mimeTypes()
+ mtypes = super(MyItemModel, self).mimeTypes()
mtypes.append('application/my-form')
return mtypes
- def mimeData(self,indexes):
- self.__mimedata = super(MyItemModel,self).mimeData(indexes)
- self.__mimedata.setData('application/my-form',bytes('hi', "UTF-8"))
+ def mimeData(self, indexes):
+ self.__mimedata = super(MyItemModel, self).mimeData(indexes)
+ self.__mimedata.setData('application/my-form', bytes('hi', "UTF-8"))
return self.__mimedata
+
class TestBug660(unittest.TestCase):
'''QMimeData type deleted prematurely when overriding mime-type in QStandardItemModel drag and drop'''
def testIt(self):
model = MyItemModel()
- model.mimeData([model.index(0, 0)]) # if it doesn't raise an exception it's all right!
+ model.mimeData([model.index(0, 0)]) # if it doesn't raise an exception it's all right!
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/bug_716.py b/sources/pyside6/tests/QtGui/bug_716.py
index cb30ff42e..fd5745078 100644
--- a/sources/pyside6/tests/QtGui/bug_716.py
+++ b/sources/pyside6/tests/QtGui/bug_716.py
@@ -1,30 +1,6 @@
-#############################################################################
-##
-## 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
+from __future__ import annotations
import os
import sys
diff --git a/sources/pyside6/tests/QtGui/bug_740.py b/sources/pyside6/tests/QtGui/bug_740.py
index 91aa23c86..c1b41c2ab 100644
--- a/sources/pyside6/tests/QtGui/bug_740.py
+++ b/sources/pyside6/tests/QtGui/bug_740.py
@@ -1,30 +1,6 @@
-#############################################################################
-##
-## 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
+from __future__ import annotations
import os
import sys
@@ -39,10 +15,12 @@ from helper.usesqapplication import UsesQApplication
from PySide6.QtCore import QSize
from PySide6.QtGui import QBitmap, QImage
+
class TestQBitmap(UsesQApplication):
def testFromDataMethod(self):
dataBits = bytes('\x38\x28\x38\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\xfe\xfe\x7c\x7c\x38\x38\x10\x10', "UTF-8")
- bim = QBitmap.fromData(QSize(8, 48), dataBits, QImage.Format_Mono) # missing function
+ bim = QBitmap.fromData(QSize(8, 48), dataBits, QImage.Format_Mono) # missing function
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/bug_743.py b/sources/pyside6/tests/QtGui/bug_743.py
index e74b32ba3..127981f1f 100644
--- a/sources/pyside6/tests/QtGui/bug_743.py
+++ b/sources/pyside6/tests/QtGui/bug_743.py
@@ -1,30 +1,6 @@
-#############################################################################
-##
-## 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
+from __future__ import annotations
import os
import sys
@@ -37,14 +13,16 @@ init_test_paths(False)
from PySide6.QtGui import QMatrix4x4
+
class TestQMatrix(unittest.TestCase):
def testOperator(self):
- m = QMatrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)
+ m = QMatrix4x4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)
v = 1
for x in range(4):
for y in range(4):
- self.assertEqual(m[x,y], v)
+ self.assertEqual(m[x, y], v)
v += 1
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/bug_785.py b/sources/pyside6/tests/QtGui/bug_785.py
new file mode 100644
index 000000000..a218398a9
--- /dev/null
+++ b/sources/pyside6/tests/QtGui/bug_785.py
@@ -0,0 +1,42 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+from __future__ import annotations
+
+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
+
+
+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/QtGui/bug_991.py b/sources/pyside6/tests/QtGui/bug_991.py
index 4738f4f04..2bac8f542 100644
--- a/sources/pyside6/tests/QtGui/bug_991.py
+++ b/sources/pyside6/tests/QtGui/bug_991.py
@@ -1,30 +1,6 @@
-#############################################################################
-##
-## 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
+from __future__ import annotations
import os
import sys
@@ -38,6 +14,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject
from PySide6.QtGui import QPen, QBrush
+
class TestBug991 (unittest.TestCase):
def testReprFunction(self):
reprPen = repr(QPen())
@@ -47,5 +24,6 @@ class TestBug991 (unittest.TestCase):
reprObject = repr(QObject())
self.assertTrue(reprObject.startswith("<PySide6.QtCore.QObject"))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/bug_PYSIDE-344.py b/sources/pyside6/tests/QtGui/bug_PYSIDE-344.py
index ce937c9a9..bd5ab4ba0 100644
--- a/sources/pyside6/tests/QtGui/bug_PYSIDE-344.py
+++ b/sources/pyside6/tests/QtGui/bug_PYSIDE-344.py
@@ -1,32 +1,7 @@
#!/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
+from __future__ import annotations
'''Test cases for PYSIDE-344, imul/idiv are used instead of mul/div, modifying the argument passed in'''
@@ -39,8 +14,10 @@ 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 *
-from PySide6.QtGui import *
+from PySide6.QtCore import QMargins, QPoint, QPointF, QSize, QSizeF
+from PySide6.QtGui import (QMatrix4x4, QQuaternion, QTransform, QVector2D,
+ QVector3D, QVector4D)
+
def testList():
return [QPoint(10, 10), QPointF(1, 1), QSize(10, 10), QSizeF(1, 1),
@@ -49,6 +26,7 @@ def testList():
QVector2D(1, 1), QVector3D(1, 1, 1), QVector4D(1, 1, 1, 1),
QQuaternion(1, 1, 1, 1)]
+
class TestMulDiv(unittest.TestCase):
def testMultiplication(self):
@@ -67,5 +45,6 @@ class TestMulDiv(unittest.TestCase):
fails += ' ' + type(a).__name__
self.assertEqual(fails, '')
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/bug_PYSIDE-41.py b/sources/pyside6/tests/QtGui/bug_PYSIDE-41.py
deleted file mode 100644
index fff11779d..000000000
--- a/sources/pyside6/tests/QtGui/bug_PYSIDE-41.py
+++ /dev/null
@@ -1,79 +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$
-##
-#############################################################################
-
-# TODO:
-# move this to QtCore -- QStringListModel is part of QtGui and there is no
-# simple model class appropriate for this test in QtCore.
-
-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 *
-from PySide6.QtGui import *
-
-
-class TestBugPYSIDE41(unittest.TestCase):
-
- def testIt(self):
-
- # list of single-character strings
- strings = list('abcdefghijklmnopqrstuvwxyz')
-
- model = QStringListModel(strings)
-
- # Test hashing of both QModelIndex and QPersistentModelIndex
- indexFunctions = []
- indexFunctions.append(model.index)
- indexFunctions.append(lambda i: QPersistentModelIndex(model.index(i)))
-
- for indexFunction in indexFunctions:
-
- # If two objects compare equal, their hashes MUST also be equal. (The
- # reverse is not a requirement.)
- for i, _ in enumerate(strings):
- index1 = indexFunction(i)
- index2 = indexFunction(i)
- self.assertEqual(index1, index2)
- self.assertEqual(hash(index1), hash(index2))
-
- # Adding the full set of indexes to itself is a no-op.
- allIndexes1 = set(indexFunction(i) for i, _ in enumerate(strings))
- allIndexes2 = set(indexFunction(i) for i, _ in enumerate(strings))
- allIndexesCombined = allIndexes1 & allIndexes2
- self.assertEqual(allIndexes1, allIndexesCombined)
- self.assertEqual(allIndexes2, allIndexesCombined)
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside6/tests/QtGui/deepcopy_test.py b/sources/pyside6/tests/QtGui/deepcopy_test.py
index e1f0240b0..b53b34ade 100644
--- a/sources/pyside6/tests/QtGui/deepcopy_test.py
+++ b/sources/pyside6/tests/QtGui/deepcopy_test.py
@@ -1,30 +1,6 @@
-#############################################################################
-##
-## 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
+from __future__ import annotations
from copy import deepcopy
import os
@@ -44,12 +20,14 @@ from PySide6.QtGui import QVector2D, QVector3D, QVector4D
from PySide6.QtGui import QColor, QTransform, QKeySequence, QQuaternion
from PySide6.QtGui import QPolygon
+
class DeepCopyHelper:
def testCopy(self):
copy = deepcopy([self.original])[0]
self.assertTrue(copy is not self.original)
self.assertEqual(copy, self.original)
+
class DeepCopyColorHelperF:
def testCopy(self):
copy = deepcopy([self.original])[0]
@@ -63,46 +41,57 @@ class QColorDeepCopy(DeepCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QColor("red")
+
class QColorRGBDeepCopy(DeepCopyColorHelperF, unittest.TestCase):
def setUp(self):
self.original = QColor.fromRgbF(0.2, 0.3, 0.4, 0.5)
+
class QColorHSLDeepCopy(DeepCopyColorHelperF, unittest.TestCase):
def setUp(self):
self.original = QColor.fromHslF(0.2, 0.3, 0.4, 0.5)
+
class QColorHSVDeepCopy(DeepCopyColorHelperF, unittest.TestCase):
def setUp(self):
self.original = QColor.fromHsvF(0.2, 0.3, 0.4, 0.5)
+
class QColorCMYKDeepCopy(DeepCopyColorHelperF, unittest.TestCase):
def setUp(self):
self.original = QColor.fromCmykF(0.2, 0.3, 0.4, 0.5, 0.6)
+
class QTransformDeepCopy(DeepCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QTransform(1, 2, 3, 4, 5, 6, 7, 8, 9)
+
class QKeySequenceDeepCopy(DeepCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QKeySequence("Ctrl+P")
+
class QQuaternionDeepCopy(DeepCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QQuaternion(1, 2, 3, 4)
+
class QVector2DDeepCopy(DeepCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QVector2D(1, 2)
+
class QVector3DDeepCopy(DeepCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QVector3D(1, 2, 3)
+
class QVector4DDeepCopy(DeepCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QVector4D(1, 2, 3, 4)
+
class QPolygonDeepCopy(DeepCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QPolygon([QPoint(1, 2), QPoint(3, 4), QPoint(5, 6)])
diff --git a/sources/pyside6/tests/QtGui/event_filter_test.py b/sources/pyside6/tests/QtGui/event_filter_test.py
new file mode 100644
index 000000000..ff894dbd0
--- /dev/null
+++ b/sources/pyside6/tests/QtGui/event_filter_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
+from __future__ import annotations
+
+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.QtGui import QWindow
+
+
+class MyFilter(QObject):
+ def eventFilter(self, obj, event):
+ if event.type() == QEvent.KeyPress:
+ pass
+ return QObject.eventFilter(self, obj, event)
+
+
+class EventFilter(UsesQApplication):
+ @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
+ 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 = QWindow()
+ 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/QtGui/float_to_int_implicit_conversion_test.py b/sources/pyside6/tests/QtGui/float_to_int_implicit_conversion_test.py
index 2537bc5b2..e26d43254 100644
--- a/sources/pyside6/tests/QtGui/float_to_int_implicit_conversion_test.py
+++ b/sources/pyside6/tests/QtGui/float_to_int_implicit_conversion_test.py
@@ -1,33 +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
+from __future__ import annotations
'''Test cases for QImage'''
+import gc
import os
import sys
import unittest
@@ -41,23 +18,26 @@ from PySide6.QtGui import QImage, qRgb
from helper.usesqapplication import UsesQApplication
+
class SetPixelFloat(UsesQApplication):
'''Test case for calling setPixel with float as argument'''
def setUp(self):
- #Acquire resources
+ # Acquire resources
super(SetPixelFloat, self).setUp()
self.color = qRgb(255, 0, 0)
self.image = QImage(200, 200, QImage.Format_RGB32)
def tearDown(self):
- #Release resources
+ # Release resources
del self.color
del self.image
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(SetPixelFloat, self).tearDown()
def testFloat(self):
- #QImage.setPixel(float, float, color) - Implicit conversion
+ # QImage.setPixel(float, float, color) - Implicit conversion
self.image.setPixel(3.14, 4.2, self.color)
self.assertEqual(self.image.pixel(3.14, 4.2), self.color)
diff --git a/sources/pyside6/tests/QtGui/pyside_reload_test.py b/sources/pyside6/tests/QtGui/pyside_reload_test.py
index 87d311596..1045dd5be 100644
--- a/sources/pyside6/tests/QtGui/pyside_reload_test.py
+++ b/sources/pyside6/tests/QtGui/pyside_reload_test.py
@@ -1,30 +1,6 @@
-#############################################################################
-##
-## 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
+from __future__ import annotations
import importlib
import importlib.util
@@ -46,6 +22,7 @@ dst = os.path.join(workdir, 'test_module.py')
shutil.copyfile(src, dst)
sys.path.append(workdir)
+
def reload_module(moduleName):
importlib.reload(moduleName)
@@ -60,6 +37,7 @@ def increment_module_value():
cacheFile = importlib.util.cache_from_source(dst)
os.remove(cacheFile)
+
class TestModuleReloading(unittest.TestCase):
def testModuleReloading(self):
@@ -79,6 +57,7 @@ class TestModuleReloading(unittest.TestCase):
reload_module(sys.modules['test_module'])
self.assertEqual(test_module.Sentinel.value, 12)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qbrush_test.py b/sources/pyside6/tests/QtGui/qbrush_test.py
new file mode 100644
index 000000000..997ffc152
--- /dev/null
+++ b/sources/pyside6/tests/QtGui/qbrush_test.py
@@ -0,0 +1,44 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+from __future__ import annotations
+
+'''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, QConicalGradient
+
+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)
+
+ def testGradient(self):
+ """Test type discovery on class hierarchies with non-virtual
+ destructors by specifying a polymorphic-id-expression without
+ polymorphic-name-function."""
+ gradient = QConicalGradient()
+ brush = QBrush(gradient)
+ self.assertEqual(type(brush.gradient()), type(gradient))
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qcolor_reduce_test.py b/sources/pyside6/tests/QtGui/qcolor_reduce_test.py
index ce855dba1..a99ad6458 100644
--- a/sources/pyside6/tests/QtGui/qcolor_reduce_test.py
+++ b/sources/pyside6/tests/QtGui/qcolor_reduce_test.py
@@ -1,30 +1,6 @@
-#############################################################################
-##
-## 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
+from __future__ import annotations
import os
import pickle
@@ -38,6 +14,7 @@ init_test_paths(False)
from PySide6.QtGui import QColor
+
class TestQColor (unittest.TestCase):
def reduceColor(self, c):
p = pickle.dumps(c)
@@ -63,5 +40,6 @@ class TestQColor (unittest.TestCase):
def testReduceHsv(self):
self.reduceColor(QColor.fromHsvF(0.1, 0.2, 0.3, 0.4))
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qcolor_test.py b/sources/pyside6/tests/QtGui/qcolor_test.py
index 6eaaa94a9..d98fcc9b4 100644
--- a/sources/pyside6/tests/QtGui/qcolor_test.py
+++ b/sources/pyside6/tests/QtGui/qcolor_test.py
@@ -1,32 +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
+from __future__ import annotations
import colorsys
+import gc
import os
import sys
import unittest
@@ -50,22 +27,22 @@ class QColorGetTest(unittest.TestCase):
self.assertEqual(self.color.getRgb(), (20, 40, 60, 80))
def testGetHslF(self):
- hls = colorsys.rgb_to_hls(20.0/255, 40.0/255, 60.0/255)
+ hls = colorsys.rgb_to_hls(20.0 / 255, 40.0 / 255, 60.0 / 255)
hsla = hls[0], hls[2], hls[1], self.color.alphaF()
- for x, y in zip(self.color.getHslF(), hsla): # Due to rounding problems
- self.assertTrue(x - y < 1/100000.0)
+ for x, y in zip(self.color.getHslF(), hsla): # Due to rounding problems
+ self.assertTrue(x - y < 1 / 100000.0)
def testGetHsv(self):
- hsv = colorsys.rgb_to_hsv(20.0/255, 40.0/255, 60.0/255)
- hsva = int(hsv[0]*360.0), int(hsv[1]*255), int(hsv[2]*256), self.color.alpha()
+ hsv = colorsys.rgb_to_hsv(20.0 / 255, 40.0 / 255, 60.0 / 255)
+ hsva = int(hsv[0] * 360.0), int(hsv[1] * 255), int(hsv[2] * 256), self.color.alpha()
self.assertEqual(self.color.getHsv(), hsva)
- def testGetCmyk(self): # not supported by colorsys
+ def testGetCmyk(self): # not supported by colorsys
self.assertEqual(self.color.getCmyk(), (170, 85, 0, 195, 80))
- def testGetCmykF(self): # not supported by colorsys
- for x, y in zip(self.color.getCmykF(), (170/255.0, 85/255.0, 0, 195/255.0, 80/255.0)):
- self.assertTrue(x - y < 1/10000.0)
+ def testGetCmykF(self): # not supported by colorsys
+ for x, y in zip(self.color.getCmykF(), (170 / 255.0, 85 / 255.0, 0, 195 / 255.0, 80 / 255.0)):
+ self.assertTrue(x - y < 1 / 10000.0)
class QColorQRgbConstructor(unittest.TestCase):
@@ -76,7 +53,7 @@ class QColorQRgbConstructor(unittest.TestCase):
def testBasic(self):
'''QColor(QRgb)'''
color = QColor(255, 0, 0)
- #QRgb format #AARRGGBB
+ # QRgb format #AARRGGBB
rgb = 0x00FF0000
self.assertEqual(QColor(rgb), color)
@@ -101,6 +78,8 @@ class QColorCopy(unittest.TestCase):
self.assertTrue(original is not copy)
self.assertEqual(original, copy)
del original
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertEqual(copy, QColor(0, 0, 255))
def testEmptyCopy(self):
@@ -111,6 +90,8 @@ class QColorCopy(unittest.TestCase):
self.assertTrue(original is not copy)
self.assertEqual(original, copy)
del original
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertEqual(copy, QColor())
@@ -126,5 +107,6 @@ class QColorRepr(unittest.TestCase):
c2 = eval(c.__str__())
self.assertEqual(c, c2)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qcursor_test.py b/sources/pyside6/tests/QtGui/qcursor_test.py
index fcab714a9..80964efb8 100644
--- a/sources/pyside6/tests/QtGui/qcursor_test.py
+++ b/sources/pyside6/tests/QtGui/qcursor_test.py
@@ -1,30 +1,6 @@
-#############################################################################
-##
-## 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
+from __future__ import annotations
'''Test for Bug 630 - Fails to resolve overload for QCursor(QBitmap, QBitmap, int, int)
http://bugs.openbossa.org/show_bug.cgi?id=630
@@ -42,11 +18,13 @@ init_test_paths(False)
from PySide6.QtGui import QBitmap, QCursor, QPixmap
from helper.usesqapplication import UsesQApplication
+
class TestQCursor(UsesQApplication):
def testQCursorConstructor(self):
bmp = QBitmap(16, 16)
cursor = QCursor(bmp, bmp, 16, 16)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qdatastream_gui_operators_test.py b/sources/pyside6/tests/QtGui/qdatastream_gui_operators_test.py
index 580d962c3..8de7160e9 100644
--- a/sources/pyside6/tests/QtGui/qdatastream_gui_operators_test.py
+++ b/sources/pyside6/tests/QtGui/qdatastream_gui_operators_test.py
@@ -1,32 +1,6 @@
-# -*- 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
+from __future__ import annotations
import os
import sys
@@ -42,13 +16,16 @@ from PySide6.QtGui import QPixmap, QColor
from helper.usesqapplication import UsesQApplication
+
class QPixmapQDatastream(UsesQApplication):
'''QDataStream <<>> QPixmap'''
def setUp(self):
super(QPixmapQDatastream, self).setUp()
self.source_pixmap = QPixmap(100, 100)
- self.source_pixmap.fill(Qt.red)
+ # PYSIDE-1533: Use Qt.transparent to force Format_ARGB32_Premultiplied
+ # when converting to QImage in any case.
+ self.source_pixmap.fill(Qt.transparent)
self.output_pixmap = QPixmap()
self.buffer = QByteArray()
self.read_stream = QDataStream(self.buffer, QIODevice.ReadOnly)
@@ -60,9 +37,9 @@ class QPixmapQDatastream(UsesQApplication):
self.read_stream >> self.output_pixmap
image = self.output_pixmap.toImage()
- pixel = image.pixel(10,10)
- self.assertEqual(pixel, QColor(Qt.red).rgba())
- self.assertEqual(self.source_pixmap.toImage(), self.output_pixmap.toImage())
+ pixel = image.pixel(10, 10)
+ self.assertEqual(pixel, QColor(Qt.transparent).rgba())
+ self.assertEqual(self.source_pixmap.toImage(), image)
if __name__ == '__main__':
diff --git a/sources/pyside6/tests/QtGui/qdesktopservices_test.py b/sources/pyside6/tests/QtGui/qdesktopservices_test.py
index fb635e142..668a16a80 100644
--- a/sources/pyside6/tests/QtGui/qdesktopservices_test.py
+++ b/sources/pyside6/tests/QtGui/qdesktopservices_test.py
@@ -1,30 +1,6 @@
-#############################################################################
-##
-## 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
+from __future__ import annotations
'''Unit tests for QDesktopServices'''
@@ -40,11 +16,13 @@ init_test_paths(False)
from PySide6.QtGui import QDesktopServices
from PySide6.QtCore import QUrl
+
class QDesktopServicesTest(unittest.TestCase):
def testOpenUrl(self):
# At the bare minimum check that they return false for invalid url's
url = QUrl()
self.assertEqual(QDesktopServices.openUrl(url), False)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qfont_test.py b/sources/pyside6/tests/QtGui/qfont_test.py
new file mode 100644
index 000000000..1971cc555
--- /dev/null
+++ b/sources/pyside6/tests/QtGui/qfont_test.py
@@ -0,0 +1,36 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+from __future__ import annotations
+
+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 QFont
+from helper.usesqapplication import UsesQApplication
+
+
+class QFontTest(UsesQApplication):
+
+ def testStringConstruction(self):
+ """PYSIDE-1685: Test that passing str to QFont works after addding
+ QFont(QStringList) by qtbase/d8602ce58b6ef268be84b9aa0166b0c3fa6a96e8"""
+ font_name = 'Times Roman'
+ font = QFont(font_name)
+ families = font.families()
+ self.assertEqual(len(families), 1)
+ self.assertEqual(families[0], font_name)
+
+ font = QFont([font_name])
+ families = font.families()
+ self.assertEqual(len(families), 1)
+ self.assertEqual(families[0], font_name)
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qfontmetrics_test.py b/sources/pyside6/tests/QtGui/qfontmetrics_test.py
index 44ae75a0d..257a3dae3 100644
--- a/sources/pyside6/tests/QtGui/qfontmetrics_test.py
+++ b/sources/pyside6/tests/QtGui/qfontmetrics_test.py
@@ -1,34 +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
+from __future__ import annotations
'''Tests for inject codes and modifications on QFontMetrics
and QFontMetricsF'''
+import gc
import os
import sys
import unittest
@@ -54,6 +31,8 @@ class QFontMetricsTest(UsesQApplication):
def tearDown(self):
del self.metrics
del self.font
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(QFontMetricsTest, self).tearDown()
@@ -113,8 +92,8 @@ class BoundingRectTest(QFontMetricsTest):
'''QFontMetrics.boundingRect(QRect, ...) - type error'''
arg = QRect(0, 0, 100, 200)
self.assertRaises(TypeError, self.metrics.boundingRect, arg,
- Qt.TextExpandTabs | Qt.AlignLeft,
- 'PySide by INdT', 20, ['aaaa', 'ase'])
+ Qt.TextExpandTabs | Qt.AlignLeft,
+ 'PySide by INdT', 20, ['aaaa', 'ase'])
class SizeTest(QFontMetricsTest):
@@ -156,6 +135,8 @@ class QFontMetricsFTest(UsesQApplication):
def tearDown(self):
del self.metrics
del self.font
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(QFontMetricsFTest, self).tearDown()
@@ -216,8 +197,8 @@ class FSizeTest(QFontMetricsFTest):
def testTypeError(self):
'''QFontMetricsF.size - type error'''
self.assertRaises(TypeError, self.metrics.size,
- Qt.TextExpandTabs | Qt.AlignLeft,
- 'PySide by INdT', 20, ['aaaa', 'ase'])
+ Qt.TextExpandTabs | Qt.AlignLeft,
+ 'PySide by INdT', 20, ['aaaa', 'ase'])
class QCharTest(QFontMetricsFTest):
@@ -230,5 +211,6 @@ class QCharTest(QFontMetricsFTest):
retCh = self.metrics.horizontalAdvance('a')
self.assertTrue(retCh > 0)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qguiapplication_test.py b/sources/pyside6/tests/QtGui/qguiapplication_test.py
index 35b9574ea..4112cd695 100644
--- a/sources/pyside6/tests/QtGui/qguiapplication_test.py
+++ b/sources/pyside6/tests/QtGui/qguiapplication_test.py
@@ -1,30 +1,6 @@
-#############################################################################
-##
-## 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
+from __future__ import annotations
import os
import sys
@@ -37,6 +13,7 @@ init_test_paths(False)
from PySide6.QtGui import QGuiApplication
+
class TestQGuiApplication(unittest.TestCase):
def testNoArguments(self):
app = QGuiApplication()
diff --git a/sources/pyside6/tests/QtGui/qicon_test.py b/sources/pyside6/tests/QtGui/qicon_test.py
index 24378b844..ac83ee297 100644
--- a/sources/pyside6/tests/QtGui/qicon_test.py
+++ b/sources/pyside6/tests/QtGui/qicon_test.py
@@ -1,30 +1,6 @@
-#############################################################################
-##
-## 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
+from __future__ import annotations
import os
import sys
@@ -35,17 +11,39 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
-from helper.timedqapplication import TimedQApplication
+from helper.timedqguiapplication import TimedQGuiApplication
from PySide6.QtGui import QIcon
-class QIconCtorWithNoneTest(TimedQApplication):
+class QIconCtorWithNoneTest(TimedQGuiApplication):
'''Test made by seblin, see Bug #944: http://bugs.pyside.org/show_bug.cgi?id=944'''
def testQIconCtorWithNone(self):
icon = QIcon(None)
pixmap = icon.pixmap(48, 48)
- self.app.exec_()
+ self.app.exec()
+
+
+PIX_PATH = os.fspath(Path(__file__).resolve().parents[2]
+ / "doc/tutorials/basictutorial/icons.png")
+
+
+class QIconAddPixmapTest(TimedQGuiApplication):
+ '''PYSIDE-1669: check that addPixmap works'''
+
+ def testQIconSetPixmap(self):
+ icon = QIcon()
+ icon.addPixmap(PIX_PATH)
+ sizes = icon.availableSizes()
+ self.assertTrue(sizes)
+
+ def testQIconSetPixmapPathlike(self):
+ icon = QIcon()
+ pix_path = Path(PIX_PATH)
+ icon.addPixmap(pix_path)
+ sizes = icon.availableSizes()
+ self.assertTrue(sizes)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qimage_test.py b/sources/pyside6/tests/QtGui/qimage_test.py
new file mode 100644
index 000000000..c87cfcf4b
--- /dev/null
+++ b/sources/pyside6/tests/QtGui/qimage_test.py
@@ -0,0 +1,57 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+from __future__ import annotations
+
+'''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 helper.usesqapplication import UsesQApplication
+from xpm_data import xpm
+
+
+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())
+ img1.setColorSpace(img0.colorSpace())
+ self.assertEqual(img0, img1)
+ img2 = QImage(img0.bits(), img0.width(), img0.height(), img0.bytesPerLine(), img0.format())
+ img2.setColorSpace(img0.colorSpace())
+ 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):
+ 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/QtGui/qimage_win_test.py b/sources/pyside6/tests/QtGui/qimage_win_test.py
new file mode 100644
index 000000000..f8ceb4aa9
--- /dev/null
+++ b/sources/pyside6/tests/QtGui/qimage_win_test.py
@@ -0,0 +1,42 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+from __future__ import annotations
+
+'''Test cases for QImage/Windows'''
+
+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 QImage
+from helper.usesqapplication import UsesQApplication
+
+
+def create_image():
+ result = QImage(20, 20, QImage.Format_RGB32)
+ result.fill(Qt.white)
+ return result
+
+
+class QImageWinTest(UsesQApplication):
+
+ def test_to_hbitmap(self):
+ """Test conversion to/from a Windows HBITMAP."""
+
+ image = create_image()
+ hbitmap = image.toHBITMAP()
+ self.assertTrue(hbitmap > 0)
+
+ image2 = QImage.fromHBITMAP(hbitmap)
+ image2.setColorSpace(image.colorSpace())
+ self.assertEqual(image, image2)
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qitemselection_test.py b/sources/pyside6/tests/QtGui/qitemselection_test.py
index 157c1bacb..26fd76ad8 100644
--- a/sources/pyside6/tests/QtGui/qitemselection_test.py
+++ b/sources/pyside6/tests/QtGui/qitemselection_test.py
@@ -1,30 +1,6 @@
-#############################################################################
-##
-## 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
+from __future__ import annotations
import os
import sys
@@ -39,6 +15,7 @@ from helper.usesqapplication import UsesQApplication
from PySide6.QtCore import QItemSelection
from PySide6.QtGui import QStandardItemModel
+
class QItemSelectionTest(UsesQApplication):
def testLen(self):
model = QStandardItemModel(2, 2)
@@ -46,9 +23,10 @@ class QItemSelectionTest(UsesQApplication):
model.insertRow(1)
model.insertColumn(0)
model.insertColumn(1)
- selection = QItemSelection(model.index(0,0), model.index(1,1))
+ selection = QItemSelection(model.index(0, 0), model.index(1, 1))
self.assertEqual(len(selection), 1)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qkeysequence_test.py b/sources/pyside6/tests/QtGui/qkeysequence_test.py
index 896447740..a6f3188d4 100644
--- a/sources/pyside6/tests/QtGui/qkeysequence_test.py
+++ b/sources/pyside6/tests/QtGui/qkeysequence_test.py
@@ -1,30 +1,6 @@
-#############################################################################
-##
-## 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
+from __future__ import annotations
import os
import sys
@@ -36,19 +12,25 @@ from init_paths import init_test_paths
init_test_paths(False)
from PySide6.QtCore import Qt
-from PySide6.QtGui import QKeySequence
+from PySide6.QtGui import QKeySequence, qt_set_sequence_auto_mnemonic
from helper.usesqapplication import UsesQApplication
+
class QKeySequenceTest(UsesQApplication):
def testGetItemOperator(self):
# bug #774
- ks = QKeySequence(Qt.SHIFT, Qt.CTRL, Qt.Key_P, Qt.Key_R)
- self.assertEqual(ks[0], Qt.SHIFT)
- self.assertEqual(ks[1], Qt.CTRL)
- self.assertEqual(ks[2], Qt.Key_P)
- self.assertEqual(ks[3], Qt.Key_R)
+ # PYSIDE-1735: Remapped from Qt.Modifier to Qt.KeyboardModifier
+ # Note that Qt.(Keyboard)?Modifier will be no longer IntFlag.
+ ks = QKeySequence(Qt.ShiftModifier, Qt.ControlModifier, Qt.Key_P, Qt.Key_R)
+ self.assertEqual(ks[0].keyboardModifiers(), Qt.ShiftModifier)
+ self.assertEqual(ks[1].keyboardModifiers(), Qt.ControlModifier)
+ self.assertEqual(ks[2].key(), Qt.Key_P)
+ self.assertEqual(ks[3].key(), Qt.Key_R)
+
+ def testAutoMnemonic(self):
+ qt_set_sequence_auto_mnemonic(True)
if __name__ == '__main__':
diff --git a/sources/pyside6/tests/QtGui/qpainter_test.py b/sources/pyside6/tests/QtGui/qpainter_test.py
index 3efb6df8b..e03bcfa63 100644
--- a/sources/pyside6/tests/QtGui/qpainter_test.py
+++ b/sources/pyside6/tests/QtGui/qpainter_test.py
@@ -1,31 +1,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
+from __future__ import annotations
+import gc
import os
import sys
import unittest
@@ -35,18 +12,32 @@ 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 QPainter, QLinearGradient
+from helper.usesqapplication import UsesQApplication
+from PySide6.QtGui import QPainter, QLinearGradient, QImage
from PySide6.QtCore import QLine, QLineF, QPoint, QPointF, QRect, QRectF, Qt
-class QPainterDrawText(unittest.TestCase):
+try:
+ import numpy as np
+ HAVE_NUMPY = True
+except ModuleNotFoundError:
+ HAVE_NUMPY = False
+
+
+class QPainterDrawText(UsesQApplication):
def setUp(self):
- self.painter = QPainter()
+ super(QPainterDrawText, self).setUp()
+ self.image = QImage(32, 32, QImage.Format_ARGB32)
+ self.painter = QPainter(self.image)
self.text = 'teste!'
def tearDown(self):
del self.text
+ self.painter.end()
del self.painter
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
+ super(QPainterDrawText, self).tearDown()
def testDrawText(self):
# bug #254
@@ -74,12 +65,12 @@ class QPainterDrawText(unittest.TestCase):
def testDrawOverloads(self):
'''Calls QPainter.drawLines overloads, if something is
wrong Exception and chaos ensues. Bug #395'''
- self.painter.drawLines([QLine(QPoint(0,0), QPoint(1,1))])
- self.painter.drawLines([QPoint(0,0), QPoint(1,1)])
- self.painter.drawLines([QPointF(0,0), QPointF(1,1)])
- self.painter.drawLines([QLineF(QPointF(0,0), QPointF(1,1))])
- self.painter.drawPoints([QPoint(0,0), QPoint(1,1)])
- self.painter.drawPoints([QPointF(0,0), QPointF(1,1)])
+ self.painter.drawLines([QLine(QPoint(0, 0), QPoint(1, 1))])
+ self.painter.drawLines([QPoint(0, 0), QPoint(1, 1)])
+ self.painter.drawLines([QPointF(0, 0), QPointF(1, 1)])
+ self.painter.drawLines([QLineF(QPointF(0, 0), QPointF(1, 1))])
+ self.painter.drawPoints([QPoint(0, 0), QPoint(1, 1)])
+ self.painter.drawPoints([QPointF(0, 0), QPointF(1, 1)])
self.painter.drawConvexPolygon([QPointF(10.0, 80.0),
QPointF(20.0, 10.0),
QPointF(80.0, 30.0),
@@ -104,14 +95,21 @@ class QPainterDrawText(unittest.TestCase):
QPoint(20.0, 10.0),
QPoint(80.0, 30.0),
QPoint(90.0, 70.0)])
+ if HAVE_NUMPY:
+ x = np.array([10.0, 20.0, 80.0, 90.0])
+ y = np.array([80.0, 10.0, 30.0, 70.0])
+ self.painter.drawPointsNp(x, y)
-class SetBrushWithOtherArgs(unittest.TestCase):
+
+class SetBrushWithOtherArgs(UsesQApplication):
'''Using qpainter.setBrush with args other than QBrush'''
def testSetBrushGradient(self):
- painter = QPainter()
- gradient = QLinearGradient(0, 0, 0, 0)
- painter.setBrush(gradient)
+ image = QImage(32, 32, QImage.Format_ARGB32)
+ with QPainter(image) as painter:
+ gradient = QLinearGradient(0, 0, 0, 0)
+ painter.setBrush(gradient)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qpdfwriter_test.py b/sources/pyside6/tests/QtGui/qpdfwriter_test.py
index a58b9242e..1379f8e80 100644
--- a/sources/pyside6/tests/QtGui/qpdfwriter_test.py
+++ b/sources/pyside6/tests/QtGui/qpdfwriter_test.py
@@ -1,30 +1,6 @@
-#############################################################################
-##
-## 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
+from __future__ import annotations
import os
import sys
@@ -39,6 +15,7 @@ from helper.usesqapplication import UsesQApplication
from PySide6.QtGui import QPageLayout, QPageSize, QPdfWriter, QTextDocument
from PySide6.QtCore import QDir, QMarginsF, QTemporaryFile
+
class QPdfWriterTest(UsesQApplication):
def testWrite(self):
@@ -51,5 +28,6 @@ class QPdfWriterTest(UsesQApplication):
temporaryFile.close()
self.assertTrue(temporaryFile.size() > 0)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qpen_test.py b/sources/pyside6/tests/QtGui/qpen_test.py
new file mode 100644
index 000000000..2f4d48e16
--- /dev/null
+++ b/sources/pyside6/tests/QtGui/qpen_test.py
@@ -0,0 +1,58 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+from __future__ import annotations
+
+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, QRasterWindow
+
+
+class Painting(QRasterWindow):
+ def __init__(self):
+ super().__init__()
+ self.penFromEnum = None
+ self.penFromInteger = None
+
+ def paintEvent(self, event):
+ with QPainter(self) as painter:
+ painter.setPen(Qt.NoPen)
+ self.penFromEnum = painter.pen()
+ intVal = Qt.NoPen.value
+ painter.setPen(intVal)
+ self.penFromInteger = painter.pen()
+ QTimer.singleShot(20, self.close)
+
+
+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()
+ w.setTitle("qpen_test")
+ 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/QtGui/qpixelformat_test.py b/sources/pyside6/tests/QtGui/qpixelformat_test.py
index 30241f50d..32d34a577 100644
--- a/sources/pyside6/tests/QtGui/qpixelformat_test.py
+++ b/sources/pyside6/tests/QtGui/qpixelformat_test.py
@@ -1,30 +1,6 @@
-#############################################################################
-##
-## 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
+from __future__ import annotations
'''Unit test for QPixelFormat'''
@@ -39,7 +15,8 @@ init_test_paths(False)
from helper.usesqapplication import UsesQApplication
from PySide6.QtCore import QSize, Qt
-from PySide6.QtGui import QColor, QImage, QPixelFormat
+from PySide6.QtGui import QColor, QImage, QPixelFormat, qPixelFormatRgba
+
class QPixelFormatTest(UsesQApplication):
def test(self):
@@ -53,5 +30,12 @@ class QPixelFormatTest(UsesQApplication):
self.assertEqual(pixelFormat.blueSize(), 8)
self.assertEqual(pixelFormat.bitsPerPixel(), 32)
+ def testHelpers(self):
+ format = qPixelFormatRgba(8, 8, 8, 8, QPixelFormat.UsesAlpha,
+ QPixelFormat.AtBeginning, QPixelFormat.Premultiplied,
+ QPixelFormat.UnsignedByte)
+ self.assertEqual(format.redSize(), 8)
+
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qpixmap_constructor.py b/sources/pyside6/tests/QtGui/qpixmap_constructor.py
new file mode 100644
index 000000000..e78774eec
--- /dev/null
+++ b/sources/pyside6/tests/QtGui/qpixmap_constructor.py
@@ -0,0 +1,261 @@
+#!/usr/bin/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
+from __future__ import annotations
+
+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 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):
+ 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/QtGui/qpixmap_test.py b/sources/pyside6/tests/QtGui/qpixmap_test.py
index 496bed5dc..b83831ba9 100644
--- a/sources/pyside6/tests/QtGui/qpixmap_test.py
+++ b/sources/pyside6/tests/QtGui/qpixmap_test.py
@@ -1,30 +1,6 @@
-#############################################################################
-##
-## 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
+from __future__ import annotations
import os
import sys
@@ -36,8 +12,9 @@ from init_paths import init_test_paths
init_test_paths(False)
from helper.usesqapplication import UsesQApplication
-from PySide6.QtGui import *
-from PySide6.QtCore import *
+from PySide6.QtGui import QColor, QPixmap
+from PySide6.QtCore import QFile, QIODevice, QObject, QSize, Qt
+
class QPixmapTest(UsesQApplication):
def testQVariantConstructor(self):
@@ -47,7 +24,7 @@ class QPixmapTest(UsesQApplication):
self.assertEqual(type(obj.property('foo')), QPixmap)
def testQSizeConstructor(self):
- pixmap = QPixmap(QSize(10,20))
+ pixmap = QPixmap(QSize(10, 20))
self.assertTrue(pixmap.size().height(), 20)
def testQStringConstructor(self):
@@ -62,7 +39,7 @@ class QPixmapTest(UsesQApplication):
self.assertTrue(pixmap.loadFromData(data))
def testQPixmapLoadFromDataWithPython(self):
- data = open(os.path.join(os.path.dirname(__file__),'sample.png'),'rb').read()
+ data = open(os.path.join(os.path.dirname(__file__), 'sample.png'), 'rb').read()
pixmap = QPixmap()
self.assertTrue(pixmap.loadFromData(data))
@@ -72,7 +49,7 @@ class QPixmapToImage(UsesQApplication):
def testFilledImage(self):
'''QPixmap.fill + toImage + image.pixel'''
pixmap = QPixmap(100, 200)
- pixmap.fill(Qt.red) # Default Qt.white
+ pixmap.fill(Qt.red) # Default Qt.white
self.assertEqual(pixmap.height(), 200)
self.assertEqual(pixmap.width(), 100)
@@ -82,7 +59,7 @@ class QPixmapToImage(UsesQApplication):
self.assertEqual(image.height(), 200)
self.assertEqual(image.width(), 100)
- pixel = image.pixel(10,10)
+ pixel = image.pixel(10, 10)
self.assertEqual(pixel, QColor(Qt.red).rgba())
diff --git a/sources/pyside6/tests/QtGui/qpixmapcache_test.py b/sources/pyside6/tests/QtGui/qpixmapcache_test.py
index 3b45b1b91..b9328bc05 100644
--- a/sources/pyside6/tests/QtGui/qpixmapcache_test.py
+++ b/sources/pyside6/tests/QtGui/qpixmapcache_test.py
@@ -1,30 +1,6 @@
-#############################################################################
-##
-## 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
+from __future__ import annotations
import os
import sys
@@ -75,6 +51,7 @@ class QPixmapCacheTest(UsesQApplication):
self.assertEqual(QPixmapCache.find(key).toImage().bits(), pm3.toImage().bits())
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qpolygonf_test.py b/sources/pyside6/tests/QtGui/qpolygonf_test.py
index 8a888d08a..ea5a73db8 100644
--- a/sources/pyside6/tests/QtGui/qpolygonf_test.py
+++ b/sources/pyside6/tests/QtGui/qpolygonf_test.py
@@ -1,30 +1,6 @@
-#############################################################################
-##
-## 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
+from __future__ import annotations
import os
import sys
diff --git a/sources/pyside6/tests/QtGui/qradialgradient_test.py b/sources/pyside6/tests/QtGui/qradialgradient_test.py
index 61a9fc3ef..5c48cf3eb 100644
--- a/sources/pyside6/tests/QtGui/qradialgradient_test.py
+++ b/sources/pyside6/tests/QtGui/qradialgradient_test.py
@@ -1,30 +1,6 @@
-#############################################################################
-##
-## 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
+from __future__ import annotations
import os
import sys
@@ -38,6 +14,7 @@ init_test_paths(False)
from PySide6.QtGui import QRadialGradient
from PySide6.QtCore import QPointF
+
class QRadialGradientConstructor(unittest.TestCase):
def _compare(self, qptf, tpl):
self.assertEqual((qptf.x(), qptf.y()), tpl)
@@ -60,5 +37,6 @@ class QRadialGradientConstructor(unittest.TestCase):
grad.setCenter(QPointF(1, 2))
self._compare(grad.center(), (1.0, 2.0))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qrasterwindow_test.py b/sources/pyside6/tests/QtGui/qrasterwindow_test.py
index 07d81c813..038ce8836 100644
--- a/sources/pyside6/tests/QtGui/qrasterwindow_test.py
+++ b/sources/pyside6/tests/QtGui/qrasterwindow_test.py
@@ -1,30 +1,6 @@
-#############################################################################
-##
-## 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
+from __future__ import annotations
'''Unit test for QBackingStore, QRasterWindow and QStaticText'''
@@ -38,31 +14,64 @@ from init_paths import init_test_paths
init_test_paths(False)
from helper.usesqapplication import UsesQApplication
-from PySide6.QtCore import QEvent, QPoint, QRect, QSize, QTimer, Qt
-from PySide6.QtGui import QColor, QBackingStore, QPaintDevice, QPainter, QWindow, QPaintDeviceWindow, QRasterWindow, QRegion, QStaticText
+from PySide6.QtCore import QPoint, QRect, QSize, QTimer, Qt
+from PySide6.QtGui import (QColor, QPainter, QRasterWindow, QStaticText,
+ QTextCursor, QTextDocument, QAbstractTextDocumentLayout)
# Window using convenience class QRasterWindow
-class TestRasterWindow(QRasterWindow):
+class StaticTextRasterWindow(QRasterWindow):
def __init__(self):
- super(TestRasterWindow, self).__init__()
+ super().__init__()
self.text = QStaticText("QRasterWindow")
def paintEvent(self, event):
clientRect = QRect(QPoint(0, 0), self.size())
- painter = QPainter(self)
- painter.fillRect(clientRect, QColor(Qt.red))
- painter.drawStaticText(QPoint(10, 10), self.text)
+ with QPainter(self) as painter:
+ painter.fillRect(clientRect, QColor(Qt.red))
+ painter.drawStaticText(QPoint(10, 10), self.text)
+
+
+class TextDocumentWindow(QRasterWindow):
+ """PYSIDE-2252, drawing with QAbstractTextDocumentLayout.PaintContext"""
+
+ def __init__(self):
+ super().__init__()
+ self.m_document = QTextDocument()
+ self.m_document.setPlainText("bla bla")
+
+ def paintEvent(self, event):
+ with QPainter(self) as painter:
+ clientRect = QRect(QPoint(0, 0), self.size())
+ painter.fillRect(clientRect, QColor(Qt.white))
+ ctx = QAbstractTextDocumentLayout.PaintContext()
+ ctx.clip = clientRect
+
+ sel = QAbstractTextDocumentLayout.Selection()
+ cursor = QTextCursor(self.m_document)
+ cursor.movePosition(QTextCursor.Start)
+ cursor.movePosition(QTextCursor.NextWord, QTextCursor.KeepAnchor)
+ sel.cursor = cursor
+ sel.format.setForeground(Qt.red)
+ ctx.selections = [sel]
+
+ self.m_document.documentLayout().draw(painter, ctx)
class QRasterWindowTest(UsesQApplication):
def test(self):
- rasterWindow = TestRasterWindow()
+ rasterWindow = StaticTextRasterWindow()
rasterWindow.setFramePosition(QPoint(100, 100))
rasterWindow.resize(QSize(400, 400))
rasterWindow.show()
+
+ rasterWindow2 = TextDocumentWindow()
+ rasterWindow2.setFramePosition(rasterWindow.frameGeometry().topRight() + QPoint(20, 0))
+ rasterWindow2.resize(QSize(400, 400))
+ rasterWindow2.show()
+
QTimer.singleShot(100, self.app.quit)
- self.app.exec_()
+ self.app.exec()
if __name__ == '__main__':
diff --git a/sources/pyside6/tests/QtGui/qregion_test.py b/sources/pyside6/tests/QtGui/qregion_test.py
index bd843e162..97410f925 100644
--- a/sources/pyside6/tests/QtGui/qregion_test.py
+++ b/sources/pyside6/tests/QtGui/qregion_test.py
@@ -1,30 +1,6 @@
-#############################################################################
-##
-## 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
+from __future__ import annotations
import os
import sys
@@ -36,9 +12,10 @@ from init_paths import init_test_paths
init_test_paths(False)
from PySide6.QtGui import QRegion
-from PySide6.QtCore import QPoint
+from PySide6.QtCore import QPoint, QRect, QSize
from helper.usesqapplication import UsesQApplication
+
class QRegionTest(UsesQApplication):
def testFunctionUnit(self):
@@ -46,10 +23,19 @@ class QRegionTest(UsesQApplication):
r2 = QRegion(5, 5, 10, 10)
ru = r.united(r2)
- self.assertTrue(ru.contains(QPoint(0,0)))
- self.assertTrue(ru.contains(QPoint(5,5)))
- self.assertTrue(ru.contains(QPoint(10,10)))
- self.assertTrue(ru.contains(QPoint(14,14)))
+ self.assertTrue(ru.contains(QPoint(0, 0)))
+ self.assertTrue(ru.contains(QPoint(5, 5)))
+ self.assertTrue(ru.contains(QPoint(10, 10)))
+ self.assertTrue(ru.contains(QPoint(14, 14)))
+
+ def testSequence(self):
+ region = QRegion()
+ region += QRect(QPoint(0, 0), QSize(10, 10))
+ region += QRect(QPoint(10, 0), QSize(20, 20))
+ self.assertEqual(len(region), 2)
+ for r in region:
+ pass
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qshortcut_test.py b/sources/pyside6/tests/QtGui/qshortcut_test.py
new file mode 100644
index 000000000..91bf1cd18
--- /dev/null
+++ b/sources/pyside6/tests/QtGui/qshortcut_test.py
@@ -0,0 +1,61 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+from __future__ import annotations
+
+''' 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 QGuiApplication, QKeySequence, QShortcut, QWindow
+
+
+class Foo(QWindow):
+ 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 = QGuiApplication([])
+ 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/QtGui/qstandarditemmodel_test.py b/sources/pyside6/tests/QtGui/qstandarditemmodel_test.py
new file mode 100644
index 000000000..05cf5db10
--- /dev/null
+++ b/sources/pyside6/tests/QtGui/qstandarditemmodel_test.py
@@ -0,0 +1,86 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+from __future__ import annotations
+
+import gc
+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
+from PySide6.QtGui import QStandardItemModel, QStandardItem
+from shiboken6 import Shiboken
+from helper.usesqapplication import UsesQApplication
+
+
+class QStandardItemModelTest(UsesQApplication):
+
+ def setUp(self):
+ super(QStandardItemModelTest, self).setUp()
+ self.parent = QObject()
+ self.model = QStandardItemModel(0, 3, self.parent)
+
+ def tearDown(self):
+ del self.parent
+ del self.model
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
+ 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):
+ @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
+ 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/QtGui/qstring_qkeysequence_test.py b/sources/pyside6/tests/QtGui/qstring_qkeysequence_test.py
new file mode 100644
index 000000000..f5410b367
--- /dev/null
+++ b/sources/pyside6/tests/QtGui/qstring_qkeysequence_test.py
@@ -0,0 +1,43 @@
+#!/usr/bin/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
+from __future__ import annotations
+
+'''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/QtGui/qstylehints_test.py b/sources/pyside6/tests/QtGui/qstylehints_test.py
index b7b2e9471..213bdf8b1 100644
--- a/sources/pyside6/tests/QtGui/qstylehints_test.py
+++ b/sources/pyside6/tests/QtGui/qstylehints_test.py
@@ -1,30 +1,6 @@
-#############################################################################
-##
-## 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
+from __future__ import annotations
'''Unit test for QStyleHints'''
@@ -40,10 +16,12 @@ init_test_paths(False)
from helper.usesqapplication import UsesQApplication
from PySide6.QtGui import QStyleHints
+
class QStyleHintsTest(UsesQApplication):
def test(self):
styleHints = self.app.styleHints()
self.assertTrue(styleHints.startDragDistance() > 0)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qtextdocument_functions.py b/sources/pyside6/tests/QtGui/qtextdocument_functions.py
index c001c5da9..0350c93ac 100644
--- a/sources/pyside6/tests/QtGui/qtextdocument_functions.py
+++ b/sources/pyside6/tests/QtGui/qtextdocument_functions.py
@@ -1,30 +1,6 @@
-#############################################################################
-##
-## 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
+from __future__ import annotations
import os
import sys
@@ -35,7 +11,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
-from PySide6.QtGui import Qt
+from PySide6.QtGui import QPageRanges, Qt
class QTextDocumentFunctions(unittest.TestCase):
@@ -47,5 +23,16 @@ class QTextDocumentFunctions(unittest.TestCase):
self.assertEqual(html, '<p>A &amp; B</p>')
+class QPageRangesTest(unittest.TestCase):
+ """PYSIDE-2237: Test that field QPageRanges.Range.from is properly mangled."""
+
+ def test(self):
+ pr = QPageRanges()
+ pr.addPage(1)
+ r0 = pr.toRangeList()[0]
+ self.assertEqual(r0.from_, 1)
+ self.assertEqual(r0.to, 1)
+
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qtextdocument_undoredo_test.py b/sources/pyside6/tests/QtGui/qtextdocument_undoredo_test.py
index caeb0e7cc..e96c14a22 100644
--- a/sources/pyside6/tests/QtGui/qtextdocument_undoredo_test.py
+++ b/sources/pyside6/tests/QtGui/qtextdocument_undoredo_test.py
@@ -1,30 +1,6 @@
-#############################################################################
-##
-## 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
+from __future__ import annotations
import os
import sys
@@ -37,6 +13,7 @@ init_test_paths(False)
from PySide6.QtGui import QTextDocument, QTextCursor
+
class QTextDocumentTest(unittest.TestCase):
def testUndoRedo(self):
@@ -60,6 +37,7 @@ class QTextDocumentTest(unittest.TestCase):
self.assertTrue(doc.isUndoAvailable())
self.assertEqual(doc.toPlainText(), text)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qtextdocumentwriter_test.py b/sources/pyside6/tests/QtGui/qtextdocumentwriter_test.py
index cf3721684..b8401d960 100644
--- a/sources/pyside6/tests/QtGui/qtextdocumentwriter_test.py
+++ b/sources/pyside6/tests/QtGui/qtextdocumentwriter_test.py
@@ -1,30 +1,6 @@
-#############################################################################
-##
-## 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
+from __future__ import annotations
import os
import sys
@@ -46,10 +22,11 @@ class QTextDocumentWriterTest(unittest.TestCase):
doc = QTextDocument(text)
b = QBuffer()
b.open(QBuffer.ReadWrite)
- writer = QTextDocumentWriter(b, bytes("plaintext", "UTF-8"));
- writer.write(doc);
+ writer = QTextDocumentWriter(b, bytes("plaintext", "UTF-8"))
+ writer.write(doc)
b.close()
self.assertEqual(b.buffer(), text)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qtextline_test.py b/sources/pyside6/tests/QtGui/qtextline_test.py
index 58bd48620..7b8032e9b 100644
--- a/sources/pyside6/tests/QtGui/qtextline_test.py
+++ b/sources/pyside6/tests/QtGui/qtextline_test.py
@@ -1,30 +1,6 @@
-#############################################################################
-##
-## 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
+from __future__ import annotations
import os
import sys
@@ -35,9 +11,10 @@ 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 QTextLayout
+from PySide6.QtGui import QTextLayout, QTextOption
from helper.usesqapplication import UsesQApplication
+
class QTextLineTest(UsesQApplication):
def testCursorToX(self):
@@ -52,6 +29,12 @@ class QTextLineTest(UsesQApplication):
self.assertEqual(type(x), float)
self.assertEqual(type(cursorPos), int)
+ def testTextOption(self):
+ """PYSIDE-2088, large enum values causing MSVC issues."""
+ v = QTextOption.IncludeTrailingSpaces | QTextOption.ShowTabsAndSpaces
+ self.assertEqual(v.value, 2147483649)
+
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qtransform_test.py b/sources/pyside6/tests/QtGui/qtransform_test.py
index 8fcddf3ec..0bc28c330 100644
--- a/sources/pyside6/tests/QtGui/qtransform_test.py
+++ b/sources/pyside6/tests/QtGui/qtransform_test.py
@@ -1,30 +1,6 @@
-#############################################################################
-##
-## 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
+from __future__ import annotations
import os
import sys
@@ -36,7 +12,8 @@ from init_paths import init_test_paths
init_test_paths(False)
from PySide6.QtCore import QPointF
-from PySide6.QtGui import QTransform, QPolygonF, QPolygonF
+from PySide6.QtGui import QTransform, QPolygonF, QPolygonF, QQuaternion, QVector3D
+
class QTransformTest(unittest.TestCase):
@@ -86,7 +63,6 @@ class QTransformTest(unittest.TestCase):
self.assertEqual(t1, r2)
-
def testsquareToQuad(self):
q1 = QPolygonF()
q1.append(QPointF(10.0, 10.0))
@@ -103,7 +79,13 @@ class QTransformTest(unittest.TestCase):
self.assertEqual(t1, r2)
+ def testQQuaternion(self):
+ """Test return tuples."""
+ q = QQuaternion(1, 1, 1, 1)
+ self.assertEqual(len(q.getAxisAndAngle()), 2)
+ self.assertEqual(len(q.getEulerAngles()), 3)
+
if __name__ == "__main__":
- unittest.main()
+ unittest.main()
diff --git a/sources/pyside6/tests/QtGui/repr_test.py b/sources/pyside6/tests/QtGui/repr_test.py
index 3b732ce77..5bf8ade37 100644
--- a/sources/pyside6/tests/QtGui/repr_test.py
+++ b/sources/pyside6/tests/QtGui/repr_test.py
@@ -1,30 +1,6 @@
-#############################################################################
-##
-## 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
+from __future__ import annotations
import os
import sys
@@ -44,28 +20,34 @@ from PySide6.QtGui import QVector2D, QVector3D, QVector4D
from PySide6.QtGui import QColor, QTransform, QKeySequence, QQuaternion
from PySide6.QtGui import QPolygon
+
class ReprCopyHelper:
def testCopy(self):
copy = eval(self.original.__repr__())
self.assertTrue(copy is not self.original)
self.assertEqual(copy, self.original)
+
class QTransformReprCopy(ReprCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QTransform(1, 2, 3, 4, 5, 6, 7, 8, 9)
+
class QQuaternionReprCopy(ReprCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QQuaternion(1, 2, 3, 4)
+
class QVector2DReprCopy(ReprCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QVector2D(1, 2)
+
class QVector3DReprCopy(ReprCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QVector3D(1, 2, 3)
+
class QVector4DReprCopy(ReprCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QVector4D(1, 2, 3, 4)
diff --git a/sources/pyside6/tests/QtGui/timed_app_and_patching_test.py b/sources/pyside6/tests/QtGui/timed_app_and_patching_test.py
index 1290fed90..232f90c92 100644
--- a/sources/pyside6/tests/QtGui/timed_app_and_patching_test.py
+++ b/sources/pyside6/tests/QtGui/timed_app_and_patching_test.py
@@ -1,30 +1,6 @@
-#############################################################################
-##
-## 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
+from __future__ import annotations
import os
import sys
@@ -32,36 +8,21 @@ import unittest
from pathlib import Path
sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
-from init_paths import init_test_paths
+from init_paths import init_test_paths # noqa: E402
init_test_paths(False)
-from helper.timedqapplication import TimedQApplication
-from PySide6.support import deprecated
-from PySide6.support.signature import importhandler
-from PySide6 import QtGui
+from helper.timedqguiapplication import TimedQGuiApplication
-class TestTimedApp(TimedQApplication):
- '''Simple test case for TimedQApplication'''
+class TestTimedApp(TimedQGuiApplication):
+ '''Simple test case for TimedQGuiApplication'''
def testFoo(self):
- #Simple test of TimedQApplication
- self.app.exec_()
+ # Simple test of TimedQGuiApplication
+ self.app.exec()
+# deprecated.py is no longer needed.
-def fix_for_QtGui(QtGui):
- QtGui.something = 42
-
-class TestPatchingFramework(unittest.TestCase):
- """Simple test that verifies that deprecated.py works"""
-
- deprecated.fix_for_QtGui = fix_for_QtGui
-
- def test_patch_works(self):
- something = "something"
- self.assertFalse(hasattr(QtGui, something))
- importhandler.finish_import(QtGui)
- self.assertTrue(hasattr(QtGui, something))
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/xpm_data.py b/sources/pyside6/tests/QtGui/xpm_data.py
new file mode 100644
index 000000000..d5502d170
--- /dev/null
+++ b/sources/pyside6/tests/QtGui/xpm_data.py
@@ -0,0 +1,238 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+from __future__ import annotations
+
+'''Test data for QImage'''
+
+
+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 . + . . + + . + + + + + + "
+]