diff options
author | Renato Filho <renato.filho@openbossa.org> | 2011-07-12 18:38:53 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:54:35 -0300 |
commit | e9f082e83cb4f78f44a53089a08a71ab9d19f797 (patch) | |
tree | b772dac86d38154a08e4a5ba9f6e0197ebe0e48c /tests/QtCore | |
parent | f62ba98e886475c7936140fae1e5fba1676947a2 (diff) |
Created unit test for bug #927.
Reviewer: Lauro Moura <lauro.neto@openbossa.org>
Hugo Parente <hugo.lima@openbossa.org>
Diffstat (limited to 'tests/QtCore')
-rw-r--r-- | tests/QtCore/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/QtCore/bug_927.py | 24 |
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/QtCore/CMakeLists.txt b/tests/QtCore/CMakeLists.txt index a088a327f..266c8f94b 100644 --- a/tests/QtCore/CMakeLists.txt +++ b/tests/QtCore/CMakeLists.txt @@ -16,6 +16,7 @@ PYSIDE_TEST(bug_820.py) PYSIDE_TEST(bug_826.py) PYSIDE_TEST(bug_829.py) PYSIDE_TEST(bug_835.py) +PYSIDE_TEST(bug_927.py) PYSIDE_TEST(blocking_signals_test.py) PYSIDE_TEST(classinfo_test.py) PYSIDE_TEST(child_event_test.py) diff --git a/tests/QtCore/bug_927.py b/tests/QtCore/bug_927.py new file mode 100644 index 000000000..87fb0161f --- /dev/null +++ b/tests/QtCore/bug_927.py @@ -0,0 +1,24 @@ +import time +import unittest + +from PySide.QtCore import QTime, QRunnable, QThreadPool + +class Task(QRunnable): + def run(self): + t = QTime() + t.start() + time.sleep(2) # Sleep 2 seconds + + +class QThreadPoolTest(unittest.TestCase): + '''This used to cause a segfault due the ownership control on globalInstance function ''' + def testSlowJobs(self): + for i in range(3): + task = Task() + QThreadPool.globalInstance().start(task) + time.sleep(1) # Sleep 1 second + + QThreadPool.globalInstance().waitForDone() + +if __name__ == '__main__': + unittest.main() |