diff --git a/Tests/test_imagecms.py b/Tests/test_imagecms.py index 6b237378d..fdce0c8a4 100644 --- a/Tests/test_imagecms.py +++ b/Tests/test_imagecms.py @@ -698,3 +698,38 @@ def test_deprecation() -> None: assert ImageCms.VERSION == "1.0.0 pil" with pytest.warns(DeprecationWarning): assert isinstance(ImageCms.FLAGS, dict) + +def test_buildTransform_flags_non_integer(): + with pytest.raises(ImageCms.PyCMSError): + ImageCms.buildTransform( + inputProfile="path/to/input/profile", + outputProfile="path/to/output/profile", + inMode="RGB", + outMode="CMYK", + renderingIntent=ImageCms.Intent.PERCEPTUAL, + flags="not_an_integer" + ) + +def test_buildTransform_flags_out_of_range(): + with pytest.raises(ImageCms.PyCMSError): + ImageCms.buildTransform( + inputProfile="path/to/input/profile", + outputProfile="path/to/output/profile", + inMode="RGB", + outMode="CMYK", + renderingIntent=ImageCms.Intent.PERCEPTUAL, + flags=999999 + ) + +def test_renderingIntent_non_integer(): + with pytest.raises(ImageCms.PyCMSError) as exc_info: + ImageCms.buildTransform( + inputProfile="path/to/input/profile", + outputProfile="path/to/output/profile", + inMode="RGB", + outMode="CMYK", + renderingIntent="not an integer", + flags=0 + ) + assert str(exc_info.value) == "renderingIntent must be an integer between 0 and 3" +