Pillow/Tests/test_qt_image_toqpixmap.py

21 lines
568 B
Python
Raw Normal View History

from PIL import ImageQt
2020-03-27 12:30:00 +03:00
from .helper import hopper
2020-03-28 04:51:28 +03:00
from .test_imageqt import PillowQPixmapTestCase
if ImageQt.qt_is_installed:
from PIL.ImageQt import QPixmap
2020-03-28 04:51:28 +03:00
class TestToQPixmap(PillowQPixmapTestCase):
def test_sanity(self, tmp_path):
for mode in ("1", "RGB", "RGBA", "L", "P"):
data = ImageQt.toqpixmap(hopper(mode))
2015-06-21 09:31:51 +03:00
2020-03-28 04:51:28 +03:00
assert isinstance(data, QPixmap)
assert not data.isNull()
2020-03-28 04:51:28 +03:00
# Test saving the file
tempfile = str(tmp_path / "temp_{}.png".format(mode))
data.save(tempfile)