From e6f0d69532fffb19befde41ab6155ca87a0390a0 Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Fri, 15 Jul 2011 19:01:22 -0300 Subject: Created unit test for bug #921. Reviewer: Marcelo Lira Lauro Moura --- tests/QtCore/CMakeLists.txt | 1 + tests/QtCore/bug_921.py | 52 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 tests/QtCore/bug_921.py (limited to 'tests/QtCore') diff --git a/tests/QtCore/CMakeLists.txt b/tests/QtCore/CMakeLists.txt index 2c99cf1b2..d3048a3fd 100644 --- a/tests/QtCore/CMakeLists.txt +++ b/tests/QtCore/CMakeLists.txt @@ -17,6 +17,7 @@ PYSIDE_TEST(bug_826.py) PYSIDE_TEST(bug_829.py) PYSIDE_TEST(bug_835.py) PYSIDE_TEST(bug_920.py) +PYSIDE_TEST(bug_921.py) PYSIDE_TEST(bug_927.py) PYSIDE_TEST(blocking_signals_test.py) PYSIDE_TEST(classinfo_test.py) diff --git a/tests/QtCore/bug_921.py b/tests/QtCore/bug_921.py new file mode 100644 index 000000000..b43f5b3d2 --- /dev/null +++ b/tests/QtCore/bug_921.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python + +import unittest + +import PySide.QtCore as QtCore +import PySide.QtGui as QtGui + +from helper import TimedQApplication + +class Signaller(QtCore.QObject): + s1 = QtCore.Signal() + s2 = QtCore.Signal() + s3 = QtCore.Signal() + +class Window(object): + + def __init__(self, s): + self._window = QtGui.QMainWindow() + self._window.setAttribute(QtCore.Qt.WA_DeleteOnClose, True) + self._window.setWindowTitle("Demo!") + + self._s = s + self._s.s1.connect(self._on_signal) + self._s.s2.connect(self._on_signal) + + def show(self): + self._window.show() + + def _on_signal(self): + self._window.setWindowTitle("Signaled!") + +class TestTimedApp(TimedQApplication): + def testSignals(self): + s = Signaller() + w = Window(s) + w.show() + + def midleFunction(): + def internalFunction(): + pass + s.s3.connect(internalFunction) + + midleFunction() + self.app.exec_() + del w + + s.s1.emit() + s.s2.emit() + s.s3.emit() + +if __name__ == '__main__': + unittest.main() -- cgit v1.2.3