aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/tests/signals
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside2/tests/signals')
-rw-r--r--sources/pyside2/tests/signals/CMakeLists.txt42
-rw-r--r--sources/pyside2/tests/signals/args_dont_match_test.py57
-rw-r--r--sources/pyside2/tests/signals/bug_189.py60
-rw-r--r--sources/pyside2/tests/signals/bug_311.py77
-rw-r--r--sources/pyside2/tests/signals/bug_312.py85
-rw-r--r--sources/pyside2/tests/signals/bug_319.py70
-rw-r--r--sources/pyside2/tests/signals/bug_79.py76
-rw-r--r--sources/pyside2/tests/signals/decorators_test.py111
-rw-r--r--sources/pyside2/tests/signals/disconnect_test.py92
-rw-r--r--sources/pyside2/tests/signals/invalid_callback_test.py62
-rw-r--r--sources/pyside2/tests/signals/lambda_gui_test.py79
-rw-r--r--sources/pyside2/tests/signals/lambda_test.py98
-rw-r--r--sources/pyside2/tests/signals/leaking_signal_test.py51
-rw-r--r--sources/pyside2/tests/signals/multiple_connections_gui_test.py95
-rw-r--r--sources/pyside2/tests/signals/multiple_connections_test.py109
-rw-r--r--sources/pyside2/tests/signals/pysignal_test.py221
-rw-r--r--sources/pyside2/tests/signals/qobject_destroyed_test.py56
-rw-r--r--sources/pyside2/tests/signals/qobject_receivers_test.py83
-rw-r--r--sources/pyside2/tests/signals/qobject_sender_test.py127
-rw-r--r--sources/pyside2/tests/signals/ref01_test.py62
-rw-r--r--sources/pyside2/tests/signals/ref02_test.py82
-rw-r--r--sources/pyside2/tests/signals/ref03_test.py64
-rw-r--r--sources/pyside2/tests/signals/ref04_test.py91
-rw-r--r--sources/pyside2/tests/signals/ref05_test.py81
-rw-r--r--sources/pyside2/tests/signals/ref06_test.py84
-rw-r--r--sources/pyside2/tests/signals/segfault_proxyparent_test.py92
-rw-r--r--sources/pyside2/tests/signals/self_connect_test.py71
-rw-r--r--sources/pyside2/tests/signals/short_circuit_test.py97
-rw-r--r--sources/pyside2/tests/signals/signal2signal_connect_test.py142
-rw-r--r--sources/pyside2/tests/signals/signal_across_threads.py106
-rw-r--r--sources/pyside2/tests/signals/signal_autoconnect_test.py65
-rw-r--r--sources/pyside2/tests/signals/signal_connectiontype_support_test.py61
-rw-r--r--sources/pyside2/tests/signals/signal_emission_gui_test.py148
-rw-r--r--sources/pyside2/tests/signals/signal_emission_test.py158
-rw-r--r--sources/pyside2/tests/signals/signal_enum_test.py80
-rw-r--r--sources/pyside2/tests/signals/signal_func_test.py55
-rw-r--r--sources/pyside2/tests/signals/signal_manager_refcount_test.py59
-rw-r--r--sources/pyside2/tests/signals/signal_number_limit_test.py97
-rw-r--r--sources/pyside2/tests/signals/signal_object_test.py121
-rw-r--r--sources/pyside2/tests/signals/signal_signature_test.py121
-rw-r--r--sources/pyside2/tests/signals/signal_with_primitive_type_test.py65
-rw-r--r--sources/pyside2/tests/signals/slot_reference_count_test.py87
-rw-r--r--sources/pyside2/tests/signals/static_metaobject_test.py92
43 files changed, 0 insertions, 3832 deletions
diff --git a/sources/pyside2/tests/signals/CMakeLists.txt b/sources/pyside2/tests/signals/CMakeLists.txt
deleted file mode 100644
index 14936869f..000000000
--- a/sources/pyside2/tests/signals/CMakeLists.txt
+++ /dev/null
@@ -1,42 +0,0 @@
-PYSIDE_TEST(args_dont_match_test.py)
-PYSIDE_TEST(bug_79.py)
-PYSIDE_TEST(bug_189.py)
-PYSIDE_TEST(bug_311.py)
-PYSIDE_TEST(bug_312.py)
-PYSIDE_TEST(bug_319.py)
-PYSIDE_TEST(decorators_test.py)
-PYSIDE_TEST(disconnect_test.py)
-PYSIDE_TEST(invalid_callback_test.py)
-PYSIDE_TEST(lambda_gui_test.py)
-PYSIDE_TEST(lambda_test.py)
-PYSIDE_TEST(leaking_signal_test.py)
-PYSIDE_TEST(multiple_connections_gui_test.py)
-PYSIDE_TEST(multiple_connections_test.py)
-PYSIDE_TEST(pysignal_test.py)
-PYSIDE_TEST(qobject_destroyed_test.py)
-PYSIDE_TEST(qobject_receivers_test.py)
-PYSIDE_TEST(qobject_sender_test.py)
-PYSIDE_TEST(ref01_test.py)
-PYSIDE_TEST(ref02_test.py)
-PYSIDE_TEST(ref03_test.py)
-PYSIDE_TEST(ref04_test.py)
-PYSIDE_TEST(ref05_test.py)
-PYSIDE_TEST(ref06_test.py)
-PYSIDE_TEST(segfault_proxyparent_test.py)
-PYSIDE_TEST(self_connect_test.py)
-PYSIDE_TEST(short_circuit_test.py)
-PYSIDE_TEST(signal2signal_connect_test.py)
-PYSIDE_TEST(signal_across_threads.py)
-PYSIDE_TEST(signal_autoconnect_test.py)
-PYSIDE_TEST(signal_connectiontype_support_test.py)
-PYSIDE_TEST(signal_enum_test.py)
-PYSIDE_TEST(signal_emission_gui_test.py)
-PYSIDE_TEST(signal_emission_test.py)
-PYSIDE_TEST(signal_func_test.py)
-PYSIDE_TEST(signal_manager_refcount_test.py)
-PYSIDE_TEST(signal_number_limit_test.py)
-PYSIDE_TEST(signal_object_test.py)
-PYSIDE_TEST(signal_signature_test.py)
-PYSIDE_TEST(signal_with_primitive_type_test.py)
-PYSIDE_TEST(slot_reference_count_test.py)
-PYSIDE_TEST(static_metaobject_test.py)
diff --git a/sources/pyside2/tests/signals/args_dont_match_test.py b/sources/pyside2/tests/signals/args_dont_match_test.py
deleted file mode 100644
index 732706ac0..000000000
--- a/sources/pyside2/tests/signals/args_dont_match_test.py
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/usr/bin/env python
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide2.QtCore import *
-
-class ArgsDontMatch(unittest.TestCase):
-
- def callback(self, arg1):
- self.ok = True
-
- def testConnectSignalToSlotWithLessArgs(self):
- self.ok = False
- obj1 = QObject()
- QObject.connect(obj1, SIGNAL('the_signal(int, int, int)'), self.callback)
- obj1.emit(SIGNAL('the_signal(int, int, int)'), 1, 2, 3)
-
- self.assertTrue(self.ok)
-
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/signals/bug_189.py b/sources/pyside2/tests/signals/bug_189.py
deleted file mode 100644
index 6492f0359..000000000
--- a/sources/pyside2/tests/signals/bug_189.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(False)
-
-from PySide2 import QtCore, QtWidgets
-from helper.usesqapplication import UsesQApplication
-
-class TestBugPYSIDE189(UsesQApplication):
-
- def testDisconnect(self):
- # Disconnecting from a signal owned by a destroyed object
- # should raise an exception, not segfault.
- def onValueChanged(self, value):
- pass
-
- sld = QtWidgets.QSlider()
- sld.valueChanged.connect(onValueChanged)
-
- sld.deleteLater()
-
- QtCore.QTimer.singleShot(0, self.app.quit)
- self.app.exec_()
-
- self.assertRaises(RuntimeError, sld.valueChanged.disconnect, onValueChanged)
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/signals/bug_311.py b/sources/pyside2/tests/signals/bug_311.py
deleted file mode 100644
index c9782741d..000000000
--- a/sources/pyside2/tests/signals/bug_311.py
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide2 import QtCore
-from helper.usesqcoreapplication import UsesQCoreApplication
-
-class DerivedDate(QtCore.QDate):
- def __init__(self,y,m,d):
- super(DerivedDate,self).__init__(y,m,d)
-
-class Emitter(QtCore.QObject):
- dateSignal1 = QtCore.Signal(QtCore.QDate)
- dateSignal2 = QtCore.Signal(DerivedDate)
- tupleSignal = QtCore.Signal(tuple)
-
-class SignaltoSignalTest(UsesQCoreApplication):
- def myCb(self, dt):
- self._dt = dt
-
- def testBug(self):
- e = Emitter()
- d = DerivedDate(2010,8,24)
- self._dt = None
- e.dateSignal1.connect(self.myCb)
- e.dateSignal1.emit(d)
- self.assertEqual(self._dt, d)
-
- self._dt = None
- e.dateSignal2.connect(self.myCb)
- e.dateSignal2.emit(d)
- self.assertEqual(self._dt, d)
-
- myTuple = (5, 6, 7)
- self._dt = None
- e.tupleSignal.connect(self.myCb)
- e.tupleSignal.emit(myTuple)
- self.assertEqual(myTuple, self._dt)
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/sources/pyside2/tests/signals/bug_312.py b/sources/pyside2/tests/signals/bug_312.py
deleted file mode 100644
index 1b6eabe7e..000000000
--- a/sources/pyside2/tests/signals/bug_312.py
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide2.QtCore import QObject, SIGNAL
-
-MAX_LOOPS = 5
-MAX_OBJECTS = 200
-
-class Dummy(object):
- def __init__(self, parent):
- self._parent = parent
-
- def callback(self):
- self._called = True
-
-class MultipleSlots(unittest.TestCase):
- def myCB(self):
- self._count += 1
-
- """
- def testUnboundSignal(self):
- o = QObject()
- self._count = 0
- for i in range(MAX_OBJECTS):
- QObject.connect(o, SIGNAL("fire()"), lambda: self.myCB())
-
- o.emit(SIGNAL("fire()"))
- self.assertEqual(self._count, MAX_OBJECTS)
-
- """
- def testDisconnectCleanup(self):
- for c in range(MAX_LOOPS):
- self._count = 0
- self._senders = []
- for i in range(MAX_OBJECTS):
- o = QObject()
- QObject.connect(o, SIGNAL("fire()"), lambda: self.myCB())
- self._senders.append(o)
- o.emit(SIGNAL("fire()"))
-
- self.assertEqual(self._count, MAX_OBJECTS)
-
- #delete all senders will disconnect the signals
- self._senders = []
-
-if __name__ == '__main__':
- unittest.main()
-
-
diff --git a/sources/pyside2/tests/signals/bug_319.py b/sources/pyside2/tests/signals/bug_319.py
deleted file mode 100644
index 17cd8abcf..000000000
--- a/sources/pyside2/tests/signals/bug_319.py
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide2 import QtCore
-from helper.usesqcoreapplication import UsesQCoreApplication
-
-class Listener(QtCore.QObject):
- def __init__(self):
- QtCore.QObject.__init__(self, None)
- self._phrase = []
-
- @QtCore.Slot(tuple)
- def listen(self, words):
- for w in words:
- self._phrase.append(w)
-
-class Communicate(QtCore.QObject):
- # create a new signal on the fly and name it 'speak'
- speak = QtCore.Signal(tuple)
-
-class SignaltoSignalTest(UsesQCoreApplication):
- def testBug(self):
- someone = Communicate()
- someone2 = Listener()
- # connect signal and slot
- someone.speak.connect(someone2.listen)
- # emit 'speak' signal
- talk = ("one","two","three")
- someone.speak.emit(talk)
- self.assertEqual(someone2._phrase, list(talk))
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/sources/pyside2/tests/signals/bug_79.py b/sources/pyside2/tests/signals/bug_79.py
deleted file mode 100644
index ca25fb3f4..000000000
--- a/sources/pyside2/tests/signals/bug_79.py
+++ /dev/null
@@ -1,76 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-from __future__ import print_function
-import os
-import gc
-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 QtGui, QtWidgets
-
-try:
- from sys import gettotalrefcount
- skiptest = False
-except ImportError:
- skiptest = True
-
-class ConnectTest(unittest.TestCase):
-
- def callback(self, o):
- print("callback")
- self._called = o
-
- def testNoLeaks_ConnectAndDisconnect(self):
- self._called = None
- app = QtWidgets.QApplication([])
- o = QtWidgets.QTreeView()
- o.setModel(QtGui.QStandardItemModel())
- o.selectionModel().destroyed.connect(self.callback)
- o.selectionModel().destroyed.disconnect(self.callback)
- gc.collect()
- # if this is no debug build, then we check at least that
- # we do not crash any longer.
- if not skiptest:
- total = gettotalrefcount()
- for idx in range(1000):
- o.selectionModel().destroyed.connect(self.callback)
- o.selectionModel().destroyed.disconnect(self.callback)
- gc.collect()
- if not skiptest:
- delta = gettotalrefcount() - total
- print("delta total refcount =", delta)
- self.assertTrue(abs(delta) < 10)
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/signals/decorators_test.py b/sources/pyside2/tests/signals/decorators_test.py
deleted file mode 100644
index e262f0bce..000000000
--- a/sources/pyside2/tests/signals/decorators_test.py
+++ /dev/null
@@ -1,111 +0,0 @@
-#!/usr/bin/env python
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide2.QtCore import QObject, Slot, SIGNAL, SLOT
-
-class MyObject(QObject):
- def __init__(self, parent=None):
- QObject.__init__(self, parent)
- self._slotCalledCount = 0
-
- @Slot()
- def mySlot(self):
- self._slotCalledCount = self._slotCalledCount + 1
-
- @Slot(int)
- @Slot('QString')
- def mySlot2(self, arg0):
- self._slotCalledCount = self._slotCalledCount + 1
-
- @Slot(name='mySlot3')
- def foo(self):
- self._slotCalledCount = self._slotCalledCount + 1
-
- @Slot(str, int)
- def mySlot4(self, a, b):
- self._slotCalledCount = self._slotCalledCount + 1
-
- @Slot(result=int)
- def mySlot5(self):
- self._slotCalledCount = self._slotCalledCount + 1
-
- @Slot(result=QObject)
- def mySlot6(self):
- self._slotCalledCount = self._slotCalledCount + 1
-
-class StaticMetaObjectTest(unittest.TestCase):
-
- def testSignalPropagation(self):
- o = MyObject()
- m = o.metaObject()
- self.assertTrue(m.indexOfSlot('mySlot()') > 0)
- self.assertTrue(m.indexOfSlot('mySlot2(int)') > 0)
- self.assertTrue(m.indexOfSlot('mySlot2(QString)') > 0)
- self.assertTrue(m.indexOfSlot('mySlot3()') > 0)
- self.assertTrue(m.indexOfSlot('mySlot4(QString,int)') > 0)
-
- def testEmission(self):
- o = MyObject()
- o.connect(SIGNAL("mySignal()"), o, SLOT("mySlot()"))
- o.emit(SIGNAL("mySignal()"))
- self.assertTrue(o._slotCalledCount == 1)
-
- def testResult(self):
- o = MyObject()
- mo = o.metaObject()
- i = mo.indexOfSlot('mySlot5()')
- m = mo.method(i)
- self.assertEqual(m.typeName(), "int")
-
- def testResultObject(self):
- o = MyObject()
- mo = o.metaObject()
- i = mo.indexOfSlot('mySlot6()')
- m = mo.method(i)
- self.assertEqual(m.typeName(), "QObject*")
-
-class SlotWithoutArgs(unittest.TestCase):
-
- def testError(self):
- # It should be an error to call the slot without the
- # arguments, as just @Slot would end up in a slot
- # accepting argument functions
- self.assertRaises(TypeError, Slot, lambda: 3)
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/signals/disconnect_test.py b/sources/pyside2/tests/signals/disconnect_test.py
deleted file mode 100644
index 6242e9e38..000000000
--- a/sources/pyside2/tests/signals/disconnect_test.py
+++ /dev/null
@@ -1,92 +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 *
-from testbinding import TestObject
-
-
-class Foo(QObject):
- bar = Signal()
-
-class TestDisconnect(unittest.TestCase):
- def theSlot1(self):
- self.called1 = True
-
- def theSlot2(self):
- self.called2 = True
-
- def testIt(self):
- self.called1 = False
- self.called2 = False
- f = Foo()
- f.bar.connect(self.theSlot1)
- f.bar.connect(self.theSlot2)
- f.bar.emit()
- self.assertTrue(self.called1)
- self.assertTrue(self.called2)
-
- self.called1 = False
- self.called2 = False
- f.bar.disconnect()
- f.bar.emit()
- self.assertFalse(self.called1)
- self.assertFalse(self.called2)
-
- def testDuringCallback(self):
- """ Test to see if the C++ object for a connection is accessed after the
- method returns. This causes a segfault if the memory that was used by the
- C++ object has been reused. """
-
- self.called = False
- obj = TestObject(0)
- def callback():
- obj.signalWithDefaultValue.disconnect(callback)
-
- # Connect more callbacks to try to overwrite memory
- for i in range(1000):
- obj.signalWithDefaultValue.connect(lambda: None)
-
- self.called = True
-
- # A non-None return value is needed
- return True
- obj.signalWithDefaultValue.connect(callback)
- obj.signalWithDefaultValue.emit()
- self.assertTrue(self.called)
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/signals/invalid_callback_test.py b/sources/pyside2/tests/signals/invalid_callback_test.py
deleted file mode 100644
index 442720baa..000000000
--- a/sources/pyside2/tests/signals/invalid_callback_test.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-'''Test cases for passing invalid callbacks to QObject.connect'''
-
-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
-
-class InvalidCallback(unittest.TestCase):
- '''Test case for passing an invalid callback to QObject.connect'''
-
- def setUp(self):
- #Acquire resources
- self.obj = QObject()
-
- def tearDown(self):
- #Release resources
- try:
- del self.obj
- except AttributeError:
- pass
-
- def testIntegerCb(self):
- #Test passing an int as callback to QObject.connect
- self.assertRaises(TypeError, QObject.connect, self.obj,
- SIGNAL('destroyed()'), 42)
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/sources/pyside2/tests/signals/lambda_gui_test.py b/sources/pyside2/tests/signals/lambda_gui_test.py
deleted file mode 100644
index 843b4037f..000000000
--- a/sources/pyside2/tests/signals/lambda_gui_test.py
+++ /dev/null
@@ -1,79 +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$
-##
-#############################################################################
-
-'''Connecting lambda to gui signals'''
-
-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
-
-try:
- from PySide2.QtWidgets import QSpinBox, QPushButton
- hasQtGui = True
-except ImportError:
- hasQtGui = False
-
-from helper.usesqapplication import UsesQApplication
-
-if hasQtGui:
- class Control:
- def __init__(self):
- self.arg = False
-
- class QtGuiSigLambda(UsesQApplication):
-
- def testButton(self):
- #Connecting a lambda to a QPushButton.clicked()
- obj = QPushButton('label')
- ctr = Control()
- func = lambda: setattr(ctr, 'arg', True)
- QObject.connect(obj, SIGNAL('clicked()'), func)
- obj.click()
- self.assertTrue(ctr.arg)
- QObject.disconnect(obj, SIGNAL('clicked()'), func)
-
-
- def testSpinButton(self):
- #Connecting a lambda to a QPushButton.clicked()
- obj = QSpinBox()
- ctr = Control()
- arg = 444
- func = lambda x: setattr(ctr, 'arg', 444)
- QObject.connect(obj, SIGNAL('valueChanged(int)'), func)
- obj.setValue(444)
- self.assertEqual(ctr.arg, arg)
- QObject.disconnect(obj, SIGNAL('valueChanged(int)'), func)
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/signals/lambda_test.py b/sources/pyside2/tests/signals/lambda_test.py
deleted file mode 100644
index f01096150..000000000
--- a/sources/pyside2/tests/signals/lambda_test.py
+++ /dev/null
@@ -1,98 +0,0 @@
-#!/usr/bin/env 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$
-##
-#############################################################################
-
-'''Connecting lambda to signals'''
-
-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, QProcess
-
-from helper.usesqcoreapplication import UsesQCoreApplication
-
-
-class Dummy(QObject):
-
- def __init__(self, *args):
- super(Dummy, self).__init__(*args)
-
-
-class BasicCase(unittest.TestCase):
-
- def testSimplePythonSignalNoArgs(self):
- #Connecting a lambda to a simple python signal without arguments
- obj = Dummy()
- QObject.connect(obj, SIGNAL('foo()'),
- lambda: setattr(obj, 'called', True))
- obj.emit(SIGNAL('foo()'))
- self.assertTrue(obj.called)
-
- def testSimplePythonSignal(self):
- #Connecting a lambda to a simple python signal witharguments
- obj = Dummy()
- arg = 42
- QObject.connect(obj, SIGNAL('foo(int)'),
- lambda x: setattr(obj, 'arg', 42))
- obj.emit(SIGNAL('foo(int)'), arg)
- self.assertEqual(obj.arg, arg)
-
-
-class QtSigLambda(UsesQCoreApplication):
-
- qapplication = True
-
- def testNoArgs(self):
- '''Connecting a lambda to a signal without arguments'''
- proc = QProcess()
- dummy = Dummy()
- QObject.connect(proc, SIGNAL('started()'),
- lambda: setattr(dummy, 'called', True))
- proc.start(sys.executable, ['-c', '""'])
- proc.waitForFinished()
- self.assertTrue(dummy.called)
-
- def testWithArgs(self):
- '''Connecting a lambda to a signal with arguments'''
- proc = QProcess()
- dummy = Dummy()
- QObject.connect(proc, SIGNAL('finished(int)'),
- lambda x: setattr(dummy, 'called', x))
- proc.start(sys.executable, ['-c', '""'])
- proc.waitForFinished()
- self.assertEqual(dummy.called, proc.exitCode())
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/signals/leaking_signal_test.py b/sources/pyside2/tests/signals/leaking_signal_test.py
deleted file mode 100644
index 705d16075..000000000
--- a/sources/pyside2/tests/signals/leaking_signal_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
-import weakref
-
-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 LeakingSignal(unittest.TestCase):
-
- def testLeakingSignal(self):
- # Was segfaulting when the signal was garbage collected.
- class Emitter(QtCore.QObject):
- my_signal = QtCore.Signal(object)
-
- emitter = Emitter()
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/signals/multiple_connections_gui_test.py b/sources/pyside2/tests/signals/multiple_connections_gui_test.py
deleted file mode 100644
index 4429c49f4..000000000
--- a/sources/pyside2/tests/signals/multiple_connections_gui_test.py
+++ /dev/null
@@ -1,95 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-from functools import partial
-import os
-import random
-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
-
-try:
- from PySide2.QtWidgets import QPushButton, QSpinBox
- hasQtGui = True
-except ImportError:
- hasQtGui = False
-
-from helper.basicpyslotcase import BasicPySlotCase
-from helper.usesqapplication import UsesQApplication
-
-class MultipleSignalConnections(unittest.TestCase):
- '''Base class for multiple signal connection testing'''
-
- def run_many(self, sender, signal, emitter, receivers, args=None):
- """Utility method to connect a list of receivers to a signal.
- sender - QObject that will emit the signal
- signal - string with the signal signature
- emitter - the callable that will trigger the signal
- receivers - list of BasicPySlotCase instances
- args - tuple with the arguments to be sent.
- """
-
- if args is None:
- args = tuple()
-
- for rec in receivers:
- rec.setUp()
- QObject.connect(sender, SIGNAL(signal), rec.cb)
- rec.args = tuple(args)
-
- emitter(*args)
-
- for rec in receivers:
- self.assertTrue(rec.called)
-
-
-if hasQtGui:
- class QtGuiMultipleSlots(UsesQApplication, MultipleSignalConnections):
- '''Multiple connections to QtGui signals'''
-
- def testButtonClick(self):
- """Multiple connections to QPushButton.clicked()"""
- sender = QPushButton('button')
- receivers = [BasicPySlotCase() for x in range(30)]
- self.run_many(sender, 'clicked()', sender.click, receivers)
-
- def testSpinBoxValueChanged(self):
- """Multiple connections to QSpinBox.valueChanged(int)"""
- sender = QSpinBox()
- #FIXME if number of receivers if higher than 50, segfaults
- receivers = [BasicPySlotCase() for x in range(10)]
- self.run_many(sender, 'valueChanged(int)', sender.setValue,
- receivers, (1,))
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/signals/multiple_connections_test.py b/sources/pyside2/tests/signals/multiple_connections_test.py
deleted file mode 100644
index a8f5bcd9d..000000000
--- a/sources/pyside2/tests/signals/multiple_connections_test.py
+++ /dev/null
@@ -1,109 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-from functools import partial
-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, QProcess
-
-from helper.basicpyslotcase import BasicPySlotCase
-from helper.usesqcoreapplication import UsesQCoreApplication
-
-
-class MultipleSignalConnections(unittest.TestCase):
- '''Base class for multiple signal connection testing'''
-
- def run_many(self, sender, signal, emitter, receivers, args=None):
- """Utility method to connect a list of receivers to a signal.
- sender - QObject that will emit the signal
- signal - string with the signal signature
- emitter - the callable that will trigger the signal
- receivers - list of BasicPySlotCase instances
- args - tuple with the arguments to be sent.
- """
-
- if args is None:
- args = tuple()
- for rec in receivers:
- rec.setUp()
- self.assertTrue(QObject.connect(sender, SIGNAL(signal), rec.cb))
- rec.args = tuple(args)
-
- emitter(*args)
-
- for rec in receivers:
- self.assertTrue(rec.called)
-
-
-class PythonMultipleSlots(UsesQCoreApplication, MultipleSignalConnections):
- '''Multiple connections to python signals'''
-
- def testPythonSignal(self):
- """Multiple connections to a python signal (short-circuit)"""
-
- class Dummy(QObject):
- pass
-
- sender = Dummy()
- receivers = [BasicPySlotCase() for x in range(10)]
- self.run_many(sender, 'foobar(int)', partial(sender.emit,SIGNAL('foobar(int)')), receivers, (0, ))
-
-
-class QProcessMultipleSlots(UsesQCoreApplication, MultipleSignalConnections):
- '''Multiple connections to QProcess signals'''
-
- def testQProcessStarted(self):
- '''Multiple connections to QProcess.started()'''
- sender = QProcess()
- receivers = [BasicPySlotCase() for x in range(10)]
-
- def start_proc(*args):
- sender.start(sys.executable, ['-c', '""'])
- sender.waitForFinished()
-
- self.run_many(sender, 'started()', start_proc, receivers)
-
- def testQProcessFinished(self):
- '''Multiple connections to QProcess.finished(int)'''
- sender = QProcess()
- receivers = [BasicPySlotCase() for x in range(10)]
-
- def start_proc(*args):
- sender.start(sys.executable, ['-c', '""'])
- sender.waitForFinished()
-
- self.run_many(sender, 'finished(int)', start_proc, receivers, (0,))
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/signals/pysignal_test.py b/sources/pyside2/tests/signals/pysignal_test.py
deleted file mode 100644
index 5561671c4..000000000
--- a/sources/pyside2/tests/signals/pysignal_test.py
+++ /dev/null
@@ -1,221 +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, SLOT, Qt
-
-try:
- from PySide2.QtWidgets import QSpinBox, QApplication, QWidget
- hasQtGui = True
-except ImportError:
- hasQtGui = False
-
-from helper.usesqapplication import UsesQApplication
-
-class Dummy(QObject):
- """Dummy class used in this test."""
- def __init__(self, parent=None):
- QObject.__init__(self, parent)
-
- def callDummy(self):
- self.emit(SIGNAL("dummy(PyObject)"), "PyObject")
-
- def callDummy2(self):
- lst = []
- lst.append("item1")
- lst.append("item2")
- lst.append("item3")
- self.emit(SIGNAL("dummy2(PyObject, PyObject)"), "PyObject0", lst)
-
-
-class PyObjectType(UsesQApplication):
- def mySlot(self, arg):
- self.assertEqual(arg, "PyObject")
- self.called = True
- self.callCount += 1
-
- def mySlot2(self, arg0, arg1):
- self.assertEqual(arg0, "PyObject0")
- self.assertEqual(arg1[0], "item1")
- self.assertEqual(arg1[1], "item2")
- self.assertEqual(arg1[2], "item3")
- self.callCount += 1
- if self.running:
- self.app.quit()
-
- def setUp(self):
- super(PyObjectType, self).setUp()
- self.callCount = 0
- self.running = False
-
- def testWithOneArg(self):
- o = Dummy()
- o.connect(SIGNAL("dummy(PyObject)"), self.mySlot)
- o.callDummy()
- self.assertEqual(self.callCount, 1)
-
- def testWithTwoArg(self):
- o = Dummy()
- o.connect(SIGNAL("dummy2(PyObject,PyObject)"), self.mySlot2)
- o.callDummy2()
- self.assertEqual(self.callCount, 1)
-
- def testAsyncSignal(self):
- self.called = False
- self.running = True
- o = Dummy()
- o.connect(SIGNAL("dummy2(PyObject,PyObject)"), self.mySlot2, Qt.QueuedConnection)
- o.callDummy2()
- self.app.exec_()
- self.assertEqual(self.callCount, 1)
-
- def testTwice(self):
- self.called = False
- self.running = True
- o = Dummy()
- o.connect(SIGNAL("dummy2(PyObject,PyObject)"), self.mySlot2, Qt.QueuedConnection)
- o.callDummy2()
- o.callDummy2()
- self.app.exec_()
- self.assertEqual(self.callCount, 2)
-
-class PythonSigSlot(unittest.TestCase):
- def setUp(self):
- self.called = False
-
- def tearDown(self):
- try:
- del self.args
- except:
- pass
-
- def callback(self, *args):
- if tuple(self.args) == args:
- self.called = True
-
- def testNoArgs(self):
- """Python signal and slots without arguments"""
- obj1 = Dummy()
-
- QObject.connect(obj1, SIGNAL('foo()'), self.callback)
- self.args = tuple()
- obj1.emit(SIGNAL('foo()'), *self.args)
-
- self.assertTrue(self.called)
-
- def testWithArgs(self):
- """Python signal and slots with integer arguments"""
- obj1 = Dummy()
-
- QObject.connect(obj1, SIGNAL('foo(int)'), self.callback)
- self.args = (42,)
- obj1.emit(SIGNAL('foo(int)'), *self.args)
-
- self.assertTrue(self.called)
-
-
- def testDisconnect(self):
- obj1 = Dummy()
-
- QObject.connect(obj1, SIGNAL('foo(int)'), self.callback)
- QObject.disconnect(obj1, SIGNAL('foo(int)'), self.callback)
-
- self.args = (42, )
- obj1.emit(SIGNAL('foo(int)'), *self.args)
-
- self.assertTrue(not self.called)
-
-
-if hasQtGui:
- class SpinBoxPySignal(UsesQApplication):
- """Tests the connection of python signals to QSpinBox qt slots."""
-
- def setUp(self):
- super(SpinBoxPySignal, self).setUp()
- self.obj = Dummy()
- self.spin = QSpinBox()
- self.spin.setValue(0)
-
- def tearDown(self):
- super(SpinBoxPySignal, self).tearDown()
- del self.obj
- del self.spin
-
- def testValueChanged(self):
- """Emission of a python signal to QSpinBox setValue(int)"""
- QObject.connect(self.obj, SIGNAL('dummy(int)'), self.spin, SLOT('setValue(int)'))
- self.assertEqual(self.spin.value(), 0)
-
- self.obj.emit(SIGNAL('dummy(int)'), 4)
- self.assertEqual(self.spin.value(), 4)
-
- def testValueChangedMultiple(self):
- """Multiple emissions of a python signal to QSpinBox setValue(int)"""
- QObject.connect(self.obj, SIGNAL('dummy(int)'), self.spin, SLOT('setValue(int)'))
- self.assertEqual(self.spin.value(), 0)
-
- self.obj.emit(SIGNAL('dummy(int)'), 4)
- self.assertEqual(self.spin.value(), 4)
-
- self.obj.emit(SIGNAL('dummy(int)'), 77)
- self.assertEqual(self.spin.value(), 77)
-
-
-if hasQtGui:
- class WidgetPySignal(UsesQApplication):
- """Tests the connection of python signals to QWidget qt slots."""
-
- def setUp(self):
- super(WidgetPySignal, self).setUp()
- self.obj = Dummy()
- self.widget = QWidget()
-
- def tearDown(self):
- super(WidgetPySignal, self).tearDown()
- del self.obj
- del self.widget
-
- def testShow(self):
- """Emission of a python signal to QWidget slot show()"""
- self.widget.hide()
-
- QObject.connect(self.obj, SIGNAL('dummy()'), self.widget, SLOT('show()'))
- self.assertTrue(not self.widget.isVisible())
-
- self.obj.emit(SIGNAL('dummy()'))
- self.assertTrue(self.widget.isVisible())
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/signals/qobject_destroyed_test.py b/sources/pyside2/tests/signals/qobject_destroyed_test.py
deleted file mode 100644
index 35752a6ca..000000000
--- a/sources/pyside2/tests/signals/qobject_destroyed_test.py
+++ /dev/null
@@ -1,56 +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
-
-class QObjectDestroyed(unittest.TestCase):
- """Very simple test case for the destroyed() signal of QObject"""
-
- def setUp(self):
- self.called = False
-
- def destroyed_cb(self):
- self.called = True
-
- def testDestroyed(self):
- """Emission of QObject.destroyed() to a python slot"""
- obj = QObject()
- QObject.connect(obj, SIGNAL('destroyed()'), self.destroyed_cb)
- del obj
- self.assertTrue(self.called)
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/signals/qobject_receivers_test.py b/sources/pyside2/tests/signals/qobject_receivers_test.py
deleted file mode 100644
index 8ad89fe78..000000000
--- a/sources/pyside2/tests/signals/qobject_receivers_test.py
+++ /dev/null
@@ -1,83 +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$
-##
-#############################################################################
-
-''' Test case for QObject.receivers()'''
-
-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 *
-
-def cute_slot():
- pass
-
-class TestQObjectReceivers(unittest.TestCase):
- '''Test case for QObject::receivers'''
-
- def testBasic(self):
- sender = QObject()
- receiver1 = QObject()
- receiver2 = QObject()
- self.assertEqual(sender.receivers(SIGNAL("")), 0)
- sender.connect(sender, SIGNAL("destroyed()"), receiver1, SLOT("deleteLater()"))
- self.assertEqual(sender.receivers(SIGNAL("destroyed()")), 1)
- sender.connect(sender, SIGNAL("destroyed()"), receiver2, SLOT("deleteLater()"))
- self.assertEqual(sender.receivers(SIGNAL("destroyed()")), 2)
- sender.disconnect(sender, SIGNAL("destroyed()"), receiver2, SLOT("deleteLater()"))
- self.assertEqual(sender.receivers(SIGNAL("destroyed()")), 1)
- del receiver2
- del receiver1
- del sender
-
- def testPySlots(self):
- sender = QObject()
- receiver = QObject()
- sender.connect(sender, SIGNAL("destroyed()"), cute_slot)
- self.assertEqual(sender.receivers(SIGNAL("destroyed( )")), 1)
- sender.connect(sender, SIGNAL("destroyed()"), receiver, SLOT("deleteLater()"))
- self.assertEqual(sender.receivers(SIGNAL("destroyed()")), 2)
- del sender
- del receiver
-
- def testPySignals(self):
- sender = QObject()
- receiver = QObject()
- sender.connect(sender, SIGNAL("some_dynamic_signal()"), cute_slot)
- self.assertEqual(sender.receivers(SIGNAL("some_dynamic_signal( )")), 1)
- sender.connect(sender, SIGNAL("some_dynamic_signal()"), receiver, SLOT("deleteLater()"))
- self.assertEqual(sender.receivers(SIGNAL("some_dynamic_signal( )")), 2)
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/signals/qobject_sender_test.py b/sources/pyside2/tests/signals/qobject_sender_test.py
deleted file mode 100644
index ce11b803a..000000000
--- a/sources/pyside2/tests/signals/qobject_sender_test.py
+++ /dev/null
@@ -1,127 +0,0 @@
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-'''Test cases for QObject.sender()'''
-
-import os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide2.QtCore import *
-from helper.usesqcoreapplication import UsesQCoreApplication
-
-class ExtQTimer(QTimer):
- def __init__(self):
- QTimer.__init__(self)
-
-class Receiver(QObject):
- def __init__(self):
- QObject.__init__(self)
- self.the_sender = None
-
- def callback(self):
- self.the_sender = self.sender()
- if QCoreApplication.instance():
- QCoreApplication.instance().exit()
-
-class ObjectSenderTest(unittest.TestCase):
- '''Test case for QObject.sender() method.'''
-
- def testSenderPythonSignal(self):
- sender = QObject()
- recv = Receiver()
- QObject.connect(sender, SIGNAL('foo()'), recv.callback)
- sender.emit(SIGNAL('foo()'))
- self.assertEqual(sender, recv.the_sender)
-
-class ObjectSenderCheckOnReceiverTest(unittest.TestCase):
- '''Test case for QObject.sender() method, this one tests the equality on the Receiver object.'''
-
- def testSenderPythonSignal(self):
- sender = QObject()
- recv = Receiver()
- QObject.connect(sender, SIGNAL('foo()'), recv.callback)
- sender.emit(SIGNAL('foo()'))
- self.assertEqual(sender, recv.the_sender)
-
-class ObjectSenderWithQAppTest(UsesQCoreApplication):
- '''Test case for QObject.sender() method with QApplication.'''
-
- def testSenderCppSignal(self):
- sender = QTimer()
- sender.setObjectName('foo')
- recv = Receiver()
- QObject.connect(sender, SIGNAL('timeout()'), recv.callback)
- sender.start(10)
- self.app.exec_()
- self.assertEqual(sender, recv.the_sender)
-
- def testSenderCppSignalSingleShotTimer(self):
- recv = Receiver()
- QTimer.singleShot(10, recv.callback)
- self.app.exec_()
- self.assertTrue(isinstance(recv.the_sender, QObject))
-
- def testSenderCppSignalWithPythonExtendedClass(self):
- sender = ExtQTimer()
- recv = Receiver()
- QObject.connect(sender, SIGNAL('timeout()'), recv.callback)
- sender.start(10)
- self.app.exec_()
- self.assertEqual(sender, recv.the_sender)
-
-class ObjectSenderWithQAppCheckOnReceiverTest(UsesQCoreApplication):
- '''Test case for QObject.sender() method with QApplication.'''
-
- def testSenderCppSignal(self):
- sender = QTimer()
- sender.setObjectName('foo')
- recv = Receiver()
- QObject.connect(sender, SIGNAL('timeout()'), recv.callback)
- sender.start(10)
- self.app.exec_()
- self.assertEqual(sender, recv.the_sender)
-
- def testSenderCppSignalWithPythonExtendedClass(self):
- sender = ExtQTimer()
- recv = Receiver()
- QObject.connect(sender, SIGNAL('timeout()'), recv.callback)
- sender.start(10)
- self.app.exec_()
- self.assertEqual(sender, recv.the_sender)
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/sources/pyside2/tests/signals/ref01_test.py b/sources/pyside2/tests/signals/ref01_test.py
deleted file mode 100644
index d2c658568..000000000
--- a/sources/pyside2/tests/signals/ref01_test.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide2.QtCore import QObject, Signal
-
-class BoundAndUnboundSignalsTest(unittest.TestCase):
-
- def setUp(self):
- self.methods = set(('connect', 'disconnect', 'emit'))
-
- def tearDown(self):
- del self.methods
-
- def testUnboundSignal(self):
- self.assertEqual(type(QObject.destroyed), Signal)
- self.assertFalse(self.methods.issubset(dir(QObject.destroyed)))
-
- def testBoundSignal(self):
- obj = QObject()
- self.assertNotEqual(type(obj.destroyed), Signal)
- self.assertTrue(self.methods.issubset(dir(obj.destroyed)))
-
-if __name__ == '__main__':
- unittest.main()
-
-
diff --git a/sources/pyside2/tests/signals/ref02_test.py b/sources/pyside2/tests/signals/ref02_test.py
deleted file mode 100644
index 9a31b4b52..000000000
--- a/sources/pyside2/tests/signals/ref02_test.py
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide2.QtCore import QCoreApplication, QTimeLine
-from helper.usesqcoreapplication import UsesQCoreApplication
-
-class NativeSignalsTest(UsesQCoreApplication):
-
- def setUp(self):
- UsesQCoreApplication.setUp(self)
- self.called = False
- self.timeline = QTimeLine(100)
-
- def tearDown(self):
- del self.called
- del self.timeline
- UsesQCoreApplication.tearDown(self)
-
- def testSignalWithIntArgument(self):
-
- def valueChangedSlot(value):
- self.called = True
- self.assertEqual(type(value), float)
- self.app.quit()
-
- self.timeline.valueChanged.connect(valueChangedSlot)
- self.timeline.start()
-
- self.app.exec_()
- self.assertTrue(self.called)
-
- def testSignalWithoutArguments(self):
-
- def finishedSlot():
- self.called = True
- self.app.quit()
-
- self.timeline.finished.connect(finishedSlot)
- self.timeline.start()
-
- self.app.exec_()
- self.assertTrue(self.called)
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/sources/pyside2/tests/signals/ref03_test.py b/sources/pyside2/tests/signals/ref03_test.py
deleted file mode 100644
index 25f404f38..000000000
--- a/sources/pyside2/tests/signals/ref03_test.py
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import os
-import sys
-from sys import getrefcount
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide2.QtCore import QObject
-
-class DisconnectSignalsTest(unittest.TestCase):
-
- def setUp(self):
- self.emitter = QObject()
-
- def tearDown(self):
- del self.emitter
-
- def testConnectionRefCount(self):
-
- def destroyedSlot():
- pass
-
- self.assertEqual(getrefcount(destroyedSlot), 2)
- self.emitter.destroyed.connect(destroyedSlot)
- self.assertEqual(getrefcount(destroyedSlot), 3)
- self.emitter.destroyed.disconnect(destroyedSlot)
- self.assertEqual(getrefcount(destroyedSlot), 2)
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/sources/pyside2/tests/signals/ref04_test.py b/sources/pyside2/tests/signals/ref04_test.py
deleted file mode 100644
index 4c66c04ef..000000000
--- a/sources/pyside2/tests/signals/ref04_test.py
+++ /dev/null
@@ -1,91 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide2.QtCore import QObject, Signal
-
-class ExtQObject(QObject):
-
- mySignal = Signal()
-
- def __init__(self):
- QObject.__init__(self)
-
-
-class UserSignalTest(unittest.TestCase):
-
- def setUp(self):
- self.emitter = ExtQObject()
- self.counter = 0
-
- def tearDown(self):
- del self.emitter
- del self.counter
-
- def testConnectEmitDisconnect(self):
-
- def slot():
- self.counter += 1
-
- self.emitter.mySignal.connect(slot)
-
- self.assertEqual(self.counter, 0)
- self.emitter.mySignal.emit()
- self.assertEqual(self.counter, 1)
- self.emitter.mySignal.emit()
- self.assertEqual(self.counter, 2)
-
- self.emitter.mySignal.disconnect(slot)
-
- self.emitter.mySignal.emit()
- self.assertEqual(self.counter, 2)
-
-# def testConnectWithConfigureMethod(self):
-#
-# def slot():
-# self.counter += 1
-#
-# self.emitter.pyqtConfigure(mySignal=slot)
-# self.assertEqual(self.counter, 0)
-# self.emitter.mySignal.emit()
-# self.assertEqual(self.counter, 1)
-
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/sources/pyside2/tests/signals/ref05_test.py b/sources/pyside2/tests/signals/ref05_test.py
deleted file mode 100644
index 3b7bf1983..000000000
--- a/sources/pyside2/tests/signals/ref05_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide2.QtCore import QObject, QCoreApplication, QTimeLine, Slot
-from helper.usesqcoreapplication import UsesQCoreApplication
-
-class ExtQObject(QObject):
-
- def __init__(self):
- QObject.__init__(self)
- self.counter = 0
-
- @Slot('qreal')
- def foo(self, value):
- self.counter += 1
-
-
-class UserSlotTest(UsesQCoreApplication):
-
- def setUp(self):
- UsesQCoreApplication.setUp(self)
- self.receiver = ExtQObject()
- self.timeline = QTimeLine(100)
-
- def tearDown(self):
- del self.timeline
- del self.receiver
- UsesQCoreApplication.tearDown(self)
-
- def testUserSlot(self):
- self.timeline.setUpdateInterval(10)
-
- self.timeline.finished.connect(self.app.quit)
-
- self.timeline.valueChanged.connect(self.receiver.foo)
- self.timeline.start()
-
- self.app.exec_()
-
- self.assertTrue(self.receiver.counter > 1)
-
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/sources/pyside2/tests/signals/ref06_test.py b/sources/pyside2/tests/signals/ref06_test.py
deleted file mode 100644
index 51d78e638..000000000
--- a/sources/pyside2/tests/signals/ref06_test.py
+++ /dev/null
@@ -1,84 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide2.QtCore import QObject, QCoreApplication, QTimeLine, Signal, Slot
-from helper.usesqcoreapplication import UsesQCoreApplication
-
-class ExtQObject(QObject):
- signalbetween = Signal('qreal')
-
- def __init__(self):
- QObject.__init__(self)
- self.counter = 0
-
- @Slot('qreal')
- def foo(self, value):
- self.counter += 1
-
-
-class SignaltoSignalTest(UsesQCoreApplication):
-
- def setUp(self):
- UsesQCoreApplication.setUp(self)
- self.receiver = ExtQObject()
- self.timeline = QTimeLine(100)
-
- def tearDown(self):
- del self.timeline
- del self.receiver
- UsesQCoreApplication.tearDown(self)
-
- def testSignaltoSignal(self):
- self.timeline.setUpdateInterval(10)
-
- self.timeline.finished.connect(self.app.quit)
-
- self.timeline.valueChanged.connect(self.receiver.signalbetween)
- self.receiver.signalbetween.connect(self.receiver.foo)
-
- self.timeline.start()
-
- self.app.exec_()
-
- self.assertTrue(self.receiver.counter > 1)
-
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/sources/pyside2/tests/signals/segfault_proxyparent_test.py b/sources/pyside2/tests/signals/segfault_proxyparent_test.py
deleted file mode 100644
index 2d45f1e7f..000000000
--- a/sources/pyside2/tests/signals/segfault_proxyparent_test.py
+++ /dev/null
@@ -1,92 +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
-
-# Description of the problem
-# After creating an PyObject that inherits from QObject, connecting it,
-# deleting it and later creating another Python QObject-based object, this
-# new object will point to the same memory position as the first one.
-
-# Somehow the underlying QObject also points to the same position.
-
-# In PyQt4, the connection works fine with the same memory behavior,
-# so it looks like specific to SIP.
-
-class Dummy(QObject):
- def __init__(self, parent=None):
- QObject.__init__(self, parent)
-
-class Joe(QObject):
- def __init__(self, parent=None):
- QObject.__init__(self, parent)
-
-class SegfaultCase(unittest.TestCase):
- """Test case for the segfault happening when parent() is called inside
- ProxyObject"""
-
- def setUp(self):
- self.called = False
-
- def tearDown(self):
- try:
- del self.args
- except:
- pass
-
- def callback(self, *args):
- if tuple(self.args) == args:
- self.called = True
-
- def testSegfault(self):
- """Regression: Segfault for qobjects in the same memory position."""
- obj = Dummy()
- QObject.connect(obj, SIGNAL('bar(int)'), self.callback)
- self.args = (33,)
- obj.emit(SIGNAL('bar(int)'), self.args[0])
- self.assertTrue(self.called)
- del obj
-
- obj = Joe()
- QObject.connect(obj, SIGNAL('bar(int)'), self.callback)
- self.args = (33,)
- obj.emit(SIGNAL('bar(int)'), self.args[0])
- self.assertTrue(self.called)
-
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/sources/pyside2/tests/signals/self_connect_test.py b/sources/pyside2/tests/signals/self_connect_test.py
deleted file mode 100644
index cca97b096..000000000
--- a/sources/pyside2/tests/signals/self_connect_test.py
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/usr/bin/env 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$
-##
-#############################################################################
-
-'''Using self.connect(signal, method)'''
-
-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, SLOT
-from PySide2.QtWidgets import QPushButton, QWidget
-
-from helper.usesqapplication import UsesQApplication
-
-
-class SelfConnect(UsesQApplication):
-
- def testButtonClickClose(self):
- button = QPushButton()
- button.connect(button, SIGNAL('clicked()'), SLOT('close()'))
-
- button.show()
- self.assertTrue(button.isVisible())
- button.click()
- self.assertTrue(not button.isVisible())
-
- def testWindowButtonClickClose(self):
- button = QPushButton()
- window = QWidget()
- window.connect(button, SIGNAL('clicked()'), SLOT('close()'))
-
- window.show()
- self.assertTrue(window.isVisible())
- button.click()
- self.assertTrue(not window.isVisible())
-
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/signals/short_circuit_test.py b/sources/pyside2/tests/signals/short_circuit_test.py
deleted file mode 100644
index 61acc77c0..000000000
--- a/sources/pyside2/tests/signals/short_circuit_test.py
+++ /dev/null
@@ -1,97 +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, SLOT
-
-class Dummy(QObject):
- """Dummy class used in this test."""
- def __init__(self, parent=None):
- QObject.__init__(self, parent)
-
-class ShortCircuitSignals(unittest.TestCase):
- def setUp(self):
- self.called = False
-
- def tearDown(self):
- try:
- del self.args
- except:
- pass
-
- def callback(self, *args):
- if tuple(self.args) == args:
- self.called = True
-
- def testNoArgs(self):
- """Short circuit signal without arguments"""
- obj1 = Dummy()
- QObject.connect(obj1, SIGNAL('foo()'), self.callback)
- self.args = tuple()
- obj1.emit(SIGNAL('foo()'), *self.args)
- self.assertTrue(self.called)
-
- def testWithArgs(self):
- """Short circuit signal with integer arguments"""
- obj1 = Dummy()
-
- QObject.connect(obj1, SIGNAL('foo(int)'), self.callback)
- self.args = (42,)
- obj1.emit(SIGNAL('foo(int)'), *self.args)
-
- self.assertTrue(self.called)
-
- def testMultipleArgs(self):
- """Short circuit signal with multiple arguments"""
- obj1 = Dummy()
-
- QObject.connect(obj1, SIGNAL('foo(int,int,QString)'), self.callback)
- self.args = (42,33,'char')
- obj1.emit(SIGNAL('foo(int,int,QString)'), *self.args)
-
- self.assertTrue(self.called)
-
- def testComplexArgs(self):
- """Short circuit signal with complex arguments"""
- obj1 = Dummy()
-
- QObject.connect(obj1, SIGNAL('foo(int,QObject*)'), self.callback)
- self.args = (42, obj1)
- obj1.emit(SIGNAL('foo(int,QObject*)'), *self.args)
-
- self.assertTrue(self.called)
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/signals/signal2signal_connect_test.py b/sources/pyside2/tests/signals/signal2signal_connect_test.py
deleted file mode 100644
index c5008c942..000000000
--- a/sources/pyside2/tests/signals/signal2signal_connect_test.py
+++ /dev/null
@@ -1,142 +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$
-##
-#############################################################################
-
-''' Test case for signal to signal connections.'''
-
-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 *
-
-def cute_slot():
- pass
-
-class TestSignal2SignalConnect(unittest.TestCase):
- '''Test case for signal to signal connections'''
-
- def setUp(self):
- #Set up the basic resources needed
- self.sender = QObject()
- self.forwarder = QObject()
- self.args = None
- self.called = False
-
- def tearDown(self):
- #Delete used resources
- try:
- del self.sender
- except:
- pass
- try:
- del self.forwarder
- except:
- pass
- del self.args
-
- def callback_noargs(self):
- #Default callback without arguments
- self.called = True
-
- def callback_args(self, *args):
- #Default callback with arguments
- if args == self.args:
- self.called = True
- else:
- raise TypeError("Invalid arguments")
-
- def callback_qobject(self, *args):
- #Default callback for QObject as argument
- if args[0].objectName() == self.args[0]:
- self.called = True
- else:
- raise TypeError("Invalid arguments")
-
-
- def testSignalWithoutArguments(self):
- QObject.connect(self.sender, SIGNAL("destroyed()"),
- self.forwarder, SIGNAL("forward()"))
- QObject.connect(self.forwarder, SIGNAL("forward()"),
- self.callback_noargs)
- del self.sender
- self.assertTrue(self.called)
-
-
- def testSignalWithOnePrimitiveTypeArgument(self):
- QObject.connect(self.sender, SIGNAL("mysignal(int)"),
- self.forwarder, SIGNAL("mysignal(int)"))
- QObject.connect(self.forwarder, SIGNAL("mysignal(int)"),
- self.callback_args)
- self.args = (19,)
- self.sender.emit(SIGNAL('mysignal(int)'), *self.args)
- self.assertTrue(self.called)
-
-
- def testSignalWithMultiplePrimitiveTypeArguments(self):
- QObject.connect(self.sender, SIGNAL("mysignal(int,int)"),
- self.forwarder, SIGNAL("mysignal(int,int)"))
- QObject.connect(self.forwarder, SIGNAL("mysignal(int,int)"),
- self.callback_args)
- self.args = (23, 29)
- self.sender.emit(SIGNAL('mysignal(int,int)'), *self.args)
- self.assertTrue(self.called)
-
-
- def testSignalWithOneStringArgument(self):
- QObject.connect(self.sender, SIGNAL("mysignal(QString)"),
- self.forwarder, SIGNAL("mysignal(QString)"))
- QObject.connect(self.forwarder, SIGNAL("mysignal(QString)"),
- self.callback_args)
- self.args = ('myargument',)
- self.sender.emit(SIGNAL('mysignal(QString)'), *self.args)
- self.assertTrue(self.called)
-
-
- def testSignalWithOneQObjectArgument(self):
- QObject.connect(self.sender, SIGNAL('destroyed(QObject*)'),
- self.forwarder, SIGNAL('forward(QObject*)'))
- QObject.connect(self.forwarder, SIGNAL('forward(QObject*)'),
- self.callback_qobject)
-
- obj_name = 'sender'
- self.sender.setObjectName(obj_name)
- self.args = (obj_name, )
- del self.sender
- self.assertTrue(self.called)
-
-
-if __name__ == '__main__':
- unittest.main()
-
-
diff --git a/sources/pyside2/tests/signals/signal_across_threads.py b/sources/pyside2/tests/signals/signal_across_threads.py
deleted file mode 100644
index 907f059a1..000000000
--- a/sources/pyside2/tests/signals/signal_across_threads.py
+++ /dev/null
@@ -1,106 +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 case for PYSIDE-1354: Ensure that slots are invoked from the receiver's
-thread context when using derived classes (and thus, a global receiver).'''
-
-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, QThread, QTimer, Slot
-from helper.usesqcoreapplication import UsesQCoreApplication
-
-
-class ReceiverBase(QObject):
- def __init__(self, parent=None):
- super(ReceiverBase, self).__init__(parent)
- self.senderThread = None
-
- @Slot()
- def slot_function(self):
- self.senderThread = QThread.currentThread()
-
-
-class Receiver(ReceiverBase):
- pass
-
-
-class TestThread(QThread):
- def __init__(self, parent=None):
- super(TestThread, self).__init__(parent)
-
- def run(self):
- pass
-
-
-class SignalAcrossThreads(UsesQCoreApplication):
- def setUp(self):
- UsesQCoreApplication.setUp(self)
- self._timer_tick = 0
- self._timer = QTimer()
- self._timer.setInterval(20)
- self._timer.timeout.connect(self._control_test)
- self._worker_thread = TestThread()
-
- def tearDown(self):
- UsesQCoreApplication.tearDown(self)
-
- @Slot()
- def _control_test(self):
- if self._timer_tick == 0:
- self._worker_thread.start()
- elif self._timer_tick == 1:
- self._worker_thread.wait()
- else:
- self._timer.stop()
- self.app.quit()
- self._timer_tick += 1
-
- def test(self):
- worker_thread_receiver = Receiver()
- worker_thread_receiver.moveToThread(self._worker_thread)
- self._worker_thread.started.connect(worker_thread_receiver.slot_function)
-
- main_thread = QThread.currentThread()
- main_thread_receiver = Receiver()
- self._worker_thread.started.connect(main_thread_receiver.slot_function)
-
- self._timer.start()
- self.app.exec_()
-
- self.assertEqual(worker_thread_receiver.senderThread, self._worker_thread)
- self.assertEqual(main_thread_receiver.senderThread, main_thread)
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/signals/signal_autoconnect_test.py b/sources/pyside2/tests/signals/signal_autoconnect_test.py
deleted file mode 100644
index b19f28ab7..000000000
--- a/sources/pyside2/tests/signals/signal_autoconnect_test.py
+++ /dev/null
@@ -1,65 +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(False)
-
-from PySide2.QtCore import *
-from PySide2.QtWidgets import *
-
-class MyObject(QWidget):
- def __init__(self, parent=None):
- QWidget.__init__(self, parent)
- self._method_called = False
-
- @Slot()
- def on_button_clicked(self):
- self._method_called = True
-
-
-class AutoConnectionTest(unittest.TestCase):
-
- def testConnection(self):
- app = QApplication([])
-
- win = MyObject()
- btn = QPushButton("click", win)
- btn.setObjectName("button")
- QMetaObject.connectSlotsByName(win)
- btn.click()
- self.assertTrue(win._method_called)
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/signals/signal_connectiontype_support_test.py b/sources/pyside2/tests/signals/signal_connectiontype_support_test.py
deleted file mode 100644
index 00865a95e..000000000
--- a/sources/pyside2/tests/signals/signal_connectiontype_support_test.py
+++ /dev/null
@@ -1,61 +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, Qt
-
-class Dummy(QObject):
- """Dummy class used in this test."""
- def __init__(self, parent=None):
- QObject.__init__(self, parent)
-
-class TestConnectionTypeSupport(unittest.TestCase):
- def callback(self, *args):
- if tuple(self.args) == args:
- self.called = True
-
- def testNoArgs(self):
- """Connect signal using a Qt.ConnectionType as argument"""
- obj1 = Dummy()
-
- QObject.connect(obj1, SIGNAL('foo()'), self.callback, Qt.DirectConnection)
- self.args = tuple()
- obj1.emit(SIGNAL('foo()'), *self.args)
-
- self.assertTrue(self.called)
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/signals/signal_emission_gui_test.py b/sources/pyside2/tests/signals/signal_emission_gui_test.py
deleted file mode 100644
index d46e78c5e..000000000
--- a/sources/pyside2/tests/signals/signal_emission_gui_test.py
+++ /dev/null
@@ -1,148 +0,0 @@
-#!/usr/bin/env 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$
-##
-#############################################################################
-
-"""Tests covering signal emission and receiving to python slots"""
-
-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, SLOT
-
-try:
- from PySide2.QtWidgets import QSpinBox, QPushButton
- hasQtGui = True
-except ImportError:
- hasQtGui = False
-
-from helper.basicpyslotcase import BasicPySlotCase
-from helper.usesqapplication import UsesQApplication
-
-if hasQtGui:
- class ButtonPySlot(UsesQApplication, BasicPySlotCase):
- """Tests the connection of python slots to QPushButton signals"""
-
- def testButtonClicked(self):
- """Connection of a python slot to QPushButton.clicked()"""
- button = QPushButton('Mylabel')
- QObject.connect(button, SIGNAL('clicked()'), self.cb)
- self.args = tuple()
- button.emit(SIGNAL('clicked(bool)'), False)
- self.assertTrue(self.called)
-
- def testButtonClick(self):
- """Indirect qt signal emission using the QPushButton.click() method """
- button = QPushButton('label')
- QObject.connect(button, SIGNAL('clicked()'), self.cb)
- self.args = tuple()
- button.click()
- self.assertTrue(self.called)
-
-
-if hasQtGui:
- class SpinBoxPySlot(UsesQApplication, BasicPySlotCase):
- """Tests the connection of python slots to QSpinBox signals"""
-
- def setUp(self):
- super(SpinBoxPySlot, self).setUp()
- self.spin = QSpinBox()
-
- def tearDown(self):
- del self.spin
- super(SpinBoxPySlot, self).tearDown()
-
- def testSpinBoxValueChanged(self):
- """Connection of a python slot to QSpinBox.valueChanged(int)"""
- QObject.connect(self.spin, SIGNAL('valueChanged(int)'), self.cb)
- self.args = [3]
- self.spin.emit(SIGNAL('valueChanged(int)'), *self.args)
- self.assertTrue(self.called)
-
- def testSpinBoxValueChangedImplicit(self):
- """Indirect qt signal emission using QSpinBox.setValue(int)"""
- QObject.connect(self.spin, SIGNAL('valueChanged(int)'), self.cb)
- self.args = [42]
- self.spin.setValue(self.args[0])
- self.assertTrue(self.called)
-
- def atestSpinBoxValueChangedFewArgs(self):
- """Emission of signals with fewer arguments than needed"""
- # XXX: PyQt4 crashes on the assertRaises
- QObject.connect(self.spin, SIGNAL('valueChanged(int)'), self.cb)
- self.args = (554,)
- self.assertRaises(TypeError, self.spin.emit, SIGNAL('valueChanged(int)'))
-
-if hasQtGui:
- class QSpinBoxQtSlots(UsesQApplication):
- """Tests the connection to QSpinBox qt slots"""
-
- qapplication = True
-
- def testSetValueIndirect(self):
- """Indirect signal emission: QSpinBox using valueChanged(int)/setValue(int)"""
- spinSend = QSpinBox()
- spinRec = QSpinBox()
-
- spinRec.setValue(5)
-
- QObject.connect(spinSend, SIGNAL('valueChanged(int)'), spinRec, SLOT('setValue(int)'))
- self.assertEqual(spinRec.value(), 5)
- spinSend.setValue(3)
- self.assertEqual(spinRec.value(), 3)
- self.assertEqual(spinSend.value(), 3)
-
- def testSetValue(self):
- """Direct signal emission: QSpinBox using valueChanged(int)/setValue(int)"""
- spinSend = QSpinBox()
- spinRec = QSpinBox()
-
- spinRec.setValue(5)
- spinSend.setValue(42)
-
- QObject.connect(spinSend, SIGNAL('valueChanged(int)'), spinRec, SLOT('setValue(int)'))
- self.assertEqual(spinRec.value(), 5)
- self.assertEqual(spinSend.value(), 42)
- spinSend.emit(SIGNAL('valueChanged(int)'), 3)
-
- self.assertEqual(spinRec.value(), 3)
- #Direct emission shouldn't change the value of the emitter
- self.assertEqual(spinSend.value(), 42)
-
- spinSend.emit(SIGNAL('valueChanged(int)'), 66)
- self.assertEqual(spinRec.value(), 66)
- self.assertEqual(spinSend.value(), 42)
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/signals/signal_emission_test.py b/sources/pyside2/tests/signals/signal_emission_test.py
deleted file mode 100644
index f9c221e8f..000000000
--- a/sources/pyside2/tests/signals/signal_emission_test.py
+++ /dev/null
@@ -1,158 +0,0 @@
-#!/usr/bin/env 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$
-##
-#############################################################################
-
-"""Tests covering signal emission and receiving to python slots"""
-
-import functools
-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, SLOT, QProcess, QTimeLine
-
-from helper.basicpyslotcase import BasicPySlotCase
-from helper.usesqcoreapplication import UsesQCoreApplication
-
-
-class ArgsOnEmptySignal(UsesQCoreApplication):
- '''Trying to emit a signal without arguments passing some arguments'''
-
- def testArgsToNoArgsSignal(self):
- '''Passing arguments to a signal without arguments'''
- process = QProcess()
- self.assertRaises(TypeError, process.emit, SIGNAL('started()'), 42)
-
-
-class MoreArgsOnEmit(UsesQCoreApplication):
- '''Trying to pass more args than needed to emit (signals with args)'''
-
- def testMoreArgs(self):
- '''Passing more arguments than needed'''
- process = QProcess()
- self.assertRaises(TypeError, process.emit, SIGNAL('finished(int)'), 55, 55)
-
-class Dummy(QObject):
- '''Dummy class'''
- pass
-
-class PythonSignalToCppSlots(UsesQCoreApplication):
- '''Connect python signals to C++ slots'''
-
- def testWithoutArgs(self):
- '''Connect python signal to QTimeLine.toggleDirection()'''
- timeline = QTimeLine()
- dummy = Dummy()
- QObject.connect(dummy, SIGNAL('dummy()'),
- timeline, SLOT('toggleDirection()'))
-
- orig_dir = timeline.direction()
- dummy.emit(SIGNAL('dummy()'))
- new_dir = timeline.direction()
-
- if orig_dir == QTimeLine.Forward:
- self.assertEqual(new_dir, QTimeLine.Backward)
- else:
- self.assertEqual(new_dir, QTimeLine.Forward)
-
- def testWithArgs(self):
- '''Connect python signals to QTimeLine.setCurrentTime(int)'''
- timeline = QTimeLine()
- dummy = Dummy()
-
- QObject.connect(dummy, SIGNAL('dummy(int)'),
- timeline, SLOT('setCurrentTime(int)'))
-
- current = timeline.currentTime()
- dummy.emit(SIGNAL('dummy(int)'), current+42)
- self.assertEqual(timeline.currentTime(), current+42)
-
-class CppSignalsToCppSlots(UsesQCoreApplication):
- '''Connection between C++ slots and signals'''
-
- def testWithoutArgs(self):
- '''Connect QProcess.started() to QTimeLine.togglePaused()'''
- process = QProcess()
- timeline = QTimeLine()
-
- QObject.connect(process, SIGNAL('finished(int, QProcess::ExitStatus)'),
- timeline, SLOT('toggleDirection()'))
-
- orig_dir = timeline.direction()
-
- process.start(sys.executable, ['-c', '"print 42"'])
- process.waitForFinished()
-
- new_dir = timeline.direction()
-
- if orig_dir == QTimeLine.Forward:
- self.assertEqual(new_dir, QTimeLine.Backward)
- else:
- self.assertEqual(new_dir, QTimeLine.Forward)
-
-called = False
-def someSlot(args=None):
- global called
- called = True
-
-class DynamicSignalsToFuncPartial(UsesQCoreApplication):
-
- def testIt(self):
- global called
- called = False
- o = QObject()
- o.connect(o, SIGNAL("ASignal()"), functools.partial(someSlot, "partial .."))
- o.emit(SIGNAL("ASignal()"))
- self.assertTrue(called)
-
-class EmitUnknownType(UsesQCoreApplication):
- def testIt(self):
- a = QObject()
- a.connect(SIGNAL('foobar(Dummy)'), lambda x: 42) # Just connect with an unknown type
- self.assertRaises(TypeError, a.emit, SIGNAL('foobar(Dummy)'), 22)
-
-class EmitEnum(UsesQCoreApplication):
- """Test emission of enum arguments"""
-
- def slot(self, arg):
- self.arg = arg
-
- def testIt(self):
- self.arg = None
- p = QProcess()
- p.stateChanged.connect(self.slot)
- p.stateChanged.emit(QProcess.NotRunning)
- self.assertEqual(self.arg, QProcess.NotRunning)
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/signals/signal_enum_test.py b/sources/pyside2/tests/signals/signal_enum_test.py
deleted file mode 100644
index d48aa10cf..000000000
--- a/sources/pyside2/tests/signals/signal_enum_test.py
+++ /dev/null
@@ -1,80 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2020 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-from enum import Enum
-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, Slot
-
-
-class Colors(Enum):
- red = 1
- green = 2
- blue = 3
-
-class Obj(QObject):
- enum_signal = Signal(Colors)
- object_signal = Signal(object)
-
- def __init__(self, parent=None):
- QObject.__init__(self, parent)
- self.enum_signal.connect(self.get_result)
- self.object_signal.connect(self.get_result)
- self.value = -1
-
- @Slot()
- def get_result(self, i):
- self.value = i
-
-
-class SignalEnumTests(unittest.TestCase):
- '''Test Signal with enum.Enum'''
-
- def testSignal(self):
- o = Obj()
- # Default value
- self.assertEqual(o.value, -1)
-
- # Enum Signal
- o.enum_signal.emit(Colors.green)
- self.assertEqual(o.value, Colors.green)
-
- # object Signal
- o.object_signal.emit(Colors.red)
- self.assertEqual(o.value, Colors.red)
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/signals/signal_func_test.py b/sources/pyside2/tests/signals/signal_func_test.py
deleted file mode 100644
index 0026bc726..000000000
--- a/sources/pyside2/tests/signals/signal_func_test.py
+++ /dev/null
@@ -1,55 +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(False)
-
-from PySide2.QtCore import SIGNAL, SLOT
-
-class SIGNALSLOTTests(unittest.TestCase):
- '''Test the output of SIGNAL and SLOT.'''
-
- def testSIGNAL(self):
- #SIGNAL function
- a = "foobar"
- self.assertEqual(str(SIGNAL(a)), "2foobar")
-
- def testSLOT(self):
- #SLOT function
- a = "foobar"
- self.assertEqual(str(SLOT(a)), "1foobar")
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/signals/signal_manager_refcount_test.py b/sources/pyside2/tests/signals/signal_manager_refcount_test.py
deleted file mode 100644
index 6942f983d..000000000
--- a/sources/pyside2/tests/signals/signal_manager_refcount_test.py
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/python
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-
-import os
-import sys
-from sys import getrefcount
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide2.QtCore import QObject, SIGNAL
-
-class SignalManagerRefCount(unittest.TestCase):
- """Simple test case to check if the signal_manager is erroneously incrementing the object refcounter"""
-
- def testObjectRefcount(self):
- """Emission of QObject.destroyed() to a python slot"""
- def callback():
- pass
- obj = QObject()
- refcount = getrefcount(obj)
- QObject.connect(obj, SIGNAL('destroyed()'), callback)
- self.assertEqual(refcount, getrefcount(obj))
- QObject.disconnect(obj, SIGNAL('destroyed()'), callback)
- self.assertEqual(refcount, getrefcount(obj))
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/sources/pyside2/tests/signals/signal_number_limit_test.py b/sources/pyside2/tests/signals/signal_number_limit_test.py
deleted file mode 100644
index 67bb63e44..000000000
--- a/sources/pyside2/tests/signals/signal_number_limit_test.py
+++ /dev/null
@@ -1,97 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide2 import QtCore
-
-class Emitter(QtCore.QObject):
- s1 = QtCore.Signal()
- s2 = QtCore.Signal()
- s3 = QtCore.Signal()
- s4 = QtCore.Signal()
- s5 = QtCore.Signal()
- s6 = QtCore.Signal()
- s7 = QtCore.Signal()
- s8 = QtCore.Signal()
- s9 = QtCore.Signal()
- s10 = QtCore.Signal()
- s11 = QtCore.Signal()
- s12 = QtCore.Signal()
- s13 = QtCore.Signal()
- s14 = QtCore.Signal()
-
-class SignalNumberLimitTest(unittest.TestCase):
- def myCb(self):
- self._count += 1
-
- def testBug(self):
- e = Emitter()
- e.s1.connect(self.myCb)
- e.s2.connect(self.myCb)
- e.s3.connect(self.myCb)
- e.s4.connect(self.myCb)
- e.s5.connect(self.myCb)
- e.s6.connect(self.myCb)
- e.s7.connect(self.myCb)
- e.s8.connect(self.myCb)
- e.s9.connect(self.myCb)
- e.s10.connect(self.myCb)
- e.s11.connect(self.myCb)
- e.s12.connect(self.myCb)
- e.s13.connect(self.myCb)
- e.s14.connect(self.myCb)
-
- self._count = 0
- e.s1.emit()
- e.s2.emit()
- e.s3.emit()
- e.s4.emit()
- e.s5.emit()
- e.s6.emit()
- e.s7.emit()
- e.s8.emit()
- e.s9.emit()
- e.s10.emit()
- e.s11.emit()
- e.s12.emit()
- e.s13.emit()
- e.s14.emit()
- self.assertEqual(self._count, 14)
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/signals/signal_object_test.py b/sources/pyside2/tests/signals/signal_object_test.py
deleted file mode 100644
index bf4abedbc..000000000
--- a/sources/pyside2/tests/signals/signal_object_test.py
+++ /dev/null
@@ -1,121 +0,0 @@
-#!/usr/bin/env python
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide2.QtCore import QTimer, Signal, QObject, Slot, Qt
-from helper.usesqcoreapplication import UsesQCoreApplication
-
-class MyObject(QTimer):
- sig1 = Signal()
- sig2 = Signal(int, name='rangeChanged')
- sig3 = Signal(int)
- sig4 = Signal((int,), (str,))
- sig5 = Signal((str,), (int,))
- sig6 = Signal(QObject)
-
- @Slot(int)
- def myRange(self, r):
- self._range = r
-
- def slot1(self):
- self._called = True
-
- def slotString(self, s):
- self._s = s
-
- def slotObject(self, o):
- self._o = o
-
-
-class SignalObjectTest(UsesQCoreApplication):
- def cb(self):
- self._cb_called = True
- self.app.exit()
-
- def testsingleConnect(self):
- o = MyObject()
- o.sig1.connect(o.slot1)
- o.sig1.emit()
- self.assertTrue(o._called)
-
- def testSignalWithArgs(self):
- o = MyObject()
- o.sig3.connect(o.myRange)
- o.sig3.emit(10)
- self.assertEqual(o._range, 10)
-
- def testSignatureParse(self):
- o = MyObject()
- o.sig2.connect(o.myRange)
- o.sig2.emit(10)
-
- def testDictOperator(self):
- o = MyObject()
- o.sig4[str].connect(o.slotString)
- o.sig4[str].emit("PySide")
- self.assertEqual(o._s, "PySide")
-
- def testGeneretedSignal(self):
- o = MyObject()
- o.timeout.connect(self.cb)
- o.start(100)
- self.app.exec_()
- self.assertTrue(self._cb_called)
-
- def testConnectionType(self):
- o = MyObject()
- o.timeout.connect(self.cb, type=Qt.DirectConnection)
- o.start(100)
- self.app.exec_()
- self.assertTrue(self._cb_called)
-
- def testSignalWithSignal(self):
- o = MyObject()
- o.sig2.connect(o.myRange)
- o.sig5.connect(o.sig2)
- o.sig5[int].emit(10)
- self.assertEqual(o._range, 10)
-
- def testSignalWithObject(self):
- o = MyObject()
- o.sig6.connect(o.slotObject)
- arg = QObject()
- o.sig6.emit(arg)
- self.assertEqual(arg, o._o)
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/signals/signal_signature_test.py b/sources/pyside2/tests/signals/signal_signature_test.py
deleted file mode 100644
index 1f661de0a..000000000
--- a/sources/pyside2/tests/signals/signal_signature_test.py
+++ /dev/null
@@ -1,121 +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$
-##
-#############################################################################
-
-'''Test case for signal signature received by QObject::connectNotify().'''
-
-import os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide2.QtCore import *
-from helper.usesqcoreapplication import UsesQCoreApplication
-
-called = False
-name = "Old"
-class Obj(QObject):
- dummySignalArgs = Signal(str)
- numberSignal = Signal(int)
- def __init__(self):
- QObject.__init__(self)
- self.signal = ''
-
- def connectNotify(self, signal):
- self.signal = signal
-
- @staticmethod
- def static_method():
- global called
- called = True
-
- @staticmethod
- def static_method_args(arg="default"):
- global name
- name = arg
-
-def callback(arg=None):
- pass
-def callback_empty():
- pass
-
-class TestConnectNotifyWithNewStyleSignals(UsesQCoreApplication):
- '''Test case for signal signature received by QObject::connectNotify().'''
-
- def testOldStyle(self):
- sender = Obj()
- receiver = QObject()
- sender.connect(SIGNAL('destroyed()'), receiver, SLOT('deleteLater()'))
- # When connecting to a regular slot, and not a python callback function, QObject::connect
- # will use the non-cloned method signature, so connectinc to destroyed() will actually
- # connect to destroyed(QObject*).
- self.assertEqual(sender.signal.methodSignature(), 'destroyed(QObject*)')
-
- def testOldStyleWithPythonCallback(self):
- sender = Obj()
- sender.connect(SIGNAL('destroyed()'), callback)
- self.assertEqual(sender.signal.methodSignature(), 'destroyed()')
-
- def testNewStyle(self):
- sender = Obj()
-
- sender.destroyed.connect(callback_empty)
- self.assertEqual(sender.signal.methodSignature(), 'destroyed()')
-
- sender.destroyed[QObject].connect(callback)
- self.assertEqual(sender.signal.methodSignature(), 'destroyed(QObject*)')
-
- def testStaticSlot(self):
- global called
- sender = Obj()
- sender.connect(sender, SIGNAL("dummySignal()"), Obj.static_method)
- sender.emit(SIGNAL("dummySignal()"))
- self.assertTrue(called)
-
-
- def testStaticSlotArgs(self):
- global name
- sender = Obj()
- sender.dummySignalArgs.connect(Obj.static_method_args)
- sender.dummySignalArgs[str].emit("New")
- self.assertEqual(name, "New")
-
- def testLambdaSlot(self):
- sender = Obj()
- sender.numberSignal[int].connect(lambda x: 42)
- with self.assertRaises(IndexError):
- sender.numberSignal[str].emit("test")
-
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/sources/pyside2/tests/signals/signal_with_primitive_type_test.py b/sources/pyside2/tests/signals/signal_with_primitive_type_test.py
deleted file mode 100644
index f7f691f34..000000000
--- a/sources/pyside2/tests/signals/signal_with_primitive_type_test.py
+++ /dev/null
@@ -1,65 +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(False)
-
-from PySide2.QtCore import *
-
-
-class SignalPrimitiveTypeTest(unittest.TestCase):
-
- def signalValueChanged(self, v):
- self.called = True
- self._app.quit()
-
- def createTimeLine(self):
- self.called = False
- tl = QTimeLine(10000)
- QObject.connect(tl, SIGNAL("valueChanged(qreal)"), self.signalValueChanged)
- return tl
-
- def testTimeLine(self):
- self._valueChangedCount = 0
- self._app = QCoreApplication([])
- tl = self.createTimeLine()
- tl.start()
- self._app.exec_()
- self.assertTrue(self.called)
-
-if __name__ == '__main__':
- unittest.main()
-
-
diff --git a/sources/pyside2/tests/signals/slot_reference_count_test.py b/sources/pyside2/tests/signals/slot_reference_count_test.py
deleted file mode 100644
index 7885a358b..000000000
--- a/sources/pyside2/tests/signals/slot_reference_count_test.py
+++ /dev/null
@@ -1,87 +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$
-##
-#############################################################################
-
-''' Forced disconnection: Delete one end of the signal connection'''
-
-import os
-import sys
-from sys import getrefcount
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide2.QtCore import QObject, SIGNAL, SLOT
-
-class Dummy(QObject):
- def dispatch(self):
- self.emit(SIGNAL('foo()'))
-
-class PythonSignalRefCount(unittest.TestCase):
-
- def setUp(self):
- self.emitter = Dummy()
-
- def tearDown(self):
- self.emitter
-
- def testRefCount(self):
- def cb(*args):
- pass
-
- self.assertEqual(getrefcount(cb), 2)
-
- QObject.connect(self.emitter, SIGNAL('foo()'), cb)
- self.assertEqual(getrefcount(cb), 3)
-
- QObject.disconnect(self.emitter, SIGNAL('foo()'), cb)
- self.assertEqual(getrefcount(cb), 2)
-
-class CppSignalRefCount(unittest.TestCase):
-
- def setUp(self):
- self.emitter = QObject()
-
- def tearDown(self):
- self.emitter
-
- def testRefCount(self):
- def cb(*args):
- pass
-
- self.assertEqual(getrefcount(cb), 2)
-
- QObject.connect(self.emitter, SIGNAL('destroyed()'), cb)
- self.assertEqual(getrefcount(cb), 3)
-
- QObject.disconnect(self.emitter, SIGNAL('destroyed()'), cb)
- self.assertEqual(getrefcount(cb), 2)
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/signals/static_metaobject_test.py b/sources/pyside2/tests/signals/static_metaobject_test.py
deleted file mode 100644
index bdb3b1992..000000000
--- a/sources/pyside2/tests/signals/static_metaobject_test.py
+++ /dev/null
@@ -1,92 +0,0 @@
-#!/usr/bin/env 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$
-##
-#############################################################################
-
-"""Tests covering signal emission and receiving to python slots"""
-
-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, Slot
-from helper.usesqcoreapplication import UsesQCoreApplication
-
-class MyObject(QObject):
- def __init__(self, parent=None):
- QObject.__init__(self, parent)
- self._slotCalledCount = 0
-
- # this '@Slot()' is needed to get the right sort order in testSharedSignalEmission.
- # For some reason, it also makes the tests actually work!
- @Slot()
- def mySlot(self):
- self._slotCalledCount = self._slotCalledCount + 1
-
-
-class StaticMetaObjectTest(UsesQCoreApplication):
-
- def testSignalPropagation(self):
- o = MyObject()
- o2 = MyObject()
-
- # SIGNAL foo not created yet
- self.assertEqual(o.metaObject().indexOfSignal("foo()"), -1)
-
- o.connect(SIGNAL("foo()"), o2.mySlot)
- # SIGNAL foo create after connect
- self.assertTrue(o.metaObject().indexOfSignal("foo()") > 0)
-
- # SIGNAL does not propagate to others objects of the same type
- self.assertEqual(o2.metaObject().indexOfSignal("foo()"), -1)
-
- del o
- del o2
- o = MyObject()
- # The SIGNAL was destroyed with old objects
- self.assertEqual(o.metaObject().indexOfSignal("foo()"), -1)
-
-
- def testSharedSignalEmission(self):
- o = QObject()
- m = MyObject()
-
- o.connect(SIGNAL("foo2()"), m.mySlot)
- m.connect(SIGNAL("foo2()"), m.mySlot)
- o.emit(SIGNAL("foo2()"))
- self.assertEqual(m._slotCalledCount, 1)
- del o
- m.emit(SIGNAL("foo2()"))
- self.assertEqual(m._slotCalledCount, 2)
-
-if __name__ == '__main__':
- unittest.main()