aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/tests/QtScript
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside2/tests/QtScript')
-rw-r--r--sources/pyside2/tests/QtScript/CMakeLists.txt5
-rw-r--r--sources/pyside2/tests/QtScript/base_test.py39
-rw-r--r--sources/pyside2/tests/QtScript/bug_1022.py47
-rw-r--r--sources/pyside2/tests/QtScript/engine_test.py47
-rw-r--r--sources/pyside2/tests/QtScript/property_test.py96
-rw-r--r--sources/pyside2/tests/QtScript/qscriptvalue_test.py78
6 files changed, 0 insertions, 312 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()