aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2011-05-17 15:46:03 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:54:23 -0300
commit85a5641368287e366b27aff2027f8cbf2163fcd0 (patch)
tree80cdf4b2f96d0a7b5d40c65c3afd1daed1304c88 /tests
parent0f1b57dc941544e1b5cee7b90d175aa46bb2fdde (diff)
Unit test for bug 634, based on code from Marcus Lindblom.
Reviewed by Hugo Parente <hugo.lima@openbossa.org> Reviewed by Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/QtCore/CMakeLists.txt1
-rw-r--r--tests/QtCore/mockclass_test.py27
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/QtCore/CMakeLists.txt b/tests/QtCore/CMakeLists.txt
index 623326321..84d0ad017 100644
--- a/tests/QtCore/CMakeLists.txt
+++ b/tests/QtCore/CMakeLists.txt
@@ -23,6 +23,7 @@ PYSIDE_TEST(duck_punching_test.py)
PYSIDE_TEST(hash_test.py)
PYSIDE_TEST(max_signals.py)
PYSIDE_TEST(missing_symbols_test.py)
+PYSIDE_TEST(mockclass_test.py)
PYSIDE_TEST(python_conversion.py)
PYSIDE_TEST(qabs_test.py)
PYSIDE_TEST(qabstractitemmodel_test.py)
diff --git a/tests/QtCore/mockclass_test.py b/tests/QtCore/mockclass_test.py
new file mode 100644
index 000000000..4210efdf2
--- /dev/null
+++ b/tests/QtCore/mockclass_test.py
@@ -0,0 +1,27 @@
+# Test case for PySide bug 634
+# http://bugs.pyside.org/show_bug.cgi?id=634
+# Marcus Lindblom <macke@yar.nu>; 2011-02-16
+
+import unittest
+from PySide.QtCore import QCoreApplication
+
+class Mock(object):
+ def __init__(self):
+ self.called = False
+ self.return_value = None
+
+ def __call__(self, *args, **kwargs):
+ self.called = True
+ return self.return_value
+
+
+class MockClassTest(unittest.TestCase):
+ def testMockQCoreApplication(self):
+ mock = Mock()
+ setattr(QCoreApplication, 'instance', mock)
+ QCoreApplication.instance()
+ self.assert_(mock.called)
+
+if __name__ == '__main__':
+ unittest.main()
+