diff options
Diffstat (limited to 'sources/pyside2/tests/QtQml')
48 files changed, 0 insertions, 3074 deletions
diff --git a/sources/pyside2/tests/QtQml/CMakeLists.txt b/sources/pyside2/tests/QtQml/CMakeLists.txt deleted file mode 100644 index e35831f25..000000000 --- a/sources/pyside2/tests/QtQml/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -PYSIDE_TEST(bug_451.py) -PYSIDE_TEST(bug_456.py) -PYSIDE_TEST(bug_557.py) -PYSIDE_TEST(bug_726.py) -PYSIDE_TEST(bug_814.py) -PYSIDE_TEST(bug_825.py) -PYSIDE_TEST(bug_847.py) -PYSIDE_TEST(bug_915.py) -PYSIDE_TEST(bug_926.py) -PYSIDE_TEST(bug_951.py) -PYSIDE_TEST(bug_995.py) -PYSIDE_TEST(bug_997.py) -PYSIDE_TEST(bug_1029.py) -PYSIDE_TEST(listproperty.py) -PYSIDE_TEST(qqmlnetwork_test.py) -PYSIDE_TEST(qquickview_test.py) -PYSIDE_TEST(connect_python_qml.py) -PYSIDE_TEST(registertype.py) -PYSIDE_TEST(registeruncreatabletype.py) -PYSIDE_TEST(registersingletontype.py) -PYSIDE_TEST(javascript_exceptions.py) -PYSIDE_TEST(qqmlincubator_incubateWhile.py) -PYSIDE_TEST(qquickitem_grabToImage.py) -PYSIDE_TEST(signal_arguments.py) diff --git a/sources/pyside2/tests/QtQml/bug_1029.py b/sources/pyside2/tests/QtQml/bug_1029.py deleted file mode 100644 index 36306e4a2..000000000 --- a/sources/pyside2/tests/QtQml/bug_1029.py +++ /dev/null @@ -1,64 +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 QUrl -from PySide2.QtGui import QGuiApplication -from PySide2.QtQml import qmlRegisterType -from PySide2.QtQuick import QQuickView, QQuickItem - -def register_qml_types(): - class TestClass(QQuickItem): - def __init__(self, parent = None): - QQuickItem.__init__(self, parent) - - qmlRegisterType(TestClass, "UserTypes", 1, 0, "TestClass") - -def main(): - app = QGuiApplication([]) - - # reg qml types here - register_qml_types() - - # force gc to run - gc.collect() - - view = QQuickView() - url = QUrl(__file__.replace(".py", ".qml")) - view.setSource(url) - -if __name__ == "__main__": - main() diff --git a/sources/pyside2/tests/QtQml/bug_1029.qml b/sources/pyside2/tests/QtQml/bug_1029.qml deleted file mode 100644 index 000a7568b..000000000 --- a/sources/pyside2/tests/QtQml/bug_1029.qml +++ /dev/null @@ -1,43 +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 QtQuick 2.0 -import UserTypes 1.0 - -Rectangle -{ - width: 200 - height: 200 - - color: "#ff0000" - - TestClass - { - - } -} diff --git a/sources/pyside2/tests/QtQml/bug_451.py b/sources/pyside2/tests/QtQml/bug_451.py deleted file mode 100644 index f87680638..000000000 --- a/sources/pyside2/tests/QtQml/bug_451.py +++ /dev/null @@ -1,105 +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 451: http://bugs.openbossa.org/show_bug.cgi?id=451 - -An archive of said bug: -https://srinikom.github.io/pyside-bz-archive/451.html -''' - -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.helper import adjust_filename - -from PySide2 import QtCore, QtGui, QtQuick - -class PythonObject(QtCore.QObject): - def __init__(self): - QtCore.QObject.__init__(self, None) - self._called = "" - self._arg1 = None - self._arg2 = None - - def setCalled(self, v): - self._called = v - - def setArg1(self, v): - self._arg1 = v - - def setArg2(self, v): - self._arg2 = v - - def getCalled(self): - return self._called - - def getArg1(self): - return self._arg1 - - def getArg2(self): - return self._arg2 - - called = QtCore.Property(str, getCalled, setCalled) - arg1 = QtCore.Property(int, getArg1, setArg1) - arg2 = QtCore.Property('QVariant', getArg2, setArg2) - -class TestBug(unittest.TestCase): - def testQMLFunctionCall(self): - app = QtGui.QGuiApplication(sys.argv) - view = QtQuick.QQuickView() - - obj = PythonObject() - context = view.rootContext() - context.setContextProperty("python", obj) - view.setSource(QtCore.QUrl.fromLocalFile(adjust_filename('bug_451.qml', __file__))) - root = view.rootObject() - root.simpleFunction() - self.assertEqual(obj.called, "simpleFunction") - - root.oneArgFunction(42) - self.assertEqual(obj.called, "oneArgFunction") - self.assertEqual(obj.arg1, 42) - - root.twoArgFunction(10, app) - self.assertEqual(obj.called, "twoArgFunction") - self.assertEqual(obj.arg1, 10) - self.assertEqual(obj.arg2, app) - - rvalue = root.returnFunction() - self.assertEqual(obj.called, "returnFunction") - self.assertEqual(rvalue, 42) - - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtQml/bug_451.qml b/sources/pyside2/tests/QtQml/bug_451.qml deleted file mode 100644 index 71bf691b4..000000000 --- a/sources/pyside2/tests/QtQml/bug_451.qml +++ /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 QtQuick 2.0 - -Rectangle { - id: page - - function simpleFunction() { - python.called = "simpleFunction" - } - - function oneArgFunction(x) { - python.called = "oneArgFunction" - python.arg1 = x - } - - function twoArgFunction(x, y) { - python.called = "twoArgFunction" - python.arg1 = x - python.arg2 = y - } - - function returnFunction() { - python.called = "returnFunction" - return 42 - } - -} diff --git a/sources/pyside2/tests/QtQml/bug_456.py b/sources/pyside2/tests/QtQml/bug_456.py deleted file mode 100644 index a99ce2b80..000000000 --- a/sources/pyside2/tests/QtQml/bug_456.py +++ /dev/null @@ -1,77 +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 helper.helper import adjust_filename -from helper.timedqapplication import TimedQApplication - -from PySide2 import QtCore, QtGui, QtQuick - -class RotateValue(QtCore.QObject): - def __init__(self): - super(RotateValue,self).__init__() - - @QtCore.Slot(result=int) - def val(self): - return 100 - - def setRotation(self, v): - self._rotation = v - - def getRotation(self): - return self._rotation - - rotation = QtCore.Property(int, getRotation, setRotation) - -class TestConnectionWithInvalidSignature(TimedQApplication): - - def testSlotRetur(self): - view = QtQuick.QQuickView() - rotatevalue = RotateValue() - - timer = QtCore.QTimer() - timer.start(2000) - - context = view.rootContext() - context.setContextProperty("rotatevalue", rotatevalue) - view.setSource(QtCore.QUrl.fromLocalFile(adjust_filename('bug_456.qml', __file__))) - root = view.rootObject() - button = root.findChild(QtCore.QObject, "buttonMouseArea") - view.show() - button.entered.emit() - self.assertEqual(rotatevalue.rotation, 100) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtQml/bug_456.qml b/sources/pyside2/tests/QtQml/bug_456.qml deleted file mode 100644 index 9b1b8c03c..000000000 --- a/sources/pyside2/tests/QtQml/bug_456.qml +++ /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$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Rectangle { - id: page - - width: 500; height: 200 - color: "lightgray" - - Rectangle { - id: button - width: 150; height: 40 - color: "darkgray" - anchors.horizontalCenter: page.horizontalCenter - y: 120 - MouseArea { - id: buttonMouseArea - objectName: "buttonMouseArea" - anchors.fill: parent - onEntered: { - rotatevalue.rotation = rotatevalue.val() - } - } - Text { - id: buttonText - text: "Press me!" - anchors.horizontalCenter: button.horizontalCenter - anchors.verticalCenter: button.verticalCenter - font.pointSize: 16; - } - } -} diff --git a/sources/pyside2/tests/QtQml/bug_557.py b/sources/pyside2/tests/QtQml/bug_557.py deleted file mode 100644 index 20892475f..000000000 --- a/sources/pyside2/tests/QtQml/bug_557.py +++ /dev/null @@ -1,50 +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 helper.helper import adjust_filename - -from PySide2.QtCore import QUrl -from PySide2.QtGui import QGuiApplication -from PySide2.QtQml import QQmlEngine, QQmlComponent - -app = QGuiApplication(sys.argv) - -engine = QQmlEngine() -component = QQmlComponent(engine) - -# This should segfault if the QDeclarativeComponent has not QQmlEngine -component.loadUrl(QUrl.fromLocalFile(adjust_filename('foo.qml', __file__))) - diff --git a/sources/pyside2/tests/QtQml/bug_726.py b/sources/pyside2/tests/QtQml/bug_726.py deleted file mode 100644 index 795d8a13f..000000000 --- a/sources/pyside2/tests/QtQml/bug_726.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$ -## -############################################################################# - -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.helper import adjust_filename -from helper.timedqapplication import TimedQApplication - -from PySide2 import QtCore, QtGui, QtQuick - -class ProxyObject(QtCore.QObject): - def __init__(self): - super(ProxyObject,self).__init__() - self._o = None - self._receivedName = "" - - @QtCore.Slot(result='QObject*') - def getObject(self): - if self._o: - return self._o - - self._o = QtCore.QObject() - self._o.setObjectName("PySideObject") - return self._o - - @QtCore.Slot(str) - def receivedObject(self, name): - self._receivedName = name - - -class TestConnectionWithInvalidSignature(TimedQApplication): - - def testSlotRetur(self): - view = QtQuick.QQuickView() - proxy = ProxyObject() - - context = view.rootContext() - context.setContextProperty("proxy", proxy) - view.setSource(QtCore.QUrl.fromLocalFile(adjust_filename('bug_726.qml', __file__))) - root = view.rootObject() - button = root.findChild(QtCore.QObject, "buttonMouseArea") - view.show() - button.entered.emit() - self.assertEqual(proxy._receivedName, "PySideObject") - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtQml/bug_726.qml b/sources/pyside2/tests/QtQml/bug_726.qml deleted file mode 100644 index 79f960243..000000000 --- a/sources/pyside2/tests/QtQml/bug_726.qml +++ /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$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Rectangle { - id: page - - width: 500; height: 200 - color: "lightgray" - - Rectangle { - id: button - width: 150; height: 40 - color: "darkgray" - anchors.horizontalCenter: page.horizontalCenter - y: 120 - MouseArea { - id: buttonMouseArea - objectName: "buttonMouseArea" - anchors.fill: parent - onEntered: { - proxy.receivedObject(proxy.getObject().objectName) - } - } - Text { - id: buttonText - text: "Press me!" - anchors.horizontalCenter: button.horizontalCenter - anchors.verticalCenter: button.verticalCenter - font.pointSize: 16; - } - } -} diff --git a/sources/pyside2/tests/QtQml/bug_814.py b/sources/pyside2/tests/QtQml/bug_814.py deleted file mode 100644 index c6f0b8441..000000000 --- a/sources/pyside2/tests/QtQml/bug_814.py +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Copyright (C) 2011 Thomas Perl <m@thp.io> -## 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 case for PySide bug 814 -# http://bugs.pyside.org/show_bug.cgi?id=814 -# archive: -# https://srinikom.github.io/pyside-bz-archive/814.html -# 2011-04-08 Thomas Perl <m@thp.io> -# Released under the same terms as PySide itself - -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.helper import adjust_filename -from helper.timedqapplication import TimedQApplication - -from PySide2.QtCore import QUrl, QAbstractListModel, QModelIndex, Qt -from PySide2.QtQuick import QQuickView - -class ListModel(QAbstractListModel): - def __init__(self): - QAbstractListModel.__init__(self) - - def roleNames(self): - return { Qt.DisplayRole: b'pysideModelData' } - - def rowCount(self, parent = QModelIndex()): - return 3 - - def data(self, index, role): - if index.isValid() and role == Qt.DisplayRole: - return 'blubb' - return None - -class TestBug814(TimedQApplication): - def testAbstractItemModelTransferToQML(self): - view = QQuickView() - model = ListModel() - view.rootContext().setContextProperty("pythonModel", model) - view.setSource(QUrl.fromLocalFile(adjust_filename('bug_814.qml', __file__))) - root = view.rootObject() - view.show() - -if __name__ == '__main__': - unittest.main() - diff --git a/sources/pyside2/tests/QtQml/bug_814.qml b/sources/pyside2/tests/QtQml/bug_814.qml deleted file mode 100644 index 411896770..000000000 --- a/sources/pyside2/tests/QtQml/bug_814.qml +++ /dev/null @@ -1,36 +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 QtQuick 2.0 - -ListView { - width: 300; height: 300 - delegate: Text { text: pysideModelData } - model: pythonModel -} - diff --git a/sources/pyside2/tests/QtQml/bug_825.py b/sources/pyside2/tests/QtQml/bug_825.py deleted file mode 100644 index 019653e93..000000000 --- a/sources/pyside2/tests/QtQml/bug_825.py +++ /dev/null @@ -1,88 +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 helper.helper import adjust_filename - -from PySide2.QtCore import Qt, QUrl, QTimer -from PySide2.QtGui import QGuiApplication, QPen -from PySide2.QtWidgets import QGraphicsItem -from PySide2.QtQml import qmlRegisterType -from PySide2.QtQuick import QQuickView, QQuickItem, QQuickPaintedItem - -paintCalled = False - -class MetaA(type): - pass - -class A(object): - __metaclass__ = MetaA - -MetaB = type(QQuickPaintedItem) -B = QQuickPaintedItem - -class MetaC(MetaA, MetaB): - pass - -class C(A, B): - __metaclass__ = MetaC - -class Bug825 (C): - def __init__(self, parent = None): - QQuickPaintedItem.__init__(self, parent) - - def paint(self, painter): - global paintCalled - pen = QPen(Qt.black, 2) - painter.setPen(pen); - painter.drawPie(self.boundingRect(), 0, 128); - paintCalled = True - -class TestBug825 (unittest.TestCase): - def testIt(self): - global paintCalled - app = QGuiApplication([]) - qmlRegisterType(Bug825, 'bugs', 1, 0, 'Bug825') - self.assertRaises(TypeError, qmlRegisterType, A, 'bugs', 1, 0, 'A') - - view = QQuickView() - view.setSource(QUrl.fromLocalFile(adjust_filename('bug_825.qml', __file__))) - view.show() - QTimer.singleShot(250, view.close) - app.exec_() - self.assertTrue(paintCalled) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtQml/bug_825.qml b/sources/pyside2/tests/QtQml/bug_825.qml deleted file mode 100644 index 6ae06d5b8..000000000 --- a/sources/pyside2/tests/QtQml/bug_825.qml +++ /dev/null @@ -1,38 +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 QtQuick 2.0 -import bugs 1.0 - -Item { - width: 300; height: 200 - - Bug825 { - anchors.fill: parent - } -} diff --git a/sources/pyside2/tests/QtQml/bug_847.py b/sources/pyside2/tests/QtQml/bug_847.py deleted file mode 100644 index ac5836459..000000000 --- a/sources/pyside2/tests/QtQml/bug_847.py +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Copyright (C) 2011 Thomas Perl <m@thp.io> -## 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$ -## -############################################################################# - -# Testcase for PySide bug 847 -# Released under the same terms as PySide itself -# 2011-05-04 Thomas Perl <m@thp.io> - -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 helper.helper import adjust_filename -from helper.usesqapplication import UsesQApplication - -from PySide2.QtCore import Slot, Signal, QUrl, QTimer, QCoreApplication -from PySide2.QtQuick import QQuickView - -class View(QQuickView): - def __init__(self): - QQuickView.__init__(self) - - called = Signal(int, int) - - @Slot(int, int) - def blubb(self, x, y): - self.called.emit(x, y) - -class TestQML(UsesQApplication): - def done(self, x, y): - self._sucess = True - self.app.quit() - print("done called") - - def testPythonSlot(self): - self._sucess = False - view = View() - - # Connect first, then set the property. - view.called.connect(self.done) - view.setSource(QUrl.fromLocalFile(adjust_filename('bug_847.qml', __file__))) - while view.status() == QQuickView.Loading: - self.app.processEvents() - self.assertEqual(view.status(), QQuickView.Ready) - self.assertTrue(view.rootObject()) - view.rootObject().setProperty('pythonObject', view) - - view.show() - while not view.isExposed(): - self.app.processEvents() - - # Essentially a timeout in case method invocation fails. - QTimer.singleShot(30000, QCoreApplication.instance().quit) - self.app.exec_() - self.assertTrue(self._sucess) - -if __name__ == '__main__': - unittest.main() - diff --git a/sources/pyside2/tests/QtQml/bug_847.qml b/sources/pyside2/tests/QtQml/bug_847.qml deleted file mode 100644 index 3833b1637..000000000 --- a/sources/pyside2/tests/QtQml/bug_847.qml +++ /dev/null @@ -1,62 +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 QtQuick 2.0 - -Rectangle { - width: 500 - height: 500 - color: 'red' - - property variant pythonObject: undefined - - Text { - anchors.centerIn: parent - text: 'click me' - color: 'white' - } - - onPythonObjectChanged: { - if (pythonObject) { - // Delay execution of method invocation, so that the event loop has a chance to start, - // which will subsequently be stopped by the method. - timer.start() - } - } - - Timer { - id: timer - interval: 100; running: false; - onTriggered: { - if (pythonObject) { - pythonObject.blubb(42, 84) - } - } - } -} - diff --git a/sources/pyside2/tests/QtQml/bug_915.py b/sources/pyside2/tests/QtQml/bug_915.py deleted file mode 100644 index 9c888b4ae..000000000 --- a/sources/pyside2/tests/QtQml/bug_915.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/python -# -*- 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$ -## -############################################################################# - -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.timedqapplication import TimedQApplication - -from PySide2.QtQuick import QQuickView, QQuickItem - -class TestBug915(TimedQApplication): - def testReturnPolicy(self): - view = QQuickView() - - item1 = QQuickItem() - item1.setObjectName("Item1") - item1.setParentItem(view.contentItem()) - self.assertEqual(item1.objectName(), "Item1") # check if the item still valid - - item2 = QQuickItem() - item2.setObjectName("Item2") - item2.setParentItem(view.contentItem()) - item1 = None - self.assertEqual(item2.objectName(), "Item2") # check if the item still valid - - view = None - -if __name__ == '__main__': - unittest.main() - - diff --git a/sources/pyside2/tests/QtQml/bug_926.py b/sources/pyside2/tests/QtQml/bug_926.py deleted file mode 100644 index 0764b8e97..000000000 --- a/sources/pyside2/tests/QtQml/bug_926.py +++ /dev/null @@ -1,75 +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 sys -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.helper import adjust_filename - -from PySide2.QtCore import QUrl, QTimer, QObject, Signal, Property -from PySide2.QtGui import QGuiApplication -from PySide2.QtQml import qmlRegisterType -from PySide2.QtQuick import QQuickView - -class MyClass (QObject): - - def __init__(self): - super(MyClass,self).__init__() - self.__url = QUrl() - - def getUrl(self): - return self.__url - - def setUrl(self,value): - newUrl = QUrl(value) - if (newUrl != self.__url): - self.__url = newUrl - self.urlChanged.emit() - - urlChanged = Signal() - urla = Property(QUrl, getUrl, setUrl, notify = urlChanged) - -class TestBug926 (unittest.TestCase): - def testIt(self): - app = QGuiApplication([]) - qmlRegisterType(MyClass,'Example',1,0,'MyClass') - view = QQuickView() - view.setSource(QUrl.fromLocalFile(adjust_filename('bug_926.qml', __file__))) - self.assertEqual(len(view.errors()), 0) - view.show() - QTimer.singleShot(0, app.quit) - app.exec_() - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtQml/bug_926.qml b/sources/pyside2/tests/QtQml/bug_926.qml deleted file mode 100644 index 9217403a4..000000000 --- a/sources/pyside2/tests/QtQml/bug_926.qml +++ /dev/null @@ -1,45 +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 QtQuick 2.0 -import Example 1.0 - -Rectangle { - width: 100 - height: 62 - - MyClass { - id: myClass - urla: "http://www.pyside.org" - } - - Text { - id: name - text: myClass.urla - } -} diff --git a/sources/pyside2/tests/QtQml/bug_951.py b/sources/pyside2/tests/QtQml/bug_951.py deleted file mode 100644 index 8919f5880..000000000 --- a/sources/pyside2/tests/QtQml/bug_951.py +++ /dev/null @@ -1,68 +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 helper.helper import adjust_filename -from helper.timedqapplication import TimedQApplication - -from PySide2.QtCore import QUrl -from PySide2.QtQml import qmlRegisterType -from PySide2.QtQuick import QQuickItem, QQuickView - -class MyItem(QQuickItem): - COMPONENT_COMPLETE_CALLED = False - def __init__(self,parent=None): - super(MyItem, self).__init__(parent) - self.setObjectName("myitem") - - def componentComplete(self): - MyItem.COMPONENT_COMPLETE_CALLED = True - super(MyItem, self).componentComplete() - -class TestRegisterQMLType(TimedQApplication): - def setup(self): - TimedQApplication.setup(self, 100 * 3) # 3s - - def testSignalEmission(self): - qmlRegisterType(MyItem, "my.item", 1, 0, "MyItem") - - view = QQuickView() - view.setSource(QUrl.fromLocalFile(adjust_filename('bug_951.qml', __file__))) - - self.app.exec_() - self.assertTrue(MyItem.COMPONENT_COMPLETE_CALLED) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtQml/bug_951.qml b/sources/pyside2/tests/QtQml/bug_951.qml deleted file mode 100644 index 8242223f9..000000000 --- a/sources/pyside2/tests/QtQml/bug_951.qml +++ /dev/null @@ -1,35 +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 QtQuick 2.0 -import my.item 1.0 -Rectangle{ - width:10 - height:10 - MyItem{ } -} diff --git a/sources/pyside2/tests/QtQml/bug_995.py b/sources/pyside2/tests/QtQml/bug_995.py deleted file mode 100644 index 945cd5bcc..000000000 --- a/sources/pyside2/tests/QtQml/bug_995.py +++ /dev/null @@ -1,52 +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 helper.helper import adjust_filename -from helper.usesqapplication import UsesQApplication - -from PySide2.QtGui import QGuiApplication -from PySide2.QtQuick import QQuickView - -app = QGuiApplication([]) -view = QQuickView(adjust_filename('bug_995.qml', __file__)) -view.show() -view.resize(200, 200) -contentItem = view.contentItem() -item = contentItem.childAt(100, 100) - -# it CAN NOT crash here -print(item) - diff --git a/sources/pyside2/tests/QtQml/bug_995.qml b/sources/pyside2/tests/QtQml/bug_995.qml deleted file mode 100644 index 1369dcca6..000000000 --- a/sources/pyside2/tests/QtQml/bug_995.qml +++ /dev/null @@ -1,40 +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 QtQuick 2.0 - -Rectangle { - width: 100 - height: 100 - color: "red" - - Text { - text: "Hello World" - anchors.centerIn: parent - } -} diff --git a/sources/pyside2/tests/QtQml/bug_997.py b/sources/pyside2/tests/QtQml/bug_997.py deleted file mode 100644 index 597e253e5..000000000 --- a/sources/pyside2/tests/QtQml/bug_997.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$ -## -############################################################################# - -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.helper import adjust_filename -from helper.usesqapplication import UsesQApplication - -from PySide2 import QtCore, QtQml, QtQuick - -class TestBug(UsesQApplication): - def testQMLFunctionCall(self): - ownerData = QtQml.QQmlPropertyMap() - ownerData.insert('name', 'John Smith') - ownerData.insert('phone', '555-5555') - ownerData.insert('newValue', '') - - view = QtQuick.QQuickView() - ctxt = view.rootContext() - ctxt.setContextProperty('owner', ownerData) - view.setSource(QtCore.QUrl.fromLocalFile(adjust_filename('bug_997.qml', __file__))) - view.show() - QtCore.QTimer.singleShot(1000, self.app.quit) - self.app.exec_() - self.assertEqual(ownerData.value('newName'), ownerData.value('name')) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtQml/bug_997.qml b/sources/pyside2/tests/QtQml/bug_997.qml deleted file mode 100644 index f36a7e8f8..000000000 --- a/sources/pyside2/tests/QtQml/bug_997.qml +++ /dev/null @@ -1,34 +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 QtQuick 2.0 - -Text { - text: owner.name + " " + owner.phone - Component.onCompleted: { owner.newName = owner.name } -} diff --git a/sources/pyside2/tests/QtQml/connect_python_qml.py b/sources/pyside2/tests/QtQml/connect_python_qml.py deleted file mode 100644 index 22134efe7..000000000 --- a/sources/pyside2/tests/QtQml/connect_python_qml.py +++ /dev/null @@ -1,72 +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 case for bug #442 - -archive: -https://srinikom.github.io/pyside-bz-archive/442.html -''' - -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.helper import adjust_filename -from helper.timedqapplication import TimedQApplication - -from PySide2 import QtCore, QtGui, QtQuick - -class TestConnectionWithInvalidSignature(TimedQApplication): - def onButtonClicked(self): - self.buttonClicked = True - self.app.quit() - - def onButtonFailClicked(self): - pass - - def testFailConnection(self): - self.buttonClicked = False - self.buttonFailClicked = False - view = QtQuick.QQuickView() - view.setSource(QtCore.QUrl.fromLocalFile(adjust_filename('connect_python_qml.qml', __file__))) - root = view.rootObject() - button = root.findChild(QtCore.QObject, "buttonMouseArea") - self.assertRaises(TypeError, QtCore.QObject.connect, [button,QtCore.SIGNAL('entered()'), self.onButtonFailClicked]) - button.entered.connect(self.onButtonClicked) - button.entered.emit() - view.show() - self.app.exec_() - self.assertTrue(self.buttonClicked) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtQml/connect_python_qml.qml b/sources/pyside2/tests/QtQml/connect_python_qml.qml deleted file mode 100644 index 249debf91..000000000 --- a/sources/pyside2/tests/QtQml/connect_python_qml.qml +++ /dev/null @@ -1,48 +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 QtQuick 2.0 - -Rectangle { - id: page - width: 500; height: 200 - color: "lightgray" - - Rectangle { - id: button - width: 150; height: 40 - color: "darkgray" - anchors.horizontalCenter: page.horizontalCenter - y: 150 - MouseArea { - id: buttonMouseArea - objectName: "buttonMouseArea" - anchors.fill: parent - } - } -} diff --git a/sources/pyside2/tests/QtQml/hw.qml b/sources/pyside2/tests/QtQml/hw.qml deleted file mode 100644 index 8b086f31f..000000000 --- a/sources/pyside2/tests/QtQml/hw.qml +++ /dev/null @@ -1,48 +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 QtQuick 2.0 - -Rectangle { - id: page - width: 500; height: 200 - color: "lightgray" - - Text { - id: helloText - text: "Hello world!" - y: 30 - anchors.horizontalCenter: page.horizontalCenter - font.pointSize: 24; font.bold: true - } - - Image { - // It's okay for this to fail. - source: "http://localhost/logo.png" - } -} diff --git a/sources/pyside2/tests/QtQml/javascript_exceptions.py b/sources/pyside2/tests/QtQml/javascript_exceptions.py deleted file mode 100644 index a5e6a4b43..000000000 --- a/sources/pyside2/tests/QtQml/javascript_exceptions.py +++ /dev/null @@ -1,110 +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 helper.helper import adjust_filename -from helper.usesqapplication import UsesQApplication - -from PySide2.QtCore import Slot, Property, Signal, QObject, QUrl -from PySide2.QtQml import QJSEngine, qmlRegisterType -from PySide2.QtQuick import QQuickView - -test_error_message = "This is an error." - -method_test_string = """ -(function (obj) { - obj.methodThrows(); -}) -""" - -property_test_string = """ -(function (obj) { - obj.propertyThrows; -}) -""" - -test_1 = False -test_2 = False - -class TestClass(QObject): - @Slot() - def methodThrows(self): - raise TypeError(test_error_message) - - @Property(str) - def propertyThrows(self): - raise TypeError(test_error_message) - - @Slot(int) - def passTest(self, test): - global test_1, test_2 - - if test == 1: - test_1 = True - else: - test_2 = True - -class JavaScriptExceptionsTest(UsesQApplication): - def test_jsengine(self): - engine = QJSEngine() - test_object = TestClass() - test_value = engine.newQObject(test_object) - - result_1 = engine.evaluate(method_test_string).call([test_value]) - - self.assertTrue(result_1.isError()) - self.assertEqual(result_1.property('message').toString(), test_error_message) - self.assertEqual(result_1.property('name').toString(), 'TypeError') - - result_2 = engine.evaluate(property_test_string).call([test_value]) - - self.assertTrue(result_2.isError()) - self.assertEqual(result_2.property('message').toString(), test_error_message) - self.assertEqual(result_2.property('name').toString(), 'TypeError') - - def test_qml_type(self): - qmlRegisterType(TestClass, 'JavaScriptExceptions', 1, 0, 'JavaScriptExceptions'); - - view = QQuickView() - qml_url = QUrl.fromLocalFile(adjust_filename('javascript_exceptions.qml', __file__)) - - view.setSource(qml_url) - - self.assertTrue(test_1) - self.assertTrue(test_2) - - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtQml/javascript_exceptions.qml b/sources/pyside2/tests/QtQml/javascript_exceptions.qml deleted file mode 100644 index 91cc83ee4..000000000 --- a/sources/pyside2/tests/QtQml/javascript_exceptions.qml +++ /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 QtQuick 2.0 -import QtQuick.Controls 1.0 -import JavaScriptExceptions 1.0 - -Rectangle { - JavaScriptExceptions { - id: obj - } - - Component.onCompleted: { - // Method call test - try { - obj.methodThrows(); - } catch(e) { - obj.passTest(1); - } - - // Property accessor test - try { - obj.propertyThrows; - } catch(e) { - obj.passTest(2); - } - } -}
\ No newline at end of file diff --git a/sources/pyside2/tests/QtQml/listproperty.py b/sources/pyside2/tests/QtQml/listproperty.py deleted file mode 100644 index 6337e5fa4..000000000 --- a/sources/pyside2/tests/QtQml/listproperty.py +++ /dev/null @@ -1,81 +0,0 @@ -############################################################################# -## -## Copyright (C) 2020 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 unittest - -from PySide2.QtCore import QObject -from PySide2.QtQml import ListProperty - -class InheritsQObject(QObject): - pass - -def dummyFunc(): - pass - -class TestListProperty(unittest.TestCase): - def testIt(self): - - # Verify that type checking works properly - type_check_error = False - - try: - ListProperty(QObject) - ListProperty(InheritsQObject) - except: - type_check_error = True - - self.assertFalse(type_check_error) - - try: - ListProperty(int) - except TypeError: - type_check_error = True - - self.assertTrue(type_check_error) - - # Verify that method validation works properly - method_check_error = False - - try: - ListProperty(QObject, append=None, at=None, count=None, replace=None, clear=None, removeLast=None) # Explicitly setting None - ListProperty(QObject, append=dummyFunc) - ListProperty(QObject, count=dummyFunc, at=dummyFunc) - except: - method_check_error = True - - self.assertFalse(method_check_error) - - try: - ListPropery(QObject, append=QObject()) - except: - method_check_error = True - - self.assertTrue(method_check_error) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtQml/qqmlincubator_incubateWhile.py b/sources/pyside2/tests/QtQml/qqmlincubator_incubateWhile.py deleted file mode 100644 index f33d852a7..000000000 --- a/sources/pyside2/tests/QtQml/qqmlincubator_incubateWhile.py +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/python -# -*- 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$ -## -############################################################################# - -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.helper import adjust_filename - -from PySide2.QtCore import QObject, QUrl, Slot, QTimer -from PySide2.QtGui import QGuiApplication -from PySide2.QtQml import QQmlIncubationController, VolatileBool -from PySide2.QtQuick import QQuickView - -class CustomIncubationController(QObject, QQmlIncubationController): - def __init__(self, test): - QObject.__init__(self) - QQmlIncubationController.__init__(self) - self.test = test - self.interrupted = False - - # Incubate every 50 milliseconds - self.startTimer(50) - self.incubationShouldContinue = VolatileBool(True) - self.test.assertEqual(self.incubationShouldContinue.get(), True) - - @Slot() - def interrupter(self): - if not self.interrupted: - self.interrupted = True - self.incubationShouldContinue.set(False) - self.test.assertEqual(self.incubationShouldContinue.get(), False) - QTimer.singleShot(0, QGuiApplication.instance().quit) - - def timerEvent(self, ev): - # Incubate items for 2000 milliseconds, or until the volatile bool is set to false. - self.incubateWhile(self.incubationShouldContinue, 2000) - -class TestBug(unittest.TestCase): - def testIncubateWhileCall(self): - app = QGuiApplication(sys.argv) - view = QQuickView() - controller = CustomIncubationController(self) - view.engine().setIncubationController(controller) - view.setResizeMode(QQuickView.SizeRootObjectToView) - view.setSource(QUrl.fromLocalFile(adjust_filename('qqmlincubator_incubateWhile.qml', - __file__))) - view.show() - - root = view.rootObject() - # The QML code will issue an interrupt signal after half of its items are loaded. - root.shouldInterrupt.connect(controller.interrupter) - res = app.exec_() - - itemsToCreate = root.property("itemsToCreate") - loadedItems = root.property("loadedItems") - self.assertEqual(loadedItems, itemsToCreate / 2) - - # Finish incubating the remaining items. - controller.incubateFor(1000) - loadedItems = root.property("loadedItems") - self.assertEqual(loadedItems, itemsToCreate) - - # Deleting the view before it goes out of scope is required to make sure all child QML - # instances are destroyed in the correct order. - del view - del app - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtQml/qqmlincubator_incubateWhile.qml b/sources/pyside2/tests/QtQml/qqmlincubator_incubateWhile.qml deleted file mode 100644 index 212166a93..000000000 --- a/sources/pyside2/tests/QtQml/qqmlincubator_incubateWhile.qml +++ /dev/null @@ -1,67 +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 QtQuick 2.0 - - -Rectangle { - id: root - objectName: "theNicestRoot" - width: 400; height: 400 - - signal shouldInterrupt() - property int loadedItems: 0 - property int itemsToCreate: 10 - - Row { - anchors.centerIn: parent - spacing: 20 - - Rectangle { - id: initialRectangle - width: 10; height: 10 - color: "red" - } - - Repeater { - model: itemsToCreate - Loader { - id: loader - asynchronous: true - source: "qqmlincubator_incubateWhile_component.qml" - onLoaded: { - root.loadedItems += 1 - - // Interrupt incubation after half of the items are loaded. - if (root.loadedItems >= (itemsToCreate / 2)) { - root.shouldInterrupt() - } - } - } - } - } -} diff --git a/sources/pyside2/tests/QtQml/qqmlincubator_incubateWhile_component.qml b/sources/pyside2/tests/QtQml/qqmlincubator_incubateWhile_component.qml deleted file mode 100644 index 55dbe144a..000000000 --- a/sources/pyside2/tests/QtQml/qqmlincubator_incubateWhile_component.qml +++ /dev/null @@ -1,35 +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 QtQuick 2.0 - -Rectangle { - id: root - width: 10; height: 10 - color: "yellow" -} diff --git a/sources/pyside2/tests/QtQml/qqmlnetwork_test.py b/sources/pyside2/tests/QtQml/qqmlnetwork_test.py deleted file mode 100644 index 2cc273431..000000000 --- a/sources/pyside2/tests/QtQml/qqmlnetwork_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$ -## -############################################################################# - -'''Test cases for QQmlNetwork''' - -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.QtCore import QUrl -from PySide2.QtQuick import QQuickView -from PySide2.QtQml import QQmlNetworkAccessManagerFactory -from PySide2.QtNetwork import QNetworkAccessManager - -from helper.helper import adjust_filename -from helper.timedqapplication import TimedQApplication - - -class CustomManager(QNetworkAccessManager): - def createRequest(self, op, req, data = None): - print(">> createRequest ", self, op, req.url(), data) - return QNetworkAccessManager.createRequest(self, op, req, data) - -class CustomFactory(QQmlNetworkAccessManagerFactory): - def create(self, parent = None): - return CustomManager() - -class TestQQmlNetworkFactory(TimedQApplication): - def setUp(self): - TimedQApplication.setUp(self, timeout=1000) - - def testQQuickNetworkFactory(self): - view = QQuickView() - self.factory = CustomFactory() - view.engine().setNetworkAccessManagerFactory(self.factory) - - url = QUrl.fromLocalFile(adjust_filename('hw.qml', __file__)) - - view.setSource(url) - view.show() - - self.assertEqual(view.status(), QQuickView.Ready) - - self.app.exec_() - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtQml/qquickitem_grabToImage.py b/sources/pyside2/tests/QtQml/qquickitem_grabToImage.py deleted file mode 100644 index 6735d5230..000000000 --- a/sources/pyside2/tests/QtQml/qquickitem_grabToImage.py +++ /dev/null @@ -1,88 +0,0 @@ -############################################################################# -## -## 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$ -## -############################################################################# - -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.helper import adjust_filename -from helper.timedqapplication import TimedQApplication - -from PySide2 import QtCore, QtGui, QtQuick - -class TestGrabToSharedPointerImage(TimedQApplication): - def setUp(self): - TimedQApplication.setUp(self, 1000) - - def testQQuickItemGrabToImageSharedPointer(self): - view = QtQuick.QQuickView() - view.setSource(QtCore.QUrl.fromLocalFile( - adjust_filename('qquickitem_grabToImage.qml', __file__))) - view.show() - - # Get the QQuickItem objects for the blue Rectangle and the Image item. - root = view.rootObject() - blueRectangle = root.findChild(QtQuick.QQuickItem, "blueRectangle") - imageContainer = root.findChild(QtQuick.QQuickItem, "imageContainer") - - # Start the image grabbing. - grabResultSharedPtr = blueRectangle.grabToImage() - - # Implicit call of operator bool() of the smart pointer, to check that it holds - # a valid pointer. - self.assertTrue(grabResultSharedPtr) - - self.grabbedColor = None - def onGrabReady(): - # Signal early exit. - QtCore.QTimer.singleShot(0, self.app.quit) - - # Show the grabbed image in the QML Image item. - imageContainer.setProperty("source", grabResultSharedPtr.url()) - - # Wait for signal when grabbing is complete. - grabResultSharedPtr.ready.connect(onGrabReady) - self.app.exec_() - - # Get the first pixel color of the grabbed image. - self.image = grabResultSharedPtr.image() - self.assertTrue(self.image) - self.grabbedColor = self.image.pixelColor(0,0) - self.assertTrue(self.grabbedColor.isValid()) - - # Compare the grabbed color with the one we set in the rectangle. - blueColor = QtGui.QColor("blue") - self.assertEqual(self.grabbedColor, blueColor) - - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtQml/qquickitem_grabToImage.qml b/sources/pyside2/tests/QtQml/qquickitem_grabToImage.qml deleted file mode 100644 index 17d0cbdfe..000000000 --- a/sources/pyside2/tests/QtQml/qquickitem_grabToImage.qml +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Item { - id: root - width: 600 - height: 600 - - Rectangle { - id: blue - objectName: "blueRectangle" - width: 200 - height: 200 - anchors.top: root.top - anchors.horizontalCenter: root.horizontalCenter - color: "blue" - } - - Text { - text: qsTr("Original blue rectangle") - anchors.left: blue.right - anchors.verticalCenter: blue.verticalCenter - } - - Image { - id: imageContainer - objectName: "imageContainer" - width: 200 - height: 200 - anchors.bottom: root.bottom - anchors.horizontalCenter: root.horizontalCenter - } - - Text { - text: qsTr("Image with the source URL set to the result of calling QQuickItem::grabToImage on the rectangle. If you see a second blue rectangle, that means it works.") - anchors.left: imageContainer.right - anchors.verticalCenter: imageContainer.verticalCenter - wrapMode: Text.WrapAtWordBoundaryOrAnywhere - width: 200 - } - -} diff --git a/sources/pyside2/tests/QtQml/qquickview_test.py b/sources/pyside2/tests/QtQml/qquickview_test.py deleted file mode 100644 index 9694cf56e..000000000 --- a/sources/pyside2/tests/QtQml/qquickview_test.py +++ /dev/null @@ -1,98 +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 cases for QQuickView''' - -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.helper import adjust_filename -from helper.timedqapplication import TimedQApplication - -from PySide2.QtCore import QUrl, QObject, Property, Slot -from PySide2.QtQml import QtQml, QQmlEngine -from PySide2.QtQuick import QQuickView - -class MyObject(QObject): - def __init__(self, text, parent=None): - QObject.__init__(self, parent) - self._text = text - - def getText(self): - return self._text - - - @Slot(str) - def qmlText(self, text): - self._qmlText = text - - title = Property(str, getText) - - -class TestQQuickView(TimedQApplication): - - def testQQuickViewList(self): - view = QQuickView() - - dataList = ["Item 1", "Item 2", "Item 3", "Item 4"] - - ctxt = view.rootContext() - ctxt.setContextProperty("myModel", dataList) - - url = QUrl.fromLocalFile(adjust_filename('view.qml', __file__)) - view.setSource(url) - view.show() - - self.assertEqual(view.status(), QQuickView.Ready) - rootObject = view.rootObject() - self.assertTrue(rootObject) - context = QQmlEngine.contextForObject(rootObject) - self.assertTrue(context) - self.assertTrue(context.engine()) - - def testModelExport(self): - view = QQuickView() - dataList = [MyObject("Item 1"), MyObject("Item 2"), MyObject("Item 3"), MyObject("Item 4")] - - ctxt = view.rootContext() - ctxt.setContextProperty("myModel", dataList) - - url = QUrl.fromLocalFile(adjust_filename('viewmodel.qml', __file__)) - view.setSource(url) - view.show() - - self.assertEqual(view.status(), QQuickView.Ready) - - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtQml/registersingletontype.py b/sources/pyside2/tests/QtQml/registersingletontype.py deleted file mode 100644 index fe3f749f5..000000000 --- a/sources/pyside2/tests/QtQml/registersingletontype.py +++ /dev/null @@ -1,86 +0,0 @@ -############################################################################# -## -## Copyright (C) 2020 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 helper.helper import adjust_filename - -from PySide2.QtCore import Property, Signal, QTimer, QUrl, QObject -from PySide2.QtGui import QGuiApplication -from PySide2.QtQml import qmlRegisterSingletonType -from PySide2.QtQuick import QQuickView - -finalResult = 0 - -class SingletonQObject(QObject): - def __init__(self, parent = None): - QObject.__init__(self, parent) - self._data = 100 - - def getData(self): - return self._data - - def setData(self, data): - global finalResult - finalResult = self._data = data - - data = Property(int, getData, setData) - -def singletonQObjectCallback(engine): - obj = SingletonQObject() - obj.setData(50) - return obj - -def singletonQJSValueCallback(engine): - return engine.evaluate("new Object({data: 50})") - -class TestQmlSupport(unittest.TestCase): - def testIt(self): - app = QGuiApplication([]) - - qmlRegisterSingletonType(SingletonQObject, 'Singletons', 1, 0, 'SingletonQObjectNoCallback') - qmlRegisterSingletonType(SingletonQObject, 'Singletons', 1, 0, 'SingletonQObjectCallback', - singletonQObjectCallback) - - qmlRegisterSingletonType('Singletons', 1, 0, 'SingletonQJSValue', singletonQJSValueCallback) - - view = QQuickView() - view.setSource(QUrl.fromLocalFile(adjust_filename('registersingletontype.qml', __file__))) - view.show() - QTimer.singleShot(250, view.close) - app.exec_() - self.assertEqual(finalResult, 200) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtQml/registersingletontype.qml b/sources/pyside2/tests/QtQml/registersingletontype.qml deleted file mode 100644 index c8b34e69a..000000000 --- a/sources/pyside2/tests/QtQml/registersingletontype.qml +++ /dev/null @@ -1,36 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 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 QtQuick 2.0 -import Singletons 1.0 - -Item { - Component.onCompleted: { - SingletonQObjectCallback.data += SingletonQObjectNoCallback.data + SingletonQJSValue.data - } -} diff --git a/sources/pyside2/tests/QtQml/registertype.py b/sources/pyside2/tests/QtQml/registertype.py deleted file mode 100644 index 2c0577fe3..000000000 --- a/sources/pyside2/tests/QtQml/registertype.py +++ /dev/null @@ -1,125 +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 helper.helper import adjust_filename - -from PySide2.QtCore import Property, QObject, QTimer, QUrl -from PySide2.QtGui import QGuiApplication, QPen, QColor, QPainter -from PySide2.QtQml import qmlRegisterType, ListProperty, QmlElement -from PySide2.QtQuick import QQuickView, QQuickItem, QQuickPaintedItem - -QML_IMPORT_NAME = "Charts" -QML_IMPORT_MAJOR_VERSION = 1 - -@QmlElement -class PieSlice (QQuickPaintedItem): - def __init__(self, parent = None): - QQuickPaintedItem.__init__(self, parent) - self._color = QColor() - self._fromAngle = 0 - self._angleSpan = 0 - - def getColor(self): - return self._color - - def setColor(self, value): - self._color = value - - def getFromAngle(self): - return self._angle - - def setFromAngle(self, value): - self._fromAngle = value - - def getAngleSpan(self): - return self._angleSpan - - def setAngleSpan(self, value): - self._angleSpan = value - - color = Property(QColor, getColor, setColor) - fromAngle = Property(int, getFromAngle, setFromAngle) - angleSpan = Property(int, getAngleSpan, setAngleSpan) - - def paint(self, painter): - global paintCalled - pen = QPen(self._color, 2) - painter.setPen(pen); - painter.setRenderHints(QPainter.Antialiasing, True); - painter.drawPie(self.boundingRect(), self._fromAngle * 16, self._angleSpan * 16); - paintCalled = True - -@QmlElement -class PieChart (QQuickItem): - def __init__(self, parent = None): - QQuickItem.__init__(self, parent) - self._name = '' - self._slices = [] - - def getName(self): - return self._name - - def setName(self, value): - self._name = value - - name = Property(str, getName, setName) - - def appendSlice(self, _slice): - global appendCalled - _slice.setParentItem(self) - self._slices.append(_slice) - appendCalled = True - - slices = ListProperty(PieSlice, append=appendSlice) - -appendCalled = False -paintCalled = False - -class TestQmlSupport(unittest.TestCase): - - def testIt(self): - app = QGuiApplication([]) - - view = QQuickView() - view.setSource(QUrl.fromLocalFile(adjust_filename('registertype.qml', __file__))) - view.show() - QTimer.singleShot(250, view.close) - app.exec_() - self.assertTrue(appendCalled) - self.assertTrue(paintCalled) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtQml/registertype.qml b/sources/pyside2/tests/QtQml/registertype.qml deleted file mode 100644 index c41226016..000000000 --- a/sources/pyside2/tests/QtQml/registertype.qml +++ /dev/null @@ -1,57 +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 QtQuick 2.0 -import Charts 1.0 - -Item { - width: 300; height: 200 - - PieChart { - anchors.centerIn: parent - width: 100; height: 100 - - slices: [ - PieSlice { - anchors.fill: parent - color: "red" - fromAngle: 0; angleSpan: 110 - }, - PieSlice { - anchors.fill: parent - color: "black" - fromAngle: 110; angleSpan: 50 - }, - PieSlice { - anchors.fill: parent - color: "blue" - fromAngle: 160; angleSpan: 100 - } - ] - } -} diff --git a/sources/pyside2/tests/QtQml/registeruncreatable.qml b/sources/pyside2/tests/QtQml/registeruncreatable.qml deleted file mode 100644 index bebf68d82..000000000 --- a/sources/pyside2/tests/QtQml/registeruncreatable.qml +++ /dev/null @@ -1,38 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 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 QtQuick 2.0 -import Charts 1.0 - -Item { - width: 300; height: 200 - - Uncreatable { - name : 'uncreatable' - } -} diff --git a/sources/pyside2/tests/QtQml/registeruncreatabletype.py b/sources/pyside2/tests/QtQml/registeruncreatabletype.py deleted file mode 100644 index 820dc6cc1..000000000 --- a/sources/pyside2/tests/QtQml/registeruncreatabletype.py +++ /dev/null @@ -1,80 +0,0 @@ -############################################################################# -## -## Copyright (C) 2020 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 helper.helper import adjust_filename - -from PySide2.QtCore import Property, QObject, QUrl -from PySide2.QtGui import QGuiApplication -from PySide2.QtQml import qmlRegisterUncreatableType, QQmlEngine, QQmlComponent - -noCreationReason = 'Cannot create an item of type: Uncreatable (expected)'; - -class Uncreatable(QObject): - def __init__(self, parent = None): - QObject.__init__(self, parent) - self._name = 'uncreatable' - - def getName(self): - return self._name - - def setName(self, value): - self._name = value - - name = Property(str, getName, setName) - -class TestQmlSupport(unittest.TestCase): - - def testIt(self): - app = QGuiApplication([]) - - self.assertTrue(qmlRegisterUncreatableType(Uncreatable, 'Charts', 1, 0, - 'Uncreatable', noCreationReason) != -1); - - engine = QQmlEngine() - component = QQmlComponent(engine, QUrl.fromLocalFile(adjust_filename('registeruncreatable.qml', __file__))) - - # Check that the uncreatable item produces the correct error - self.assertEqual(component.status(), QQmlComponent.Error) - errorFound = False - for e in component.errors(): - if noCreationReason in e.toString(): - errorFound = True - break - self.assertTrue(errorFound) - - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtQml/signal_arguments.py b/sources/pyside2/tests/QtQml/signal_arguments.py deleted file mode 100644 index 16257a22f..000000000 --- a/sources/pyside2/tests/QtQml/signal_arguments.py +++ /dev/null @@ -1,77 +0,0 @@ -############################################################################# -## -## 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$ -## -############################################################################# - -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.helper import adjust_filename -from helper.timedqapplication import TimedQApplication - -from PySide2.QtQuick import QQuickView -from PySide2.QtCore import QObject, Signal, Slot, QUrl, QTimer, Property - -class Obj(QObject): - def __init__(self): - QObject.__init__(self) - self.value = 0 - - sumResult = Signal(int, name="sumResult", arguments=['sum']) - - @Slot(int, int) - def sum(self, arg1, arg2): - self.sumResult.emit(arg1 + arg2) - - @Slot(str) - def sendValue(self, s): - self.value = int(s) - - -class TestConnectionWithQml(TimedQApplication): - - def testSignalArguments(self): - view = QQuickView() - obj = Obj() - - context = view.rootContext() - context.setContextProperty("o", obj) - view.setSource(QUrl.fromLocalFile(adjust_filename('signal_arguments.qml', __file__))) - root = view.rootObject() - self.assertTrue(root) - button = root.findChild(QObject, "button") - self.assertTrue(button) - view.show() - button.clicked.emit() - self.assertEqual(obj.value, 42) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtQml/signal_arguments.qml b/sources/pyside2/tests/QtQml/signal_arguments.qml deleted file mode 100644 index 73a1715fa..000000000 --- a/sources/pyside2/tests/QtQml/signal_arguments.qml +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - - -import QtQuick 2.5 -import QtQuick.Controls 2.12 -import QtQuick.Layouts 1.2 - -Rectangle { - visible: true - GridLayout { - Button { - id: button - objectName: "button" - text: "sum!" - onClicked: { - o.sum(40, 2) - } - } - Text { - id: sumResultText - } - } - Connections { - target: o - onSumResult: { - // set the value on the Qml side - sumResultText.text = sum - // set internal Python value from the already - // modified value - o.sendValue(sumResultText.text) - } - } -} diff --git a/sources/pyside2/tests/QtQml/view.qml b/sources/pyside2/tests/QtQml/view.qml deleted file mode 100644 index dcc0076a0..000000000 --- a/sources/pyside2/tests/QtQml/view.qml +++ /dev/null @@ -1,43 +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 QtQuick 2.0 - -ListView { - width: 100 - height: 100 - anchors.fill: parent - model: myModel - delegate: Component { - Rectangle { - height: 25 - width: 100 - Text { text: modelData } - } - } -} diff --git a/sources/pyside2/tests/QtQml/viewmodel.qml b/sources/pyside2/tests/QtQml/viewmodel.qml deleted file mode 100644 index 61366a73e..000000000 --- a/sources/pyside2/tests/QtQml/viewmodel.qml +++ /dev/null @@ -1,42 +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 QtQuick 2.0 - -ListView { - width: 100; height: 100 - anchors.fill: parent - - model: myModel - delegate: Rectangle { - height: 25 - width: 100 - Text { text: title } - } -} - |