summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2011-05-19 18:16:32 -0300
committerRenato Filho <renato.filho@openbossa.org>2011-05-23 17:43:31 -0300
commit1abf8c614933d4e3fdc5cd067191637fa8baad72 (patch)
treee45d6f618cff3aa0a996c316c12017f2fe6fc075
parent04be2b1ca26d5d4b51d7187542488e7f2f296e77 (diff)
downloadpyside-1abf8c614933d4e3fdc5cd067191637fa8baad72.tar.gz
pyside-1abf8c614933d4e3fdc5cd067191637fa8baad72.tar.xz
pyside-1abf8c614933d4e3fdc5cd067191637fa8baad72.zip
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 cd9efca..251add1 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 0000000..a343118
--- /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()