aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorHugo Lima <hugo.lima@openbossa.org>2010-03-24 19:24:14 -0300
committerHugo Lima <hugo.lima@openbossa.org>2010-03-30 17:15:59 -0300
commit771c2be893567c8f6bd0deda87ff0e95322923a2 (patch)
tree6261470efc60cce784be617887c2852082ba40a5 /tests
parent7107c2fef5b5a0eba19c513945d8698bc8d962bb (diff)
Initial bindings for QtUiTools.
Diffstat (limited to 'tests')
-rw-r--r--tests/qtuitools/uiloader_test.py26
1 files changed, 11 insertions, 15 deletions
diff --git a/tests/qtuitools/uiloader_test.py b/tests/qtuitools/uiloader_test.py
index 83dd9c46d..fe3725ba1 100644
--- a/tests/qtuitools/uiloader_test.py
+++ b/tests/qtuitools/uiloader_test.py
@@ -2,11 +2,8 @@ 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" ]
+from PySide.QtGui import *
+from PySide.QtUiTools import *
def get_file_path():
for path in file_path:
@@ -16,18 +13,17 @@ def get_file_path():
class QUioaderTeste(UsesQApplication):
def testLoadFile(self):
- widget = QWidget()
-
- file_path = get_file_path()
- self.assertTrue(file_path != "")
-
- QUiLoader.loadUi(file_path, widget)
+ filePath = os.path.join(os.path.dirname(__file__), 'test.ui')
+ loader = QUiLoader()
+ parent = QWidget()
+ w = loader.load(filePath, parent)
+ self.assertNotEqual(w, None)
- self.assertTrue("child_object" in dir(widget))
- self.assertTrue("grandson_object" in dir(widget.child_object))
+ self.assertEqual(len(parent.children()), 1)
- self.assertEqual(type(widget.child_object), QFrame)
- self.assertEqual(type(widget.child_object.grandson_object), QPushButton)
+ child = w.findChild(QWidget, "child_object")
+ self.assertNotEqual(child, None)
+ self.assertEqual(w.findChild(QWidget, "grandson_object"), child.findChild(QWidget, "grandson_object"))
if __name__ == '__main__':
unittest.main()