aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/tests/pysidetest
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside2/tests/pysidetest')
-rw-r--r--sources/pyside2/tests/pysidetest/CMakeLists.txt173
-rw-r--r--sources/pyside2/tests/pysidetest/all_modules_load_test.py51
-rw-r--r--sources/pyside2/tests/pysidetest/bug_1016.py48
-rw-r--r--sources/pyside2/tests/pysidetest/constructor_properties_test.py70
-rw-r--r--sources/pyside2/tests/pysidetest/curr_errors.txt12
-rw-r--r--sources/pyside2/tests/pysidetest/decoratedslot_test.py74
-rw-r--r--sources/pyside2/tests/pysidetest/delegatecreateseditor_test.py105
-rw-r--r--sources/pyside2/tests/pysidetest/embedding_test.py80
-rw-r--r--sources/pyside2/tests/pysidetest/enum_test.py51
-rw-r--r--sources/pyside2/tests/pysidetest/flagstest.cpp36
-rw-r--r--sources/pyside2/tests/pysidetest/flagstest.h55
-rw-r--r--sources/pyside2/tests/pysidetest/hiddenobject.cpp44
-rw-r--r--sources/pyside2/tests/pysidetest/hiddenobject.h52
-rw-r--r--sources/pyside2/tests/pysidetest/homonymoussignalandmethod_test.py88
-rw-r--r--sources/pyside2/tests/pysidetest/iterable_test.py91
-rw-r--r--sources/pyside2/tests/pysidetest/list_signal_test.py58
-rw-r--r--sources/pyside2/tests/pysidetest/mixin_signal_slots_test.py223
-rw-r--r--sources/pyside2/tests/pysidetest/modelview_test.py105
-rw-r--r--sources/pyside2/tests/pysidetest/new_inherited_functions_test.py198
-rw-r--r--sources/pyside2/tests/pysidetest/notify_id.py83
-rw-r--r--sources/pyside2/tests/pysidetest/properties_test.py132
-rw-r--r--sources/pyside2/tests/pysidetest/property_python_test.py231
-rw-r--r--sources/pyside2/tests/pysidetest/pysidetest_global.h38
-rw-r--r--sources/pyside2/tests/pysidetest/pysidetest_macros.h43
-rw-r--r--sources/pyside2/tests/pysidetest/qapp_like_a_macro_test.py88
-rw-r--r--sources/pyside2/tests/pysidetest/qvariant_test.py51
-rw-r--r--sources/pyside2/tests/pysidetest/repr_test.py90
-rw-r--r--sources/pyside2/tests/pysidetest/signal_slot_warning.py76
-rw-r--r--sources/pyside2/tests/pysidetest/signal_tp_descr_get_test.py87
-rw-r--r--sources/pyside2/tests/pysidetest/signalandnamespace_test.py127
-rw-r--r--sources/pyside2/tests/pysidetest/signalemissionfrompython_test.py114
-rw-r--r--sources/pyside2/tests/pysidetest/signalwithdefaultvalue_test.py102
-rw-r--r--sources/pyside2/tests/pysidetest/symbols.filter7
-rw-r--r--sources/pyside2/tests/pysidetest/testobject.cpp78
-rw-r--r--sources/pyside2/tests/pysidetest/testobject.h153
-rw-r--r--sources/pyside2/tests/pysidetest/testview.cpp52
-rw-r--r--sources/pyside2/tests/pysidetest/testview.h59
-rw-r--r--sources/pyside2/tests/pysidetest/typedef_signal_test.py60
-rw-r--r--sources/pyside2/tests/pysidetest/typesystem_pysidetest.xml77
-rw-r--r--sources/pyside2/tests/pysidetest/version_test.py54
40 files changed, 0 insertions, 3416 deletions
diff --git a/sources/pyside2/tests/pysidetest/CMakeLists.txt b/sources/pyside2/tests/pysidetest/CMakeLists.txt
deleted file mode 100644
index e969e13c9..000000000
--- a/sources/pyside2/tests/pysidetest/CMakeLists.txt
+++ /dev/null
@@ -1,173 +0,0 @@
-project(pysidetest)
-project(testbinding)
-
-cmake_minimum_required(VERSION 3.16)
-
-set(QT_USE_QTCORE 1)
-# no more supported: include(${QT_USE_FILE})
-
-# removed after qtbase/054b66a65748c9ebfafeca88bf31669a24994237, is this required?
-# add_definitions(${Qt${QT_MAJOR_VERSION}Core_DEFINITIONS})
-
-add_definitions(-DQT_SHARED)
-add_definitions(-DRXX_ALLOCATOR_INIT_0)
-
-find_package(Qt${QT_MAJOR_VERSION}Widgets)
-
-set(pysidetest_SRC
-flagstest.cpp
-testobject.cpp
-testview.cpp
-hiddenobject.cpp
-)
-
-set(pysidetest_MOC_HEADERS
-flagstest.h
-testobject.h
-testview.h
-hiddenobject.h
-)
-
-qt_wrap_cpp(pysidetest_MOC_SRC ${pysidetest_MOC_HEADERS})
-
-set(testbinding_SRC
-${CMAKE_CURRENT_BINARY_DIR}/testbinding/flagsnamespace_classforenum_wrapper.cpp
-${CMAKE_CURRENT_BINARY_DIR}/testbinding/testobject_wrapper.cpp
-${CMAKE_CURRENT_BINARY_DIR}/testbinding/intvalue_wrapper.cpp
-${CMAKE_CURRENT_BINARY_DIR}/testbinding/pysidecpp_wrapper.cpp
-${CMAKE_CURRENT_BINARY_DIR}/testbinding/pysidecpp_testobjectwithnamespace_wrapper.cpp
-${CMAKE_CURRENT_BINARY_DIR}/testbinding/pysidecpp_testobject2withnamespace_wrapper.cpp
-${CMAKE_CURRENT_BINARY_DIR}/testbinding/pysidecpp2_testobjectwithoutnamespace_wrapper.cpp
-${CMAKE_CURRENT_BINARY_DIR}/testbinding/testview_wrapper.cpp
-${CMAKE_CURRENT_BINARY_DIR}/testbinding/testbinding_module_wrapper.cpp
-)
-
-# Get per module include dirs.
-# There are usually 3 paths there:
-# ./qt/include/; ./qt/include/QtCore ; ./qt/mkspecs/linux-g++
-# on framework build they are:
-# ./qt/lib/QtCore.framework; ./qt/lib/QtCore.framework/Headers ; ./qt/mkspecs/macx-clang
-# Thus we use the second direct path, which contains the actual header files.
-
-if(${QT_MAJOR_VERSION} GREATER_EQUAL 6)
- set(Qt6Core_DIRECT_INCLUDE_DIR ${Qt6Core_INCLUDE_DIRS})
- set(Qt6Gui_DIRECT_INCLUDE_DIR ${Qt6Gui_INCLUDE_DIRS})
- set(Qt6Widgets_DIRECT_INCLUDE_DIR ${Qt6Widgets_INCLUDE_DIRS})
-else()
- list(GET Qt5Core_INCLUDE_DIRS 1 Qt5Core_DIRECT_INCLUDE_DIR)
- list(GET Qt5Gui_INCLUDE_DIRS 1 Qt5Gui_DIRECT_INCLUDE_DIR)
- list(GET Qt5Widgets_INCLUDE_DIRS 1 Qt5Widgets_DIRECT_INCLUDE_DIR)
-endif()
-
-# Adjust include headers paths for frameworks.
-set(shiboken_framework_include_dirs_option "")
-if(CMAKE_HOST_APPLE AND QtCore_is_framework)
- set(shiboken_framework_include_dirs "${QT_FRAMEWORK_INCLUDE_DIR}")
- set(shiboken_framework_include_dirs_option "--framework-include-paths=${shiboken_framework_include_dirs}")
-endif()
-
-make_path(testbinding_include_dirs ${pyside2_BINARY_DIR}
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_CURRENT_SOURCE_DIR}/../../../shiboken6/libshiboken
- ${CMAKE_CURRENT_SOURCE_DIR}/../../PySide2
- ${CMAKE_CURRENT_SOURCE_DIR}/../../libpyside
- ${QT_INCLUDE_DIR}
- ${Qt${QT_MAJOR_VERSION}Core_DIRECT_INCLUDE_DIR}
- ${Qt${QT_MAJOR_VERSION}Gui_DIRECT_INCLUDE_DIR}
- ${Qt${QT_MAJOR_VERSION}Widgets_DIRECT_INCLUDE_DIR}
- )
-
-make_path(testbinding_typesystem_path ${pyside2_SOURCE_DIR}
- ${pyside2_BINARY_DIR})
-
-add_custom_command(
-OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/mjb_rejected_classes.log"
- BYPRODUCTS ${testbinding_SRC}
- COMMAND Shiboken6::shiboken6 ${GENERATOR_EXTRA_FLAGS}
- ${CMAKE_CURRENT_SOURCE_DIR}/pysidetest_global.h
- --include-paths=${testbinding_include_dirs}
- ${shiboken_framework_include_dirs_option}
- --typesystem-paths=${testbinding_typesystem_path}
- --output-directory=${CMAKE_CURRENT_BINARY_DIR}
- ${CMAKE_CURRENT_SOURCE_DIR}/typesystem_pysidetest.xml
- --api-version=${SUPPORTED_QT_VERSION}
-WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-COMMENT "Running generator for test binding..."
-)
-
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_CURRENT_BINARY_DIR}
- ${Qt${QT_MAJOR_VERSION}Core_INCLUDE_DIRS}
- ${Qt${QT_MAJOR_VERSION}Gui_INCLUDE_DIRS}
- ${Qt${QT_MAJOR_VERSION}Widgets_INCLUDE_DIRS}
- ${pyside2_SOURCE_DIR}
- ${QtCore_GEN_DIR}
- ${QtGui_GEN_DIR}
- ${QtWidgets_GEN_DIR}
- ${libpyside_SOURCE_DIR})
-
-add_library(pysidetest SHARED ${pysidetest_SRC} ${pysidetest_MOC_SRC})
-set_target_properties(pysidetest PROPERTIES
- DEFINE_SYMBOL BUILD_PYSIDETEST)
-
-target_link_libraries(pysidetest
- Shiboken6::libshiboken
- ${Qt${QT_MAJOR_VERSION}Core_LIBRARIES}
- ${Qt${QT_MAJOR_VERSION}Gui_LIBRARIES}
- ${Qt${QT_MAJOR_VERSION}Widgets_LIBRARIES}
- )
-
-add_library(testbinding MODULE ${testbinding_SRC})
-set_property(TARGET testbinding PROPERTY PREFIX "")
-set_property(TARGET testbinding PROPERTY OUTPUT_NAME "testbinding${SHIBOKEN_PYTHON_EXTENSION_SUFFIX}")
-if(WIN32)
- set_property(TARGET testbinding PROPERTY SUFFIX ".pyd")
-endif()
-
-if(PYTHON_LIMITED_API)
- set(TESTBINDING_PYTHON_LIBS ${PYTHON_LIMITED_LIBRARIES})
-else()
- set(TESTBINDING_PYTHON_LIBS ${PYTHON_LIBRARIES})
-endif()
-
-target_link_libraries(testbinding
- pysidetest
- pyside2
- ${TESTBINDING_PYTHON_LIBS}
- Shiboken6::libshiboken
- ${Qt${QT_MAJOR_VERSION}Core_LIBRARIES}
- ${Qt${QT_MAJOR_VERSION}Gui_LIBRARIES}
- ${Qt${QT_MAJOR_VERSION}Widgets_LIBRARIES})
-
-add_dependencies(testbinding pyside2 QtCore QtGui QtWidgets pysidetest)
-create_generator_target(testbinding)
-
-PYSIDE_TEST(constructor_properties_test.py)
-PYSIDE_TEST(decoratedslot_test.py)
-# Will always crash when built against Qt 5.6, no point in running it.
-if (Qt${QT_MAJOR_VERSION}Core_VERSION VERSION_GREATER 5.7.0)
- PYSIDE_TEST(delegatecreateseditor_test.py)
-endif()
-PYSIDE_TEST(all_modules_load_test.py)
-PYSIDE_TEST(bug_1016.py)
-PYSIDE_TEST(embedding_test.py)
-PYSIDE_TEST(enum_test.py)
-PYSIDE_TEST(homonymoussignalandmethod_test.py)
-PYSIDE_TEST(iterable_test.py)
-PYSIDE_TEST(list_signal_test.py)
-PYSIDE_TEST(mixin_signal_slots_test.py)
-PYSIDE_TEST(modelview_test.py)
-PYSIDE_TEST(new_inherited_functions_test.py)
-PYSIDE_TEST(notify_id.py)
-PYSIDE_TEST(properties_test.py)
-PYSIDE_TEST(property_python_test.py)
-PYSIDE_TEST(qapp_like_a_macro_test.py)
-PYSIDE_TEST(qvariant_test.py)
-PYSIDE_TEST(repr_test.py)
-PYSIDE_TEST(signal_tp_descr_get_test.py)
-PYSIDE_TEST(signal_slot_warning.py)
-PYSIDE_TEST(signalandnamespace_test.py)
-PYSIDE_TEST(signalemissionfrompython_test.py)
-PYSIDE_TEST(signalwithdefaultvalue_test.py)
-PYSIDE_TEST(typedef_signal_test.py)
-PYSIDE_TEST(version_test.py)
diff --git a/sources/pyside2/tests/pysidetest/all_modules_load_test.py b/sources/pyside2/tests/pysidetest/all_modules_load_test.py
deleted file mode 100644
index 10ccc5221..000000000
--- a/sources/pyside2/tests/pysidetest/all_modules_load_test.py
+++ /dev/null
@@ -1,51 +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)
-
-import PySide2
-
-# Note:
-# "from PySide2 import *" can only be used at module level.
-# It is also really not recommended to use. But for testing,
-# the "__all__" variable is a great feature!
-
-class AllModulesImportTest(unittest.TestCase):
- def testAllModulesCanImport(self):
- # would also work: exec("from PySide2 import *")
- for name in PySide2.__all__:
- exec("import PySide2.{}".format(name))
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/pysidetest/bug_1016.py b/sources/pyside2/tests/pysidetest/bug_1016.py
deleted file mode 100644
index 234bfe0e5..000000000
--- a/sources/pyside2/tests/pysidetest/bug_1016.py
+++ /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 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(True)
-
-import shiboken6
-from testbinding import *
-
-class TestBug1016 (unittest.TestCase):
-
- def testIt(self):
- obj = getHiddenObject()
- self.assertEqual(obj.callMe(), None)
- self.assertTrue(obj.wasCalled())
-
-if __name__ == "__main__":
- unittest.main()
diff --git a/sources/pyside2/tests/pysidetest/constructor_properties_test.py b/sources/pyside2/tests/pysidetest/constructor_properties_test.py
deleted file mode 100644
index 139091fed..000000000
--- a/sources/pyside2/tests/pysidetest/constructor_properties_test.py
+++ /dev/null
@@ -1,70 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2019 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:LGPL$
-## 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 Lesser General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU Lesser
-## General Public License version 3 as published by the Free Software
-## Foundation and appearing in the file LICENSE.LGPL3 included in the
-## packaging of this file. Please review the following information to
-## ensure the GNU Lesser General Public License version 3 requirements
-## will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 2.0 or (at your option) the GNU General
-## Public license version 3 or any later version approved by the KDE Free
-## Qt Foundation. The licenses are as published by the Free Software
-## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-## 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-2.0.html and
-## 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.usesqapplication import UsesQApplication
-from PySide2.QtCore import Qt
-from PySide2.QtWidgets import QApplication, QLabel, QFrame
-
-
-class ConstructorPropertiesTest(UsesQApplication):
-
- def testCallConstructor(self):
- label = QLabel(
- frameStyle=QFrame.Panel | QFrame.Sunken,
- text="first line\nsecond line",
- alignment=Qt.AlignBottom | Qt.AlignRight
- )
- self.assertRaises(AttributeError, lambda: QLabel(
- somethingelse=42,
- text="first line\nsecond line",
- alignment=Qt.AlignBottom | Qt.AlignRight
- ))
-
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/sources/pyside2/tests/pysidetest/curr_errors.txt b/sources/pyside2/tests/pysidetest/curr_errors.txt
deleted file mode 100644
index a02da203d..000000000
--- a/sources/pyside2/tests/pysidetest/curr_errors.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-Generating class model... [OK]
-Generating enum model... [OK]
-Generating namespace model... [OK]
-Resolving typedefs... [OK]
-Fixing class inheritance... [OK]
-Detecting inconsistencies in class model... [OK]
-[OK]
- type 'QPyTextObject' is specified in typesystem, but not defined. This could potentially lead to compilation errors.
-
-
-
-Done, 1 warnings (1051 known issues)
diff --git a/sources/pyside2/tests/pysidetest/decoratedslot_test.py b/sources/pyside2/tests/pysidetest/decoratedslot_test.py
deleted file mode 100644
index 3825f48ab..000000000
--- a/sources/pyside2/tests/pysidetest/decoratedslot_test.py
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/python
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(True)
-
-from PySide2.QtCore import QObject
-from testbinding import TestObject
-
-class Receiver(QObject):
- def __init__(self):
- QObject.__init__(self)
- self.called = False
-
- def ReceiverDecorator(func):
- def decoratedFunction(self, *args, **kw):
- func(self, *args, **kw)
- return decoratedFunction
-
- # This method with the same name of the internal decorated function
- # is here to test the binding capabilities.
- def decoratedFunction(self):
- pass
-
- @ReceiverDecorator
- def slot(self):
- self.called = True
-
-
-class DecoratedSlotTest(unittest.TestCase):
-
- def testCallingOfDecoratedSlot(self):
- obj = TestObject(0)
- receiver = Receiver()
- obj.staticMethodDouble.connect(receiver.slot)
- obj.emitStaticMethodDoubleSignal()
- self.assertTrue(receiver.called)
-
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/sources/pyside2/tests/pysidetest/delegatecreateseditor_test.py b/sources/pyside2/tests/pysidetest/delegatecreateseditor_test.py
deleted file mode 100644
index 111d4ebbf..000000000
--- a/sources/pyside2/tests/pysidetest/delegatecreateseditor_test.py
+++ /dev/null
@@ -1,105 +0,0 @@
-#!/usr/bin/python
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(True)
-
-from helper.usesqapplication import UsesQApplication
-from testbinding import TestView
-from PySide2.QtCore import Qt
-from PySide2.QtGui import QStandardItem, QStandardItemModel
-from PySide2.QtWidgets import (QAbstractItemDelegate, QComboBox,
- QSpinBox, QStyledItemDelegate,
- QStyleOptionViewItem, QWidget)
-
-id_text = 'This is me'
-
-class DelegateDoesntKeepReferenceToEditor(QAbstractItemDelegate):
- def createEditor(self, parent, option, index):
- comboBox = QComboBox(parent)
- comboBox.addItem(id_text)
- return comboBox
-
-
-class DelegateKeepsReferenceToEditor(QAbstractItemDelegate):
- def __init__(self, parent=None):
- QAbstractItemDelegate.__init__(self, parent)
- self.comboBox = QComboBox()
- self.comboBox.addItem(id_text)
-
- def createEditor(self, parent, option, index):
- self.comboBox.setParent(parent)
- return self.comboBox
-
-
-class EditorCreatedByDelegateTest(UsesQApplication):
-
- def testDelegateDoesntKeepReferenceToEditor(self):
- view = TestView(None)
- delegate = DelegateDoesntKeepReferenceToEditor()
- view.setItemDelegate(delegate)
- editor = view.getEditorWidgetFromItemDelegate()
- self.assertEqual(type(editor), QComboBox)
- self.assertEqual(editor.count(), 1)
- self.assertEqual(editor.itemData(0, Qt.DisplayRole), id_text)
- editor.metaObject()
-
- def testDelegateKeepsReferenceToEditor(self):
- view = TestView(None)
- delegate = DelegateKeepsReferenceToEditor()
- view.setItemDelegate(delegate)
- editor = view.getEditorWidgetFromItemDelegate()
- self.assertEqual(type(editor), QComboBox)
- self.assertEqual(editor.count(), 1)
- self.assertEqual(editor.itemData(0, Qt.DisplayRole), id_text)
- editor.metaObject()
-
- def testIntDelegate(self):
- """PYSIDE-1250: When creating a QVariant, use int instead of long long
- for anything that fits into a int. Verify by checking that a spin
- box is created as item view editor for int."""
- item = QStandardItem()
- item.setData(123123, Qt.EditRole) # <-- QVariant conversion here
- model = QStandardItemModel()
- model.appendRow(item)
- style_option = QStyleOptionViewItem()
- delegate = QStyledItemDelegate()
- editor = delegate.createEditor(None, style_option, model.index(0, 0))
- self.assertEqual(type(editor), QSpinBox)
-
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/sources/pyside2/tests/pysidetest/embedding_test.py b/sources/pyside2/tests/pysidetest/embedding_test.py
deleted file mode 100644
index 1960838ff..000000000
--- a/sources/pyside2/tests/pysidetest/embedding_test.py
+++ /dev/null
@@ -1,80 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2019 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of PySide2.
-##
-## $QT_BEGIN_LICENSE:LGPL$
-## 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 Lesser General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU Lesser
-## General Public License version 3 as published by the Free Software
-## Foundation and appearing in the file LICENSE.LGPL3 included in the
-## packaging of this file. Please review the following information to
-## ensure the GNU Lesser General Public License version 3 requirements
-## will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 2.0 or (at your option) the GNU General
-## Public license version 3 or any later version approved by the KDE Free
-## Qt Foundation. The licenses are as published by the Free Software
-## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-## 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-2.0.html and
-## 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)
-
-# This test tests the embedding feature of PySide.
-# Normally, embedding is only used when necessary.
-# By setting the variable "pyside_uses_embedding",
-# we enforce usage of embedding.
-
-
-class EmbeddingTest(unittest.TestCase):
-
- # def test_pyside_normal(self):
- # import sys
- # self.assertFalse(hasattr(sys, "pyside_uses_embedding"))
- # import PySide2
- # # everything has to be imported
- # self.assertTrue("PySide2.support.signature" in sys.modules)
- # # there should be a variale in sys, now (no idea if set)
- # self.assertTrue(hasattr(sys, "pyside_uses_embedding"))
-
- # Unfortunately, I see no way how to shut things enough down
- # to trigger a second initiatization. Therefore, only one test :-/
- def test_pyside_embedding(self):
- import sys, os
- self.assertFalse(hasattr(sys, "pyside_uses_embedding"))
- sys.pyside_uses_embedding = "anything true"
- import PySide2
- # everything has to be imported
- self.assertTrue("PySide2.support.signature" in sys.modules)
- self.assertEqual(sys.pyside_uses_embedding, True)
- dn = os.path.dirname
- name = os.path.basename(dn(dn(dn(PySide2.support.signature.__file__))))
- self.assertTrue(name.startswith("embedded.") and name.endswith(".zip"))
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/pysidetest/enum_test.py b/sources/pyside2/tests/pysidetest/enum_test.py
deleted file mode 100644
index d179d6248..000000000
--- a/sources/pyside2/tests/pysidetest/enum_test.py
+++ /dev/null
@@ -1,51 +0,0 @@
-# -*- 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(True)
-
-from testbinding import Enum1, TestObjectWithoutNamespace
-
-class ListConnectionTest(unittest.TestCase):
-
- def testEnumVisibility(self):
- self.assertEqual(Enum1.Option1, 1)
- self.assertEqual(Enum1.Option2, 2)
- self.assertEqual(TestObjectWithoutNamespace.Enum2.Option3, 3)
- self.assertEqual(TestObjectWithoutNamespace.Enum2.Option4, 4)
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/sources/pyside2/tests/pysidetest/flagstest.cpp b/sources/pyside2/tests/pysidetest/flagstest.cpp
deleted file mode 100644
index 2bd0c454e..000000000
--- a/sources/pyside2/tests/pysidetest/flagstest.cpp
+++ /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$
-**
-****************************************************************************/
-
-#include "flagstest.h"
-
-namespace FlagsNamespace
-{
- ClassForEnum::ClassForEnum(FlagsNamespace::Options) {}
-
- ClassForEnum::~ClassForEnum() = default;
-}
diff --git a/sources/pyside2/tests/pysidetest/flagstest.h b/sources/pyside2/tests/pysidetest/flagstest.h
deleted file mode 100644
index 7f070361c..000000000
--- a/sources/pyside2/tests/pysidetest/flagstest.h
+++ /dev/null
@@ -1,55 +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$
-**
-****************************************************************************/
-
-#pragma once
-
-#include "pysidetest_macros.h"
-
-#include <QtCore/QObject>
-
-namespace FlagsNamespace
-{
-
-enum Option {
- NoOptions = 0x0,
- ShowTabs = 0x1,
- ShowAll = 0x2,
- SqueezeBlank = 0x4
-};
-Q_DECLARE_FLAGS(Options, Option)
-Q_DECLARE_OPERATORS_FOR_FLAGS(Options)
-
-class PYSIDETEST_API ClassForEnum : public QObject
-{
- Q_OBJECT
-public:
- ClassForEnum(FlagsNamespace::Options opt = FlagsNamespace::Option::NoOptions);
- virtual ~ClassForEnum();
-};
-
-} // namespace FlagsNamespace
diff --git a/sources/pyside2/tests/pysidetest/hiddenobject.cpp b/sources/pyside2/tests/pysidetest/hiddenobject.cpp
deleted file mode 100644
index 70692a8ec..000000000
--- a/sources/pyside2/tests/pysidetest/hiddenobject.cpp
+++ /dev/null
@@ -1,44 +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$
-**
-****************************************************************************/
-
-#include "hiddenobject.h"
-
-void HiddenObject::callMe()
-{
- m_called = true;
-}
-
-bool HiddenObject::wasCalled()
-{
- return m_called;
-}
-
-QObject *getHiddenObject()
-{
- return new HiddenObject();
-}
diff --git a/sources/pyside2/tests/pysidetest/hiddenobject.h b/sources/pyside2/tests/pysidetest/hiddenobject.h
deleted file mode 100644
index 97a2864c5..000000000
--- a/sources/pyside2/tests/pysidetest/hiddenobject.h
+++ /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$
-**
-****************************************************************************/
-
-#ifndef HIDDENOBJECT_H
-#define HIDDENOBJECT_H
-
-#include "pysidetest_macros.h"
-
-#include <QtCore/QObject>
-
-// This class shouldn't be exported!
-class HiddenObject : public QObject
-{
- Q_OBJECT
-public:
- HiddenObject() : m_called(false) {}
- Q_INVOKABLE void callMe();
-public Q_SLOTS:
- bool wasCalled();
-private:
- bool m_called;
-};
-
-// Return a instance of HiddenObject
-PYSIDETEST_API QObject* getHiddenObject();
-
-#endif
diff --git a/sources/pyside2/tests/pysidetest/homonymoussignalandmethod_test.py b/sources/pyside2/tests/pysidetest/homonymoussignalandmethod_test.py
deleted file mode 100644
index 1566b4a82..000000000
--- a/sources/pyside2/tests/pysidetest/homonymoussignalandmethod_test.py
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/usr/bin/python
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(True)
-
-from testbinding import TestObject
-
-'''Tests the behaviour of homonymous signals and slots.'''
-
-class HomonymousSignalAndMethodTest(unittest.TestCase):
-
- def setUp(self):
- self.value = 123
- self.called = False
- self.obj = TestObject(self.value)
-
- def tearDown(self):
- del self.value
- del self.called
- del self.obj
-
- def testIdValueSignalEmission(self):
- def callback(idValue):
- self.assertEqual(idValue, self.value)
- self.obj.idValue.connect(callback)
- self.obj.emitIdValueSignal()
-
- def testStaticMethodDoubleSignalEmission(self):
- def callback():
- self.called = True
- self.obj.staticMethodDouble.connect(callback)
- self.obj.emitStaticMethodDoubleSignal()
- self.assertTrue(self.called)
-
- def testSignalNotCallable(self):
- self.assertRaises(TypeError, self.obj.justASignal)
-
- def testCallingInstanceMethodWithArguments(self):
- self.assertRaises(TypeError, TestObject.idValue, 1)
-
- def testCallingInstanceMethodWithoutArguments(self):
- self.assertRaises(TypeError, TestObject.idValue)
-
- def testHomonymousSignalAndMethod(self):
- self.assertEqual(self.obj.idValue(), self.value)
-
- def testHomonymousSignalAndStaticMethod(self):
- self.assertEqual(TestObject.staticMethodDouble(3), 6)
-
- def testHomonymousSignalAndStaticMethodFromInstance(self):
- self.assertEqual(self.obj.staticMethodDouble(4), 8)
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/sources/pyside2/tests/pysidetest/iterable_test.py b/sources/pyside2/tests/pysidetest/iterable_test.py
deleted file mode 100644
index c5685112d..000000000
--- a/sources/pyside2/tests/pysidetest/iterable_test.py
+++ /dev/null
@@ -1,91 +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$
-##
-#############################################################################
-
-"""
-iterable_test.py
-
-This test checks that the Iterable protocol is implemented correctly.
-"""
-
-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)
-
-import PySide2
-from PySide2 import QtCore, QtGui
-
-try:
- import numpy as np
- have_numpy = True
-except ImportError:
- have_numpy = False
-
-class PySequenceTest(unittest.TestCase):
-
- def test_iterable(self):
- def gen(lis):
- for item in lis:
- if item == "crash":
- raise IndexError
- yield item
- # testing "pyseq_to_cpplist_conversion"
- testfunc = QtCore.QUrl.fromStringList
- # use a generator (iterable)
- self.assertEqual(testfunc(gen(["asd", "ghj"])),
- [PySide2.QtCore.QUrl('asd'), PySide2.QtCore.QUrl('ghj')])
- # use an iterator
- self.assertEqual(testfunc(iter(["asd", "ghj"])),
- [PySide2.QtCore.QUrl('asd'), PySide2.QtCore.QUrl('ghj')])
- self.assertRaises(IndexError, testfunc, gen(["asd", "crash", "ghj"]))
- # testing QMatrix4x4
- testfunc = QtGui.QMatrix4x4
- self.assertEqual(testfunc(gen(range(16))), testfunc(range(16)))
- # Note: The errormessage needs to be improved!
- # We should better get a ValueError
- self.assertRaises((TypeError, ValueError), testfunc, gen(range(15)))
- # All other matrix sizes:
- testfunc = QtGui.QMatrix2x2
- self.assertEqual(testfunc(gen(range(4))), testfunc(range(4)))
- testfunc = QtGui.QMatrix2x3
- self.assertEqual(testfunc(gen(range(6))), testfunc(range(6)))
-
- @unittest.skipUnless(have_numpy, "requires numpy")
- def test_iterable_numpy(self):
- # Demo for numpy: We create a unit matrix.
- num_mat = np.eye(4)
- num_mat.shape = 16
- unit = QtGui.QMatrix4x4(num_mat)
- self.assertEqual(unit, QtGui.QMatrix4x4())
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/pysidetest/list_signal_test.py b/sources/pyside2/tests/pysidetest/list_signal_test.py
deleted file mode 100644
index d66ba7905..000000000
--- a/sources/pyside2/tests/pysidetest/list_signal_test.py
+++ /dev/null
@@ -1,58 +0,0 @@
-# -*- 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(True)
-
-from testbinding import TestObject
-from PySide2.QtCore import QObject
-
-class ListConnectionTest(unittest.TestCase):
-
- def childrenChanged(self, children):
- self._child = children[0]
-
- def testConnection(self):
- o = TestObject(0)
- c = QObject()
- c.setObjectName("child")
- self._child = None
- o.childrenChanged.connect(self.childrenChanged)
- o.addChild(c)
- self.assertEqual(self._child.objectName(), "child")
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/sources/pyside2/tests/pysidetest/mixin_signal_slots_test.py b/sources/pyside2/tests/pysidetest/mixin_signal_slots_test.py
deleted file mode 100644
index d0b40cfa0..000000000
--- a/sources/pyside2/tests/pysidetest/mixin_signal_slots_test.py
+++ /dev/null
@@ -1,223 +0,0 @@
-#!/usr/bin/python
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-''' PYSIDE-315: https://bugreports.qt.io/browse/PYSIDE-315
- Test that all signals and slots of a class (including any mixin classes)
- are registered at type parsing time. Also test that the signal and slot
- indices do not change after signal connection or emission. '''
-
-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 import QtCore
-
-class Mixin(object):
- mixinSignal = QtCore.Signal()
- def __init__(self, *args, **kwargs):
- super(Mixin,self).__init__(*args, **kwargs)
-
-class MixinTwo(Mixin):
- mixinTwoSignal = QtCore.Signal()
-
- def __init__(self, *args, **kwargs):
- super(MixinTwo,self).__init__(*args, **kwargs)
- self.mixinTwoSlotCalled = False
-
- @QtCore.Slot()
- def mixinTwoSlot(self):
- self.mixinTwoSlotCalled = True
-
-class MixinThree(object):
- mixinThreeSignal = QtCore.Signal()
-
- def __init__(self, *args, **kwargs):
- super(MixinThree,self).__init__(*args, **kwargs)
- self.mixinThreeSlotCalled = False
-
- @QtCore.Slot()
- def mixinThreeSlot(self):
- self.mixinThreeSlotCalled = True
-
-class Derived(Mixin, QtCore.QObject):
- derivedSignal = QtCore.Signal(str)
-
- def __init__(self):
- super(Derived,self).__init__()
- self.derivedSlotCalled = False
- self.derivedSlotString = ''
-
- @QtCore.Slot(str)
- def derivedSlot(self, theString):
- self.derivedSlotCalled = True
- self.derivedSlotString = theString
-
-class MultipleDerived(MixinTwo, MixinThree, Mixin, QtCore.QObject):
- derivedSignal = QtCore.Signal(str)
-
- def __init__(self):
- super(MultipleDerived,self).__init__()
- self.derivedSlotCalled = False
- self.derivedSlotString = ''
-
- @QtCore.Slot(str)
- def derivedSlot(self, theString):
- self.derivedSlotCalled = True
- self.derivedSlotString = theString
-
-
-class MixinTest(unittest.TestCase):
- def testMixinSignalSlotRegistration(self):
- obj = Derived()
- m = obj.metaObject()
-
- # Should contain 2 signals and 1 slot immediately after type parsing
- self.assertEqual(m.methodCount() - m.methodOffset(), 3)
-
- # Save method indices to check that they do not change
- methodIndices = {}
- for i in range(m.methodOffset(), m.methodCount()):
- signature = m.method(i).methodSignature()
- methodIndices[signature] = i
-
- # Check derivedSignal emission
- obj.derivedSignal.connect(obj.derivedSlot)
- obj.derivedSignal.emit('emit1')
- self.assertTrue(obj.derivedSlotCalled)
- obj.derivedSlotCalled = False
-
- # Check derivedSignal emission after mixingSignal connection
- self.outsideSlotCalled = False
- @QtCore.Slot()
- def outsideSlot():
- self.outsideSlotCalled = True
-
- obj.mixinSignal.connect(outsideSlot)
- obj.derivedSignal.emit('emit2')
- self.assertTrue(obj.derivedSlotCalled)
- self.assertFalse(self.outsideSlotCalled)
- obj.derivedSlotCalled = False
-
- # Check mixinSignal emission
- obj.mixinSignal.emit()
- self.assertTrue(self.outsideSlotCalled)
- self.assertFalse(obj.derivedSlotCalled)
- self.outsideSlotCalled = False
-
- # Check that method indices haven't changed.
- # Make sure to requery for the meta object, to check that a new one was not
- # created as a child of the old one.
- m = obj.metaObject()
- self.assertEqual(m.methodCount() - m.methodOffset(), 3)
- for i in range(m.methodOffset(), m.methodCount()):
- signature = m.method(i).methodSignature()
- self.assertEqual(methodIndices[signature], i)
-
-
- def testMixinSignalSlotRegistrationWithMultipleInheritance(self):
- obj = MultipleDerived()
- m = obj.metaObject()
-
- # Should contain 4 signals and 3 slots immediately after type parsing
- self.assertEqual(m.methodCount() - m.methodOffset(), 7)
-
- # Save method indices to check that they do not change
- methodIndices = {}
- for i in range(m.methodOffset(), m.methodCount()):
- signature = m.method(i).methodSignature()
- methodIndices[signature] = i
-
- # Check derivedSignal emission
- obj.derivedSignal.connect(obj.derivedSlot)
- obj.derivedSignal.emit('emit1')
- self.assertTrue(obj.derivedSlotCalled)
- self.assertFalse(obj.mixinTwoSlotCalled)
- self.assertFalse(obj.mixinThreeSlotCalled)
- obj.derivedSlotCalled = False
-
- # Check derivedSignal emission after mixinThreeSignal connection
- self.outsideSlotCalled = False
- @QtCore.Slot()
- def outsideSlot():
- self.outsideSlotCalled = True
-
- obj.mixinThreeSignal.connect(obj.mixinThreeSlot)
- obj.mixinThreeSignal.connect(outsideSlot)
- obj.derivedSignal.emit('emit2')
- self.assertTrue(obj.derivedSlotCalled)
- self.assertFalse(obj.mixinTwoSlotCalled)
- self.assertFalse(obj.mixinThreeSlotCalled)
- self.assertFalse(self.outsideSlotCalled)
- obj.derivedSlotCalled = False
-
- # Check mixinThreeSignal emission
- obj.mixinThreeSignal.emit()
- self.assertTrue(self.outsideSlotCalled)
- self.assertTrue(obj.mixinThreeSlotCalled)
- self.assertFalse(obj.derivedSlotCalled)
- self.assertFalse(obj.mixinTwoSlotCalled)
- self.outsideSlotCalled = False
- obj.mixinThreeSlotCalled = False
-
- # Check mixinTwoSignal emission
- obj.mixinTwoSignal.connect(obj.mixinTwoSlot)
- obj.mixinTwoSignal.emit()
- self.assertTrue(obj.mixinTwoSlotCalled)
- self.assertFalse(obj.mixinThreeSlotCalled)
- self.assertFalse(obj.derivedSlotCalled)
- self.assertFalse(self.outsideSlotCalled)
- obj.mixinTwoSlotCalled = False
-
- # Check mixinSignal emission
- obj.mixinSignal.connect(outsideSlot)
- obj.mixinSignal.emit()
- self.assertTrue(self.outsideSlotCalled)
- self.assertFalse(obj.mixinTwoSlotCalled)
- self.assertFalse(obj.mixinThreeSlotCalled)
- self.assertFalse(obj.derivedSlotCalled)
- self.outsideSlotCalled = False
-
- # Check that method indices haven't changed.
- # Make sure to requery for the meta object, to check that a new one was not
- # created as a child of the old one.
- m = obj.metaObject()
- self.assertEqual(m.methodCount() - m.methodOffset(), 7)
- for i in range(m.methodOffset(), m.methodCount()):
- signature = m.method(i).methodSignature()
- self.assertEqual(methodIndices[signature], i)
-
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/sources/pyside2/tests/pysidetest/modelview_test.py b/sources/pyside2/tests/pysidetest/modelview_test.py
deleted file mode 100644
index e9d376801..000000000
--- a/sources/pyside2/tests/pysidetest/modelview_test.py
+++ /dev/null
@@ -1,105 +0,0 @@
-#!/usr/bin/python
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(True)
-
-from testbinding import TestView
-from PySide2.QtCore import QAbstractListModel, QObject, QModelIndex
-
-'''Tests model/view relationship.'''
-
-object_name = 'test object'
-
-class MyObject(QObject):
- pass
-
-class ListModelKeepsReference(QAbstractListModel):
- def __init__(self, parent=None):
- QAbstractListModel.__init__(self, parent)
- self.obj = MyObject()
- self.obj.setObjectName(object_name)
-
- def rowCount(self, parent=QModelIndex()):
- return 1
-
- def data(self, index, role):
- return self.obj
-
-class ListModelDoesntKeepsReference(QAbstractListModel):
- def rowCount(self, parent=QModelIndex()):
- return 1
-
- def data(self, index, role):
- obj = MyObject()
- obj.setObjectName(object_name)
- return obj
-
-class ListModelThatReturnsString(QAbstractListModel):
- def rowCount(self, parent=QModelIndex()):
- return 1
-
- def data(self, index, role):
- self.obj = 'string'
- return self.obj
-
-
-class ModelViewTest(unittest.TestCase):
-
- def testListModelDoesntKeepsReference(self):
- model = ListModelDoesntKeepsReference()
- view = TestView(model)
- obj = view.getData()
- self.assertEqual(type(obj), MyObject)
- self.assertEqual(obj.objectName(), object_name)
- obj.metaObject()
-
- def testListModelKeepsReference(self):
- model = ListModelKeepsReference()
- view = TestView(model)
- obj = view.getData()
- self.assertEqual(type(obj), MyObject)
- self.assertEqual(obj.objectName(), object_name)
-
- def testListModelThatReturnsString(self):
- model = ListModelThatReturnsString()
- view = TestView(model)
- obj = view.getData()
- self.assertEqual(type(obj), str)
- self.assertEqual(obj, 'string')
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/sources/pyside2/tests/pysidetest/new_inherited_functions_test.py b/sources/pyside2/tests/pysidetest/new_inherited_functions_test.py
deleted file mode 100644
index 1998376d7..000000000
--- a/sources/pyside2/tests/pysidetest/new_inherited_functions_test.py
+++ /dev/null
@@ -1,198 +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$
-##
-#############################################################################
-
-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 import *
-for modname, mod in sys.modules.items():
- # Python 2 leaves "None" in the dict.
- if modname.startswith("PySide2.") and mod is not None:
- print("importing", modname)
- exec("import " + modname)
-
-# This test tests the existence and callability of the newly existing functions,
-# after the inheritance was made complete in the course of PYSIDE-331.
-
-new_functions = """
- PySide2.QtCore.QAbstractItemModel().parent()
- PySide2.QtCore.QAbstractListModel().parent()
- PySide2.QtCore.QAbstractTableModel().parent()
- PySide2.QtCore.QFile().resize(qint64)
- m = PySide2.QtCore.QMutex(); m.tryLock(); m.unlock() # prevent a message "QMutex: destroying locked mutex"
- PySide2.QtCore.QSortFilterProxyModel().parent()
- PySide2.QtCore.QTemporaryFile(tfarg).open(openMode)
-"""
-
-new_functions += """
- PySide2.QtGui.QStandardItemModel().insertColumn(int,qModelIndex)
- PySide2.QtGui.QStandardItemModel().parent()
- # PySide2.QtGui.QTextList(qTextDocument).setFormat(qTextFormat) # Segmentation fault: 11
- # PySide2.QtGui.QTextTable(qTextDocument).setFormat(qTextFormat) # Segmentation fault: 11
-""" if "PySide2.QtGui" in sys.modules else ""
-
-new_functions += """
- PySide2.QtWidgets.QAbstractItemView().update()
- PySide2.QtWidgets.QApplication.palette()
- PySide2.QtWidgets.QApplication.setFont(qFont)
- PySide2.QtWidgets.QApplication.setPalette(qPalette)
- PySide2.QtWidgets.QBoxLayout(direction).addWidget(qWidget)
- PySide2.QtWidgets.QColorDialog().open()
- PySide2.QtWidgets.QFileDialog().open()
- PySide2.QtWidgets.QFileSystemModel().index(int,int,qModelIndex)
- PySide2.QtWidgets.QFileSystemModel().parent()
- PySide2.QtWidgets.QFontDialog().open()
- PySide2.QtWidgets.QGestureEvent([]).accept()
- PySide2.QtWidgets.QGestureEvent([]).ignore()
- PySide2.QtWidgets.QGestureEvent([]).isAccepted()
- PySide2.QtWidgets.QGestureEvent([]).setAccepted(bool)
- # PySide2.QtWidgets.QGraphicsView().render(qPaintDevice,qPoint,qRegion,renderFlags) # QPaintDevice: NotImplementedError
- PySide2.QtWidgets.QGridLayout().addWidget(qWidget)
- PySide2.QtWidgets.QHeaderView(orientation).initStyleOption(qStyleOptionFrame)
- PySide2.QtWidgets.QInputDialog().open()
- PySide2.QtWidgets.QLineEdit().addAction(qAction)
- PySide2.QtWidgets.QListWidget().closePersistentEditor(qModelIndex)
- PySide2.QtWidgets.QListWidget().openPersistentEditor(qModelIndex)
- PySide2.QtWidgets.QMessageBox().open()
- PySide2.QtWidgets.QPlainTextEdit().find(findStr)
- PySide2.QtWidgets.QProgressDialog().open()
- PySide2.QtWidgets.QStackedLayout().widget()
- # PySide2.QtWidgets.QStylePainter().begin(qPaintDevice) # QPaintDevice: NotImplementedError
- PySide2.QtWidgets.QTableWidget().closePersistentEditor(qModelIndex)
- PySide2.QtWidgets.QTableWidget().openPersistentEditor(qModelIndex)
- PySide2.QtWidgets.QTextEdit().find(findStr)
- PySide2.QtWidgets.QTreeWidget().closePersistentEditor(qModelIndex)
- PySide2.QtWidgets.QTreeWidget().openPersistentEditor(qModelIndex)
- PySide2.QtWidgets.QWidget.find(quintptr)
-""" if "PySide2.QtWidgets" in sys.modules else ""
-
-new_functions += """
- # PySide2.QtPrintSupport.QPageSetupDialog().open() # Segmentation fault: 11
- # PySide2.QtPrintSupport.QPrintDialog().open() # opens the dialog, but works
- PySide2.QtPrintSupport.QPrintDialog().printer()
- PySide2.QtPrintSupport.QPrintPreviewDialog().open() # note: this prints something, but really shouldn't ;-)
-""" if "PySide2.QtPrintSupport" in sys.modules else ""
-
-new_functions += """
- PySide2.QtHelp.QHelpContentModel().parent()
- # PySide2.QtHelp.QHelpIndexModel().createIndex(int,int,quintptr) # returned NULL without setting an error
- # PySide2.QtHelp.QHelpIndexModel().createIndex(int,int,object()) # returned NULL without setting an error
-""" if "PySide2.QtHelp" in sys.modules else ""
-
-new_functions += """
- PySide2.QtQuick.QQuickPaintedItem().update()
-""" if "PySide2.QtQuick" in sys.modules else ""
-
-
-class MainTest(unittest.TestCase):
-
- def testNewInheriedFunctionsExist(self):
- """
- Run all new method signarures
- """
- for app in "QtWidgets.QApplication", "QtGui.QGuiApplication", "QtCore.QCoreApplication":
- try:
- exec("qApp = PySide2.{0}([]) or PySide2.{0}.instance()".format(app))
- break
- except AttributeError:
- continue
- bool = True
- int = 42
- qint64 = 42
- tfarg = os.path.join(PySide2.QtCore.QDir.tempPath(), "XXXXXX.tmp")
- findStr = 'bla'
- orientation = PySide2.QtCore.Qt.Orientation()
- openMode = PySide2.QtCore.QIODevice.OpenMode(PySide2.QtCore.QIODevice.ReadOnly)
- qModelIndex = PySide2.QtCore.QModelIndex()
- transformationMode = PySide2.QtCore.Qt.TransformationMode()
- qObject = PySide2.QtCore.QObject()
- qPoint = PySide2.QtCore.QPoint()
- try:
- PySide2.QtGui
- #qPaintDevice = PySide2.QtGui.QPaintDevice() # NotImplementedError
- qTextDocument = PySide2.QtGui.QTextDocument()
- qTextFormat = PySide2.QtGui.QTextFormat()
- quintptr = 42
- qFont = PySide2.QtGui.QFont()
- qPalette = PySide2.QtGui.QPalette()
- except AttributeError:
- pass
- try:
- PySide2.QtWidgets
- direction = PySide2.QtWidgets.QBoxLayout.Direction()
- qWidget = PySide2.QtWidgets.QWidget()
- qStyleOptionFrame = PySide2.QtWidgets.QStyleOptionFrame()
- qAction = PySide2.QtGui.QAction(qObject)
- renderFlags = PySide2.QtWidgets.QWidget.RenderFlags
- except AttributeError:
- pass
-
- for func in new_functions.splitlines():
- func = func.strip()
- if func.startswith("#"):
- # this is a crashing or otherwise untestable function
- print(func)
- continue
- try:
- exec(func)
- except NotImplementedError:
- print(func, "# raises NotImplementedError")
- else:
- print(func)
-
- def testQAppSignatures(self):
- """
- Verify that qApp.palette owns three signatures, especially
- palette() without argument.
- """
- try:
- qApp = (PySide2.QtWidgets.QApplication.instance() or
- PySide2.QtWidgets.QApplication([]))
- except AttributeError:
- unittest.TestCase().skipTest("this test makes only sense if QtWidgets is available.")
- try:
- PySide2.QtWidgets.QApplication.palette(42) # raises
- except TypeError as e:
- lines = e.args[0].splitlines()
- heading_pos = lines.index("Supported signatures:")
- lines = lines[heading_pos+1:]
- self.assertEqual(len(lines), 3)
- txt = '\n'.join(lines)
- print("Signatures found:")
- print(txt)
- self.assertTrue("palette()" in txt)
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/pysidetest/notify_id.py b/sources/pyside2/tests/pysidetest/notify_id.py
deleted file mode 100644
index 393736a65..000000000
--- a/sources/pyside2/tests/pysidetest/notify_id.py
+++ /dev/null
@@ -1,83 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide2.QtCore import QObject, Signal, Property, Slot
-
-'''Tests that the signal notify id of a property is correct, aka corresponds to the initially set
-notify method.'''
-
-class Foo(QObject):
- def __init__(self):
- QObject.__init__(self)
- self._prop = "Empty"
-
- def getProp(self):
- return self._prop
-
- def setProp(self, value):
- if value != self._prop:
- self._prop = value
- self.propChanged.emit()
-
- # Inside the dynamic QMetaObject, the methods have to be sorted, so that this slot comes
- # after any signals. That means the property notify id has to be updated, to have the correct
- # relative method id.
- @Slot()
- def randomSlot():
- pass
-
- propChanged = Signal()
- prop = Property(str, getProp, setProp, notify=propChanged)
-
-class NotifyIdSignal(unittest.TestCase):
- def setUp(self):
- self.obj = Foo()
-
- def tearDown(self):
- del self.obj
-
- def testSignalEmission(self):
- metaObject = self.obj.metaObject()
- propertyIndex = metaObject.indexOfProperty("prop")
- property = metaObject.property(propertyIndex)
-
- signalIndex = property.notifySignalIndex()
- signal = metaObject.method(signalIndex)
- signalName = signal.name()
- self.assertEqual(signalName, "propChanged")
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/pysidetest/properties_test.py b/sources/pyside2/tests/pysidetest/properties_test.py
deleted file mode 100644
index cedfac8d1..000000000
--- a/sources/pyside2/tests/pysidetest/properties_test.py
+++ /dev/null
@@ -1,132 +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 PySide2.QtCore import QObject, QStringListModel, Signal, Property, Slot
-
-"""Tests PySide2.QtCore.Property()"""
-
-
-class TestObject(QObject):
-
- valueChanged = Signal()
-
- def __init__(self, parent=None):
- super(TestObject, self).__init__(parent)
- self._value = -1
- self.valueChanged.connect(self._changed)
- self.getter_called = 0
- self.setter_called = 0
- self.changed_emitted = 0
-
- @Slot(int)
- def _changed(self):
- self.changed_emitted += 1
-
- def getValue(self):
- self.getter_called += 1
- return self._value
-
- def setValue(self, value):
- self.setter_called += 1
- if (self._value != value):
- self._value = value
- self.valueChanged.emit()
-
- value = Property(int, fget=getValue, fset=setValue,
- notify=valueChanged)
-
-
-class TestDerivedObject(QStringListModel):
-
- valueChanged = Signal()
-
- def __init__(self, parent=None):
- super(TestDerivedObject, self).__init__(parent)
- self._value = -1
- self.valueChanged.connect(self._changed)
- self.getter_called = 0
- self.setter_called = 0
- self.changed_emitted = 0
-
- @Slot(int)
- def _changed(self):
- self.changed_emitted += 1
-
- def getValue(self):
- self.getter_called += 1
- return self._value
-
- def setValue(self, value):
- self.setter_called += 1
- if (self._value != value):
- self._value = value
- self.valueChanged.emit()
-
- value = Property(int, fget=getValue, fset=setValue,
- notify=valueChanged)
-
-
-class PropertyTest(unittest.TestCase):
-
- def test1Object(self):
- """Basic property test."""
- testObject = TestObject()
- v = testObject.value
- self.assertEqual(v, -1)
- self.assertEqual(testObject.getter_called, 1)
- testObject.value = 42
- v = testObject.value
- self.assertEqual(v, 42)
- self.assertEqual(testObject.changed_emitted, 1)
- self.assertEqual(testObject.setter_called, 1)
- self.assertEqual(testObject.getter_called, 2)
-
- def test2DerivedObject(self):
- """PYSIDE-1255: Run the same test for a class inheriting QObject."""
- testObject = TestDerivedObject()
- v = testObject.value
- self.assertEqual(v, -1)
- self.assertEqual(testObject.getter_called, 1)
- testObject.value = 42
- v = testObject.value
- self.assertEqual(v, 42)
- self.assertEqual(testObject.changed_emitted, 1)
- self.assertEqual(testObject.setter_called, 1)
- self.assertEqual(testObject.getter_called, 2)
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/pysidetest/property_python_test.py b/sources/pyside2/tests/pysidetest/property_python_test.py
deleted file mode 100644
index 443977c90..000000000
--- a/sources/pyside2/tests/pysidetest/property_python_test.py
+++ /dev/null
@@ -1,231 +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$
-##
-#############################################################################
-
-"""
-Test for PySide's Property
-==========================
-
-This test is copied from Python's `test_property.py` and adapted to
-the PySide Property implementation.
-
-This test is to ensure maximum compatibility.
-"""
-
-# Test case for property
-# more tests are in test_descr
-
-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 Property, QObject
-#from PyQt5.QtCore import pyqtProperty as Property, QObject
-
-# This are the original imports.
-import sys
-import unittest
-has_test = False
-try:
- from test import support
- has_test = True
-except ImportError:
- pass
-
-class PropertyBase(Exception):
- pass
-
-class PropertyGet(PropertyBase):
- pass
-
-class PropertySet(PropertyBase):
- pass
-
-class PropertyDel(PropertyBase):
- pass
-
-class BaseClass(QObject):
- def __init__(self):
- QObject.__init__(self)
-
- self._spam = 5
-
- @Property(object)
- def spam(self):
- """BaseClass.getter"""
- return self._spam
-
- @spam.setter
- def spam(self, value):
- self._spam = value
-
- @spam.deleter
- def spam(self):
- del self._spam
-
-class SubClass(BaseClass):
-
- @BaseClass.spam.getter
- def spam(self):
- """SubClass.getter"""
- raise PropertyGet(self._spam)
-
- @spam.setter
- def spam(self, value):
- raise PropertySet(self._spam)
-
- @spam.deleter
- def spam(self):
- raise PropertyDel(self._spam)
-
-class PropertyDocBase(object):
- _spam = 1
- def _get_spam(self):
- return self._spam
- spam = Property(object, _get_spam, doc="spam spam spam")
-
-class PropertyDocSub(PropertyDocBase):
- @PropertyDocBase.spam.getter
- def spam(self):
- """The decorator does not use this doc string"""
- return self._spam
-
-class PropertySubNewGetter(BaseClass):
- @BaseClass.spam.getter
- def spam(self):
- """new docstring"""
- return 5
-
-class PropertyNewGetter(QObject):
- def __init__(self):
- QObject.__init__(self)
-
- @Property(object)
- def spam(self):
- """original docstring"""
- return 1
- @spam.getter
- def spam(self):
- """new docstring"""
- return 8
-
-class PropertyTests(unittest.TestCase):
- def test_property_decorator_baseclass(self):
- # see #1620
- base = BaseClass()
- self.assertEqual(base.spam, 5)
- self.assertEqual(base._spam, 5)
- base.spam = 10
- self.assertEqual(base.spam, 10)
- self.assertEqual(base._spam, 10)
- delattr(base, "spam")
- self.assertTrue(not hasattr(base, "spam"))
- self.assertTrue(not hasattr(base, "_spam"))
- base.spam = 20
- self.assertEqual(base.spam, 20)
- self.assertEqual(base._spam, 20)
-
- def test_property_decorator_subclass(self):
- # see #1620
- sub = SubClass()
- self.assertRaises(PropertyGet, getattr, sub, "spam")
- self.assertRaises(PropertySet, setattr, sub, "spam", None)
- self.assertRaises(PropertyDel, delattr, sub, "spam")
-
- @unittest.skipIf(sys.flags.optimize >= 2,
- "Docstrings are omitted with -O2 and above")
- def test_property_decorator_subclass_doc(self):
- sub = SubClass()
- self.assertEqual(sub.__class__.spam.__doc__, "SubClass.getter")
-
- @unittest.skipIf(sys.flags.optimize >= 2,
- "Docstrings are omitted with -O2 and above")
- def test_property_decorator_baseclass_doc(self):
- base = BaseClass()
- self.assertEqual(base.__class__.spam.__doc__, "BaseClass.getter")
-
- def test_property_decorator_doc(self):
- base = PropertyDocBase()
- sub = PropertyDocSub()
- self.assertEqual(base.__class__.spam.__doc__, "spam spam spam")
- self.assertEqual(sub.__class__.spam.__doc__, "spam spam spam")
-
- @unittest.skipIf(sys.flags.optimize >= 2,
- "Docstrings are omitted with -O2 and above")
- def test_property_getter_doc_override(self):
- newgettersub = PropertySubNewGetter()
- self.assertEqual(newgettersub.spam, 5)
- self.assertEqual(newgettersub.__class__.spam.__doc__, "new docstring")
- newgetter = PropertyNewGetter()
- self.assertEqual(newgetter.spam, 8)
- self.assertEqual(newgetter.__class__.spam.__doc__, "new docstring")
-
- @unittest.skipIf(sys.flags.optimize >= 2,
- "Docstrings are omitted with -O2 and above")
- def test_property_builtin_doc_writable(self):
- p = Property(object, doc='basic')
- self.assertEqual(p.__doc__, 'basic')
- p.__doc__ = 'extended'
- self.assertEqual(p.__doc__, 'extended')
-
- @unittest.skipIf(sys.flags.optimize >= 2,
- "Docstrings are omitted with -O2 and above")
- def test_property_decorator_doc_writable(self):
- class PropertyWritableDoc(object):
-
- @Property(object)
- def spam(self):
- """Eggs"""
- return "eggs"
-
- sub = PropertyWritableDoc()
- self.assertEqual(sub.__class__.spam.__doc__, 'Eggs')
- sub.__class__.spam.__doc__ = 'Spam'
- self.assertEqual(sub.__class__.spam.__doc__, 'Spam')
-
- if has_test: # This test has no support in Python 2
- @support.refcount_test
- def test_refleaks_in___init__(self):
- gettotalrefcount = support.get_attribute(sys, 'gettotalrefcount')
- fake_prop = Property(object, 'fget', 'fset', "freset", 'fdel', 'doc')
- refs_before = gettotalrefcount()
- for i in range(100):
- fake_prop.__init__(object, 'fget', 'fset', "freset", 'fdel', 'doc')
- self.assertAlmostEqual(gettotalrefcount() - refs_before, 0, delta=10)
-
-
-# Note: We ignore the whole subclass tests concerning __doc__ strings.
-# See the original Python test starting with:
-# "Issue 5890: subclasses of property do not preserve method __doc__ strings"
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/pysidetest/pysidetest_global.h b/sources/pyside2/tests/pysidetest/pysidetest_global.h
deleted file mode 100644
index 6f9b187ba..000000000
--- a/sources/pyside2/tests/pysidetest/pysidetest_global.h
+++ /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$
-**
-****************************************************************************/
-
-#ifndef PYSIDETEST_GLOBAL_H
-#define PYSIDETEST_GLOBAL_H
-
-// PySide global.h file
-#include "testobject.h"
-#include "testview.h"
-#include "flagstest.h"
-#include "hiddenobject.h"
-
-#endif // PYSIDETEST_GLOBAL_H
diff --git a/sources/pyside2/tests/pysidetest/pysidetest_macros.h b/sources/pyside2/tests/pysidetest/pysidetest_macros.h
deleted file mode 100644
index b561efbbc..000000000
--- a/sources/pyside2/tests/pysidetest/pysidetest_macros.h
+++ /dev/null
@@ -1,43 +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$
-**
-****************************************************************************/
-
-#ifndef PYSIDETEST_MACROS_H
-#define PYSIDETEST_MACROS_H
-
-#include <pysidemacros.h>
-
-#define PYSIDETEST_EXPORT PYSIDE_EXPORT
-#define PYSIDETEST_IMPORT PYSIDE_IMPORT
-
-#ifdef BUILD_PYSIDETEST
-# define PYSIDETEST_API PYSIDETEST_EXPORT
-#else
-# define PYSIDETEST_API PYSIDETEST_IMPORT
-#endif
-
-#endif // PYSIDETEST_MACROS_H
diff --git a/sources/pyside2/tests/pysidetest/qapp_like_a_macro_test.py b/sources/pyside2/tests/pysidetest/qapp_like_a_macro_test.py
deleted file mode 100644
index bfcf40111..000000000
--- a/sources/pyside2/tests/pysidetest/qapp_like_a_macro_test.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)
-
-import PySide2
-
-# This test tests the new "macro" feature of qApp.
-# It also uses the qApp variable to finish the instance and start over.
-
-# Note: this test makes qapplication_singleton_test.py obsolete.
-
-class qAppMacroTest(unittest.TestCase):
- _test_1093_is_first = True
-
- def test_qApp_is_like_a_macro_and_can_restart(self):
- self._test_1093_is_first = False
- from PySide2 import QtCore
- try:
- from PySide2 import QtGui, QtWidgets
- except ImportError:
- QtWidgets = QtGui = QtCore
- # qApp is in the builtins
- self.assertEqual(bool(qApp), False)
- # and the type is None
- self.assertTrue(qApp is None)
- # now we create an application for all cases
- classes = (QtCore.QCoreApplication,
- QtGui.QGuiApplication,
- QtWidgets.QApplication)
- for klass in classes:
- print("created", klass([]))
- qApp.shutdown()
- print("deleted qApp", qApp)
- # creating without deletion raises:
- QtCore.QCoreApplication([])
- with self.assertRaises(RuntimeError):
- QtCore.QCoreApplication([])
- self.assertEqual(QtCore.QCoreApplication.instance(), qApp)
-
- def test_1093(self):
- # Test that without creating a QApplication staticMetaObject still exists.
- # Please see https://bugreports.qt.io/browse/PYSIDE-1093 for explanation.
- # Note: This test must run first, otherwise we would be mislead!
- assert self._test_1093_is_first
- from PySide2 import QtCore
- self.assertTrue(QtCore.QObject.staticMetaObject is not None)
- app = QtCore.QCoreApplication.instance()
- self.assertTrue(QtCore.QObject.staticMetaObject is not None)
- if app is None:
- app = QtCore.QCoreApplication([])
- self.assertTrue(QtCore.QObject.staticMetaObject is not None)
- qApp.shutdown()
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/pysidetest/qvariant_test.py b/sources/pyside2/tests/pysidetest/qvariant_test.py
deleted file mode 100644
index 547cca441..000000000
--- a/sources/pyside2/tests/pysidetest/qvariant_test.py
+++ /dev/null
@@ -1,51 +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(True)
-
-from testbinding import TestObject
-from PySide2.QtCore import Qt
-from PySide2.QtGui import QKeySequence
-
-from helper.usesqapplication import UsesQApplication
-
-class QVariantTest(UsesQApplication):
-
- def testQKeySequenceQVariantOperator(self):
- # bug #775
- ks = QKeySequence(Qt.SHIFT, Qt.CTRL, Qt.Key_P, Qt.Key_R)
- self.assertEqual(TestObject.checkType(ks), 4107)
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/pysidetest/repr_test.py b/sources/pyside2/tests/pysidetest/repr_test.py
deleted file mode 100644
index 356d11911..000000000
--- a/sources/pyside2/tests/pysidetest/repr_test.py
+++ /dev/null
@@ -1,90 +0,0 @@
-# -*- coding: utf-8 -*-
-
-#############################################################################
-##
-## Copyright (C) 2019 The Qt Company Ltd.
-## Copyright (C) 2019 Andreas Beckermann
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:LGPL$
-## 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 Lesser General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU Lesser
-## General Public License version 3 as published by the Free Software
-## Foundation and appearing in the file LICENSE.LGPL3 included in the
-## packaging of this file. Please review the following information to
-## ensure the GNU Lesser General Public License version 3 requirements
-## will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 2.0 or (at your option) the GNU General
-## Public license version 3 or any later version approved by the KDE Free
-## Qt Foundation. The licenses are as published by the Free Software
-## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-## 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-2.0.html and
-## 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(True)
-
-from testbinding import PySideCPP, TestObject
-
-class QObjectDerivedReprTest(unittest.TestCase):
- """Test the __repr__ implementation of QObject derived classes"""
-
- def testReprWithoutNamespace(self):
- """Test that classes outside a namespace that have a operator<<(QDebug,...) defined use that
- for __repr__"""
- t = TestObject(123)
-
- # We don't define __str__, so str(q) should call __repr__
- self.assertEqual(t.__repr__(), str(t))
-
- # __repr__ should use the operator<<(QDebug,...) implementation
- self.assertIn('TestObject(id=123)', str(t))
-
- def testReprWithNamespace(self):
- """Test that classes inside a namespace that have a operator<<(QDebug,...) defined use that
- for __repr__"""
- t = PySideCPP.TestObjectWithNamespace(None)
-
- # We don't define __str__, so str(q) should call __repr__
- self.assertEqual(t.__repr__(), str(t))
-
- # __repr__ should use the operator<<(QDebug,...) implementation
- self.assertIn('TestObjectWithNamespace("TestObjectWithNamespace")', str(t))
-
- def testReprInject(self):
- """Test that injecting __repr__ via typesystem overrides the operator<<(QDebug, ...)"""
- t = PySideCPP.TestObject2WithNamespace(None)
-
- # We don't define __str__, so str(q) should call __repr__
- self.assertEqual(t.__repr__(), str(t))
-
- # __repr__ should use the operator<<(QDebug,...) implementation
- self.assertEqual(str(t), "TestObject2WithNamespace(injected_repr)")
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/sources/pyside2/tests/pysidetest/signal_slot_warning.py b/sources/pyside2/tests/pysidetest/signal_slot_warning.py
deleted file mode 100644
index a54974c3b..000000000
--- a/sources/pyside2/tests/pysidetest/signal_slot_warning.py
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/usr/bin/python
-
-#############################################################################
-##
-## 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$
-##
-#############################################################################
-
-''' PYSIDE-315: https://bugreports.qt.io/browse/PYSIDE-315
- Test that creating a signal in the wrong order triggers a warning. '''
-
-from __future__ import print_function
-
-import os
-import sys
-import unittest
-import warnings
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-import PySide2.QtCore as QtCore
-
-
-class Whatever(QtCore.QObject):
- echoSignal = QtCore.Signal(str)
-
- def __init__(self):
- super(Whatever, self).__init__()
- self.echoSignal.connect(self.mySlot)
-
- def mySlot(self, v):
- pass
-
-class WarningTest(unittest.TestCase):
- def testSignalSlotWarning(self):
- # we create an object. This gives no warning.
- obj = Whatever()
- # then we insert a signal after slots have been created.
- setattr(Whatever, "foo", QtCore.Signal())
- with warnings.catch_warnings(record=True) as w:
- # Cause all warnings to always be triggered.
- warnings.simplefilter("always")
- # Trigger a warning.
- obj.foo.connect(obj.mySlot)
- # Verify some things
- assert issubclass(w[-1].category, RuntimeWarning)
- assert "*** Sort Warning ***" in str(w[-1].message)
- # note that this warning cannot be turned into an error (too hard)
-
-
-if __name__ == "__main__":
- unittest.main()
diff --git a/sources/pyside2/tests/pysidetest/signal_tp_descr_get_test.py b/sources/pyside2/tests/pysidetest/signal_tp_descr_get_test.py
deleted file mode 100644
index 61ad8b730..000000000
--- a/sources/pyside2/tests/pysidetest/signal_tp_descr_get_test.py
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/usr/bin/python
-
-#############################################################################
-##
-## 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$
-##
-#############################################################################
-
-"""
-PYSIDE-68: Test that signals have a `__get__` function after all.
-
-We supply a `tp_descr_get` slot for the signal type.
-That creates the `__get__` method via `PyType_Ready`.
-
-The original test script was converted to a unittest.
-See https://bugreports.qt.io/browse/PYSIDE-68 .
-
-Created: 16 May '12 21:25
-Updated: 17 Sep '20 17:02
-
-This fix was over 8 years late. :)
-"""
-
-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 import QtCore
-
-
-def emit_upon_success(signal):
- def f_(f):
- def f__(self):
- result = f(self)
- s = signal.__get__(self)
- print(result)
- return result
- return f__
- return f_
-
-
-class Foo(QtCore.QObject):
- SIG = QtCore.Signal()
-
- @emit_upon_success(SIG)
- def do_something(self):
- print("hooka, it worrrks")
- return 42
-
-
-class UnderUnderGetUnderUnderTest(unittest.TestCase):
- def test_tp_descr_get(self):
- foo = Foo()
- ret = foo.do_something()
- self.assertEqual(ret, 42)
-
-
-if __name__ == "__main__":
- unittest.main()
diff --git a/sources/pyside2/tests/pysidetest/signalandnamespace_test.py b/sources/pyside2/tests/pysidetest/signalandnamespace_test.py
deleted file mode 100644
index f56beaf84..000000000
--- a/sources/pyside2/tests/pysidetest/signalandnamespace_test.py
+++ /dev/null
@@ -1,127 +0,0 @@
-#!/usr/bin/python
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(True)
-
-from testbinding import PySideCPP, TestObjectWithoutNamespace
-
-class ModelViewTest(unittest.TestCase):
-
- def callback(self, o):
- self._called = o
-
- def testWithoutNamespace(self):
- self._called = None
- o = PySideCPP.TestObjectWithNamespace(None)
- o.emitSignal.connect(self.callback)
- o.emitSignal.emit(o)
- self.assertTrue(o == self._called)
-
- self._called = None
- o = PySideCPP.TestObjectWithNamespace(None)
- o.emitSignal.connect(self.callback)
- o.callSignal(o)
- self.assertTrue(o == self._called)
-
- def testWithNamespace(self):
- self._called = None
- o = PySideCPP.TestObjectWithNamespace(None)
- o.emitSignalWithNamespace.connect(self.callback)
- o.emitSignalWithNamespace.emit(o)
- self.assertTrue(o == self._called)
-
- self._called = None
- o = PySideCPP.TestObjectWithNamespace(None)
- o.emitSignalWithNamespace.connect(self.callback)
- o.callSignalWithNamespace(o)
- self.assertTrue(o == self._called)
-
-
- def testWithoutNamespace1(self):
- self._called = None
- o = TestObjectWithoutNamespace(None)
- o.emitSignal.connect(self.callback)
- o.emitSignal.emit(o)
- self.assertTrue(o == self._called)
-
- self._called = None
- o = TestObjectWithoutNamespace(None)
- o.emitSignal.connect(self.callback)
- o.callSignal(o)
- self.assertTrue(o == self._called)
-
- def testWithNamespace1(self):
- self._called = None
- o = TestObjectWithoutNamespace(None)
- o.emitSignalWithNamespace.connect(self.callback)
- o.emitSignalWithNamespace.emit(o)
- self.assertTrue(o == self._called)
-
- self._called = None
- o = TestObjectWithoutNamespace(None)
- o.emitSignalWithNamespace.connect(self.callback)
- o.callSignalWithNamespace(o)
- self.assertTrue(o == self._called)
-
- def testTypedfWithouNamespace(self):
- self._called = None
- o = PySideCPP.TestObjectWithNamespace(None)
- o.emitSignalWithTypedef.connect(self.callback)
- o.emitSignalWithTypedef.emit(10)
- self.assertEqual(10, self._called)
-
- self._called = None
- o = PySideCPP.TestObjectWithNamespace(None)
- o.emitSignalWithTypedef.connect(self.callback)
- o.callSignalWithTypedef(10)
- self.assertEqual(10, self._called)
-
- def testTypedefWithNamespace(self):
- self._called = None
- o = TestObjectWithoutNamespace(None)
- o.emitSignalWithTypedef.connect(self.callback)
- o.emitSignalWithTypedef.emit(10)
- self.assertEqual(10, self._called)
-
- self._called = None
- o = TestObjectWithoutNamespace(None)
- o.emitSignalWithTypedef.connect(self.callback)
- o.callSignalWithTypedef(10)
- self.assertEqual(10, self._called)
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/sources/pyside2/tests/pysidetest/signalemissionfrompython_test.py b/sources/pyside2/tests/pysidetest/signalemissionfrompython_test.py
deleted file mode 100644
index ed7302c69..000000000
--- a/sources/pyside2/tests/pysidetest/signalemissionfrompython_test.py
+++ /dev/null
@@ -1,114 +0,0 @@
-#!/usr/bin/python
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(True)
-
-from testbinding import TestObject
-from PySide2.QtCore import QObject, SIGNAL
-
-'''Tests the behaviour of signals with default values when emitted from Python.'''
-
-class SignalEmissionFromPython(unittest.TestCase):
-
- def setUp(self):
- self.obj1 = TestObject(0)
- self.obj2 = TestObject(0)
- self.one_called = 0
- self.two_called = 0
-
- def tearDown(self):
- del self.obj1
- del self.obj2
- del self.one_called
- del self.two_called
-
- def testConnectNewStyleEmitVoidSignal(self):
- def callbackOne():
- self.one_called += 1
- self.obj2.signalWithDefaultValue.emit()
- def callbackTwo():
- self.two_called += 1
- self.obj1.signalWithDefaultValue.connect(callbackOne)
- self.obj2.signalWithDefaultValue.connect(callbackTwo)
- self.obj1.emitSignalWithDefaultValue_void()
- self.obj2.emitSignalWithDefaultValue_void()
- self.assertEqual(self.one_called, 1)
- self.assertEqual(self.two_called, 2)
-
- def testConnectOldStyleEmitVoidSignal(self):
- def callbackOne():
- self.one_called += 1
- self.obj2.signalWithDefaultValue.emit()
- def callbackTwo():
- self.two_called += 1
- QObject.connect(self.obj1, SIGNAL('signalWithDefaultValue()'), callbackOne)
- QObject.connect(self.obj2, SIGNAL('signalWithDefaultValue()'), callbackTwo)
- self.obj1.emitSignalWithDefaultValue_void()
- self.obj2.emitSignalWithDefaultValue_void()
- self.assertEqual(self.one_called, 1)
- self.assertEqual(self.two_called, 2)
-
- def testConnectNewStyleEmitBoolSignal(self):
- def callbackOne():
- self.one_called += 1
- self.obj2.signalWithDefaultValue[bool].emit(True)
- def callbackTwo():
- self.two_called += 1
- self.obj1.signalWithDefaultValue.connect(callbackOne)
- self.obj2.signalWithDefaultValue.connect(callbackTwo)
- self.obj1.emitSignalWithDefaultValue_void()
- self.obj2.emitSignalWithDefaultValue_void()
- self.assertEqual(self.one_called, 1)
- self.assertEqual(self.two_called, 2)
-
- def testConnectOldStyleEmitBoolSignal(self):
- def callbackOne():
- self.one_called += 1
- self.obj2.signalWithDefaultValue[bool].emit(True)
- def callbackTwo():
- self.two_called += 1
- QObject.connect(self.obj1, SIGNAL('signalWithDefaultValue()'), callbackOne)
- QObject.connect(self.obj2, SIGNAL('signalWithDefaultValue()'), callbackTwo)
- self.obj1.emitSignalWithDefaultValue_void()
- self.obj2.emitSignalWithDefaultValue_void()
- self.assertEqual(self.one_called, 1)
- self.assertEqual(self.two_called, 2)
-
-
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/sources/pyside2/tests/pysidetest/signalwithdefaultvalue_test.py b/sources/pyside2/tests/pysidetest/signalwithdefaultvalue_test.py
deleted file mode 100644
index fc13fc0d9..000000000
--- a/sources/pyside2/tests/pysidetest/signalwithdefaultvalue_test.py
+++ /dev/null
@@ -1,102 +0,0 @@
-#!/usr/bin/python
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(True)
-
-from testbinding import TestObject
-from PySide2.QtCore import QObject, SIGNAL
-
-'''Tests the behaviour of signals with default values.'''
-
-class SignalWithDefaultValueTest(unittest.TestCase):
-
- def setUp(self):
- self.obj = TestObject(0)
- self.void_called = False
- self.bool_called = False
-
- def tearDown(self):
- del self.obj
- del self.void_called
- del self.bool_called
-
- def testConnectNewStyleEmitVoidSignal(self):
- def callbackVoid():
- self.void_called = True
- def callbackBool(value):
- self.bool_called = True
- self.obj.signalWithDefaultValue.connect(callbackVoid)
- self.obj.signalWithDefaultValue[bool].connect(callbackBool)
- self.obj.emitSignalWithDefaultValue_void()
- self.assertTrue(self.void_called)
- self.assertTrue(self.bool_called)
-
- def testConnectNewStyleEmitBoolSignal(self):
- def callbackVoid():
- self.void_called = True
- def callbackBool(value):
- self.bool_called = True
- self.obj.signalWithDefaultValue.connect(callbackVoid)
- self.obj.signalWithDefaultValue[bool].connect(callbackBool)
- self.obj.emitSignalWithDefaultValue_bool()
- self.assertTrue(self.void_called)
- self.assertTrue(self.bool_called)
-
- def testConnectOldStyleEmitVoidSignal(self):
- def callbackVoid():
- self.void_called = True
- def callbackBool(value):
- self.bool_called = True
- QObject.connect(self.obj, SIGNAL('signalWithDefaultValue()'), callbackVoid)
- QObject.connect(self.obj, SIGNAL('signalWithDefaultValue(bool)'), callbackBool)
- self.obj.emitSignalWithDefaultValue_void()
- self.assertTrue(self.void_called)
- self.assertTrue(self.bool_called)
-
- def testConnectOldStyleEmitBoolSignal(self):
- def callbackVoid():
- self.void_called = True
- def callbackBool(value):
- self.bool_called = True
- QObject.connect(self.obj, SIGNAL('signalWithDefaultValue()'), callbackVoid)
- QObject.connect(self.obj, SIGNAL('signalWithDefaultValue(bool)'), callbackBool)
- self.obj.emitSignalWithDefaultValue_bool()
- self.assertTrue(self.void_called)
- self.assertTrue(self.bool_called)
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/sources/pyside2/tests/pysidetest/symbols.filter b/sources/pyside2/tests/pysidetest/symbols.filter
deleted file mode 100644
index af6c744dd..000000000
--- a/sources/pyside2/tests/pysidetest/symbols.filter
+++ /dev/null
@@ -1,7 +0,0 @@
-{
-local:
-_ZSt*;
-_ZNSt*;
-_ZNSs*;
-_ZNKSt*;
-};
diff --git a/sources/pyside2/tests/pysidetest/testobject.cpp b/sources/pyside2/tests/pysidetest/testobject.cpp
deleted file mode 100644
index 43fa93bac..000000000
--- a/sources/pyside2/tests/pysidetest/testobject.cpp
+++ /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$
-**
-****************************************************************************/
-
-#include "testobject.h"
-
-#include <QtCore/QDebug>
-
-void TestObject::emitIdValueSignal()
-{
- emit idValue(m_idValue);
-}
-
-void TestObject::emitStaticMethodDoubleSignal()
-{
- emit staticMethodDouble();
-}
-
-void TestObject::emitSignalWithDefaultValue_void()
-{
- emit signalWithDefaultValue();
-}
-
-void TestObject::emitSignalWithDefaultValue_bool()
-{
- emit signalWithDefaultValue(true);
-}
-
-void TestObject::emitSignalWithTypedefValue(int value)
-{
- emit signalWithTypedefValue(TypedefValue(value));
-}
-
-QDebug operator<<(QDebug dbg, TestObject& testObject)
-{
- QDebugStateSaver saver(dbg);
- dbg.nospace() << "TestObject(id=" << testObject.idValue() << ") ";
- return dbg;
-}
-
-namespace PySideCPP {
- QDebug operator<<(QDebug dbg, TestObjectWithNamespace& testObject)
- {
- QDebugStateSaver saver(dbg);
- dbg.nospace() << "TestObjectWithNamespace(" << testObject.name() << ") ";
- return dbg;
- }
- QDebug operator<<(QDebug dbg, TestObject2WithNamespace& testObject)
- {
- QDebugStateSaver saver(dbg);
- dbg.nospace() << "TestObject2WithNamespace(" << testObject.name() << ") ";
- return dbg;
- }
-}
diff --git a/sources/pyside2/tests/pysidetest/testobject.h b/sources/pyside2/tests/pysidetest/testobject.h
deleted file mode 100644
index c31a2ab73..000000000
--- a/sources/pyside2/tests/pysidetest/testobject.h
+++ /dev/null
@@ -1,153 +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$
-**
-****************************************************************************/
-
-#ifndef TESTOBJECT_H
-#define TESTOBJECT_H
-
-#include "pysidetest_macros.h"
-
-#include <QtWidgets/QApplication>
-
-#include <QtCore/QObject>
-#include <QtCore/QMetaType>
-#include <QtCore/QVariant>
-
-QT_FORWARD_DECLARE_CLASS(QDebug)
-
-class IntValue
-{
-public:
-
- IntValue(int val): value(val){};
- IntValue() : value(0) {};
- int value;
-};
-
-typedef IntValue TypedefValue;
-
-class PYSIDETEST_API TestObject : public QObject
-{
- Q_OBJECT
-public:
- static void createApp() { int argc=0; new QApplication(argc, 0); };
- static int checkType(const QVariant& var) { return var.metaType().id(); }
-
- TestObject(int idValue, QObject* parent = 0) : QObject(parent), m_idValue(idValue) {}
- int idValue() const { return m_idValue; }
- static int staticMethodDouble(int value) { return value * 2; }
- void addChild(QObject* c) { m_children.append(c); emit childrenChanged(m_children); }
-
- void emitIdValueSignal();
- void emitStaticMethodDoubleSignal();
-
- void emitSignalWithDefaultValue_void();
- void emitSignalWithDefaultValue_bool();
-
- void emitSignalWithTypedefValue(int value);
-
-signals:
- void idValue(int newValue);
- void justASignal();
- void staticMethodDouble();
- void childrenChanged(const QList<QObject*>&);
- void signalWithDefaultValue(bool value = false);
- void signalWithTypedefValue(TypedefValue value);
-
-private:
- int m_idValue;
- QList<QObject*> m_children;
-};
-
-PYSIDETEST_API QDebug operator<<(QDebug dbg, TestObject &testObject);
-
-typedef int PySideInt;
-
-
-namespace PySideCPP {
-
-class PYSIDETEST_API TestObjectWithNamespace : public QObject
-{
- Q_OBJECT
-public:
- TestObjectWithNamespace(QObject* parent) : QObject(parent) {}
- QString name() { return "TestObjectWithNamespace"; }
-
- void callSignal(TestObjectWithNamespace* obj) { emitSignal(obj); }
- void callSignalWithNamespace(TestObjectWithNamespace* obj) { emitSignalWithNamespace(obj); }
- void callSignalWithTypedef(int val) { emitSignalWithTypedef(val); }
-
-signals:
- void emitSignal(TestObjectWithNamespace* obj);
- void emitSignalWithNamespace(PySideCPP::TestObjectWithNamespace* obj);
- void emitSignalWithTypedef(PySideInt val);
-};
-
-PYSIDETEST_API QDebug operator<<(QDebug dbg, TestObjectWithNamespace &testObject);
-
-class PYSIDETEST_API TestObject2WithNamespace : public QObject
-{
- Q_OBJECT
-public:
- TestObject2WithNamespace(QObject* parent) : QObject(parent) {}
- QString name() { return "TestObject2WithNamespace"; }
-};
-
-PYSIDETEST_API QDebug operator<<(QDebug dbg, TestObject2WithNamespace& testObject);
-
-} // Namespace PySideCPP
-
-namespace PySideCPP2 {
-
-enum Enum1 { Option1 = 1, Option2 = 2 };
-
-
-typedef long PySideLong;
-
-class PYSIDETEST_API TestObjectWithoutNamespace : public QObject
-{
- Q_OBJECT
-public:
- enum Enum2 { Option3 = 3, Option4 = 4};
- TestObjectWithoutNamespace(QObject* parent) : QObject(parent) {}
- QString name() { return "TestObjectWithoutNamespace"; }
-
- void callSignal(TestObjectWithoutNamespace* obj) { emitSignal(obj); }
- void callSignalWithNamespace(TestObjectWithoutNamespace* obj) { emitSignalWithNamespace(obj); }
- void callSignalWithTypedef(long val) { emitSignalWithTypedef(val); }
-
-signals:
- void emitSignal(TestObjectWithoutNamespace* obj);
- void emitSignalWithNamespace(PySideCPP2::TestObjectWithoutNamespace* obj);
- void emitSignalWithTypedef(PySideLong val);
-};
-
-
-} // Namespace PySideCPP2
-
-#endif // TESTOBJECT_H
-
diff --git a/sources/pyside2/tests/pysidetest/testview.cpp b/sources/pyside2/tests/pysidetest/testview.cpp
deleted file mode 100644
index 49e3730f5..000000000
--- a/sources/pyside2/tests/pysidetest/testview.cpp
+++ /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$
-**
-****************************************************************************/
-
-#include "testview.h"
-
-#include <QDebug>
-#include <QWidget>
-#include <QAbstractListModel>
-#include <QAbstractItemDelegate>
-
-QVariant
-TestView::getData()
-{
- QModelIndex index;
- return m_model->data(index);
-}
-
-QWidget*
-TestView::getEditorWidgetFromItemDelegate() const
-{
- if (!m_delegate)
- return 0;
-
- QModelIndex index;
- QStyleOptionViewItem options;
- return m_delegate->createEditor(0, options, index);
-}
diff --git a/sources/pyside2/tests/pysidetest/testview.h b/sources/pyside2/tests/pysidetest/testview.h
deleted file mode 100644
index b80a7fca9..000000000
--- a/sources/pyside2/tests/pysidetest/testview.h
+++ /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$
-**
-****************************************************************************/
-
-#ifndef TESTVIEW_H
-#define TESTVIEW_H
-
-#include "pysidetest_macros.h"
-
-#include <QtCore/QObject>
-
-QT_BEGIN_NAMESPACE
-class QWidget;
-class QAbstractListModel;
-class QAbstractItemDelegate;
-QT_END_NAMESPACE
-
-class PYSIDETEST_API TestView : public QObject
-{
- Q_OBJECT
-public:
- TestView(QAbstractListModel* model, QObject* parent = 0) : QObject(parent), m_model(model) {}
- QAbstractListModel* model() { return m_model; }
- QVariant getData();
-
- void setItemDelegate(QAbstractItemDelegate* delegate) { m_delegate = delegate; }
- QWidget* getEditorWidgetFromItemDelegate() const;
-
-private:
- QAbstractListModel* m_model;
- QAbstractItemDelegate* m_delegate;
-};
-
-#endif // TESTVIEW_H
-
diff --git a/sources/pyside2/tests/pysidetest/typedef_signal_test.py b/sources/pyside2/tests/pysidetest/typedef_signal_test.py
deleted file mode 100644
index ecbfa35d4..000000000
--- a/sources/pyside2/tests/pysidetest/typedef_signal_test.py
+++ /dev/null
@@ -1,60 +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(True)
-
-from PySide2.QtCore import QObject
-from testbinding import TestObject
-
-class Receiver(QObject):
-
- def __init__(self):
- QObject.__init__(self)
- self.received = None
-
- def slot(self, value):
- self.received = value
-
-class TypedefSignal(unittest.TestCase):
-
- def testTypedef(self):
- obj = TestObject(0)
- receiver = Receiver()
-
- obj.signalWithTypedefValue.connect(receiver.slot)
- obj.emitSignalWithTypedefValue(2)
- self.assertEqual(receiver.received.value, 2)
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/pysidetest/typesystem_pysidetest.xml b/sources/pyside2/tests/pysidetest/typesystem_pysidetest.xml
deleted file mode 100644
index c959e7fd3..000000000
--- a/sources/pyside2/tests/pysidetest/typesystem_pysidetest.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<typesystem package="testbinding">
- <load-typesystem name="QtWidgets/typesystem_widgets.xml" generate="no"/>
- <value-type name="IntValue"/>
- <primitive-type name="TypedefValue">
- <!--
- A conversion rule is used here because ApiExtractor can't associate
- a primitive typedef to a non-primitive type. That would be a good
- improvement to ApiExtractor.
- -->
- <conversion-rule>
- <native-to-target>
- return %CONVERTTOPYTHON[IntValue](%in);
- </native-to-target>
- <target-to-native>
- <add-conversion type="IntValue">
- IntValue value = %CONVERTTOCPP[IntValue](%in);
- %out = %OUTTYPE(value);
- </add-conversion>
- </target-to-native>
- </conversion-rule>
- </primitive-type>
- <object-type name="TestObject" />
-
- <primitive-type name="PySideInt"/>
- <primitive-type name="PySideCPP2::PySideLong"/>
- <!--<primitive-type name="PySideLong"/>-->
-
- <function signature="getHiddenObject()" />
-
- <inject-code position="end">
- Shiboken::Conversions::registerConverterName(Shiboken::Conversions::PrimitiveTypeConverter&lt;long&gt;(), "PySideLong");
- Shiboken::Conversions::registerConverterName(Shiboken::Conversions::PrimitiveTypeConverter&lt;long&gt;(), "PySideCPP2::PySideLong");
- qRegisterMetaType&lt;PySideInt>("PySideInt");
- qRegisterMetaType&lt;PySideCPP2::PySideLong>("PySideLong");
- </inject-code>
-
- <namespace-type name="PySideCPP">
- <object-type name="TestObjectWithNamespace"/>
- <object-type name="TestObject2WithNamespace">
- <add-function signature="__repr__" return-type="PyObject*">
- <inject-code class="target" position="beginning">
- %PYARG_0 = Shiboken::String::fromCString("TestObject2WithNamespace(injected_repr)");
- </inject-code>
- </add-function>
- </object-type>
- </namespace-type>
-
- <namespace-type name="PySideCPP2" generate="no">
- <enum-type name="Enum1" />
- <object-type name="TestObjectWithoutNamespace">
- <enum-type name="Enum2" />
- </object-type>
- </namespace-type>
-
- <object-type name="TestView" >
- <modify-function signature="TestView(QAbstractListModel*,QObject*)">
- <modify-argument index="1">
- <reference-count action="set"/>
- </modify-argument>
- </modify-function>
- </object-type>
-
- <namespace-type name="FlagsNamespace" visible="no">
- <enum-type name="Option" flags="Options"/>
- <object-type name="ClassForEnum" />
- </namespace-type>
-
- <suppress-warning text="type 'QPyTextObject' is specified in typesystem, but not defined. This could potentially lead to compilation errors." />
- <!-- Qt5: I never really understood this warning. Probably it is because there
- is no way to instantiate the class. Anyway, why must this class emit this warning?
- I am not a C++ warrior, so I'd prefer if it would say "it is ok if you see this warning!".
- Well, maybe somebody will enlighten me, and I'll change this comment.
- I'd actually prefer an implementation that avoids generating this message, but I still failed
- doing so :-(
- -->
-</typesystem>
diff --git a/sources/pyside2/tests/pysidetest/version_test.py b/sources/pyside2/tests/pysidetest/version_test.py
deleted file mode 100644
index 5cc34d8c3..000000000
--- a/sources/pyside2/tests/pysidetest/version_test.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/python
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide2 import __version_info__, __version__, QtCore
-
-class CheckForVariablesTest(unittest.TestCase):
- def testVesions(self):
- version_tuple = (__version_info__[0], __version_info__[1], __version_info__[2])
- self.assertTrue(version_tuple >= (1, 0, 0))
-
- self.assertTrue(version_tuple < (99, 99, 99))
- self.assertTrue(__version__)
-
- self.assertTrue(QtCore.__version_info__ >= (4, 5, 0))
- self.assertTrue(QtCore.__version__)
-
-if __name__ == '__main__':
- unittest.main()
-