aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2011-05-19 18:16:32 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:54:25 -0300
commit306395a65ffd72987dcbe50a1b5c29bc45b7ab2a (patch)
treebc030a415aa007f58b90c178c32e8408e435f899
parente13ce9212afb46f86e11f78fee98a1d1e1b1557e (diff)
Created unit test for ClassInfo class.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Hugo Parente Lima <hugo.pl@gmail.com>
-rw-r--r--tests/QtCore/CMakeLists.txt1
-rw-r--r--tests/QtCore/classinfo_test.py29
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/QtCore/CMakeLists.txt b/tests/QtCore/CMakeLists.txt
index cd9efca0e..251add10d 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(blocking_signals_test.py)
+PYSIDE_TEST(classinfo_test.py)
PYSIDE_TEST(child_event_test.py)
PYSIDE_TEST(deepcopy_test.py)
PYSIDE_TEST(deletelater_test.py)
diff --git a/tests/QtCore/classinfo_test.py b/tests/QtCore/classinfo_test.py
new file mode 100644
index 000000000..a343118e8
--- /dev/null
+++ b/tests/QtCore/classinfo_test.py
@@ -0,0 +1,29 @@
+import unittest
+import sys
+from PySide.QtCore import QObject, ClassInfo
+
+@ClassInfo(author='pyside',url='http://www.pyside.org')
+class MyObject(QObject):
+ pass
+
+class TestClassInfo(unittest.TestCase):
+ def testMetaData(self):
+ o = MyObject()
+ mo = o.metaObject()
+ self.assertEqual(mo.classInfoCount(), 2)
+
+ ci = mo.classInfo(0) #author
+ self.assertEqual(ci.name(), 'author')
+ self.assertEqual(ci.value(), 'pyside')
+
+ ci = mo.classInfo(1) #url
+ self.assertEqual(ci.name(), 'url')
+ self.assertEqual(ci.value(), 'http://www.pyside.org')
+
+if __name__ == '__main__':
+ if sys.version_info[0] < 2:
+ sys.exit(0)
+ elif (sys.version_info[0] == 2) and (sys.version_info[1] <= 5):
+ sys.exit(0)
+ else:
+ unittest.main()