Fix bug 721 - "QFile doesn't support map and unmap functions."

This commit is contained in:
Hugo Parente Lima 2011-04-06 18:35:49 -03:00
commit 3b9481c24c
2 changed files with 27 additions and 5 deletions

View file

@ -27,5 +27,16 @@ class GetCharTest(unittest.TestCase):
self.assert_(not obj.getChar()[0])
obj.close()
def testBug721(self):
obj = QFile(self.filename)
obj.open(QIODevice.ReadOnly)
memory = obj.map(0, 1)
self.assertEqual(len(memory), 1)
self.assertEqual(memory[0], 'a')
obj.unmap(memory)
# now memory points to wild bytes... :-)
# uncommenting this must cause a segfault.
# self.assertEqual(memory[0], 'a')
if __name__ == '__main__':
unittest.main()