2019-07-06 23:40:53 +03:00
|
|
|
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
|
2014-09-15 22:24:56 +04:00
|
|
|
|
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"))
|
2014-09-15 22:24:56 +04:00
|
|
|
|
2020-03-28 04:51:28 +03:00
|
|
|
def test_sanity(self):
|
|
|
|
for mode in ("1", "RGB", "RGBA", "L", "P"):
|
|
|
|
self.roundtrip(hopper(mode))
|