aboutsummaryrefslogtreecommitdiffstats
path: root/tests/qtuitools/uiloader_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/qtuitools/uiloader_test.py')
-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()