Adding a more complex test for QPixmap, QColor, etc
This commit is contained in:
parent
061349d639
commit
c4896b8372
1 changed files with 20 additions and 0 deletions
|
|
@ -37,6 +37,26 @@ class QPixmapTest(UsesQApplication):
|
||||||
pixmap = QPixmap()
|
pixmap = QPixmap()
|
||||||
self.assert_(pixmap.loadFromData(data))
|
self.assert_(pixmap.loadFromData(data))
|
||||||
|
|
||||||
|
|
||||||
|
class QPixmapToImage(UsesQApplication):
|
||||||
|
|
||||||
|
def testFilledImage(self):
|
||||||
|
'''QPixmap.fill + toImage + image.pixel'''
|
||||||
|
pixmap = QPixmap(100, 200)
|
||||||
|
pixmap.fill(Qt.red) # Default Qt.white
|
||||||
|
|
||||||
|
self.assertEqual(pixmap.height(), 200)
|
||||||
|
self.assertEqual(pixmap.width(), 100)
|
||||||
|
|
||||||
|
image = pixmap.toImage()
|
||||||
|
|
||||||
|
self.assertEqual(image.height(), 200)
|
||||||
|
self.assertEqual(image.width(), 100)
|
||||||
|
|
||||||
|
pixel = image.pixel(10,10)
|
||||||
|
self.assertEqual(pixel, QColor(Qt.red).rgba())
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue