aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.lima@openbossa.org>2010-06-08 09:59:01 -0300
committerHugo Parente Lima <hugo.lima@openbossa.org>2010-06-10 14:57:42 -0300
commit00918cb847dfa1b28acb791c66cb444bc2123f79 (patch)
tree73e3b0c28fdb534cefc5eb8bc06cacbab08ee111 /tests
parentccd189d30c284e9a67a802193ef05c4149108f9a (diff)
Added QDataStream methods to read and write QString, QChar and QStringList.
Diffstat (limited to 'tests')
-rw-r--r--tests/QtCore/qdatastream_test.py46
1 files changed, 15 insertions, 31 deletions
diff --git a/tests/QtCore/qdatastream_test.py b/tests/QtCore/qdatastream_test.py
index e8091859..b634a7e3 100644
--- a/tests/QtCore/qdatastream_test.py
+++ b/tests/QtCore/qdatastream_test.py
@@ -76,22 +76,17 @@ class QDataStreamShift(unittest.TestCase):
def testQCharValid(self):
'''QDataStream <<>> QChar - valid'''
- self.stream << QChar(42)
+ self.stream.writeQChar(42)
- res = QChar()
-
- self.read_stream >> res
- self.assertEqual(res, QChar(42))
+ res = self.read_stream.readQChar()
+ self.assertEqual(res, unichr(42))
def testQCharNull(self):
'''QDataStream <<>> QChar - null'''
- self.stream << QChar()
+ self.stream.writeQChar(None)
- res = QChar()
-
- self.read_stream >> res
- self.assertEqual(res, QChar())
- self.assert_(res.isNull())
+ res = self.read_stream.readQChar()
+ self.assertEqual(res, u'\x00')
def testQByteArrayValid(self):
'''QDataStream <<>> QByteArray - valid'''
@@ -126,35 +121,24 @@ class QDataStreamShift(unittest.TestCase):
def testQStringValid(self):
'''QDataStream <<>> QString - valid'''
- self.stream << QString('Ka-boom')
-
- res = QString()
+ self.stream.writeQString('Ka-boom')
- self.read_stream >> res
- self.assertEqual(res, QString('Ka-boom'))
+ res = self.read_stream.readQString()
+ self.assertEqual(res, u'Ka-boom')
def testQStringEmpty(self):
'''QDataStream <<>> QString - empty'''
- self.stream << QString('')
-
- res = QString()
+ self.stream.writeQString('')
- self.read_stream >> res
- self.assertEqual(res, QString(""))
- self.assert_(res.isEmpty())
- self.assert_(not res.isNull())
+ res = self.read_stream.readQString()
+ self.assertEqual(res, u'')
def testQStringNull(self):
'''QDataStream <<>> QString - null'''
- self.stream << QString()
-
- res = QString()
-
- self.read_stream >> res
- self.assertEqual(res, QString())
- self.assert_(res.isEmpty())
- self.assert_(res.isNull())
+ self.stream.writeQString(None)
+ res = self.read_stream.readQString()
+ self.assertEqual(res, u'')
def testQBitArrayNull(self):
'''QDataStream <<>> QBitArray - null'''