diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-09-04 08:15:17 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-09-04 08:29:54 +0000 |
commit | 9768da0be5a09632c60c4e4035fa52b9c55376df (patch) | |
tree | d9e0d8545e08597f208cda183787b51028fa0680 /sources/pyside2/tests | |
parent | f47818b5c710aa6ae5f76809046105cb8c3d9f7f (diff) |
Remove QtScript, QtXmlPatterns
They are obsolete in Qt 6.
Task-number: PYSIDE-1339
Task-number: PYSIDE-904
Change-Id: I70816b3c3270a1db65ad3b3871a09c62d31420e5
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/pyside2/tests')
-rw-r--r-- | sources/pyside2/tests/QtScript/CMakeLists.txt | 5 | ||||
-rw-r--r-- | sources/pyside2/tests/QtScript/base_test.py | 39 | ||||
-rw-r--r-- | sources/pyside2/tests/QtScript/bug_1022.py | 47 | ||||
-rw-r--r-- | sources/pyside2/tests/QtScript/engine_test.py | 47 | ||||
-rw-r--r-- | sources/pyside2/tests/QtScript/property_test.py | 96 | ||||
-rw-r--r-- | sources/pyside2/tests/QtScript/qscriptvalue_test.py | 78 | ||||
-rw-r--r-- | sources/pyside2/tests/QtScriptTools/CMakeLists.txt | 1 | ||||
-rw-r--r-- | sources/pyside2/tests/QtScriptTools/debugger_test.py | 81 | ||||
-rw-r--r-- | sources/pyside2/tests/QtXmlPatterns/CMakeLists.txt | 1 | ||||
-rw-r--r-- | sources/pyside2/tests/QtXmlPatterns/import_test.py | 66 |
10 files changed, 0 insertions, 461 deletions
diff --git a/sources/pyside2/tests/QtScript/CMakeLists.txt b/sources/pyside2/tests/QtScript/CMakeLists.txt deleted file mode 100644 index dfea68df0..000000000 --- a/sources/pyside2/tests/QtScript/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -PYSIDE_TEST(base_test.py) -PYSIDE_TEST(bug_1022.py) -PYSIDE_TEST(engine_test.py) -PYSIDE_TEST(property_test.py) -PYSIDE_TEST(qscriptvalue_test.py) diff --git a/sources/pyside2/tests/QtScript/base_test.py b/sources/pyside2/tests/QtScript/base_test.py deleted file mode 100644 index 3cde8ad83..000000000 --- a/sources/pyside2/tests/QtScript/base_test.py +++ /dev/null @@ -1,39 +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.dirname(os.path.dirname(os.path.abspath(__file__)))) -from init_paths import init_test_paths -init_test_paths(False) - -from PySide2 import QtScript - - -#only test if the module import works fine bug #278 diff --git a/sources/pyside2/tests/QtScript/bug_1022.py b/sources/pyside2/tests/QtScript/bug_1022.py deleted file mode 100644 index 2c2699de6..000000000 --- a/sources/pyside2/tests/QtScript/bug_1022.py +++ /dev/null @@ -1,47 +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 * -from PySide2.QtScript import * - -class QScriptValueTest(unittest.TestCase): - def testQScriptValue(self): - app = QCoreApplication([]) - engine = QScriptEngine() - repr(engine.evaluate('1 + 1')) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtScript/engine_test.py b/sources/pyside2/tests/QtScript/engine_test.py deleted file mode 100644 index f88b98d69..000000000 --- a/sources/pyside2/tests/QtScript/engine_test.py +++ /dev/null @@ -1,47 +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 QObject -from PySide2.QtScript import QScriptEngine - -class QScriptEngineTest(unittest.TestCase): - - def testQScriptEngine(self): - engine = QScriptEngine() - obj = engine.evaluate("({ unitName: 'Celsius', toKelvin: function(x) { return x + 273; } })") - toKelvin = obj.property("toKelvin") - result = toKelvin.call(obj, [100]) - self.assertEqual(result.toNumber(), 373) diff --git a/sources/pyside2/tests/QtScript/property_test.py b/sources/pyside2/tests/QtScript/property_test.py deleted file mode 100644 index 372bba2ba..000000000 --- a/sources/pyside2/tests/QtScript/property_test.py +++ /dev/null @@ -1,96 +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 QObject, Property, QCoreApplication -from PySide2.QtScript import QScriptEngine - -class MyObject(QObject): - def __init__(self, parent = None): - QObject.__init__(self, parent) - self._p = 100 - - def setX(self, value): - self._p = value - - def getX(self): - return self._p - - def resetX(self): - self._p = 100 - - def delX(self): - self._p = 0 - - x = Property(int, getX, setX, resetX, delX) - - -class QPropertyTest(unittest.TestCase): - - def testSimple(self): - o = MyObject() - self.assertEqual(o.x, 100) - o.x = 42 - self.assertEqual(o.x, 42) - - def testHasProperty(self): - o = MyObject() - o.setProperty("x", 10) - self.assertEqual(o.x, 10) - self.assertEqual(o.property("x"), 10) - - def testMetaProperty(self): - o = MyObject() - m = o.metaObject() - found = False - for i in range(m.propertyCount()): - mp = m.property(i) - if mp.name() == "x": - found = True - break - self.assertTrue(found) - - def testScriptQProperty(self): - qapp = QCoreApplication([]) - myEngine = QScriptEngine() - obj = MyObject() - scriptObj = myEngine.newQObject(obj) - myEngine.globalObject().setProperty("obj", scriptObj) - myEngine.evaluate("obj.x = 42") - self.assertEqual(scriptObj.property("x").toInt32(), 42) - self.assertEqual(obj.property("x"), 42) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtScript/qscriptvalue_test.py b/sources/pyside2/tests/QtScript/qscriptvalue_test.py deleted file mode 100644 index 06a029232..000000000 --- a/sources/pyside2/tests/QtScript/qscriptvalue_test.py +++ /dev/null @@ -1,78 +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$ -## -############################################################################# - -from __future__ import print_function - -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.QtScript import * - -# Required for eval() to work -import PySide2.QtScript - -from helper.usesqapplication import UsesQApplication - -class TestQScriptValue (UsesQApplication): - - def testOperator(self): - engine = QScriptEngine() - value = engine.evaluate('x = {"a": 1, "b":2}') - self.assertEqual(value['a'], 1) - self.assertRaises(KeyError, value.__getitem__, 'c') - value = engine.evaluate('x = ["x", "y", "z"]') - self.assertEqual(value[2], 'z') - self.assertRaises(IndexError, value.__getitem__, 23) - - def testRepr(self): - value = QScriptValue("somePerson = { firstName: 'John', lastName: 'Doe' }") - print(repr(value)) - value2 = eval(repr(value)) - self.assertEqual(value.toString(), value2.toString()) - self.assertEqual(value.toVariant(), value2.toVariant()) - - def testIteratorProtocol(self): - engine = QScriptEngine() - value = engine.evaluate('x = {"a": 1, "b":2}') - d = {} - for k, v in QScriptValueIterator(value): - d[k] = v - self.assertEqual(d, {'a': 1, 'b': 2}) - - d = {} - for k, v in value: - d[k] = v - self.assertEqual(d, {'a': 1, 'b': 2}) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtScriptTools/CMakeLists.txt b/sources/pyside2/tests/QtScriptTools/CMakeLists.txt deleted file mode 100644 index ee22737c6..000000000 --- a/sources/pyside2/tests/QtScriptTools/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -PYSIDE_TEST(debugger_test.py) diff --git a/sources/pyside2/tests/QtScriptTools/debugger_test.py b/sources/pyside2/tests/QtScriptTools/debugger_test.py deleted file mode 100644 index cefe48f5b..000000000 --- a/sources/pyside2/tests/QtScriptTools/debugger_test.py +++ /dev/null @@ -1,81 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import os -import sys -import unittest - -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 SIGNAL, QTimer -from PySide2.QtScript import QScriptEngine -from PySide2.QtScriptTools import QScriptEngineDebugger - -from helper.usesqapplication import UsesQApplication - -class DebuggerTest(UsesQApplication): - - def setUp(self): - UsesQApplication.setUp(self) - self.engine = QScriptEngine() - self.debugger = QScriptEngineDebugger() - self.has_suspended = 0 - self.has_resumed = 0 - self.count = 3 - - def suspended(self): - self.has_suspended += 1 - # Will emit evaluationResumed until there are more instructions to be run - QTimer.singleShot(100, self.debugger.action(QScriptEngineDebugger.StepIntoAction).trigger) - - def resumed(self): - # Will be called when debugger.state() change from Suspended to Running - # except for the first time. - self.has_resumed += 1 - - def testBasic(self): - '''Interrupt and resume evaluation with QScriptEngineDebugger''' - - self.debugger.attachTo(self.engine) - self.debugger.setAutoShowStandardWindow(False) - self.debugger.connect(SIGNAL('evaluationSuspended()'), self.suspended) - self.debugger.connect(SIGNAL('evaluationResumed()'), self.resumed) - - # For some reason StepIntoAction does not actually continue execution, and thus interrupting - # causes the test to hang. The same behavior is present in a Qt5.6 C++ code equivalent. It - # seems like a bug in QtScript, thus the interruption is commented out for now, which will - # force the test to fail. - #self.debugger.action(QScriptEngineDebugger.InterruptAction).trigger() - self.engine.evaluate("3+4\n2+1\n5+1") - self.assertTrue(self.has_resumed >= 1) - self.assertTrue(self.has_suspended >= 1) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtXmlPatterns/CMakeLists.txt b/sources/pyside2/tests/QtXmlPatterns/CMakeLists.txt deleted file mode 100644 index 7f570f156..000000000 --- a/sources/pyside2/tests/QtXmlPatterns/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -PYSIDE_TEST(import_test.py) diff --git a/sources/pyside2/tests/QtXmlPatterns/import_test.py b/sources/pyside2/tests/QtXmlPatterns/import_test.py deleted file mode 100644 index e60034e0d..000000000 --- a/sources/pyside2/tests/QtXmlPatterns/import_test.py +++ /dev/null @@ -1,66 +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 * -from PySide2.QtXmlPatterns import QXmlSchema -from helper.usesqcoreapplication import UsesQCoreApplication - - -class QXmlPatternsTest(UsesQCoreApplication): - - def testSchema(self): - data = QByteArray(py3k.b('''<?xml version=\"1.0\" encoding=\"UTF-8\"?> - <xsd:schema - xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" - xmlns=\"http://qt.nokia.com/xmlschematest\" - targetNamespace=\"http://qt.nokia.com/xmlschematest\" - version=\"1.0\" - elementFormDefault=\"qualified\"> - </xsd:schema>''')) - - buf = QBuffer(data) - buf.open(QIODevice.ReadOnly) - - schema = QXmlSchema() - schema.load(buf) - self.assertTrue(schema.isValid()) - - -if __name__ == '__main__': - unittest.main() - |