mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-03-23 19:44:13 +03:00
Merge pull request #1215 from python-pillow/hugovk-fix-1209
Fix OS X build
This commit is contained in:
commit
51a17acb02
|
@ -5,8 +5,8 @@ from PIL import Image
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
# sample icon file
|
# sample icon file
|
||||||
test_file = "Tests/images/pillow.icns"
|
TEST_FILE = "Tests/images/pillow.icns"
|
||||||
data = open(test_file, "rb").read()
|
data = open(TEST_FILE, "rb").read()
|
||||||
|
|
||||||
enable_jpeg2k = hasattr(Image.core, 'jp2klib_version')
|
enable_jpeg2k = hasattr(Image.core, 'jp2klib_version')
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ class TestFileIcns(PillowTestCase):
|
||||||
def test_sanity(self):
|
def test_sanity(self):
|
||||||
# Loading this icon by default should result in the largest size
|
# Loading this icon by default should result in the largest size
|
||||||
# (512x512@2x) being loaded
|
# (512x512@2x) being loaded
|
||||||
im = Image.open(test_file)
|
im = Image.open(TEST_FILE)
|
||||||
im.load()
|
im.load()
|
||||||
self.assertEqual(im.mode, "RGBA")
|
self.assertEqual(im.mode, "RGBA")
|
||||||
self.assertEqual(im.size, (1024, 1024))
|
self.assertEqual(im.size, (1024, 1024))
|
||||||
|
@ -25,12 +25,12 @@ class TestFileIcns(PillowTestCase):
|
||||||
@unittest.skipIf(sys.platform != 'darwin',
|
@unittest.skipIf(sys.platform != 'darwin',
|
||||||
"requires MacOS")
|
"requires MacOS")
|
||||||
def test_save(self):
|
def test_save(self):
|
||||||
im = Image.open(file)
|
im = Image.open(TEST_FILE)
|
||||||
|
|
||||||
test_file = self.tempfile("temp.icns")
|
TEST_FILE = self.tempfile("temp.icns")
|
||||||
im.save(test_file)
|
im.save(TEST_FILE)
|
||||||
|
|
||||||
reread = Image.open(test_file)
|
reread = Image.open(TEST_FILE)
|
||||||
|
|
||||||
self.assertEqual(reread.mode, "RGBA")
|
self.assertEqual(reread.mode, "RGBA")
|
||||||
self.assertEqual(reread.size, (1024, 1024))
|
self.assertEqual(reread.size, (1024, 1024))
|
||||||
|
@ -39,11 +39,11 @@ class TestFileIcns(PillowTestCase):
|
||||||
def test_sizes(self):
|
def test_sizes(self):
|
||||||
# Check that we can load all of the sizes, and that the final pixel
|
# Check that we can load all of the sizes, and that the final pixel
|
||||||
# dimensions are as expected
|
# dimensions are as expected
|
||||||
im = Image.open(test_file)
|
im = Image.open(TEST_FILE)
|
||||||
for w, h, r in im.info['sizes']:
|
for w, h, r in im.info['sizes']:
|
||||||
wr = w * r
|
wr = w * r
|
||||||
hr = h * r
|
hr = h * r
|
||||||
im2 = Image.open(test_file)
|
im2 = Image.open(TEST_FILE)
|
||||||
im2.size = (w, h, r)
|
im2.size = (w, h, r)
|
||||||
im2.load()
|
im2.load()
|
||||||
self.assertEqual(im2.mode, 'RGBA')
|
self.assertEqual(im2.mode, 'RGBA')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user