aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
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 d2d89ee98..5d1cec422 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 000000000..e458d8bbf
--- /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 8ccc1d35d..28b3cbd16 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__':