diff options
author | Renato Araujo Oliveira Filho <renato.filho@openbossa.org> | 2010-11-14 21:02:34 -0300 |
---|---|---|
committer | Renato Araujo Oliveira Filho <renato.filho@openbossa.org> | 2010-11-19 15:14:15 -0300 |
commit | dd8b0fcfe41222be0141e2b717bb6f6b4c6f7107 (patch) | |
tree | aec9f9886eb26e84c769f51fa7513ba816f52493 /tests | |
parent | 71d279c0406030faa97927f510e2b2f802daf794 (diff) | |
download | pyside-dd8b0fcfe41222be0141e2b717bb6f6b4c6f7107.tar.gz pyside-dd8b0fcfe41222be0141e2b717bb6f6b4c6f7107.tar.xz pyside-dd8b0fcfe41222be0141e2b717bb6f6b4c6f7107.zip |
Created unit test for bug 462.
Reviewer: Hugo Parente Lima <hugo.pl@gmail.com>
Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/QtCore/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/QtCore/bug_462.py | 43 |
2 files changed, 44 insertions, 0 deletions
diff --git a/tests/QtCore/CMakeLists.txt b/tests/QtCore/CMakeLists.txt index 53388d1..b73a1ba 100644 --- a/tests/QtCore/CMakeLists.txt +++ b/tests/QtCore/CMakeLists.txt @@ -2,6 +2,7 @@ PYSIDE_TEST(bug_278_test.py) PYSIDE_TEST(bug_332.py) PYSIDE_TEST(bug_408.py) PYSIDE_TEST(bug_428.py) +PYSIDE_TEST(bug_462.py) PYSIDE_TEST(blocking_signals_test.py) PYSIDE_TEST(child_event_test.py) PYSIDE_TEST(deepcopy_test.py) diff --git a/tests/QtCore/bug_462.py b/tests/QtCore/bug_462.py new file mode 100644 index 0000000..feb75c7 --- /dev/null +++ b/tests/QtCore/bug_462.py @@ -0,0 +1,43 @@ +import unittest +import sys + +from PySide.QtCore import QObject, QCoreApplication, QEvent, QThread + +class MyEvent(QEvent): + def __init__(self,i): + super(MyEvent,self).__init__(QEvent.Type(QEvent.User + 100 )) + self.i = i + +class MyThread (QThread): + def __init__(self,owner): + super(MyThread,self).__init__() + self.owner=owner; + + def run(self): + for i in xrange(3): + e=MyEvent(i); + QCoreApplication.postEvent(self.owner,e) + +class MyBaseObject(QObject): + def __init__(self): + QObject.__init__(self) + self.events = [] + self.t = MyThread(self) + self.t.start() + + def customEvent(self, event): + self.events.append(event) + if len(self.events) == 3: + self.app.quit() + + +class CheckForEventsTypes(unittest.TestCase): + def testTypes(self): + o = MyBaseObject() + o.app = QCoreApplication(sys.argv) + o.app.exec_() + for e in o.events: + self.assert_(isinstance(e, MyEvent)) + +if __name__ == '__main__': + unittest.main() |