summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2010-10-19 15:30:59 -0200
committerHugo Parente Lima <hugo.pl@gmail.com>2010-10-19 16:35:59 -0200
commit65022ffef62096033bcff49c4544640dac92f44e (patch)
tree3c18f989ea7aa8a972a316a07cac672f5899dfee /tests
parente7f280f7451b3429fc1e1407225a6b9d27db1888 (diff)
downloadpyside-65022ffef62096033bcff49c4544640dac92f44e.tar.gz
pyside-65022ffef62096033bcff49c4544640dac92f44e.tar.xz
pyside-65022ffef62096033bcff49c4544640dac92f44e.zip
Fix bug#408 - "QIODevice.readData() and .readLineData() have output parameters in their signatures"
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Marcelo Lira <marcelo.lira@openbossa.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/QtCore/CMakeLists.txt1
-rw-r--r--tests/QtCore/bug_408.py28
2 files changed, 29 insertions, 0 deletions
diff --git a/tests/QtCore/CMakeLists.txt b/tests/QtCore/CMakeLists.txt
index 7225da0..36b8776 100644
--- a/tests/QtCore/CMakeLists.txt
+++ b/tests/QtCore/CMakeLists.txt
@@ -1,5 +1,6 @@
PYSIDE_TEST(bug_278_test.py)
PYSIDE_TEST(bug_332.py)
+PYSIDE_TEST(bug_408.py)
PYSIDE_TEST(blocking_signals_test.py)
PYSIDE_TEST(child_event_test.py)
PYSIDE_TEST(deepcopy_test.py)
diff --git a/tests/QtCore/bug_408.py b/tests/QtCore/bug_408.py
new file mode 100644
index 0000000..5827e56
--- /dev/null
+++ b/tests/QtCore/bug_408.py
@@ -0,0 +1,28 @@
+import unittest
+
+from PySide.QtCore import *
+
+class MyDevice(QIODevice):
+ def __init__(self, txt):
+ QIODevice.__init__(self)
+ self.txt = txt
+ self.ptr = 0
+
+ def readData(self, size):
+ size = min(len(self.txt) - self.ptr, size)
+ retval = self.txt[self.ptr:size]
+ self.ptr += size
+ return retval
+
+class QIODeviceTest(unittest.TestCase):
+
+ def testIt(self):
+ device = MyDevice("hello world\nhello again")
+ device.open(QIODevice.ReadOnly)
+
+ s = QTextStream(device)
+ self.assertEqual(s.readLine(), "hello world")
+ self.assertEqual(s.readLine(), "hello again")
+
+if __name__ == '__main__':
+ unittest.main()