aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2010-06-16 18:03:07 -0300
committerRenato Filho <renato.filho@openbossa.org>2010-06-17 15:35:28 -0300
commitd699a3abedfe60e7146fad8381b03687ce476699 (patch)
tree574a2274e05b3c3b5a17fbcb5ae57c59cf533268 /tests
parentcf90354ff99bc90ecfc6ea57e3cbddcad6bab9a1 (diff)
Created test for Connection between new Signal API and Slots
Reviewer: Hugo Parente Lima <hugo.lima@openbossa.org>, Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/QtGui/CMakeLists.txt1
-rw-r--r--tests/QtGui/qtextedit_signal_test.py37
2 files changed, 38 insertions, 0 deletions
diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt
index 5ff457940..5f50ea860 100644
--- a/tests/QtGui/CMakeLists.txt
+++ b/tests/QtGui/CMakeLists.txt
@@ -48,6 +48,7 @@ PYSIDE_TEST(qstyle_test.py)
PYSIDE_TEST(qtableview_test.py)
PYSIDE_TEST(qtabwidget_test.py)
PYSIDE_TEST(qtextedit_test.py)
+PYSIDE_TEST(qtextedit_signal_test.py)
PYSIDE_TEST(qtoolbar_test.py)
PYSIDE_TEST(qtoolbox_test.py)
PYSIDE_TEST(qwidget_setlayout_test.py)
diff --git a/tests/QtGui/qtextedit_signal_test.py b/tests/QtGui/qtextedit_signal_test.py
new file mode 100644
index 000000000..3195e0e8e
--- /dev/null
+++ b/tests/QtGui/qtextedit_signal_test.py
@@ -0,0 +1,37 @@
+from PySide import QtGui, QtCore
+from helper import UsesQApplication
+
+import unittest
+
+class MyWindow(QtGui.QMainWindow):
+ appendText = QtCore.Signal(str)
+
+ @QtCore.Slot()
+ def onButtonPressed(self):
+ self.appendText.emit("PySide")
+
+ def __init__(self, parent=None):
+ super(MyWindow, self).__init__(parent)
+
+ self.textEdit = QtGui.QTextEdit()
+ self.btn = QtGui.QPushButton("ClickMe")
+ self.btn.clicked.connect(self.onButtonPressed)
+ self.appendText.connect(self.textEdit.append)
+
+ def start(self):
+ self.btn.click()
+
+ def text(self):
+ return self.textEdit.toPlainText()
+
+
+class testSignalWithCPPSlot(UsesQApplication):
+
+ def testEmission(self):
+ w = MyWindow()
+ w.start()
+ self.assertEqual(w.text(), "PySide")
+
+if __name__ == '__main__':
+ unittest.main()
+