From b5e66251787fd1034d77c84ec292f17426409ce3 Mon Sep 17 00:00:00 2001 From: sofijazolotarev Date: Thu, 20 Jun 2024 15:20:06 +0200 Subject: [PATCH] test_load_blp1() function improved --- Tests/test_file_blp.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Tests/test_file_blp.py b/Tests/test_file_blp.py index b1d36b81c..0afac6534 100644 --- a/Tests/test_file_blp.py +++ b/Tests/test_file_blp.py @@ -15,11 +15,27 @@ from .helper import ( def test_load_blp1() -> None: + # Test when _blp_compression is Format.JPEG with Image.open("Tests/images/blp/blp1_jpeg.blp") as im: assert_image_equal_tofile(im, "Tests/images/blp/blp1_jpeg.png") - with Image.open("Tests/images/blp/blp1_jpeg2.blp") as im: + # Test when _blp_compression is 1 and _blp_encoding is 4 or 5 + with Image.open("Tests/images/blp/blp1_encoding4.blp") as im: im.load() + with Image.open("Tests/images/blp/blp1_encoding5.blp") as im: + im.load() + + # Test when _blp_compression is 1 but _blp_encoding is not 4 or 5 + with pytest.raises(BLPFormatError): + with Image.open("Tests/images/blp/blp1_invalid_encoding.blp") as im: + im.load() + + # Test when _blp_compression is not 1 or Format.JPEG + with pytest.raises(BLPFormatError): + with Image.open("Tests/images/blp/blp1_invalid_compression.blp") as im: + im.load() + + def test_load_blp2_raw() -> None: