diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/QtDeclarative/CMakeLists.txt | 1 | ||||
-rwxr-xr-x | tests/QtDeclarative/connect_python_qml.py | 30 | ||||
-rw-r--r-- | tests/QtDeclarative/connect_python_qml.qml | 20 |
3 files changed, 51 insertions, 0 deletions
diff --git a/tests/QtDeclarative/CMakeLists.txt b/tests/QtDeclarative/CMakeLists.txt index 4896010bd..98b797c97 100644 --- a/tests/QtDeclarative/CMakeLists.txt +++ b/tests/QtDeclarative/CMakeLists.txt @@ -1,2 +1,3 @@ PYSIDE_TEST(qdeclarativenetwork_test.py FALSE) PYSIDE_TEST(qdeclarativeview_test.py FALSE) +PYSIDE_TEST(connect_python_qml.py FALSE) diff --git a/tests/QtDeclarative/connect_python_qml.py b/tests/QtDeclarative/connect_python_qml.py new file mode 100755 index 000000000..bb505156e --- /dev/null +++ b/tests/QtDeclarative/connect_python_qml.py @@ -0,0 +1,30 @@ +'''Test case for bug #442''' + +from PySide import QtCore, QtGui, QtDeclarative +from helper import adjust_filename, TimedQApplication +import unittest + +class TestConnectionWithInvalidSignature(TimedQApplication): + def onButtonClicked(self): + self.buttonClicked = True + self.app.quit() + + def onButtonFailClicked(self): + pass + + def testFailConnection(self): + self.buttonClicked = False + self.buttonFailClicked = False + view = QtDeclarative.QDeclarativeView() + view.setSource(QtCore.QUrl(adjust_filename('connect_python_qml.qml', __file__))) + root = view.rootObject() + button = root.findChild(QtCore.QObject, "buttonMouseArea") + self.assertRaises(TypeError, QtCore.QObject.connect, [button,QtCore.SIGNAL('clicked()'), self.onButtonFailClicked]) + button.clicked.connect(self.onButtonClicked) + button.clicked.emit() + view.show() + self.app.exec_() + self.assert_(self.buttonClicked) + +if __name__ == '__main__': + unittest.main() diff --git a/tests/QtDeclarative/connect_python_qml.qml b/tests/QtDeclarative/connect_python_qml.qml new file mode 100644 index 000000000..dbf890f6f --- /dev/null +++ b/tests/QtDeclarative/connect_python_qml.qml @@ -0,0 +1,20 @@ +import Qt 4.7 + +Rectangle { + id: page + width: 500; height: 200 + color: "lightgray" + + Rectangle { + id: button + width: 150; height: 40 + color: "darkgray" + anchors.horizontalCenter: page.horizontalCenter + y: 150 + MouseArea { + id: buttonMouseArea + objectName: "buttonMouseArea" + anchors.fill: parent + } + } +} |