aboutsummaryrefslogtreecommitdiffstats
path: root/tests/QtGui/qstyle_test.py
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/QtGui/qstyle_test.py
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/QtGui/qstyle_test.py')
-rwxr-xr-xtests/QtGui/qstyle_test.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/QtGui/qstyle_test.py b/tests/QtGui/qstyle_test.py
new file mode 100755
index 000000000..da467e871
--- /dev/null
+++ b/tests/QtGui/qstyle_test.py
@@ -0,0 +1,32 @@
+
+import unittest
+from helper import UsesQApplication
+
+from PySide.QtGui import QWidget, QLabel, QFontComboBox, QStyleFactory
+
+class SetStyleTest(UsesQApplication):
+ '''Tests setting the same QStyle for all objects in a UI hierarchy.'''
+
+ def testSetStyle(self):
+ '''All this test have to do is not break with some invalid Python wrapper.'''
+
+ def setStyleHelper(widget, style):
+ widget.setStyle(style)
+ widget.setPalette(style.standardPalette())
+ for child in widget.children():
+ if isinstance(child, QWidget):
+ setStyleHelper(child, style)
+
+ container = QWidget()
+ # QFontComboBox is used because it has an QLineEdit created in C++ inside it,
+ # and if the QWidget.setStyle(style) steals the ownership of the style
+ # for the C++ originated widget everything will break.
+ fontComboBox = QFontComboBox(container)
+ label = QLabel(container)
+ label.setText('Label')
+ style = QStyleFactory.create(QStyleFactory.keys()[0])
+ setStyleHelper(container, style)
+
+if __name__ == '__main__':
+ unittest.main()
+