diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-03-23 09:19:10 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-03-23 09:19:56 +0100 |
commit | 37333deacf7e2361cff7d40886f61c7546516852 (patch) | |
tree | a96c36d84cd0bb501067daed51062cb5357e578e | |
parent | bbc13fe6ad1de634a6d3b594220ad780583378e0 (diff) | |
parent | 4edd9a1278efdf37f366e9aa6e82f151a357ef32 (diff) |
Merge branch 'dev' into wip/clangwip/clang
Change-Id: Ia2090c014755d23b04325f024a00a8b7641ae9cc
-rw-r--r-- | PySide2/QtCore/CMakeLists.txt | 3 | ||||
-rw-r--r-- | PySide2/QtCore/typesystem_core_common.xml | 7 | ||||
-rw-r--r-- | PySide2/QtGui/CMakeLists.txt | 1 | ||||
-rw-r--r-- | PySide2/QtGui/typesystem_gui_common.xml | 1 | ||||
-rw-r--r-- | PySide2/QtScriptTools/CMakeLists.txt | 10 | ||||
-rw-r--r-- | PySide2/QtScriptTools/typesystem_scripttools.xml | 1 | ||||
-rw-r--r-- | libpyside/pyside.cpp | 3 | ||||
-rw-r--r-- | libpyside/signalmanager.cpp.in | 1 | ||||
-rw-r--r-- | tests/QtCore/CMakeLists.txt | 2 | ||||
-rw-r--r-- | tests/QtCore/qcollator_test.py | 61 | ||||
-rw-r--r-- | tests/QtCore/qobject_connect_notify_test.py | 5 | ||||
-rw-r--r-- | tests/QtCore/qstandardpaths_test.py | 50 | ||||
-rw-r--r-- | tests/QtGui/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/QtGui/qdesktopservices_test.py | 43 | ||||
-rw-r--r-- | tests/QtMultimedia/audio_test.py | 8 | ||||
-rwxr-xr-x | tests/QtQml/bug_557.py | 3 | ||||
-rw-r--r-- | tests/QtScript/qscriptvalue_test.py | 4 | ||||
-rw-r--r-- | tests/QtScriptTools/debugger_test.py | 6 | ||||
-rw-r--r-- | tests/QtWidgets/returnquadruplesofnumbers_test.py | 5 | ||||
-rw-r--r-- | tests/signals/signal_signature_test.py | 11 |
20 files changed, 210 insertions, 16 deletions
diff --git a/PySide2/QtCore/CMakeLists.txt b/PySide2/QtCore/CMakeLists.txt index 4b097e8d..82a25b77 100644 --- a/PySide2/QtCore/CMakeLists.txt +++ b/PySide2/QtCore/CMakeLists.txt @@ -31,6 +31,8 @@ ${QtCore_GEN_DIR}/qbuffer_wrapper.cpp ${QtCore_GEN_DIR}/qbytearray_wrapper.cpp ${QtCore_GEN_DIR}/qbytearraymatcher_wrapper.cpp ${QtCore_GEN_DIR}/qchildevent_wrapper.cpp +${QtCore_GEN_DIR}/qcollator_wrapper.cpp +${QtCore_GEN_DIR}/qcollatorsortkey_wrapper.cpp ${QtCore_GEN_DIR}/qcoreapplication_wrapper.cpp ${QtCore_GEN_DIR}/qcryptographichash_wrapper.cpp ${QtCore_GEN_DIR}/qdatastream_wrapper.cpp @@ -107,6 +109,7 @@ ${QtCore_GEN_DIR}/qsizef_wrapper.cpp ${QtCore_GEN_DIR}/qsocketnotifier_wrapper.cpp ${QtCore_GEN_DIR}/qsortfilterproxymodel_wrapper.cpp ${QtCore_GEN_DIR}/qstate_wrapper.cpp +${QtCore_GEN_DIR}/qstandardpaths_wrapper.cpp ${QtCore_GEN_DIR}/qstatemachine_signalevent_wrapper.cpp ${QtCore_GEN_DIR}/qstatemachine_wrappedevent_wrapper.cpp ${QtCore_GEN_DIR}/qstatemachine_wrapper.cpp diff --git a/PySide2/QtCore/typesystem_core_common.xml b/PySide2/QtCore/typesystem_core_common.xml index 9a2d74b6..ae3df443 100644 --- a/PySide2/QtCore/typesystem_core_common.xml +++ b/PySide2/QtCore/typesystem_core_common.xml @@ -3172,6 +3172,9 @@ </object-type> <object-type name="QSignalMapper" /> + <object-type name="QCollatorSortKey" since="5.2" /> + <object-type name="QCollator" since="5.2" /> + <object-type name="QCoreApplication"> <!--Qt5: gone <enum-type name="Encoding" /> --> <enum-type identified-by-value="ApplicationFlags" since="4.8" revision="4800"/> @@ -3606,6 +3609,10 @@ <modify-function signature="readLine(qint64)" allow-thread="yes"/> <modify-function signature="readAll()" allow-thread="yes"/> </object-type> + <object-type name="QStandardPaths" since="5.0"> + <enum-type name="StandardLocation"/> + <enum-type name="LocateOption" flags="LocateOptions"/> + </object-type> <object-type name="QSystemSemaphore"> <enum-type name="AccessMode"/> <enum-type name="SystemSemaphoreError"/> diff --git a/PySide2/QtGui/CMakeLists.txt b/PySide2/QtGui/CMakeLists.txt index 6960b2cd..3fa2effd 100644 --- a/PySide2/QtGui/CMakeLists.txt +++ b/PySide2/QtGui/CMakeLists.txt @@ -16,6 +16,7 @@ ${QtGui_GEN_DIR}/qcolor_wrapper.cpp ${QtGui_GEN_DIR}/qconicalgradient_wrapper.cpp ${QtGui_GEN_DIR}/qcontextmenuevent_wrapper.cpp ${QtGui_GEN_DIR}/qcursor_wrapper.cpp +${QtGui_GEN_DIR}/qdesktopservices_wrapper.cpp ${QtGui_GEN_DIR}/qdoublevalidator_wrapper.cpp ${QtGui_GEN_DIR}/qdrag_wrapper.cpp ${QtGui_GEN_DIR}/qdragenterevent_wrapper.cpp diff --git a/PySide2/QtGui/typesystem_gui_common.xml b/PySide2/QtGui/typesystem_gui_common.xml index a6795f12..855610dc 100644 --- a/PySide2/QtGui/typesystem_gui_common.xml +++ b/PySide2/QtGui/typesystem_gui_common.xml @@ -1482,6 +1482,7 @@ </object-type> <object-type name="QPyTextObject" /> + <object-type name="QDesktopServices" since="4.2" /> <object-type name="QDoubleValidator"> <enum-type name="Notation"/> </object-type> diff --git a/PySide2/QtScriptTools/CMakeLists.txt b/PySide2/QtScriptTools/CMakeLists.txt index 13ec63a7..43652207 100644 --- a/PySide2/QtScriptTools/CMakeLists.txt +++ b/PySide2/QtScriptTools/CMakeLists.txt @@ -8,12 +8,14 @@ ${QtScriptTools_GEN_DIR}/qtscripttools_module_wrapper.cpp make_path(QtScriptTools_typesystem_path ${QtCore_SOURCE_DIR} ${QtGui_SOURCE_DIR} ${QtScript_SOURCE_DIR} ${QtCore_BINARY_DIR} ${QtGui_BINARY_DIR} ${QtScript_BINARY_DIR} + ${QtWidgets_SOURCE_DIR} ${QtWidgets_BINARY_DIR} ${QtScriptTools_SOURCE_DIR}) set(QtScriptTools_include_dirs ${QtScriptTools_SOURCE_DIR} ${QtScriptTools_BINARY_DIR} ${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} + ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Script_INCLUDE_DIRS} ${Qt5ScriptTools_INCLUDE_DIRS} ${SHIBOKEN_PYTHON_INCLUDE_DIR} @@ -21,6 +23,7 @@ set(QtScriptTools_include_dirs ${QtScriptTools_SOURCE_DIR} ${libpyside_SOURCE_DIR} ${QtCore_GEN_DIR} ${QtGui_GEN_DIR} + ${QtWidgets_GEN_DIR} ${QtScript_GEN_DIR} ) @@ -28,10 +31,11 @@ set(QtScriptTools_libraries pyside2 ${SHIBOKEN_PYTHON_LIBRARIES} ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} - ${Qt5Script_LIBRARYIES} - ${Qt5ScriptTools_LIBRARYIES}) + ${Qt5Widgets_LIBRARIES} + ${Qt5Script_LIBRARIES} + ${Qt5ScriptTools_LIBRARIES}) -set(QtScriptTools_deps QtCore QtScript QtGui) +set(QtScriptTools_deps QtCore QtScript QtGui QtWidgets) create_pyside_module(QtScriptTools QtScriptTools_include_dirs diff --git a/PySide2/QtScriptTools/typesystem_scripttools.xml b/PySide2/QtScriptTools/typesystem_scripttools.xml index 812d924f..15bda405 100644 --- a/PySide2/QtScriptTools/typesystem_scripttools.xml +++ b/PySide2/QtScriptTools/typesystem_scripttools.xml @@ -42,6 +42,7 @@ <typesystem package="PySide2.QtScriptTools"> <load-typesystem name="typesystem_script.xml" generate="no" /> <load-typesystem name="typesystem_gui.xml" generate="no" /> + <load-typesystem name="typesystem_widgets.xml" generate="no" /> <object-type name="QScriptEngineDebugger"> <enum-type name="DebuggerAction"/> diff --git a/libpyside/pyside.cpp b/libpyside/pyside.cpp index 59934286..7d05f45a 100644 --- a/libpyside/pyside.cpp +++ b/libpyside/pyside.cpp @@ -271,7 +271,8 @@ PyObject* getMetaDataFromQObject(QObject* cppSelf, PyObject* self, PyObject* nam QList<QMetaMethod> signalList; for(int i=0, i_max = metaObject->methodCount(); i < i_max; i++) { QMetaMethod method = metaObject->method(i); - const char* methSig = method.methodSignature(); + const QByteArray methSig_ = method.methodSignature(); + const char *methSig = methSig_.constData(); bool methMacth = !std::strncmp(cname, methSig, cnameLen) && methSig[cnameLen] == '('; if (methMacth) { if (method.methodType() == QMetaMethod::Signal) { diff --git a/libpyside/signalmanager.cpp.in b/libpyside/signalmanager.cpp.in index 73408e9a..d6757efb 100644 --- a/libpyside/signalmanager.cpp.in +++ b/libpyside/signalmanager.cpp.in @@ -64,6 +64,7 @@ #if @QML_SUPPORT@ #include <private/qv4engine_p.h> #include <private/qv4context_p.h> + #include <private/qqmldata_p.h> #if QT_VERSION < 0x050700 #include <private/qqmlcontextwrapper_p.h> #endif diff --git a/tests/QtCore/CMakeLists.txt b/tests/QtCore/CMakeLists.txt index 1a7d53a7..6f62eee7 100644 --- a/tests/QtCore/CMakeLists.txt +++ b/tests/QtCore/CMakeLists.txt @@ -50,6 +50,7 @@ PYSIDE_TEST(qbytearray_concatenation_operator_test.py) PYSIDE_TEST(qbytearray_operator_iadd_test.py) PYSIDE_TEST(qbytearray_operator_test.py) PYSIDE_TEST(qbytearray_test.py) +PYSIDE_TEST(qcollator_test.py) PYSIDE_TEST(qcoreapplication_instance_test.py) PYSIDE_TEST(qdatastream_test.py) PYSIDE_TEST(qdatetime_test.py) @@ -87,6 +88,7 @@ PYSIDE_TEST(qresource_test.py) PYSIDE_TEST(qsize_test.py) PYSIDE_TEST(qslot_object_test.py) PYSIDE_TEST(qsrand_test.py) +PYSIDE_TEST(qstandardpaths_test.py) PYSIDE_TEST(qstatemachine_test.py) PYSIDE_TEST(qstate_test.py) PYSIDE_TEST(qstring_test.py) diff --git a/tests/QtCore/qcollator_test.py b/tests/QtCore/qcollator_test.py new file mode 100644 index 00000000..0afb1ca8 --- /dev/null +++ b/tests/QtCore/qcollator_test.py @@ -0,0 +1,61 @@ +#!/usr/bin/python + +############################################################################# +## +## Copyright (C) 2017 The Qt Company Ltd. +## Contact: https://www.qt.io/licensing/ +## +## This file is part of the test suite of PySide2. +## +## $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$ +## +############################################################################# + +'''Unit tests for QCollator''' + +import unittest +import ctypes +import sys + +from PySide2.QtCore import * + +class QCollatorTest(unittest.TestCase): + def testState(self): + c = QCollator() + c.setCaseSensitivity(Qt.CaseInsensitive) + c.setLocale(QLocale.German) + + print("compare a and b:", c.compare("a", "b")) + + self.assertEqual(c.caseSensitivity(), Qt.CaseInsensitive) + self.assertEqual(c.locale(), QLocale(QLocale.German)) + + c.setLocale(QLocale.French) + c.setNumericMode(True) + c.setIgnorePunctuation(True) + c.setLocale(QLocale.Norwegian) + + self.assertEqual(c.caseSensitivity(), Qt.CaseInsensitive) + self.assertEqual(c.numericMode(), True) + self.assertEqual(c.ignorePunctuation(), True) + self.assertEqual(c.locale(), QLocale(QLocale.Norwegian)) + +if __name__ == '__main__': + unittest.main() diff --git a/tests/QtCore/qobject_connect_notify_test.py b/tests/QtCore/qobject_connect_notify_test.py index 629a79a6..50b748ca 100644 --- a/tests/QtCore/qobject_connect_notify_test.py +++ b/tests/QtCore/qobject_connect_notify_test.py @@ -69,7 +69,10 @@ class TestQObjectConnectNotify(UsesQCoreApplication): receiver = QObject() sender.connect(SIGNAL("destroyed()"), receiver, SLOT("deleteLater()")) self.assertTrue(sender.con_notified) - self.assertEqual(sender.signal, SIGNAL("destroyed()")) + # When connecting to a regular slot, and not a python callback function, QObject::connect + # will use the non-cloned method signature, so connecting to destroyed() will actually + # connect to destroyed(QObject*). + self.assertEqual(sender.signal.methodSignature(), "destroyed(QObject*)") sender.disconnect(SIGNAL("destroyed()"), receiver, SLOT("deleteLater()")) self.assertTrue(sender.dis_notified) diff --git a/tests/QtCore/qstandardpaths_test.py b/tests/QtCore/qstandardpaths_test.py new file mode 100644 index 00000000..35e25e1f --- /dev/null +++ b/tests/QtCore/qstandardpaths_test.py @@ -0,0 +1,50 @@ +#!/usr/bin/python + +############################################################################# +## +## Copyright (C) 2017 The Qt Company Ltd. +## Contact: https://www.qt.io/licensing/ +## +## This file is part of the test suite of PySide2. +## +## $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$ +## +############################################################################# + +'''Unit tests for QStandardPaths''' + +import unittest +import ctypes +import sys + +from PySide2.QtCore import QStandardPaths + +class QStandardPathsTest(unittest.TestCase): + def testTestModeEnabled(self): + print("QStandardPaths.isTestModeEnabled:", QStandardPaths.isTestModeEnabled()) + sp = True + QStandardPaths.setTestModeEnabled(sp) + self.assertEqual(QStandardPaths.isTestModeEnabled(), sp) + sp = False + QStandardPaths.setTestModeEnabled(sp) + self.assertEqual(QStandardPaths.isTestModeEnabled(), sp) + +if __name__ == '__main__': + unittest.main() diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt index 1d94d4f5..f41a0f8b 100644 --- a/tests/QtGui/CMakeLists.txt +++ b/tests/QtGui/CMakeLists.txt @@ -22,6 +22,7 @@ PYSIDE_TEST(qcolor_test.py) PYSIDE_TEST(qcolor_reduce_test.py) PYSIDE_TEST(qcursor_test.py) PYSIDE_TEST(qdatastream_gui_operators_test.py) +PYSIDE_TEST(qdesktopservices_test.py) PYSIDE_TEST(qfontmetrics_test.py) PYSIDE_TEST(qicon_test.py) PYSIDE_TEST(qitemselection_test.py) diff --git a/tests/QtGui/qdesktopservices_test.py b/tests/QtGui/qdesktopservices_test.py new file mode 100644 index 00000000..edeb32a0 --- /dev/null +++ b/tests/QtGui/qdesktopservices_test.py @@ -0,0 +1,43 @@ +############################################################################# +## +## Copyright (C) 2017 The Qt Company Ltd. +## Contact: https://www.qt.io/licensing/ +## +## This file is part of the test suite of PySide2. +## +## $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$ +## +############################################################################# + +'''Unit tests for QDesktopServices''' + +import unittest + +from PySide2.QtGui import QDesktopServices +from PySide2.QtCore import QUrl + +class QDesktopServicesTest(unittest.TestCase): + def testOpenUrl(self): + # At the bare minimum check that they return false for invalid url's + url = QUrl() + self.assertEqual(QDesktopServices.openUrl(url), False) + +if __name__ == '__main__': + unittest.main() diff --git a/tests/QtMultimedia/audio_test.py b/tests/QtMultimedia/audio_test.py index 0cc06cb7..66db5e1e 100644 --- a/tests/QtMultimedia/audio_test.py +++ b/tests/QtMultimedia/audio_test.py @@ -52,10 +52,10 @@ class testAudioDevices(unittest.TestCase): fmt = QAudioFormat() for codec in devInfo.supportedCodecs(): fmt.setCodec(codec) - for frequency in devInfo.supportedFrequencies(): - fmt.setFrequency(frequency) - for channels in devInfo.supportedChannels(): - fmt.setChannels(channels) + for frequency in devInfo.supportedSampleRates(): + fmt.setSampleRate(frequency) + for channels in devInfo.supportedChannelCounts(): + fmt.setChannelCount(channels) for sampleType in devInfo.supportedSampleTypes(): fmt.setSampleType(sampleType) for sampleSize in devInfo.supportedSampleSizes(): diff --git a/tests/QtQml/bug_557.py b/tests/QtQml/bug_557.py index d1e8ede9..96e89d6d 100755 --- a/tests/QtQml/bug_557.py +++ b/tests/QtQml/bug_557.py @@ -27,6 +27,7 @@ ############################################################################# import sys +from helper import adjust_filename from PySide2.QtCore import QUrl from PySide2.QtGui import QGuiApplication @@ -38,5 +39,5 @@ engine = QQmlEngine() component = QQmlComponent(engine) # This should segfault if the QDeclarativeComponent has not QQmlEngine -component.loadUrl(QUrl.fromLocalFile('foo.qml')) +component.loadUrl(QUrl.fromLocalFile(adjust_filename('foo.qml', __file__))) diff --git a/tests/QtScript/qscriptvalue_test.py b/tests/QtScript/qscriptvalue_test.py index 5e48a101..bf2a69f2 100644 --- a/tests/QtScript/qscriptvalue_test.py +++ b/tests/QtScript/qscriptvalue_test.py @@ -30,6 +30,9 @@ import unittest from PySide2.QtScript import * +# Required for eval() to work +import PySide2.QtScript + from helper import UsesQApplication class TestQScriptValue (UsesQApplication): @@ -45,6 +48,7 @@ class TestQScriptValue (UsesQApplication): def testRepr(self): value = QScriptValue("somePerson = { firstName: 'John', lastName: 'Doe' }") + print repr(value) value2 = eval(repr(value)) self.assertEqual(value.toString(), value2.toString()) self.assertEqual(value.toVariant(), value2.toVariant()) diff --git a/tests/QtScriptTools/debugger_test.py b/tests/QtScriptTools/debugger_test.py index 6e27a72a..ea8e557a 100644 --- a/tests/QtScriptTools/debugger_test.py +++ b/tests/QtScriptTools/debugger_test.py @@ -62,7 +62,11 @@ class DebuggerTest(UsesQApplication): self.debugger.connect(SIGNAL('evaluationSuspended()'), self.suspended) self.debugger.connect(SIGNAL('evaluationResumed()'), self.resumed) - self.debugger.action(QScriptEngineDebugger.InterruptAction).trigger() + # For some reason StepIntoAction does not actually continue execution, and thus interrupting + # causes the test to hang. The same behavior is present in a Qt5.6 C++ code equivalent. It + # seems like a bug in QtScript, thus the interruption is commented out for now, which will + # force the test to fail. + #self.debugger.action(QScriptEngineDebugger.InterruptAction).trigger() self.engine.evaluate("3+4\n2+1\n5+1") self.assertTrue(self.has_resumed >= 1) self.assertTrue(self.has_suspended >= 1) diff --git a/tests/QtWidgets/returnquadruplesofnumbers_test.py b/tests/QtWidgets/returnquadruplesofnumbers_test.py index 45bcf7e9..39799040 100644 --- a/tests/QtWidgets/returnquadruplesofnumbers_test.py +++ b/tests/QtWidgets/returnquadruplesofnumbers_test.py @@ -81,8 +81,11 @@ class ReturnsQuadruplesOfNumbers(UsesQApplication): def testQPrinterGetPageMargins(self): # Bug #742 obj = QPrinter() - values = (10.0, 20.0, 30.0, 40.0, QPrinter.Point) + # On macOS the minimum margin of a page is ~12, setting something lower than that will + # actually fail to set all the margins. + values = (15.0, 16.0, 17.0, 18.0, QPrinter.Point) obj.setPageMargins(*values) + print obj.getPageMargins(QPrinter.Point), values[:-1] self.assertTrue(self.compareTuples(obj.getPageMargins(QPrinter.Point), values[:-1])) if __name__ == "__main__": diff --git a/tests/signals/signal_signature_test.py b/tests/signals/signal_signature_test.py index 8d60c17f..349619aa 100644 --- a/tests/signals/signal_signature_test.py +++ b/tests/signals/signal_signature_test.py @@ -52,21 +52,24 @@ class TestConnectNotifyWithNewStyleSignals(UsesQCoreApplication): sender = Obj() receiver = QObject() sender.connect(SIGNAL('destroyed()'), receiver, SLOT('deleteLater()')) - self.assertEqual(sender.signal, SIGNAL('destroyed()')) + # 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, SIGNAL('destroyed()')) + self.assertEqual(sender.signal.methodSignature(), 'destroyed()') def testNewStyle(self): sender = Obj() sender.destroyed.connect(callback) - self.assertEqual(sender.signal, SIGNAL('destroyed()')) + self.assertEqual(sender.signal.methodSignature(), 'destroyed()') sender.destroyed[QObject].connect(callback) - self.assertEqual(sender.signal, SIGNAL('destroyed(QObject*)')) + self.assertEqual(sender.signal.methodSignature(), 'destroyed(QObject*)') if __name__ == '__main__': unittest.main() |