mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-14 13:46:57 +03:00
dbe9f85c7d
* Drop unittest2 requirement * Use set literals * Use dict/set comprehension * Use str.format() automatic numbering
28 lines
714 B
Python
28 lines
714 B
Python
from helper import unittest, PillowTestCase, hopper
|
|
from test_imageqt import PillowQtTestCase, PillowQPixmapTestCase
|
|
|
|
from PIL import ImageQt
|
|
|
|
if ImageQt.qt_is_installed:
|
|
from PIL.ImageQt import QPixmap
|
|
|
|
|
|
class TestToQPixmap(PillowQPixmapTestCase, PillowTestCase):
|
|
|
|
def test_sanity(self):
|
|
PillowQtTestCase.setUp(self)
|
|
|
|
for mode in ('1', 'RGB', 'RGBA', 'L', 'P'):
|
|
data = ImageQt.toqpixmap(hopper(mode))
|
|
|
|
self.assertIsInstance(data, QPixmap)
|
|
self.assertFalse(data.isNull())
|
|
|
|
# Test saving the file
|
|
tempfile = self.tempfile('temp_{}.png'.format(mode))
|
|
data.save(tempfile)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|