Pillow/Tests/test_qt_image_toqpixmap.py

26 lines
658 B
Python
Raw Normal View History

2017-04-20 14:14:23 +03:00
from helper import unittest, PillowTestCase, hopper
2018-08-04 13:18:36 +03:00
from test_imageqt import PillowQPixmapTestCase
from PIL import ImageQt
if ImageQt.qt_is_installed:
from PIL.ImageQt import QPixmap
class TestToQPixmap(PillowQPixmapTestCase, PillowTestCase):
def test_sanity(self):
for mode in ('1', 'RGB', 'RGBA', 'L', 'P'):
data = ImageQt.toqpixmap(hopper(mode))
2015-06-21 09:31:51 +03:00
self.assertIsInstance(data, QPixmap)
self.assertFalse(data.isNull())
2015-06-21 09:31:51 +03:00
# Test saving the file
tempfile = self.tempfile('temp_{}.png'.format(mode))
2015-06-21 09:31:51 +03:00
data.save(tempfile)
if __name__ == '__main__':
unittest.main()