summaryrefslogtreecommitdiffstats
path: root/tests/QtDeclarative/connect_python_qml.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/QtDeclarative/connect_python_qml.py')
-rwxr-xr-xtests/QtDeclarative/connect_python_qml.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/QtDeclarative/connect_python_qml.py b/tests/QtDeclarative/connect_python_qml.py
new file mode 100755
index 0000000..bb50515
--- /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()