Fix bug 944 - "QIODevice.readData must use qmemcpy instead of qstrncpy"

Reviewer:  Luciano Wolf <luciano.wolf@openbossa.org>
           Marcelo Lira <marcelo.lira@openbossa.org>
This commit is contained in:
Hugo Parente Lima 2011-08-31 17:43:45 -03:00
commit 9afe76796d
3 changed files with 22 additions and 1 deletions

20
tests/QtCore/bug_994.py Normal file
View file

@ -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()