Merge branch 'main' into ImageOps.contain-function-issue-in-finding-new-size

This commit is contained in:
Andrew Murray 2022-08-24 21:53:48 +10:00
commit 192aae9ddd
5 changed files with 207 additions and 204 deletions

View File

@ -37,6 +37,7 @@ def helper_save_as_pdf(tmp_path, mode, **kwargs):
return outfile
@pytest.mark.valgrind_known_error(reason="Temporary skip")
def test_monochrome(tmp_path):
# Arrange
mode = "1"

View File

@ -1,3 +1,5 @@
import pytest
from PIL import Image
from .helper import CachedProperty, assert_image_equal
@ -101,8 +103,8 @@ class TestImagingPaste:
],
)
def test_image_solid(self):
for mode in ("RGBA", "RGB", "L"):
@pytest.mark.parametrize("mode", ["RGBA", "RGB", "L"])
def test_image_solid(self, mode):
im = Image.new(mode, (200, 200), "red")
im2 = getattr(self, "gradient_" + mode)
@ -111,8 +113,8 @@ class TestImagingPaste:
im = im.crop((12, 23, im2.width + 12, im2.height + 23))
assert_image_equal(im, im2)
def test_image_mask_1(self):
for mode in ("RGBA", "RGB", "L"):
@pytest.mark.parametrize("mode", ["RGBA", "RGB", "L"])
def test_image_mask_1(self, mode):
im = Image.new(mode, (200, 200), "white")
im2 = getattr(self, "gradient_" + mode)
@ -133,8 +135,8 @@ class TestImagingPaste:
],
)
def test_image_mask_L(self):
for mode in ("RGBA", "RGB", "L"):
@pytest.mark.parametrize("mode", ["RGBA", "RGB", "L"])
def test_image_mask_L(self, mode):
im = Image.new(mode, (200, 200), "white")
im2 = getattr(self, "gradient_" + mode)
@ -155,8 +157,8 @@ class TestImagingPaste:
],
)
def test_image_mask_LA(self):
for mode in ("RGBA", "RGB", "L"):
@pytest.mark.parametrize("mode", ["RGBA", "RGB", "L"])
def test_image_mask_LA(self, mode):
im = Image.new(mode, (200, 200), "white")
im2 = getattr(self, "gradient_" + mode)
@ -177,8 +179,8 @@ class TestImagingPaste:
],
)
def test_image_mask_RGBA(self):
for mode in ("RGBA", "RGB", "L"):
@pytest.mark.parametrize("mode", ["RGBA", "RGB", "L"])
def test_image_mask_RGBA(self, mode):
im = Image.new(mode, (200, 200), "white")
im2 = getattr(self, "gradient_" + mode)
@ -199,8 +201,8 @@ class TestImagingPaste:
],
)
def test_image_mask_RGBa(self):
for mode in ("RGBA", "RGB", "L"):
@pytest.mark.parametrize("mode", ["RGBA", "RGB", "L"])
def test_image_mask_RGBa(self, mode):
im = Image.new(mode, (200, 200), "white")
im2 = getattr(self, "gradient_" + mode)
@ -221,8 +223,8 @@ class TestImagingPaste:
],
)
def test_color_solid(self):
for mode in ("RGBA", "RGB", "L"):
@pytest.mark.parametrize("mode", ["RGBA", "RGB", "L"])
def test_color_solid(self, mode):
im = Image.new(mode, (200, 200), "black")
rect = (12, 23, 128 + 12, 128 + 23)
@ -234,8 +236,8 @@ class TestImagingPaste:
assert head[255] == 128 * 128
assert sum(head[:255]) == 0
def test_color_mask_1(self):
for mode in ("RGBA", "RGB", "L"):
@pytest.mark.parametrize("mode", ["RGBA", "RGB", "L"])
def test_color_mask_1(self, mode):
im = Image.new(mode, (200, 200), (50, 60, 70, 80)[: len(mode)])
color = (10, 20, 30, 40)[: len(mode)]
@ -256,8 +258,8 @@ class TestImagingPaste:
],
)
def test_color_mask_L(self):
for mode in ("RGBA", "RGB", "L"):
@pytest.mark.parametrize("mode", ["RGBA", "RGB", "L"])
def test_color_mask_L(self, mode):
im = getattr(self, "gradient_" + mode).copy()
color = "white"
@ -278,8 +280,8 @@ class TestImagingPaste:
],
)
def test_color_mask_RGBA(self):
for mode in ("RGBA", "RGB", "L"):
@pytest.mark.parametrize("mode", ["RGBA", "RGB", "L"])
def test_color_mask_RGBA(self, mode):
im = getattr(self, "gradient_" + mode).copy()
color = "white"
@ -300,8 +302,8 @@ class TestImagingPaste:
],
)
def test_color_mask_RGBa(self):
for mode in ("RGBA", "RGB", "L"):
@pytest.mark.parametrize("mode", ["RGBA", "RGB", "L"])
def test_color_mask_RGBa(self, mode):
im = getattr(self, "gradient_" + mode).copy()
color = "white"

View File

@ -1,7 +1,7 @@
#!/bin/bash
# install libimagequant
archive=libimagequant-4.0.1
archive=libimagequant-4.0.2
./download-and-extract.sh $archive https://raw.githubusercontent.com/python-pillow/pillow-depends/main/$archive.tar.gz

View File

@ -166,7 +166,7 @@ Many of Pillow's features require external libraries:
* **libimagequant** provides improved color quantization
* Pillow has been tested with libimagequant **2.6-4.0.1**
* Pillow has been tested with libimagequant **2.6-4.0.2**
* Libimagequant is licensed GPLv3, which is more restrictive than
the Pillow license, therefore we will not be distributing binaries
with libimagequant support enabled.

View File

@ -226,21 +226,21 @@ deps = {
"filename": "lcms2-2.13.1.tar.gz",
"dir": "lcms2-2.13.1",
"patch": {
r"Projects\VC2019\lcms2_static\lcms2_static.vcxproj": {
r"Projects\VC2022\lcms2_static\lcms2_static.vcxproj": {
# default is /MD for x86 and /MT for x64, we need /MD always
"<RuntimeLibrary>MultiThreaded</RuntimeLibrary>": "<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>", # noqa: E501
# retarget to default toolset (selected by vcvarsall.bat)
"<PlatformToolset>v142</PlatformToolset>": "<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>", # noqa: E501
"<PlatformToolset>v143</PlatformToolset>": "<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>", # noqa: E501
# retarget to latest (selected by vcvarsall.bat)
"<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>": "<WindowsTargetPlatformVersion>$(WindowsSDKVersion)</WindowsTargetPlatformVersion>", # noqa: E501
}
},
"build": [
cmd_rmdir("Lib"),
cmd_rmdir(r"Projects\VC2019\Release"),
cmd_msbuild(r"Projects\VC2019\lcms2.sln", "Release", "Clean"),
cmd_rmdir(r"Projects\VC2022\Release"),
cmd_msbuild(r"Projects\VC2022\lcms2.sln", "Release", "Clean"),
cmd_msbuild(
r"Projects\VC2019\lcms2.sln", "Release", "lcms2_static:Rebuild"
r"Projects\VC2022\lcms2.sln", "Release", "lcms2_static:Rebuild"
),
cmd_xcopy("include", "{inc_dir}"),
],