aboutsummaryrefslogtreecommitdiffstats
path: root/tests/QtCore
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2011-10-06 11:36:24 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:56:11 -0300
commitedaefbce481634b2f9d5a6e28c2e73db7f958602 (patch)
tree489c4169928d8e688cff79f80e564e93bad9a57f /tests/QtCore
parent75843bf45a494c37168ff2ee5672490ca1dee9cf (diff)
Updated QtCore modue to works with python 2.x and 3.x
Diffstat (limited to 'tests/QtCore')
-rw-r--r--tests/QtCore/bug_462.py5
-rw-r--r--tests/QtCore/bug_829.conf2
-rw-r--r--tests/QtCore/qdatastream_test.py8
-rw-r--r--tests/QtCore/qobject_parent_test.py11
-rw-r--r--tests/QtCore/qobject_test.py2
-rw-r--r--tests/QtCore/qstring_test.py8
-rw-r--r--tests/QtCore/translation_test.py6
-rw-r--r--tests/QtCore/unicode_test.py6
8 files changed, 25 insertions, 23 deletions
diff --git a/tests/QtCore/bug_462.py b/tests/QtCore/bug_462.py
index 59e50e1b7..7f6623471 100644
--- a/tests/QtCore/bug_462.py
+++ b/tests/QtCore/bug_462.py
@@ -5,6 +5,7 @@ from PySide.QtCore import QObject, QCoreApplication, QEvent, QThread
class MyEvent(QEvent):
def __init__(self,i):
+ print("TYPE:", type(QEvent.User))
super(MyEvent,self).__init__(QEvent.Type(QEvent.User + 100 ))
self.i = i
@@ -42,4 +43,6 @@ class CheckForEventsTypes(unittest.TestCase):
o.app = None
if __name__ == '__main__':
- unittest.main()
+ print int(QEvent.User)
+ val = QEvent.User + 100
+ #unittest.main()
diff --git a/tests/QtCore/bug_829.conf b/tests/QtCore/bug_829.conf
index 6f5d58e85..90da1ee5a 100644
--- a/tests/QtCore/bug_829.conf
+++ b/tests/QtCore/bug_829.conf
@@ -1,2 +1,2 @@
[General]
-x=@Variant(\0\0\0\x7f\0\0\0\x18PySide::PyObjectWrapper\0\0\0\0\x11\x80\x3}q\0K\x1X\x1\0\0\0\x61q\x1s.)
+x=@Variant(\0\0\0\x7f\0\0\0\x18PySide::PyObjectWrapper\0\0\0\0\x12(dp0\nI1\nS'a'\np1\ns.)
diff --git a/tests/QtCore/qdatastream_test.py b/tests/QtCore/qdatastream_test.py
index 89f9305d1..aa4c115df 100644
--- a/tests/QtCore/qdatastream_test.py
+++ b/tests/QtCore/qdatastream_test.py
@@ -86,7 +86,7 @@ class QDataStreamShift(unittest.TestCase):
self.stream.writeQChar(None)
res = self.read_stream.readQChar()
- self.assertEqual(res, py3k.unicode('\x00'))
+ self.assertEqual(res, py3k.unicode_('\x00'))
def testQByteArrayValid(self):
'''QDataStream <<>> QByteArray - valid'''
@@ -124,21 +124,21 @@ class QDataStreamShift(unittest.TestCase):
self.stream.writeQString('Ka-boom')
res = self.read_stream.readQString()
- self.assertEqual(res, py3k.unicode('Ka-boom'))
+ self.assertEqual(res, py3k.unicode_('Ka-boom'))
def testQStringEmpty(self):
'''QDataStream <<>> QString - empty'''
self.stream.writeQString('')
res = self.read_stream.readQString()
- self.assertEqual(res, py3k.unicode(''))
+ self.assertEqual(res, py3k.unicode_(''))
def testQStringNull(self):
'''QDataStream <<>> QString - null'''
self.stream.writeQString(None)
res = self.read_stream.readQString()
- self.assertEqual(res, py3k.unicode(''))
+ self.assertEqual(res, py3k.unicode_(''))
def testQBitArrayNull(self):
'''QDataStream <<>> QBitArray - null'''
diff --git a/tests/QtCore/qobject_parent_test.py b/tests/QtCore/qobject_parent_test.py
index cda6022e8..ea393d896 100644
--- a/tests/QtCore/qobject_parent_test.py
+++ b/tests/QtCore/qobject_parent_test.py
@@ -87,7 +87,7 @@ class ParentCase(unittest.TestCase):
child.setObjectName(name % i)
child = parent.findChild(QObject)
- self.assert_(isinstance(child, QObject))
+ self.assertTrue(isinstance(child, QObject))
def testFindChildren(self):
#QObject.findChildren() with all QObject
@@ -105,8 +105,7 @@ class ParentCase(unittest.TestCase):
# Emulates findChildren with the intended outcome
target_children = [x for x in children if x.objectName() == target_name]
test_children = parent.findChildren(QObject, target_name)
-
- self.assertEqual(sorted(target_children), sorted(test_children))
+ self.assertEqual(target_children, test_children)
# test findChildren default value
res = parent.findChildren(QTimer)
@@ -114,7 +113,7 @@ class ParentCase(unittest.TestCase):
# test findChildre with a regex
res = parent.findChildren(QObject, QRegExp("^fo+"))
- self.assertEqual(sorted(res), sorted(test_children))
+ self.assertEqual(res, test_children)
def testParentEquality(self):
@@ -218,7 +217,7 @@ class ReparentingTest(unittest.TestCase):
object_list.append(obj)
obj.setParent(parent)
for child in parent.children():
- self.assert_(child in object_list)
+ self.assertTrue(child in object_list)
def testParentedExtQObjectType(self):
object_list = []
@@ -241,7 +240,7 @@ class ReparentingTest(unittest.TestCase):
for obj in object_list:
obj.setParent(new_parent)
for child in new_parent.children():
- self.assert_(child in object_list)
+ self.assertTrue(child in object_list)
def testReparentedExtQObjectType(self):
object_list = []
diff --git a/tests/QtCore/qobject_test.py b/tests/QtCore/qobject_test.py
index 91d6586fe..492fc916f 100644
--- a/tests/QtCore/qobject_test.py
+++ b/tests/QtCore/qobject_test.py
@@ -32,7 +32,7 @@ class ObjectNameCase(unittest.TestCase):
self.assertEqual('', obj.objectName())
def testUnicode(self):
- name = py3k.unicode('diseño')
+ name = py3k.unicode_('não')
#FIXME Strange error on upstream when using equal(name, obj)
obj = QObject()
obj.setObjectName(name)
diff --git a/tests/QtCore/qstring_test.py b/tests/QtCore/qstring_test.py
index 9c2d38c49..5f2eb9a82 100644
--- a/tests/QtCore/qstring_test.py
+++ b/tests/QtCore/qstring_test.py
@@ -12,11 +12,11 @@ class QStringConstructor(unittest.TestCase):
def testQStringDefault(self):
obj = QObject()
obj.setObjectName('foo')
- self.assertEqual(obj.objectName(), py3k.unicode('foo'))
- obj.setObjectName(py3k.unicode('áâãà'))
- self.assertEqual(obj.objectName(), py3k.unicode('áâãà'))
+ self.assertEqual(obj.objectName(), py3k.unicode_('foo'))
+ obj.setObjectName(py3k.unicode_('áâãà'))
+ self.assertEqual(obj.objectName(), py3k.unicode_('áâãà'))
obj.setObjectName(None)
- self.assertEqual(obj.objectName(), py3k.unicode(''))
+ self.assertEqual(obj.objectName(), py3k.unicode_(''))
if __name__ == '__main__':
unittest.main()
diff --git a/tests/QtCore/translation_test.py b/tests/QtCore/translation_test.py
index 99d4bf4e1..adf830cd6 100644
--- a/tests/QtCore/translation_test.py
+++ b/tests/QtCore/translation_test.py
@@ -25,7 +25,7 @@ class TranslationTest(UsesQCoreApplication):
obj = QObject()
obj.setObjectName(obj.tr('Hello World!'))
- self.assertEqual(obj.objectName(), py3k.unicode('Orbis, te saluto!'))
+ self.assertEqual(obj.objectName(), py3k.unicode_('Orbis, te saluto!'))
def testRussian(self):
#Set string value to Russian
@@ -35,7 +35,7 @@ class TranslationTest(UsesQCoreApplication):
obj = QObject()
obj.setObjectName(obj.tr('Hello World!'))
- self.assertEqual(obj.objectName(), py3k.unicode('привет мир!'))
+ self.assertEqual(obj.objectName(), py3k.unicode_('привет мир!'))
def testUtf8(self):
translator = QTranslator()
@@ -44,7 +44,7 @@ class TranslationTest(UsesQCoreApplication):
obj = QObject()
obj.setObjectName(obj.trUtf8('Hello World!'))
- self.assertEqual(obj.objectName(), py3k.unicode('привет мир!'))
+ self.assertEqual(obj.objectName(), py3k.unicode_('привет мир!'))
def testTranslateWithNoneDisambiguation(self):
value = 'String here'
diff --git a/tests/QtCore/unicode_test.py b/tests/QtCore/unicode_test.py
index abb73d4dc..ccc499739 100644
--- a/tests/QtCore/unicode_test.py
+++ b/tests/QtCore/unicode_test.py
@@ -21,13 +21,13 @@ class UnicodeConversion(unittest.TestCase):
#Set regular Python string retrieve unicode
obj = QObject()
obj.setObjectName('test')
- self.assertEqual(obj.objectName(), py3k.unicode('test'))
+ self.assertEqual(obj.objectName(), py3k.unicode_('test'))
def testSetUnicodeRetrieveUnicode(self):
#Set Python unicode string and retrieve unicode
obj = QObject()
- obj.setObjectName(py3k.unicode('ümlaut'))
- self.assertEqual(obj.objectName(), py3k.unicode('ümlaut'))
+ obj.setObjectName(py3k.unicode_('ümlaut'))
+ self.assertEqual(obj.objectName(), py3k.unicode_('ümlaut'))
if __name__ == '__main__':
unittest.main()