From e362818d91a6d985b9cf3ac88210f777ff2066ab Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Mon, 7 Aug 2023 12:28:13 +1000 Subject: [PATCH] Added test --- Tests/test_file_pdf.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Tests/test_file_pdf.py b/Tests/test_file_pdf.py index 9c8e90b7e21..4f7b09af26a 100644 --- a/Tests/test_file_pdf.py +++ b/Tests/test_file_pdf.py @@ -48,6 +48,22 @@ def test_save_alpha(tmp_path, mode): helper_save_as_pdf(tmp_path, mode) +def test_p_alpha(tmp_path): + # Arrange + outfile = str(tmp_path / "temp.pdf") + with Image.open("Tests/images/pil123p.png") as im: + assert im.mode == "P" + assert isinstance(im.info["transparency"], bytes) + + # Act + im.save(outfile) + + # Assert + with open(outfile, "rb") as fp: + contents = fp.read() + assert b"SMask" in contents + + def test_monochrome(tmp_path): # Arrange mode = "1"