aboutsummaryrefslogtreecommitdiffstats
path: root/tests/QtCore/bug_724.py
blob: 550b53f2bc3cbd8a98deee5b42f225ef68cd93aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from PySide.QtCore import *
import unittest
import tempfile
import os

class TestBug724 (unittest.TestCase):

    def testIt(self):
        # creates a temporary file
        handle, self.filename = tempfile.mkstemp()
        os.write(handle, 'a')
        os.close(handle)

        engine = QAbstractFileEngine.create(self.filename)
        engine.open(QIODevice.ReadOnly)
        memory = engine.map(0, 1, QFile.NoOptions)
        self.assertEqual(len(memory), 1)
        self.assertEqual(memory[0], 'a')
        engine.unmap(memory)

if __name__ == '__main__':
    unittest.main()