Pillow/Tests/test_qt_image_fromqpixmap.py

16 lines
488 B
Python
Raw Normal View History

from PIL import ImageQt
2020-03-27 12:30:00 +03:00
from .helper import assert_image_equal, hopper
2020-03-28 04:51:28 +03:00
from .test_imageqt import PillowQPixmapTestCase
2017-04-20 14:14:23 +03:00
2020-03-28 04:51:28 +03:00
class TestFromQPixmap(PillowQPixmapTestCase):
def roundtrip(self, expected):
result = ImageQt.fromqpixmap(ImageQt.toqpixmap(expected))
# Qt saves all pixmaps as rgb
assert_image_equal(result, expected.convert("RGB"))
2020-03-28 04:51:28 +03:00
def test_sanity(self):
for mode in ("1", "RGB", "RGBA", "L", "P"):
self.roundtrip(hopper(mode))