2019-07-06 23:40:53 +03:00
|
|
|
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
|
2014-09-15 22:24:56 +04:00
|
|
|
|
|
|
|
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()
|
2014-09-15 22:24:56 +04:00
|
|
|
|
2020-03-28 04:51:28 +03:00
|
|
|
# Test saving the file
|
|
|
|
tempfile = str(tmp_path / "temp_{}.png".format(mode))
|
|
|
|
data.save(tempfile)
|