From ab918abc1e103e0ca86939f7d057e8a44ac8a4ef Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Mon, 7 Jun 2010 14:43:45 -0300 Subject: Created new unittest model. Separete unittest for module. Only run unittest for compiled modules. Reviewer: Marcelo Lira , Luciano Wolf --- tests/QtUiTools/CMakeLists.txt | 2 ++ tests/QtUiTools/test.ui | 48 ++++++++++++++++++++++++++++++++++++++++ tests/QtUiTools/ui_test.py | 14 ++++++++++++ tests/QtUiTools/uiloader_test.py | 30 +++++++++++++++++++++++++ 4 files changed, 94 insertions(+) create mode 100644 tests/QtUiTools/CMakeLists.txt create mode 100644 tests/QtUiTools/test.ui create mode 100644 tests/QtUiTools/ui_test.py create mode 100644 tests/QtUiTools/uiloader_test.py (limited to 'tests/QtUiTools') diff --git a/tests/QtUiTools/CMakeLists.txt b/tests/QtUiTools/CMakeLists.txt new file mode 100644 index 0000000..9118b5b --- /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 0000000..60afe22 --- /dev/null +++ b/tests/QtUiTools/test.ui @@ -0,0 +1,48 @@ + + + Form + + + + 0 + 0 + 185 + 133 + + + + Form + + + + + 0 + 0 + 181 + 131 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + 50 + 60 + 80 + 25 + + + + PushButton + + + + + + + diff --git a/tests/QtUiTools/ui_test.py b/tests/QtUiTools/ui_test.py new file mode 100644 index 0000000..6f599ce --- /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 0000000..fe3725b --- /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() + -- cgit