aboutsummaryrefslogtreecommitdiffstats
path: root/tests/QtCore/bug_994.py
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-08-31 17:43:45 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:54:50 -0300
commit9afe76796d365978ee4be04e195cc5ec43758868 (patch)
tree0911ef266c6999663e6d62d7cbc48a977e94e733 /tests/QtCore/bug_994.py
parent08d202e824ffc6221bd426084ac169324808e9da (diff)
Fix bug 944 - "QIODevice.readData must use qmemcpy instead of qstrncpy"
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Marcelo Lira <marcelo.lira@openbossa.org>
Diffstat (limited to 'tests/QtCore/bug_994.py')
-rw-r--r--tests/QtCore/bug_994.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/QtCore/bug_994.py b/tests/QtCore/bug_994.py
new file mode 100644
index 000000000..74e352c8f
--- /dev/null
+++ b/tests/QtCore/bug_994.py
@@ -0,0 +1,20 @@
+import unittest
+from PySide.QtCore import *
+
+class MyIODevice (QIODevice):
+ def readData(self, amount):
+ return "\0a" * (amount/2)
+
+ def atEnd(self):
+ return False
+
+class TestBug944 (unittest.TestCase):
+
+ def testIt(self):
+ device = MyIODevice()
+ device.open(QIODevice.ReadOnly)
+ s = QTextStream(device)
+ self.assertEqual(s.read(4), "\0a\0a")
+
+if __name__ == "__main__":
+ unittest.main()