aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2010-05-07 11:47:43 -0300
committerRenato Filho <renato.filho@openbossa.org>2010-05-07 11:49:34 -0300
commitf17539378b995711c011b74070509566f30c7e9a (patch)
tree5ddf35a92256a8c333164549f101a1aaa9647a08 /tests
parent1551821972882def5738220112c3a7487ab80edf (diff)
unittest for autoconection signal/slot.
Reviewer: Hugo Parente Lima <hugo.lima@openbossa.org>, Luciano Wolf <luciano.wolf@openbossa.org
Diffstat (limited to 'tests')
-rw-r--r--tests/signals/signal_autoconect_test.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/signals/signal_autoconect_test.py b/tests/signals/signal_autoconect_test.py
new file mode 100644
index 000000000..2ad27c43c
--- /dev/null
+++ b/tests/signals/signal_autoconect_test.py
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+
+import unittest
+
+from PySide.QtCore import *
+from PySide.QtGui import *
+
+class MyObject(QWidget):
+ def __init__(self, parent=None):
+ QWidget.__init__(self, parent)
+ self._method_called = False
+
+ 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.assert_(win._method_called)
+
+if __name__ == '__main__':
+ unittest.main()