2014-09-05 14:03:56 +04:00
|
|
|
from helper import unittest, PillowTestCase, hopper, fromstring
|
2012-10-16 00:26:38 +04:00
|
|
|
|
|
|
|
|
2014-06-10 13:10:47 +04:00
|
|
|
class TestImageToBitmap(PillowTestCase):
|
2013-07-01 02:42:19 +04:00
|
|
|
|
2014-06-10 13:10:47 +04:00
|
|
|
def test_sanity(self):
|
2012-10-16 00:26:38 +04:00
|
|
|
|
2014-09-05 14:03:56 +04:00
|
|
|
self.assertRaises(ValueError, lambda: hopper().tobitmap())
|
2012-10-16 00:26:38 +04:00
|
|
|
|
2014-09-05 14:03:56 +04:00
|
|
|
im1 = hopper().convert("1")
|
2012-10-16 00:26:38 +04:00
|
|
|
|
2014-06-10 13:10:47 +04:00
|
|
|
bitmap = im1.tobitmap()
|
|
|
|
|
|
|
|
self.assertIsInstance(bitmap, bytes)
|
|
|
|
self.assert_image_equal(im1, fromstring(bitmap))
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main()
|