Tests synchronized with the boost python PySide.

This commit is contained in:
Hugo Lima 2009-12-15 15:37:20 -02:00
commit 3deada6b7e
14 changed files with 329 additions and 8 deletions

48
tests/qtuitools/test.ui Normal file
View file

@ -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>

View file

@ -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()

View file

@ -0,0 +1,34 @@
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" ]
def get_file_path():
for path in file_path:
if os.path.exists(path):
return path
return ""
class QUioaderTeste(UsesQApplication):
def testLoadFile(self):
widget = QWidget()
file_path = get_file_path()
self.assertTrue(file_path != "")
QUiLoader.loadUi(file_path, widget)
self.assertTrue("child_object" in dir(widget))
self.assertTrue("grandson_object" in dir(widget.child_object))
self.assertEqual(type(widget.child_object), QFrame)
self.assertEqual(type(widget.child_object.grandson_object), QPushButton)
if __name__ == '__main__':
unittest.main()