summaryrefslogtreecommitdiffstats
path: root/tests/QtUiTools
diff options
context:
space:
mode:
authorrenatofilho <renato.filho@openbossa.org>2010-09-21 14:29:34 -0300
committerrenatofilho <renato.filho@openbossa.org>2010-09-21 14:53:04 -0300
commit4229fa0082135c889094c6cea7baa970b5208587 (patch)
treeaea56ff9056863b239a2ac7319c6c844e045a63a /tests/QtUiTools
parent2a225be9c770ccf774a97457ab409b6b3f60b467 (diff)
downloadpyside-4229fa0082135c889094c6cea7baa970b5208587.tar.gz
pyside-4229fa0082135c889094c6cea7baa970b5208587.tar.xz
pyside-4229fa0082135c889094c6cea7baa970b5208587.zip
Created unit test for bug #360.
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Marcelo Lira <marcelo.lira@openbossa.org>
Diffstat (limited to 'tests/QtUiTools')
-rw-r--r--tests/QtUiTools/CMakeLists.txt1
-rw-r--r--tests/QtUiTools/bug_360.py36
-rw-r--r--tests/QtUiTools/minimal.ui6
3 files changed, 43 insertions, 0 deletions
diff --git a/tests/QtUiTools/CMakeLists.txt b/tests/QtUiTools/CMakeLists.txt
index 9118b5b..03ce768 100644
--- a/tests/QtUiTools/CMakeLists.txt
+++ b/tests/QtUiTools/CMakeLists.txt
@@ -1,2 +1,3 @@
+PYSIDE_TEST(bug_360.py)
PYSIDE_TEST(uiloader_test.py)
PYSIDE_TEST(ui_test.py)
diff --git a/tests/QtUiTools/bug_360.py b/tests/QtUiTools/bug_360.py
new file mode 100644
index 0000000..aefc422
--- /dev/null
+++ b/tests/QtUiTools/bug_360.py
@@ -0,0 +1,36 @@
+import unittest
+import os
+from helper import UsesQApplication
+
+from PySide import QtCore, QtGui
+from PySide.QtUiTools import QUiLoader
+
+class MyQUiLoader(QUiLoader):
+ def __init__(self, baseinstance):
+ QUiLoader.__init__(self)
+ self.baseinstance = baseinstance
+ self._widgets = []
+
+ def createWidget(self, className, parent=None, name=""):
+ widget = QUiLoader.createWidget(self, className, parent, name)
+ self._widgets.append(widget)
+ if parent is None:
+ return self.baseinstance
+ else:
+ setattr(self.baseinstance, name, widget)
+ return widget
+
+class ButTest(UsesQApplication):
+ def testCase(self):
+ w = QtGui.QWidget()
+ loader = MyQUiLoader(w)
+
+ filePath = os.path.join(os.path.dirname(__file__), 'minimal.ui')
+ ui = loader.load(filePath)
+
+ self.assertEqual(len(loader._widgets), 1)
+ self.assertEqual(type(loader._widgets[0]), QtGui.QFrame)
+
+if __name__ == '__main__':
+ unittest.main()
+
diff --git a/tests/QtUiTools/minimal.ui b/tests/QtUiTools/minimal.ui
new file mode 100644
index 0000000..c6bb70c
--- /dev/null
+++ b/tests/QtUiTools/minimal.ui
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Form</class>
+ <widget class="QFrame" name="Form">
+ </widget>
+</ui>