aboutsummaryrefslogtreecommitdiffstats
path: root/tests/QtUiTools
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2010-06-07 14:43:45 -0300
committerRenato Filho <renato.filho@openbossa.org>2010-06-07 16:57:11 -0300
commitab918abc1e103e0ca86939f7d057e8a44ac8a4ef (patch)
tree53c6f57d089dcf5e145d766b1ceef704714046d8 /tests/QtUiTools
parent471486732b03cbb42b884158604a59d5a18e8a35 (diff)
Created new unittest model.
Separete unittest for module. Only run unittest for compiled modules. Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>, Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'tests/QtUiTools')
-rw-r--r--tests/QtUiTools/CMakeLists.txt2
-rw-r--r--tests/QtUiTools/test.ui48
-rw-r--r--tests/QtUiTools/ui_test.py14
-rw-r--r--tests/QtUiTools/uiloader_test.py30
4 files changed, 94 insertions, 0 deletions
diff --git a/tests/QtUiTools/CMakeLists.txt b/tests/QtUiTools/CMakeLists.txt
new file mode 100644
index 000000000..9118b5b6c
--- /dev/null
+++ b/tests/QtUiTools/CMakeLists.txt
@@ -0,0 +1,2 @@
+PYSIDE_TEST(uiloader_test.py)
+PYSIDE_TEST(ui_test.py)
diff --git a/tests/QtUiTools/test.ui b/tests/QtUiTools/test.ui
new file mode 100644
index 000000000..60afe22b3
--- /dev/null
+++ b/tests/QtUiTools/test.ui
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Form</class>
+ <widget class="QWidget" name="Form">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>185</width>
+ <height>133</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <widget class="QFrame" name="child_object">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>181</width>
+ <height>131</height>
+ </rect>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <widget class="QPushButton" name="grandson_object">
+ <property name="geometry">
+ <rect>
+ <x>50</x>
+ <y>60</y>
+ <width>80</width>
+ <height>25</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>PushButton</string>
+ </property>
+ </widget>
+ </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/tests/QtUiTools/ui_test.py b/tests/QtUiTools/ui_test.py
new file mode 100644
index 000000000..6f599cefb
--- /dev/null
+++ b/tests/QtUiTools/ui_test.py
@@ -0,0 +1,14 @@
+
+import unittest
+
+from PySide.QtUiTools import QUiLoader
+
+from helper import UsesQApplication
+
+class QUiLoaderCreation(UsesQApplication):
+
+ def testConstructor(self):
+ loader = QUiLoader()
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/tests/QtUiTools/uiloader_test.py b/tests/QtUiTools/uiloader_test.py
new file mode 100644
index 000000000..fe3725ba1
--- /dev/null
+++ b/tests/QtUiTools/uiloader_test.py
@@ -0,0 +1,30 @@
+import unittest
+import os
+from helper import UsesQApplication
+
+from PySide.QtGui import *
+from PySide.QtUiTools import *
+
+def get_file_path():
+ for path in file_path:
+ if os.path.exists(path):
+ return path
+ return ""
+
+class QUioaderTeste(UsesQApplication):
+ def testLoadFile(self):
+ filePath = os.path.join(os.path.dirname(__file__), 'test.ui')
+ loader = QUiLoader()
+ parent = QWidget()
+ w = loader.load(filePath, parent)
+ self.assertNotEqual(w, None)
+
+ self.assertEqual(len(parent.children()), 1)
+
+ 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()
+