aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/tests
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-08-31 13:40:42 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-09-01 05:32:25 +0000
commit7ac8da6adee7528578ec800bf810ea69ac746043 (patch)
treedd2a1d6eadd0f70edccb5b68ce495759e80ff350 /sources/pyside2/tests
parent404f584d6ac4b94c65d60aa1171f0ef1fe4dc6bd (diff)
Adapt to recent Qt 6 changes
- Removal of the statemachine framework from QtCore - Addition of QAbstractFileIconProvider - Adapt some signatures - QMetaType deprecations Change-Id: Ia51354542ad1d2f0bb5530e45ebef0d6ccdb633d Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside2/tests')
-rw-r--r--sources/pyside2/tests/QtCore/CMakeLists.txt4
-rw-r--r--sources/pyside2/tests/QtCore/bug_1031.py41
-rw-r--r--sources/pyside2/tests/QtCore/qabstracttransition_test.py191
-rw-r--r--sources/pyside2/tests/QtCore/qbytearray_test.py6
-rw-r--r--sources/pyside2/tests/QtCore/qstate_test.py71
-rw-r--r--sources/pyside2/tests/QtCore/qstatemachine_test.py104
-rw-r--r--sources/pyside2/tests/QtCore/setprop_on_ctor_test.py6
-rw-r--r--sources/pyside2/tests/support/voidptr_test.py2
8 files changed, 4 insertions, 421 deletions
diff --git a/sources/pyside2/tests/QtCore/CMakeLists.txt b/sources/pyside2/tests/QtCore/CMakeLists.txt
index 3af239c8c..5d661dc34 100644
--- a/sources/pyside2/tests/QtCore/CMakeLists.txt
+++ b/sources/pyside2/tests/QtCore/CMakeLists.txt
@@ -23,7 +23,6 @@ PYSIDE_TEST(bug_953.py)
PYSIDE_TEST(bug_987.py)
PYSIDE_TEST(bug_994.py)
PYSIDE_TEST(bug_1019.py)
-PYSIDE_TEST(bug_1031.py)
PYSIDE_TEST(bug_1063.py)
PYSIDE_TEST(bug_1069.py)
PYSIDE_TEST(bug_1313.py)
@@ -46,7 +45,6 @@ PYSIDE_TEST(multiple_feature_test.py)
PYSIDE_TEST(python_conversion.py)
PYSIDE_TEST(qabs_test.py)
PYSIDE_TEST(qabstractitemmodel_test.py)
-PYSIDE_TEST(qabstracttransition_test.py)
PYSIDE_TEST(qanimationgroup_test.py)
PYSIDE_TEST(qbitarray_test.py)
PYSIDE_TEST(qbytearray_buffer_protocol_test.py)
@@ -107,8 +105,6 @@ PYSIDE_TEST(qslot_object_test.py)
PYSIDE_TEST(qsocketnotifier_test.py)
PYSIDE_TEST(qsrand_test.py)
PYSIDE_TEST(qstandardpaths_test.py)
-PYSIDE_TEST(qstatemachine_test.py)
-PYSIDE_TEST(qstate_test.py)
PYSIDE_TEST(qstorageinfo_test.py)
PYSIDE_TEST(qstring_test.py)
PYSIDE_TEST(qsysinfo_test.py)
diff --git a/sources/pyside2/tests/QtCore/bug_1031.py b/sources/pyside2/tests/QtCore/bug_1031.py
deleted file mode 100644
index 6a7f248cc..000000000
--- a/sources/pyside2/tests/QtCore/bug_1031.py
+++ /dev/null
@@ -1,41 +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
-
-sys.path.append(os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "util"))
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths()
-
-from PySide2.QtCore import QStateMachine, QState
-
-mach = QStateMachine()
-state = QState(mach)
-print(state.machine())
diff --git a/sources/pyside2/tests/QtCore/qabstracttransition_test.py b/sources/pyside2/tests/QtCore/qabstracttransition_test.py
deleted file mode 100644
index 063d266d2..000000000
--- a/sources/pyside2/tests/QtCore/qabstracttransition_test.py
+++ /dev/null
@@ -1,191 +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
-from sys import getrefcount
-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 *
-
-def addStates(transition):
- sx = QState()
- sy = QState()
- transition.setTargetStates([sx, sy])
-
-def addAnimation(transition):
- animation = QParallelAnimationGroup()
- transition.addAnimation(animation)
-
-class QAbstractTransitionTest(unittest.TestCase):
-
- def testBasic(self):
- app = QCoreApplication([])
-
- o = QObject()
- o.setProperty("text", "INdT")
-
- machine = QStateMachine()
- s1 = QState()
- s1.assignProperty(o, "text", "Rocks")
-
- s2 = QFinalState()
- t = s1.addTransition(o, SIGNAL("change()"), s2)
-
- self.assertEqual(t.targetStates(), [s2])
-
- addStates(t)
- self.assertEqual(len(t.targetStates()), 2)
-
- animation = QParallelAnimationGroup()
- t.addAnimation(animation)
-
- self.assertEqual(t.animations(), [animation])
-
- addAnimation(t)
- self.assertEqual(t.animations()[0].parent(), None)
-
- machine.addState(s1)
- machine.addState(s2)
- machine.setInitialState(s1)
- machine.start()
-
- QTimer.singleShot(100, app.quit)
- app.exec_()
-
- def testRefCountOfTargetState(self):
- transition = QEventTransition()
- state1 = QState()
- refcount1 = getrefcount(state1)
-
- transition.setTargetState(state1)
-
- self.assertEqual(transition.targetState(), state1)
- self.assertEqual(getrefcount(transition.targetState()), refcount1 + 1)
-
- state2 = QState()
- refcount2 = getrefcount(state2)
-
- transition.setTargetState(state2)
-
- self.assertEqual(transition.targetState(), state2)
- self.assertEqual(getrefcount(transition.targetState()), refcount2 + 1)
- self.assertEqual(getrefcount(state1), refcount1)
-
- del transition
-
- self.assertEqual(getrefcount(state2), refcount2)
-
- def testRefCountOfTargetStates(self):
- transition = QEventTransition()
- state1 = QState()
- state2 = QState()
- states = [state1, state2]
- refcount1 = getrefcount(state1)
- refcount2 = getrefcount(state2)
-
- transition.setTargetStates(states)
-
- self.assertEqual(transition.targetStates(), states)
- self.assertEqual(transition.targetState(), state1)
- self.assertEqual(getrefcount(transition.targetStates()[0]), refcount1 + 1)
- self.assertEqual(getrefcount(transition.targetStates()[1]), refcount2 + 1)
-
- del states
- del transition
-
- self.assertEqual(getrefcount(state1), refcount1 - 1)
- self.assertEqual(getrefcount(state2), refcount2 - 1)
-
- def testRefCountOfTargetStatesAfterSingleTargetState(self):
- transition = QEventTransition()
- state0 = QState()
- refcount0 = getrefcount(state0)
-
- transition.setTargetState(state0)
-
- self.assertEqual(transition.targetState(), state0)
- self.assertEqual(getrefcount(transition.targetState()), refcount0 + 1)
-
- state1 = QState()
- state2 = QState()
- states = [state1, state2]
- refcount1 = getrefcount(state1)
- refcount2 = getrefcount(state2)
-
- transition.setTargetStates(states)
-
- self.assertEqual(getrefcount(state0), refcount0)
- self.assertEqual(transition.targetStates(), states)
- self.assertEqual(transition.targetState(), state1)
- self.assertEqual(getrefcount(transition.targetStates()[0]), refcount1 + 1)
- self.assertEqual(getrefcount(transition.targetStates()[1]), refcount2 + 1)
-
- del states
- del transition
-
- self.assertEqual(getrefcount(state1), refcount1 - 1)
- self.assertEqual(getrefcount(state2), refcount2 - 1)
-
- def testRefCountOfTargetStatesBeforeSingleTargetState(self):
- transition = QEventTransition()
- state1 = QState()
- state2 = QState()
- states = [state1, state2]
- refcount1 = getrefcount(state1)
- refcount2 = getrefcount(state2)
-
- transition.setTargetStates(states)
-
- self.assertEqual(transition.targetStates(), states)
- self.assertEqual(transition.targetState(), state1)
- self.assertEqual(getrefcount(transition.targetStates()[0]), refcount1 + 1)
- self.assertEqual(getrefcount(transition.targetStates()[1]), refcount2 + 1)
-
- state3 = QState()
- refcount3 = getrefcount(state3)
-
- transition.setTargetState(state3)
-
- self.assertEqual(transition.targetState(), state3)
- self.assertEqual(getrefcount(transition.targetState()), refcount3 + 1)
-
- del states
-
- self.assertEqual(getrefcount(state1), refcount1 - 1)
- self.assertEqual(getrefcount(state2), refcount2 - 1)
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/sources/pyside2/tests/QtCore/qbytearray_test.py b/sources/pyside2/tests/QtCore/qbytearray_test.py
index c17b7efb1..5202569f1 100644
--- a/sources/pyside2/tests/QtCore/qbytearray_test.py
+++ b/sources/pyside2/tests/QtCore/qbytearray_test.py
@@ -165,12 +165,6 @@ class TestBug567(unittest.TestCase):
self.assertEqual(ba[::-2], '08642')
self.assertEqual(ba[2:8:3], '36')
-class QByteArrayBug514(unittest.TestCase):
- def testIt(self):
- data = py3k.b("foobar")
- a = QByteArray.fromRawData(data)
- self.assertEqual(type(a), QByteArray)
- self.assertEqual(a.data(), data)
class TestPickler(unittest.TestCase):
def testIt(self):
diff --git a/sources/pyside2/tests/QtCore/qstate_test.py b/sources/pyside2/tests/QtCore/qstate_test.py
deleted file mode 100644
index 4c97fecca..000000000
--- a/sources/pyside2/tests/QtCore/qstate_test.py
+++ /dev/null
@@ -1,71 +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 *
-
-
-class QStateTest(unittest.TestCase):
- def testBasic(self):
- app = QCoreApplication([])
-
- o = QObject()
- o.setProperty("text", "INdT")
-
- machine = QStateMachine()
- s1 = QState()
- s1.assignProperty(o, "text", "Rocks");
-
- s2 = QFinalState()
- t = s1.addTransition(o, SIGNAL("change()"), s2);
- self.assertTrue(isinstance(t, QSignalTransition))
-
- machine.addState(s1)
- machine.addState(s2)
- machine.setInitialState(s1)
- machine.start()
-
- o.emit(SIGNAL("change()"))
-
- QTimer.singleShot(100, app.quit)
- app.exec_()
-
- txt = o.property("text")
- self.assertTrue(txt, "Rocks")
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/QtCore/qstatemachine_test.py b/sources/pyside2/tests/QtCore/qstatemachine_test.py
deleted file mode 100644
index 19dcb1e81..000000000
--- a/sources/pyside2/tests/QtCore/qstatemachine_test.py
+++ /dev/null
@@ -1,104 +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 QObject, QState, QFinalState, SIGNAL
-from PySide2.QtCore import QTimer, QStateMachine
-from PySide2.QtCore import QParallelAnimationGroup
-
-from helper.usesqcoreapplication import UsesQCoreApplication
-
-
-class StateMachineTest(unittest.TestCase):
- '''Check presence of State Machine classes'''
-
- def testBasic(self):
- '''State machine classes'''
- import PySide2.QtCore
- PySide2.QtCore.QSignalTransition
- PySide2.QtCore.QPropertyAnimation
-
-
-
-class QStateMachineTest(UsesQCoreApplication):
-
- def cb(self, *args):
- self.assertEqual(self.machine.defaultAnimations(), [self.anim])
-
- def testBasic(self):
- self.machine = QStateMachine()
- s1 = QState()
- s2 = QState()
- s3 = QFinalState()
-
- QObject.connect(self.machine, SIGNAL("started()"), self.cb)
-
- self.anim = QParallelAnimationGroup()
-
- self.machine.addState(s1)
- self.machine.addState(s2)
- self.machine.addState(s3)
- self.machine.setInitialState(s1)
- self.machine.addDefaultAnimation(self.anim)
- self.machine.start()
-
- QTimer.singleShot(100, self.app.quit)
- self.app.exec_()
-
-
-class QSetConverterTest(UsesQCoreApplication):
- '''Test converter of QSet toPython using QStateAnimation.configuration'''
-
- def testBasic(self):
- '''QStateMachine.configuration converting QSet to python set'''
- machine = QStateMachine()
- s1 = QState()
- machine.addState(s1)
- machine.setInitialState(s1)
- machine.start()
-
- QTimer.singleShot(100, self.app.quit)
- self.app.exec_()
-
- configuration = machine.configuration()
-
- self.assertTrue(isinstance(configuration, set))
- self.assertTrue(s1 in configuration)
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/QtCore/setprop_on_ctor_test.py b/sources/pyside2/tests/QtCore/setprop_on_ctor_test.py
index e149f8ffb..2d208cb69 100644
--- a/sources/pyside2/tests/QtCore/setprop_on_ctor_test.py
+++ b/sources/pyside2/tests/QtCore/setprop_on_ctor_test.py
@@ -36,13 +36,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.QtCore import *
+from PySide2.QtCore import QTimer
class SetPropOnCtorTest(unittest.TestCase):
def testIt(self):
- obj = QEventTransition(targetStates = [QState()])
- self.assertEqual(len(obj.targetStates()), 1);
+ timer = QTimer(interval = 42)
+ self.assertEqual(timer.interval(), 42);
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside2/tests/support/voidptr_test.py b/sources/pyside2/tests/support/voidptr_test.py
index 9e3668eb1..367d250da 100644
--- a/sources/pyside2/tests/support/voidptr_test.py
+++ b/sources/pyside2/tests/support/voidptr_test.py
@@ -53,7 +53,7 @@ class PySide2Support(unittest.TestCase):
self.assertIsInstance(vp, shiboken.VoidPtr)
# Create QByteArray from voidptr byte interpretation
- nba = QByteArray.fromRawData(vp.toBytes())
+ nba = QByteArray(vp.toBytes())
# Compare original bytes to toBytes()
self.assertTrue(b, vp.toBytes())
# Compare original with new QByteArray data