Pillow/Tests/test_qt_image_toqpixmap.py

21 lines
600 B
Python
Raw Normal View History

from PIL import ImageQt
from .helper import PillowTestCase, hopper
from .test_imageqt import PillowQPixmapTestCase
if ImageQt.qt_is_installed:
from PIL.ImageQt import QPixmap
class TestToQPixmap(PillowQPixmapTestCase, PillowTestCase):
def test_sanity(self):
2019-06-13 18:54:46 +03:00
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
2019-06-13 18:54:46 +03:00
tempfile = self.tempfile("temp_{}.png".format(mode))
2015-06-21 09:31:51 +03:00
data.save(tempfile)