aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLuciano Wolf <luciano.wolf@openbossa.org>2010-06-14 16:56:36 -0300
committerLuciano Wolf <luciano.wolf@openbossa.org>2010-06-15 20:41:41 -0300
commite0c46d67613fe8c38c3bee6b99ae58260cb33260 (patch)
tree6036525d0bd39b7a4aa46507092d4d98eda9e80f /tests
parent0eb8d670c240b5ea621dba6271139f30cc97790a (diff)
Implementing API2 modifications.
Reviewer: Hugo Parente Lima <hugo.lima@openbossa.org>, Marcelo Lira <marcelo.lira@openbossa.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/QtGui/CMakeLists.txt1
-rw-r--r--tests/QtGui/api2_test.py60
-rw-r--r--tests/QtGui/qobject_mi_test.py6
3 files changed, 65 insertions, 2 deletions
diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt
index d2d89ee9..5d1cec42 100644
--- a/tests/QtGui/CMakeLists.txt
+++ b/tests/QtGui/CMakeLists.txt
@@ -1,3 +1,4 @@
+PYSIDE_TEST(api2_test.py)
PYSIDE_TEST(add_action_test.py)
PYSIDE_TEST(customproxywidget_test.py)
PYSIDE_TEST(float_to_int_implicit_conversion_test.py)
diff --git a/tests/QtGui/api2_test.py b/tests/QtGui/api2_test.py
new file mode 100644
index 00000000..e458d8bb
--- /dev/null
+++ b/tests/QtGui/api2_test.py
@@ -0,0 +1,60 @@
+'''Test cases for PySide API2 support'''
+
+
+import unittest
+
+from PySide.QtCore import QObject
+from PySide.QtGui import *
+
+from helper import UsesQApplication
+
+class WidgetValidatorQInt(QWidget, QIntValidator):
+ def __init__(self, parent=None):
+ QWidget.__init__(self, parent)
+ QIntValidator.__init__(self, parent)
+
+class WidgetValidatorQSpinBox(QSpinBox):
+ def __init__(self, parent=None):
+ QSpinBox.__init__(self, parent)
+
+ def fixup(self, text):
+ print "It was called!"
+
+class DoubleQObjectInheritanceTest(UsesQApplication):
+
+ def testDouble(self):
+ '''Double inheritance from QObject classes'''
+
+ obj = WidgetValidatorQInt()
+
+ #QIntValidator methods
+ state, string, number = obj.validate('Test', 0)
+ self.assertEqual(state, QValidator.Invalid)
+ state, string, number = obj.validate('33', 0)
+ self.assertEqual(state, QValidator.Acceptable)
+
+ def testQSpinBox(self):
+ obj = WidgetValidatorQSpinBox()
+
+ obj.setRange(1, 10)
+ obj.setValue(0)
+ print "Value:", obj.value()
+
+class QClipboardTest(UsesQApplication):
+
+ def testQClipboard(self):
+ clip = QClipboard()
+ clip.setText("Testing this thing!")
+
+ text, subtype = clip.text("")
+ self.assertEqual(subtype, "plain")
+ self.assertEqual(text, "Testing this thing!")
+
+#class QFileDialog(UsesQApplication):
+#
+# def testQFileDialog(self):
+# string, filtr = QFileDialog.getOpenFileName()
+# print string, filtr
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/tests/QtGui/qobject_mi_test.py b/tests/QtGui/qobject_mi_test.py
index 8ccc1d35..28b3cbd1 100644
--- a/tests/QtGui/qobject_mi_test.py
+++ b/tests/QtGui/qobject_mi_test.py
@@ -29,8 +29,10 @@ class DoubleQObjectInheritanceTest(UsesQApplication):
self.assertFalse(obj.isVisible())
#QIntValidator methods
- self.assertEqual(obj.validate('aaaa', 0), QValidator.Invalid)
- self.assertEqual(obj.validate('33', 0), QValidator.Acceptable)
+ state, string, number = obj.validate('aaaa', 0)
+ self.assertEqual(state, QValidator.Invalid)
+ state, string, number = obj.validate('33', 0)
+ self.assertEqual(state, QValidator.Acceptable)
if __name__ == '__main__':