aboutsummaryrefslogtreecommitdiffstats
path: root/tests/qtuitools/uiloader_test.py
diff options
context:
space:
mode:
authorHugo Lima <hugo.lima@openbossa.org>2009-12-15 15:37:20 -0200
committerHugo Lima <hugo.lima@openbossa.org>2009-12-15 15:37:20 -0200
commit3deada6b7ebad62985850ec436db84b832715003 (patch)
tree509acacb14d13e420b4b1ed08f30213365ae20ea /tests/qtuitools/uiloader_test.py
parent84282e06acb7514455e38bf64ed70fba3d302b71 (diff)
Tests synchronized with the boost python PySide.
Diffstat (limited to 'tests/qtuitools/uiloader_test.py')
-rw-r--r--tests/qtuitools/uiloader_test.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/qtuitools/uiloader_test.py b/tests/qtuitools/uiloader_test.py
new file mode 100644
index 000000000..83dd9c46d
--- /dev/null
+++ b/tests/qtuitools/uiloader_test.py
@@ -0,0 +1,34 @@
+import unittest
+import os
+from helper import UsesQApplication
+
+from PySide.QtGui import QWidget, QFrame, QPushButton
+from PySide.QtUiTools import QUiLoader
+
+#ugly workaround for work with ctest
+file_path = [ "./test.ui", "./qtuitools/test.ui", "../tests/qtuitools/test.ui", "../../tests/qtuitools/test.ui" ]
+
+def get_file_path():
+ for path in file_path:
+ if os.path.exists(path):
+ return path
+ return ""
+
+class QUioaderTeste(UsesQApplication):
+ def testLoadFile(self):
+ widget = QWidget()
+
+ file_path = get_file_path()
+ self.assertTrue(file_path != "")
+
+ QUiLoader.loadUi(file_path, widget)
+
+ self.assertTrue("child_object" in dir(widget))
+ self.assertTrue("grandson_object" in dir(widget.child_object))
+
+ self.assertEqual(type(widget.child_object), QFrame)
+ self.assertEqual(type(widget.child_object.grandson_object), QPushButton)
+
+if __name__ == '__main__':
+ unittest.main()
+