2
'''Test cases for QImage'''
5
from PySide.QtGui import *
8
class QImageTest(UsesQApplication):
9
'''Test case for calling setPixel with float as argument'''
11
def testQImageStringBuffer(self):
12
'''Test if the QImage signatures receiving string buffers exist.'''
13
img0 = QImage(adjust_filename('sample.png', __file__))
15
print type(img0.bits())
17
# btw let's test the bits() method
18
img1 = QImage(img0.bits(), img0.width(), img0.height(), img0.format())
19
self.assertEqual(img0, img1)
20
img2 = QImage(img0.bits(), img0.width(), img0.height(), img0.bytesPerLine(), img0.format())
21
self.assertEqual(img0, img2)
23
## test scanLine method
24
data1 = img0.scanLine(0)
25
data2 = img1.scanLine(0)
26
self.assertEqual(data1, data2)
27
self.assertEquals(str(data1), img0.bits()[:img0.bytesPerLine()])
28
self.assertEquals(str(data2), img0.bits()[:img0.bytesPerLine()])
30
if __name__ == '__main__':