aboutsummaryrefslogtreecommitdiffstats
path: root/tests/QtGui
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-06-14 18:44:56 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:54:29 -0300
commitdf30f375124a1faea6a960e6adcd0d90fba08615 (patch)
treeb5e6c71cacf67d5092aeed2d10307494d4eac8a5 /tests/QtGui
parent590abafc54206e458066f5632accda94e37f5edf (diff)
Fix bug 879 - "QDoubleSpinBox: Can't call the parent validate() method from a subclass"
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'tests/QtGui')
-rw-r--r--tests/QtGui/CMakeLists.txt1
-rw-r--r--tests/QtGui/bug_879.py28
2 files changed, 29 insertions, 0 deletions
diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt
index 5209ee581..68aff6476 100644
--- a/tests/QtGui/CMakeLists.txt
+++ b/tests/QtGui/CMakeLists.txt
@@ -64,6 +64,7 @@ PYSIDE_TEST(bug_854.py)
PYSIDE_TEST(bug_860.py)
PYSIDE_TEST(bug_862.py)
PYSIDE_TEST(bug_871.py)
+PYSIDE_TEST(bug_879.py)
PYSIDE_TEST(bug_882.py)
PYSIDE_TEST(customproxywidget_test.py)
PYSIDE_TEST(deepcopy_test.py)
diff --git a/tests/QtGui/bug_879.py b/tests/QtGui/bug_879.py
new file mode 100644
index 000000000..6261ead20
--- /dev/null
+++ b/tests/QtGui/bug_879.py
@@ -0,0 +1,28 @@
+import unittest
+from PySide.QtCore import *
+from PySide.QtGui import *
+
+class MySpinBox(QSpinBox):
+
+ def validate(self,text,pos):
+ return QSpinBox.validate(self,text,pos)
+
+class TestBug879 (unittest.TestCase):
+
+ def testIt(self):
+ app = QApplication([])
+ self.box = MySpinBox()
+ self.box.show()
+
+ QTimer.singleShot(0, self.sendKbdEvent)
+ QTimer.singleShot(100, app.quit)
+ app.exec_()
+
+ self.assertEqual(self.box.text(), '0')
+
+ def sendKbdEvent(self):
+ ev = QKeyEvent(QEvent.KeyPress, Qt.Key_A, Qt.NoModifier, 'a')
+ QCoreApplication.sendEvent(self.box, ev)
+
+if __name__ == '__main__':
+ unittest.main()