Implementing API2 modifications.
Reviewer: Hugo Parente Lima <hugo.lima@openbossa.org>,
Marcelo Lira <marcelo.lira@openbossa.org>
This commit is contained in:
parent
0eb8d670c2
commit
e0c46d6761
6 changed files with 239 additions and 12 deletions
|
|
@ -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)
|
||||
|
|
|
|||
60
tests/QtGui/api2_test.py
Normal file
60
tests/QtGui/api2_test.py
Normal file
|
|
@ -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()
|
||||
|
|
@ -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__':
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue