diff options
| author | Friedemann Kleint <[email protected]> | 2020-05-19 11:55:10 +0200 |
|---|---|---|
| committer | Friedemann Kleint <[email protected]> | 2020-07-03 15:40:57 +0000 |
| commit | ceeb82693a0240b1dd4f51605ba21413927ee558 (patch) | |
| tree | 8363fe26b1f00823ff0b8f4c2d7af38bc3e4d087 /sources/pyside2/tests | |
| parent | 0eec9fecd241a178ca8f09218b9286ae763f29b3 (diff) | |
Initial port of Core,Gui,Widgets,Network,Qml,Quick to Qt 6
Test failures:
shiboken2:testmodifyfunction
pyside2:QtCore::qbytearray_test
pyside2:QtGui::bug_PYSIDE-41
pyside2:QtGui::deepcopy_test
pyside2:QtGui::qfontmetrics_test
pyside2:QtGui::qpixmapcache_test
pyside2:QtWidgets::api2_test (QTBUG-85417)
pyside2:QtWidgets::bug_632
pyside2:QtWidgets::bug_714
pyside2:QtWidgets::bug_785
pyside2:QtWidgets::qshortcut_test
pyside2:QtQml::bug_825
pyside2:QtQml::bug_1029
pyside2:QtQml::registertype
pyside2:QtQml::qqmlincubator_incubateWhile
pyside2:QtQml::signal_arguments
Task-number: PYSIDE-1339
Task-number: PYSIDE-904
Change-Id: Ia43d7ed037dfdd07def0edd76bada2243e73d335
Reviewed-by: Christian Tismer <[email protected]>
Diffstat (limited to 'sources/pyside2/tests')
27 files changed, 35 insertions, 343 deletions
diff --git a/sources/pyside2/tests/QtCore/CMakeLists.txt b/sources/pyside2/tests/QtCore/CMakeLists.txt index a151e6d11..419d5131b 100644 --- a/sources/pyside2/tests/QtCore/CMakeLists.txt +++ b/sources/pyside2/tests/QtCore/CMakeLists.txt @@ -97,7 +97,6 @@ PYSIDE_TEST(qpoint_test.py) PYSIDE_TEST(qprocess_test.py) PYSIDE_TEST(qproperty_decorator.py) PYSIDE_TEST(qrect_test.py) -PYSIDE_TEST(qregexp_test.py) PYSIDE_TEST(qregularexpression_test.py) PYSIDE_TEST(qresource_test.py) PYSIDE_TEST(qsettings_test.py) @@ -111,7 +110,6 @@ PYSIDE_TEST(qstate_test.py) PYSIDE_TEST(qstorageinfo_test.py) PYSIDE_TEST(qstring_test.py) PYSIDE_TEST(qsysinfo_test.py) -PYSIDE_TEST(qtext_codec_test.py) PYSIDE_TEST(qtextstream_test.py) PYSIDE_TEST(qthread_prod_cons_test.py) PYSIDE_TEST(qthread_signal_test.py) diff --git a/sources/pyside2/tests/QtCore/qobject_parent_test.py b/sources/pyside2/tests/QtCore/qobject_parent_test.py index 0a02fbc26..386209e8a 100644 --- a/sources/pyside2/tests/QtCore/qobject_parent_test.py +++ b/sources/pyside2/tests/QtCore/qobject_parent_test.py @@ -148,10 +148,6 @@ class ParentCase(unittest.TestCase): res = parent.findChildren(QObject, QRegularExpression("^fo+")) self.assertEqual(res, test_children) - # test findChildren with a QRegExp (deprecated) - res = parent.findChildren(QObject, QRegExp("^fo+")) - self.assertEqual(res, test_children) - def testParentEquality(self): #QObject.parent() == parent parent = QObject() diff --git a/sources/pyside2/tests/QtCore/qregexp_test.py b/sources/pyside2/tests/QtCore/qregexp_test.py deleted file mode 100644 index a031137fd..000000000 --- a/sources/pyside2/tests/QtCore/qregexp_test.py +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/python - -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import os -import sys -import unittest - -sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from init_paths import init_test_paths -init_test_paths(False) - -from PySide2.QtCore import QRegExp - -class QRegExpTest(unittest.TestCase): - - def testReplace1(self): - re = QRegExp('a[mn]') - string = re.replace('Banana', 'ox') - self.assertEqual(string, 'Boxoxa') - - def testReplace2(self): - re = QRegExp('<i>([^<]*)</i>') - string = re.replace('A <i>bon mot</i>.', '\\emph{\\1}') - self.assertEqual(string, 'A \\emph{bon mot}.') - -if __name__ == '__main__': - unittest.main() - diff --git a/sources/pyside2/tests/QtCore/qtext_codec_test.py b/sources/pyside2/tests/QtCore/qtext_codec_test.py deleted file mode 100644 index 9e41c38c6..000000000 --- a/sources/pyside2/tests/QtCore/qtext_codec_test.py +++ /dev/null @@ -1,54 +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 gc -import os -import sys -import unittest - -sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from init_paths import init_test_paths -init_test_paths(False) - -from PySide2.QtCore import QTextCodec - -class TestCodecGetters(unittest.TestCase): - - def testCodecsNames(self): - for codec_name in QTextCodec.availableCodecs(): - codec = QTextCodec.codecForName(codec_name) - self.assertTrue(type(codec), QTextCodec) - - def testCodecsMibs(self): - for codec_num in QTextCodec.availableMibs(): - codec = QTextCodec.codecForMib(codec_num) - self.assertTrue(type(codec), QTextCodec) - - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtCore/qtextstream_test.py b/sources/pyside2/tests/QtCore/qtextstream_test.py index bd25367c3..d4bbd8479 100644 --- a/sources/pyside2/tests/QtCore/qtextstream_test.py +++ b/sources/pyside2/tests/QtCore/qtextstream_test.py @@ -38,7 +38,7 @@ init_test_paths(False) import py3kcompat as py3k -from PySide2.QtCore import QByteArray, QTextStream, QIODevice, QTextCodec, QFile +from PySide2.QtCore import QByteArray, QTextStream, QIODevice, QFile class QTextStreamShiftTest(unittest.TestCase): @@ -61,14 +61,6 @@ class QTextStreamGetSet(unittest.TestCase): def setUp(self): self.obj = QTextStream() - - def testCodec(self): - '''QTextStream set/get Codec''' - - codec = QTextCodec.codecForName('ISO8859-1') - self.obj.setCodec(codec) - self.assertEqual(codec, self.obj.codec()) - def testDevice(self): '''QTextStream get/set Device''' device = QFile() @@ -83,7 +75,6 @@ class QTextStreamInitialization(unittest.TestCase): '''QTextStream construction''' obj = QTextStream() - self.assertEqual(obj.codec(), QTextCodec.codecForLocale()) self.assertEqual(obj.device(), None) self.assertEqual(obj.string(), None) diff --git a/sources/pyside2/tests/QtCore/qurlquery_test.py b/sources/pyside2/tests/QtCore/qurlquery_test.py index ac7ab69b0..6e538c919 100644 --- a/sources/pyside2/tests/QtCore/qurlquery_test.py +++ b/sources/pyside2/tests/QtCore/qurlquery_test.py @@ -45,8 +45,6 @@ class QUrlQueryTest(unittest.TestCase): def testConstructing(self): empty = QUrlQuery() self.assertTrue(empty.isEmpty()) - self.assertEqual(empty.queryPairDelimiter(), QUrlQuery.defaultQueryPairDelimiter()) - self.assertEqual(empty.queryValueDelimiter(), QUrlQuery.defaultQueryValueDelimiter()) empty.clear(); self.assertTrue(empty.isEmpty()) diff --git a/sources/pyside2/tests/QtGui/CMakeLists.txt b/sources/pyside2/tests/QtGui/CMakeLists.txt index 172703ab9..179e88fd6 100644 --- a/sources/pyside2/tests/QtGui/CMakeLists.txt +++ b/sources/pyside2/tests/QtGui/CMakeLists.txt @@ -26,8 +26,6 @@ PYSIDE_TEST(qfontmetrics_test.py) PYSIDE_TEST(qguiapplication_test.py) PYSIDE_TEST(qicon_test.py) PYSIDE_TEST(qitemselection_test.py) -PYSIDE_TEST(qmatrix_test.py) -PYSIDE_TEST(qopenglbuffer_test.py) PYSIDE_TEST(qpainter_test.py) PYSIDE_TEST(qpdfwriter_test.py) PYSIDE_TEST(qpixelformat_test.py) @@ -37,7 +35,6 @@ PYSIDE_TEST(qpolygonf_test.py) PYSIDE_TEST(qkeysequence_test.py) PYSIDE_TEST(qradialgradient_test.py) PYSIDE_TEST(qrasterwindow_test.py) -PYSIDE_TEST(qopenglwindow_test.py) PYSIDE_TEST(qregion_test.py) PYSIDE_TEST(qstylehints_test.py) PYSIDE_TEST(qtextdocument_functions.py) diff --git a/sources/pyside2/tests/QtGui/deepcopy_test.py b/sources/pyside2/tests/QtGui/deepcopy_test.py index d4dcdd64c..0fa82150f 100644 --- a/sources/pyside2/tests/QtGui/deepcopy_test.py +++ b/sources/pyside2/tests/QtGui/deepcopy_test.py @@ -36,7 +36,6 @@ from init_paths import init_test_paths init_test_paths(False) from PySide2.QtCore import QPoint -from PySide2.QtGui import QMatrix from PySide2.QtGui import QMatrix2x2, QMatrix2x3, QMatrix2x4 from PySide2.QtGui import QMatrix3x2, QMatrix3x3, QMatrix3x4 from PySide2.QtGui import QMatrix4x2, QMatrix4x3, QMatrix4x4 @@ -81,7 +80,7 @@ class QColorCMYKDeepCopy(DeepCopyColorHelperF, unittest.TestCase): class QTransformDeepCopy(DeepCopyHelper, unittest.TestCase): def setUp(self): - self.original = QTransform(1, 2, 3, 4, 5, 6, 7, 8) + self.original = QTransform(1, 2, 3, 4, 5, 6, 7, 8, 9) class QKeySequenceDeepCopy(DeepCopyHelper, unittest.TestCase): def setUp(self): @@ -107,10 +106,6 @@ class QPolygonDeepCopy(DeepCopyHelper, unittest.TestCase): def setUp(self): self.original = QPolygon([QPoint(1, 2), QPoint(3, 4), QPoint(5, 6)]) -class QMatrixDeepCopy(DeepCopyHelper, unittest.TestCase): - def setUp(self): - self.original = QMatrix(1, 2, 3, 4, 5, 6) - # Avoid these tests until get gcc fixed # Related bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43247 diff --git a/sources/pyside2/tests/QtGui/qmatrix_test.py b/sources/pyside2/tests/QtGui/qmatrix_test.py deleted file mode 100644 index 48380faf6..000000000 --- a/sources/pyside2/tests/QtGui/qmatrix_test.py +++ /dev/null @@ -1,106 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import os -import sys -import unittest - -sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from init_paths import init_test_paths -init_test_paths(False) - -from PySide2.QtCore import QPoint -from PySide2.QtGui import QMatrix, QMatrix2x2, QMatrix4x4 - - -def qpointTimesQMatrix(point, matrix): - '''As seen in "QPoint QMatrix::map(const QPoint &p) const" C++ implementation.''' - return QPoint(matrix.m11() * point.x() + matrix.m21() * point.y() + matrix.dx(), - matrix.m12() * point.x() + matrix.m22() * point.y() + matrix.dy()) - -class QMatrixTest(unittest.TestCase): - - def testMatrix(self): - matrix = QMatrix(11, 12, 21, 22, 100, 200) - point = QPoint(3, 3) - self.assertEqual(matrix.map(point), qpointTimesQMatrix(point, matrix)) - - def testMatrixWithWrongType(self): - matrix = QMatrix(11, 12, 21, 22, 100, 200) - point = QPoint(3, 3) - # This exception may move from a TypeError to a ValueError. - self.assertRaises((TypeError, ValueError), matrix.__mul__, point) - - def testMatrix2x2(self): - matrix = QMatrix2x2([1.0, 2.0, 3.0, 4.0]) - - expectedTransposed = QMatrix2x2([1.0, 3.0, 2.0, 4.0]) - self.assertEqual(matrix.transposed(), expectedTransposed) - - expectedMultiplied = QMatrix2x2([2.0, 4.0, 6.0, 8.0]) - matrix *= 2.0 - self.assertEqual(matrix, expectedMultiplied) - - matrix.setToIdentity() - self.assertTrue(matrix.isIdentity()) - - def testMatrix4x4(self): - self.assertRaises(TypeError, QMatrix4x4, [0.0, 1.0, 2.0, 3.0]) - self.assertRaises(TypeError, QMatrix4x4, [0.0, 1.0, 2.0, 'I', - 4.0, 5.0, 6.0, 7.0, - 8.0, 9.0, 'N', 11.0, - 12.0, 'd', 14.0, 'T']) - - my_data = [0.0, 1.0, 2.0, 3.0, - 4.0, 5.0, 6.0, 7.0, - 8.0, 9.0, 10.0, 11.0, - 12.0, 13.0, 14.0, 15.0] - my_datac = [0.0, 4.0, 8.0, 12.0, - 1.0, 5.0, 9.0, 13.0, - 2.0, 6.0, 10.0, 14.0, - 3.0, 7.0, 11.0, 15.0] - - m = QMatrix4x4(my_data) - d = m.data() - self.assertTrue(my_datac, d) - - d = m.copyDataTo() - self.assertTrue(my_data == list(d)) - - def testMatrixMapping(self): - m = QMatrix(1.0, 2.0, 1.0, 3.0, 100.0, 200.0) - res = m.map(5, 5) - self.assertAlmostEqual(res[0], 5 * 1.0 + 5 * 1.0 + 100.0) - self.assertAlmostEqual(res[1], 5 * 2.0 + 5 * 3.0 + 200.0) - res = m.map(5.0, 5.0) - self.assertAlmostEqual(res[0], 5.0 * 1.0 + 5.0 * 1.0 + 100.0) - self.assertAlmostEqual(res[1], 5.0 * 2.0 + 5.0 * 3.0 + 200.0) - -if __name__ == '__main__': - unittest.main() - diff --git a/sources/pyside2/tests/QtGui/qtextdocument_functions.py b/sources/pyside2/tests/QtGui/qtextdocument_functions.py index 765a6b5b7..bd1462049 100644 --- a/sources/pyside2/tests/QtGui/qtextdocument_functions.py +++ b/sources/pyside2/tests/QtGui/qtextdocument_functions.py @@ -35,7 +35,6 @@ from init_paths import init_test_paths init_test_paths(False) from PySide2.QtGui import Qt -from PySide2.QtCore import QTextCodec class QTextDocumentFunctions(unittest.TestCase): @@ -45,8 +44,6 @@ class QTextDocumentFunctions(unittest.TestCase): self.assertTrue(Qt.mightBeRichText('<html><head/><body><p>bla</p></body></html>')) html = Qt.convertFromPlainText("A & B", Qt.WhiteSpaceNormal) self.assertEqual(html, '<p>A & B</p>') - codec = Qt.codecForHtml(b'bla') - self.assertTrue(codec) if __name__ == '__main__': diff --git a/sources/pyside2/tests/QtGui/repr_test.py b/sources/pyside2/tests/QtGui/repr_test.py index e06f4d487..770c9d5bd 100644 --- a/sources/pyside2/tests/QtGui/repr_test.py +++ b/sources/pyside2/tests/QtGui/repr_test.py @@ -36,7 +36,6 @@ init_test_paths(False) import PySide2 from PySide2.QtCore import QPoint -from PySide2.QtGui import QMatrix from PySide2.QtGui import QMatrix2x2, QMatrix2x3, QMatrix2x4 from PySide2.QtGui import QMatrix3x2, QMatrix3x3, QMatrix3x4 from PySide2.QtGui import QMatrix4x2, QMatrix4x3, QMatrix4x4 @@ -52,7 +51,7 @@ class ReprCopyHelper: class QTransformReprCopy(ReprCopyHelper, unittest.TestCase): def setUp(self): - self.original = QTransform(1, 2, 3, 4, 5, 6, 7, 8) + self.original = QTransform(1, 2, 3, 4, 5, 6, 7, 8, 9) class QKeySequenceReprCopy(ReprCopyHelper, unittest.TestCase): def setUp(self): @@ -74,10 +73,6 @@ class QVector4DReprCopy(ReprCopyHelper, unittest.TestCase): def setUp(self): self.original = QVector4D(1, 2, 3, 4) -class QMatrixReprCopy(ReprCopyHelper, unittest.TestCase): - def setUp(self): - self.original = QMatrix(1, 2, 3, 4, 5, 6) - # Avoid these tests until get gcc fixed # Related bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43247 diff --git a/sources/pyside2/tests/QtNetwork/bug_446.py b/sources/pyside2/tests/QtNetwork/bug_446.py index f15ff01f9..e94bef510 100644 --- a/sources/pyside2/tests/QtNetwork/bug_446.py +++ b/sources/pyside2/tests/QtNetwork/bug_446.py @@ -49,7 +49,7 @@ class HttpSignalsCase(UsesQCoreApplication): def onNewConnection(self): self.serverConnection = self.server.nextPendingConnection() - self.serverConnection.error.connect(self.onError) + self.serverConnection.errorOccurred.connect(self.onError) self.serverConnection.write(HttpSignalsCase.DATA) self.server.close() diff --git a/sources/pyside2/tests/QtOpenGL/CMakeLists.txt b/sources/pyside2/tests/QtOpenGL/CMakeLists.txt index b37a9ddce..a0e8d0053 100644 --- a/sources/pyside2/tests/QtOpenGL/CMakeLists.txt +++ b/sources/pyside2/tests/QtOpenGL/CMakeLists.txt @@ -1,2 +1,4 @@ PYSIDE_TEST(qglbuffer_test.py) PYSIDE_TEST(qglwidget_test.py) +PYSIDE_TEST(qopenglbuffer_test.py) +PYSIDE_TEST(qopenglwindow_test.py) diff --git a/sources/pyside2/tests/QtGui/qopenglbuffer_test.py b/sources/pyside2/tests/QtOpenGL/qopenglbuffer_test.py index a5d8385c9..a5d8385c9 100644 --- a/sources/pyside2/tests/QtGui/qopenglbuffer_test.py +++ b/sources/pyside2/tests/QtOpenGL/qopenglbuffer_test.py diff --git a/sources/pyside2/tests/QtUiTools/bug_392.py b/sources/pyside2/tests/QtUiTools/bug_392.py index 2439e7203..07db9802e 100644 --- a/sources/pyside2/tests/QtUiTools/bug_392.py +++ b/sources/pyside2/tests/QtUiTools/bug_392.py @@ -53,7 +53,7 @@ class BugTest(UsesQApplication): filePath = os.path.join(os.path.dirname(__file__), 'action.ui') result = loader.load(filePath, w) - self.assertTrue(isinstance(result.actionFoo, QtWidgets.QAction)) + self.assertTrue(isinstance(result.actionFoo, QtGui.QAction)) def testPythonCustomWidgets(self): w = QtWidgets.QWidget() diff --git a/sources/pyside2/tests/QtUiTools/bug_426.py b/sources/pyside2/tests/QtUiTools/bug_426.py index e84da0382..15cfeee2b 100644 --- a/sources/pyside2/tests/QtUiTools/bug_426.py +++ b/sources/pyside2/tests/QtUiTools/bug_426.py @@ -42,7 +42,7 @@ class Window(object): loader = QUiLoader() filePath = os.path.join(os.path.dirname(__file__), 'bug_426.ui') self.widget = loader.load(filePath) - self.group = QtWidgets.QActionGroup(self.widget) + self.group = QtGui.QActionGroup(self.widget) self.widget.show() QtCore.QTimer.singleShot(0, self.widget.close) diff --git a/sources/pyside2/tests/QtWidgets/CMakeLists.txt b/sources/pyside2/tests/QtWidgets/CMakeLists.txt index 6682136ea..695749a92 100644 --- a/sources/pyside2/tests/QtWidgets/CMakeLists.txt +++ b/sources/pyside2/tests/QtWidgets/CMakeLists.txt @@ -9,7 +9,6 @@ PYSIDE_TEST(bug_243.py) PYSIDE_TEST(bug_307.py) PYSIDE_TEST(bug_324.py) PYSIDE_TEST(bug_338.py) -PYSIDE_TEST(bug_363.py) PYSIDE_TEST(bug_389.py) PYSIDE_TEST(bug_400.py) PYSIDE_TEST(bug_416.py) diff --git a/sources/pyside2/tests/QtWidgets/add_action_test.py b/sources/pyside2/tests/QtWidgets/add_action_test.py index c8a7c2269..d4af8b5d1 100644 --- a/sources/pyside2/tests/QtWidgets/add_action_test.py +++ b/sources/pyside2/tests/QtWidgets/add_action_test.py @@ -37,7 +37,8 @@ from init_paths import init_test_paths init_test_paths(False) from PySide2.QtCore import SLOT -from PySide2.QtWidgets import QMenuBar, QAction, QPushButton +from PySide2.QtGui import QAction +from PySide2.QtWidgets import QMenuBar, QPushButton from helper.usesqapplication import UsesQApplication diff --git a/sources/pyside2/tests/QtWidgets/bug_363.py b/sources/pyside2/tests/QtWidgets/bug_363.py deleted file mode 100644 index 910525fed..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_363.py +++ /dev/null @@ -1,59 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -''' Test bug 363: http://bugs.openbossa.org/show_bug.cgi?id=363''' - -import os -import sys -import unittest - -sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from init_paths import init_test_paths -init_test_paths(False) - -from helper.usesqapplication import UsesQApplication -from PySide2 import QtCore, QtWidgets - -# Check for desktop object lifetime -class BugTest(UsesQApplication): - def mySlot(self): - pass - - # test if it is possible to connect with a desktop object after storing that on an auxiliar variable - def testCase1(self): - desktop = QtWidgets.QApplication.desktop() - desktop.resized[int].connect(self.mySlot) - self.assertTrue(True) - - # test if it is possible to connect with a desktop object without storing that on an auxiliar variable - def testCase2(self): - QtWidgets.QApplication.desktop().resized[int].connect(self.mySlot) - self.assertTrue(True) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_711.py b/sources/pyside2/tests/QtWidgets/bug_711.py index 43e4b7bb2..3898e23f5 100644 --- a/sources/pyside2/tests/QtWidgets/bug_711.py +++ b/sources/pyside2/tests/QtWidgets/bug_711.py @@ -34,7 +34,8 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from init_paths import init_test_paths init_test_paths(False) -from PySide2.QtWidgets import QToolBar, QApplication, QAction, QToolButton +from PySide2.QtGui import QAction +from PySide2.QtWidgets import QToolBar, QApplication, QToolButton try: xrange diff --git a/sources/pyside2/tests/QtWidgets/bug_860.py b/sources/pyside2/tests/QtWidgets/bug_860.py index 8cdab2e45..483973fdb 100644 --- a/sources/pyside2/tests/QtWidgets/bug_860.py +++ b/sources/pyside2/tests/QtWidgets/bug_860.py @@ -52,7 +52,7 @@ class MultipleSlotTest(UsesQApplication): box.stateChanged.connect(checkboxMapper.map) checkboxMapper.setMapping(box, box.text()) - checkboxMapper.mapped[str].connect(self.cb_changed) + checkboxMapper.mappedString[str].connect(self.cb_changed) self._changed = False box.setChecked(True) self.assertTrue(self._changed) diff --git a/sources/pyside2/tests/QtWidgets/qaction_test.py b/sources/pyside2/tests/QtWidgets/qaction_test.py index 8fc8f6c05..d587a59b1 100644 --- a/sources/pyside2/tests/QtWidgets/qaction_test.py +++ b/sources/pyside2/tests/QtWidgets/qaction_test.py @@ -34,7 +34,8 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from init_paths import init_test_paths init_test_paths(False) -from PySide2.QtWidgets import QAction, QWidget +from PySide2.QtGui import QAction +from PySide2.QtWidgets import QWidget from helper.usesqapplication import UsesQApplication class QPainterDrawText(UsesQApplication): diff --git a/sources/pyside2/tests/QtWidgets/qshortcut_test.py b/sources/pyside2/tests/QtWidgets/qshortcut_test.py index 18aec285d..030021475 100644 --- a/sources/pyside2/tests/QtWidgets/qshortcut_test.py +++ b/sources/pyside2/tests/QtWidgets/qshortcut_test.py @@ -38,11 +38,13 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from init_paths import init_test_paths init_test_paths(False) -from PySide2 import QtCore, QtGui, QtWidgets +from PySide2.QtCore import Qt, QTimer +from PySide2.QtGui import QKeySequence, QShortcut +from PySide2.QtWidgets import QApplication, QWidget -class Foo(QtWidgets.QWidget): +class Foo(QWidget): def __init__(self): - QtWidgets.QWidget.__init__(self) + QWidget.__init__(self) self.ok = False self.copy = False @@ -52,9 +54,9 @@ class Foo(QtWidgets.QWidget): def slot_of_copy(self): self.copy = True -class MyShortcut(QtWidgets.QShortcut): +class MyShortcut(QShortcut): def __init__(self, keys, wdg, slot): - QtWidgets.QShortcut.__init__(self, keys, wdg, slot) + QShortcut.__init__(self, keys, wdg, slot) def emit_signal(self): self.emit(QtCore.SIGNAL("activated()")) @@ -62,12 +64,12 @@ class MyShortcut(QtWidgets.QShortcut): class QAppPresence(unittest.TestCase): def testQShortcut(self): - self.qapp = QtWidgets.QApplication([]) + self.qapp = QApplication([]) f = Foo() - self.sc = MyShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Return), f, f.slot_of_foo) - self.scstd = MyShortcut(QtGui.QKeySequence.Copy, f, f.slot_of_copy) - QtCore.QTimer.singleShot(0, self.init); + 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) diff --git a/sources/pyside2/tests/QtWidgets/qstring_qkeysequence_test.py b/sources/pyside2/tests/QtWidgets/qstring_qkeysequence_test.py index 0321b69a4..79842aac2 100644 --- a/sources/pyside2/tests/QtWidgets/qstring_qkeysequence_test.py +++ b/sources/pyside2/tests/QtWidgets/qstring_qkeysequence_test.py @@ -42,8 +42,8 @@ init_test_paths(False) import py3kcompat as py3k from helper.usesqapplication import UsesQApplication -from PySide2.QtGui import QKeySequence -from PySide2.QtWidgets import QAction +from PySide2.QtGui import QAction, QKeySequence + class QStringQKeySequenceTest(UsesQApplication): '''Tests conversions of QString to and from QKeySequence.''' diff --git a/sources/pyside2/tests/QtWidgets/qtoolbar_test.py b/sources/pyside2/tests/QtWidgets/qtoolbar_test.py index 856bf07f3..a70305c4a 100644 --- a/sources/pyside2/tests/QtWidgets/qtoolbar_test.py +++ b/sources/pyside2/tests/QtWidgets/qtoolbar_test.py @@ -36,7 +36,8 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from init_paths import init_test_paths init_test_paths(False) -from PySide2.QtWidgets import QToolBar, QMainWindow, QAction +from PySide2.QtGui import QAction +from PySide2.QtWidgets import QToolBar, QMainWindow from helper.usesqapplication import UsesQApplication diff --git a/sources/pyside2/tests/pysidetest/CMakeLists.txt b/sources/pyside2/tests/pysidetest/CMakeLists.txt index bdd88ea37..cdf653745 100644 --- a/sources/pyside2/tests/pysidetest/CMakeLists.txt +++ b/sources/pyside2/tests/pysidetest/CMakeLists.txt @@ -23,11 +23,7 @@ testview.h hiddenobject.h ) -if (${QT_MAJOR_VERSION} GREATER_EQUAL 6) - qt6_wrap_cpp(pysidetest_MOC_SRC ${pysidetest_MOC_HEADERS}) -else() - qt5_wrap_cpp(pysidetest_MOC_SRC ${pysidetest_MOC_HEADERS}) -endif() +qt_wrap_cpp(pysidetest_MOC_SRC ${pysidetest_MOC_HEADERS}) set(testbinding_SRC ${CMAKE_CURRENT_BINARY_DIR}/testbinding/testobject_wrapper.cpp @@ -48,9 +44,9 @@ ${CMAKE_CURRENT_BINARY_DIR}/testbinding/testbinding_module_wrapper.cpp # Thus we use the second direct path, which contains the actual header files. if(${QT_MAJOR_VERSION} GREATER_EQUAL 6) - set(Qt6Core_DIRECT_INCLUDE_DIR Qt6Core_INCLUDE_DIRS) - set(Qt6Gui_DIRECT_INCLUDE_DIR Qt6Gui_INCLUDE_DIRS) - set(Qt6Widgets_DIRECT_INCLUDE_DIR Qt6Widgets_INCLUDE_DIRS) + set(Qt6Core_DIRECT_INCLUDE_DIR ${Qt6Core_INCLUDE_DIRS}) + set(Qt6Gui_DIRECT_INCLUDE_DIR ${Qt6Gui_INCLUDE_DIRS}) + set(Qt6Widgets_DIRECT_INCLUDE_DIR ${Qt6Widgets_INCLUDE_DIRS}) else() list(GET Qt5Core_INCLUDE_DIRS 1 Qt5Core_DIRECT_INCLUDE_DIR) list(GET Qt5Gui_INCLUDE_DIRS 1 Qt5Gui_DIRECT_INCLUDE_DIR) diff --git a/sources/pyside2/tests/pysidetest/new_inherited_functions_test.py b/sources/pyside2/tests/pysidetest/new_inherited_functions_test.py index 81a764986..55953ad69 100644 --- a/sources/pyside2/tests/pysidetest/new_inherited_functions_test.py +++ b/sources/pyside2/tests/pysidetest/new_inherited_functions_test.py @@ -57,7 +57,6 @@ new_functions = """ """ new_functions += """ - PySide2.QtGui.QBitmap().transformed(qMatrix,transformationMode) PySide2.QtGui.QStandardItemModel().insertColumn(int,qModelIndex) PySide2.QtGui.QStandardItemModel().parent() # PySide2.QtGui.QTextList(qTextDocument).setFormat(qTextFormat) # Segmentation fault: 11 @@ -71,8 +70,6 @@ new_functions += """ PySide2.QtWidgets.QApplication.setPalette(qPalette) PySide2.QtWidgets.QBoxLayout(direction).addWidget(qWidget) PySide2.QtWidgets.QColorDialog().open() - PySide2.QtWidgets.QDirModel().index(int,int,qModelIndex) - PySide2.QtWidgets.QDirModel().parent() PySide2.QtWidgets.QFileDialog().open() PySide2.QtWidgets.QFileSystemModel().index(int,int,qModelIndex) PySide2.QtWidgets.QFileSystemModel().parent() @@ -145,7 +142,6 @@ class MainTest(unittest.TestCase): try: PySide2.QtGui #qPaintDevice = PySide2.QtGui.QPaintDevice() # NotImplementedError - qMatrix = PySide2.QtGui.QMatrix() qTextDocument = PySide2.QtGui.QTextDocument() qTextFormat = PySide2.QtGui.QTextFormat() quintptr = long(42) if sys.version_info[0] < 3 else 42 @@ -158,7 +154,7 @@ class MainTest(unittest.TestCase): direction = PySide2.QtWidgets.QBoxLayout.Direction() qWidget = PySide2.QtWidgets.QWidget() qStyleOptionFrame = PySide2.QtWidgets.QStyleOptionFrame() - qAction = PySide2.QtWidgets.QAction(qObject) + qAction = PySide2.QtGui.QAction(qObject) renderFlags = PySide2.QtWidgets.QWidget.RenderFlags except AttributeError: pass |
