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

class MyIODevice (QIODevice):
    def readData(self, amount):
        return "\0a" * (amount/2)

    def readLineData(self, maxSize):
        return "\0b" * 4

    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")
        self.assertEqual(device.readLine(), "\0b\0b\0b\0b")

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