|
4 | 4 |
|
5 | 5 | import pytest |
6 | 6 |
|
7 | | -from PIL import IcnsImagePlugin, Image, _binary, features |
| 7 | +from PIL import IcnsImagePlugin, Image, _binary |
8 | 8 |
|
9 | | -from .helper import assert_image_equal, assert_image_similar_tofile |
| 9 | +from .helper import assert_image_equal, assert_image_similar_tofile, skip_unless_feature |
10 | 10 |
|
11 | 11 | # sample icon file |
12 | 12 | TEST_FILE = "Tests/images/pillow.icns" |
13 | 13 |
|
14 | | -ENABLE_JPEG2K = features.check_codec("jpg_2000") |
15 | | - |
16 | 14 |
|
17 | 15 | def test_sanity(): |
18 | 16 | # Loading this icon by default should result in the largest size |
@@ -111,14 +109,12 @@ def test_older_icon(): |
111 | 109 | assert im2.size == (wr, hr) |
112 | 110 |
|
113 | 111 |
|
| 112 | +@skip_unless_feature("jpg_2000") |
114 | 113 | def test_jp2_icon(): |
115 | 114 | # This icon uses JPEG 2000 images instead of the PNG images. |
116 | 115 | # The advantage of doing this is that OS X 10.5 supports JPEG 2000 |
117 | 116 | # but not PNG; some commercial software therefore does just this. |
118 | 117 |
|
119 | | - if not ENABLE_JPEG2K: |
120 | | - return |
121 | | - |
122 | 118 | with Image.open("Tests/images/pillow3.icns") as im: |
123 | 119 | for w, h, r in im.info["sizes"]: |
124 | 120 | wr = w * r |
@@ -149,6 +145,7 @@ def test_not_an_icns_file(): |
149 | 145 | IcnsImagePlugin.IcnsFile(fp) |
150 | 146 |
|
151 | 147 |
|
| 148 | +@skip_unless_feature("jpg_2000") |
152 | 149 | def test_icns_decompression_bomb(): |
153 | 150 | with Image.open( |
154 | 151 | "Tests/images/oom-8ed3316a4109213ca96fb8a256a0bfefdece1461.icns" |
|
0 commit comments