2019-07-06 23:40:53 +03:00
|
|
|
from PIL import ImageQt
|
|
|
|
|
2019-02-03 18:34:53 +03:00
|
|
|
from .helper import PillowTestCase, hopper
|
2019-01-13 20:00:12 +03:00
|
|
|
from .test_imageqt import PillowQPixmapTestCase
|
2014-09-15 22:24:56 +04:00
|
|
|
|
|
|
|
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"):
|
2014-09-15 22:24:56 +04:00
|
|
|
data = ImageQt.toqpixmap(hopper(mode))
|
2015-06-21 09:31:51 +03:00
|
|
|
|
2020-02-22 16:06:21 +03:00
|
|
|
assert isinstance(data, QPixmap)
|
|
|
|
assert not data.isNull()
|
2014-09-15 22:24:56 +04:00
|
|
|
|
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)
|