move eps test images to their own folder
Co-authored-by: Andrew Murray <radarhere@users.noreply.github.com>
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
|
@ -19,18 +19,18 @@ from .helper import (
|
||||||
HAS_GHOSTSCRIPT = EpsImagePlugin.has_ghostscript()
|
HAS_GHOSTSCRIPT = EpsImagePlugin.has_ghostscript()
|
||||||
|
|
||||||
# Our two EPS test files (they are identical except for their bounding boxes)
|
# Our two EPS test files (they are identical except for their bounding boxes)
|
||||||
FILE1 = "Tests/images/zero_bb.eps"
|
FILE1 = "Tests/images/eps/zero_bb.eps"
|
||||||
FILE2 = "Tests/images/non_zero_bb.eps"
|
FILE2 = "Tests/images/eps/non_zero_bb.eps"
|
||||||
|
|
||||||
# Due to palletization, we'll need to convert these to RGB after load
|
# Due to palletization, we'll need to convert these to RGB after load
|
||||||
FILE1_COMPARE = "Tests/images/zero_bb.png"
|
FILE1_COMPARE = "Tests/images/eps/zero_bb.png"
|
||||||
FILE1_COMPARE_SCALE2 = "Tests/images/zero_bb_scale2.png"
|
FILE1_COMPARE_SCALE2 = "Tests/images/eps/zero_bb_scale2.png"
|
||||||
|
|
||||||
FILE2_COMPARE = "Tests/images/non_zero_bb.png"
|
FILE2_COMPARE = "Tests/images/eps/non_zero_bb.png"
|
||||||
FILE2_COMPARE_SCALE2 = "Tests/images/non_zero_bb_scale2.png"
|
FILE2_COMPARE_SCALE2 = "Tests/images/eps/non_zero_bb_scale2.png"
|
||||||
|
|
||||||
# EPS test files with binary preview
|
# EPS test files with binary preview
|
||||||
FILE3 = "Tests/images/binary_preview_map.eps"
|
FILE3 = "Tests/images/eps/binary_preview_map.eps"
|
||||||
|
|
||||||
# Three unsigned 32bit little-endian values:
|
# Three unsigned 32bit little-endian values:
|
||||||
# 0xC6D3D0C5 magic number
|
# 0xC6D3D0C5 magic number
|
||||||
|
@ -187,7 +187,7 @@ def test_load_long_binary_data(prefix: bytes) -> None:
|
||||||
)
|
)
|
||||||
@pytest.mark.skipif(not HAS_GHOSTSCRIPT, reason="Ghostscript not available")
|
@pytest.mark.skipif(not HAS_GHOSTSCRIPT, reason="Ghostscript not available")
|
||||||
def test_cmyk() -> None:
|
def test_cmyk() -> None:
|
||||||
with Image.open("Tests/images/pil_sample_cmyk.eps") as cmyk_image:
|
with Image.open("Tests/images/eps/pil_sample_cmyk.eps") as cmyk_image:
|
||||||
assert cmyk_image.mode == "CMYK"
|
assert cmyk_image.mode == "CMYK"
|
||||||
assert cmyk_image.size == (100, 100)
|
assert cmyk_image.size == (100, 100)
|
||||||
assert cmyk_image.format == "EPS"
|
assert cmyk_image.format == "EPS"
|
||||||
|
@ -204,8 +204,8 @@ def test_cmyk() -> None:
|
||||||
@pytest.mark.skipif(not HAS_GHOSTSCRIPT, reason="Ghostscript not available")
|
@pytest.mark.skipif(not HAS_GHOSTSCRIPT, reason="Ghostscript not available")
|
||||||
def test_showpage() -> None:
|
def test_showpage() -> None:
|
||||||
# See https://github.com/python-pillow/Pillow/issues/2615
|
# See https://github.com/python-pillow/Pillow/issues/2615
|
||||||
with Image.open("Tests/images/reqd_showpage.eps") as plot_image:
|
with Image.open("Tests/images/eps/reqd_showpage.eps") as plot_image:
|
||||||
with Image.open("Tests/images/reqd_showpage.png") as target:
|
with Image.open("Tests/images/eps/reqd_showpage.png") as target:
|
||||||
# should not crash/hang
|
# should not crash/hang
|
||||||
plot_image.load()
|
plot_image.load()
|
||||||
# fonts could be slightly different
|
# fonts could be slightly different
|
||||||
|
@ -214,11 +214,11 @@ def test_showpage() -> None:
|
||||||
|
|
||||||
@pytest.mark.skipif(not HAS_GHOSTSCRIPT, reason="Ghostscript not available")
|
@pytest.mark.skipif(not HAS_GHOSTSCRIPT, reason="Ghostscript not available")
|
||||||
def test_transparency() -> None:
|
def test_transparency() -> None:
|
||||||
with Image.open("Tests/images/reqd_showpage.eps") as plot_image:
|
with Image.open("Tests/images/eps/reqd_showpage.eps") as plot_image:
|
||||||
plot_image.load(transparency=True)
|
plot_image.load(transparency=True)
|
||||||
assert plot_image.mode == "RGBA"
|
assert plot_image.mode == "RGBA"
|
||||||
|
|
||||||
with Image.open("Tests/images/reqd_showpage_transparency.png") as target:
|
with Image.open("Tests/images/eps/reqd_showpage_transparency.png") as target:
|
||||||
# fonts could be slightly different
|
# fonts could be slightly different
|
||||||
assert_image_similar(plot_image, target, 6)
|
assert_image_similar(plot_image, target, 6)
|
||||||
|
|
||||||
|
@ -246,7 +246,7 @@ def test_bytesio_object() -> None:
|
||||||
|
|
||||||
|
|
||||||
def test_1_mode() -> None:
|
def test_1_mode() -> None:
|
||||||
with Image.open("Tests/images/1.eps") as im:
|
with Image.open("Tests/images/eps/1.eps") as im:
|
||||||
assert im.mode == "1"
|
assert im.mode == "1"
|
||||||
|
|
||||||
|
|
||||||
|
@ -302,7 +302,9 @@ def test_render_scale2() -> None:
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(not HAS_GHOSTSCRIPT, reason="Ghostscript not available")
|
@pytest.mark.skipif(not HAS_GHOSTSCRIPT, reason="Ghostscript not available")
|
||||||
@pytest.mark.parametrize("filename", (FILE1, FILE2, "Tests/images/illu10_preview.eps"))
|
@pytest.mark.parametrize(
|
||||||
|
"filename", (FILE1, FILE2, "Tests/images/eps/illu10_preview.eps")
|
||||||
|
)
|
||||||
def test_resize(filename: str) -> None:
|
def test_resize(filename: str) -> None:
|
||||||
with Image.open(filename) as im:
|
with Image.open(filename) as im:
|
||||||
new_size = (100, 100)
|
new_size = (100, 100)
|
||||||
|
@ -344,10 +346,10 @@ def test_readline(prefix: bytes, line_ending: bytes) -> None:
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"filename",
|
"filename",
|
||||||
(
|
(
|
||||||
"Tests/images/illu10_no_preview.eps",
|
"Tests/images/eps/illu10_no_preview.eps",
|
||||||
"Tests/images/illu10_preview.eps",
|
"Tests/images/eps/illu10_preview.eps",
|
||||||
"Tests/images/illuCS6_no_preview.eps",
|
"Tests/images/eps/illuCS6_no_preview.eps",
|
||||||
"Tests/images/illuCS6_preview.eps",
|
"Tests/images/eps/illuCS6_preview.eps",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
def test_open_eps(filename: str) -> None:
|
def test_open_eps(filename: str) -> None:
|
||||||
|
@ -359,7 +361,7 @@ def test_open_eps(filename: str) -> None:
|
||||||
@pytest.mark.skipif(not HAS_GHOSTSCRIPT, reason="Ghostscript not available")
|
@pytest.mark.skipif(not HAS_GHOSTSCRIPT, reason="Ghostscript not available")
|
||||||
def test_emptyline() -> None:
|
def test_emptyline() -> None:
|
||||||
# Test file includes an empty line in the header data
|
# Test file includes an empty line in the header data
|
||||||
emptyline_file = "Tests/images/zero_bb_emptyline.eps"
|
emptyline_file = "Tests/images/eps/zero_bb_emptyline.eps"
|
||||||
|
|
||||||
with Image.open(emptyline_file) as image:
|
with Image.open(emptyline_file) as image:
|
||||||
image.load()
|
image.load()
|
||||||
|
@ -371,7 +373,7 @@ def test_emptyline() -> None:
|
||||||
@pytest.mark.timeout(timeout=5)
|
@pytest.mark.timeout(timeout=5)
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"test_file",
|
"test_file",
|
||||||
["Tests/images/timeout-d675703545fee17acab56e5fec644c19979175de.eps"],
|
["Tests/images/eps/timeout-d675703545fee17acab56e5fec644c19979175de.eps"],
|
||||||
)
|
)
|
||||||
def test_timeout(test_file: str) -> None:
|
def test_timeout(test_file: str) -> None:
|
||||||
with open(test_file, "rb") as f:
|
with open(test_file, "rb") as f:
|
||||||
|
@ -384,7 +386,7 @@ def test_bounding_box_in_trailer() -> None:
|
||||||
# Check bounding boxes are parsed in the same way
|
# Check bounding boxes are parsed in the same way
|
||||||
# when specified in the header and the trailer
|
# when specified in the header and the trailer
|
||||||
with (
|
with (
|
||||||
Image.open("Tests/images/zero_bb_trailer.eps") as trailer_image,
|
Image.open("Tests/images/eps/zero_bb_trailer.eps") as trailer_image,
|
||||||
Image.open(FILE1) as header_image,
|
Image.open(FILE1) as header_image,
|
||||||
):
|
):
|
||||||
assert trailer_image.size == header_image.size
|
assert trailer_image.size == header_image.size
|
||||||
|
@ -392,12 +394,12 @@ def test_bounding_box_in_trailer() -> None:
|
||||||
|
|
||||||
def test_eof_before_bounding_box() -> None:
|
def test_eof_before_bounding_box() -> None:
|
||||||
with pytest.raises(OSError):
|
with pytest.raises(OSError):
|
||||||
with Image.open("Tests/images/zero_bb_eof_before_boundingbox.eps"):
|
with Image.open("Tests/images/eps/zero_bb_eof_before_boundingbox.eps"):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def test_invalid_data_after_eof() -> None:
|
def test_invalid_data_after_eof() -> None:
|
||||||
with open("Tests/images/illuCS6_preview.eps", "rb") as f:
|
with open("Tests/images/eps/illuCS6_preview.eps", "rb") as f:
|
||||||
img_bytes = io.BytesIO(f.read() + b"\r\n%" + (b" " * 255))
|
img_bytes = io.BytesIO(f.read() + b"\r\n%" + (b" " * 255))
|
||||||
|
|
||||||
with Image.open(img_bytes) as img:
|
with Image.open(img_bytes) as img:
|
||||||
|
|
|
@ -56,10 +56,10 @@ def helper_pickle_string(protocol: int, test_file: str, mode: str | None) -> Non
|
||||||
),
|
),
|
||||||
("Tests/images/hopper.tif", None),
|
("Tests/images/hopper.tif", None),
|
||||||
("Tests/images/test-card.png", None),
|
("Tests/images/test-card.png", None),
|
||||||
("Tests/images/zero_bb.png", None),
|
("Tests/images/eps/zero_bb.png", None),
|
||||||
("Tests/images/zero_bb_scale2.png", None),
|
("Tests/images/eps/zero_bb_scale2.png", None),
|
||||||
("Tests/images/non_zero_bb.png", None),
|
("Tests/images/eps/non_zero_bb.png", None),
|
||||||
("Tests/images/non_zero_bb_scale2.png", None),
|
("Tests/images/eps/non_zero_bb_scale2.png", None),
|
||||||
("Tests/images/p_trns_single.png", None),
|
("Tests/images/p_trns_single.png", None),
|
||||||
("Tests/images/pil123p.png", None),
|
("Tests/images/pil123p.png", None),
|
||||||
("Tests/images/itxt_chunks.png", None),
|
("Tests/images/itxt_chunks.png", None),
|
||||||
|
|