diff options
author | Lauro Neto <lauro.neto@openbossa.org> | 2010-03-18 16:37:31 -0300 |
---|---|---|
committer | Lauro Neto <lauro.neto@openbossa.org> | 2010-03-22 15:02:12 -0300 |
commit | c4896b83723adc7050d486450b9758e5211dacb5 (patch) | |
tree | 89b16a0184e7cc717636bc51ffdfd26959ca8b91 /tests | |
parent | 061349d6391cd3677b58489e31d4e9e654abc47b (diff) |
Adding a more complex test for QPixmap, QColor, etc
Diffstat (limited to 'tests')
-rw-r--r-- | tests/qtgui/qpixmap_test.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/qtgui/qpixmap_test.py b/tests/qtgui/qpixmap_test.py index 64264109b..481409462 100644 --- a/tests/qtgui/qpixmap_test.py +++ b/tests/qtgui/qpixmap_test.py @@ -37,6 +37,26 @@ class QPixmapTest(UsesQApplication): pixmap = QPixmap() 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__': unittest.main() |