mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-06-30 01:43:17 +03:00
Merge branch 'main' into convert
This commit is contained in:
commit
7d35d705ee
|
@ -1,3 +1,5 @@
|
||||||
|
import pytest
|
||||||
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
from .helper import CachedProperty, assert_image_equal
|
from .helper import CachedProperty, assert_image_equal
|
||||||
|
@ -101,8 +103,8 @@ class TestImagingPaste:
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_image_solid(self):
|
@pytest.mark.parametrize("mode", ["RGBA", "RGB", "L"])
|
||||||
for mode in ("RGBA", "RGB", "L"):
|
def test_image_solid(self, mode):
|
||||||
im = Image.new(mode, (200, 200), "red")
|
im = Image.new(mode, (200, 200), "red")
|
||||||
im2 = getattr(self, "gradient_" + mode)
|
im2 = getattr(self, "gradient_" + mode)
|
||||||
|
|
||||||
|
@ -111,8 +113,8 @@ class TestImagingPaste:
|
||||||
im = im.crop((12, 23, im2.width + 12, im2.height + 23))
|
im = im.crop((12, 23, im2.width + 12, im2.height + 23))
|
||||||
assert_image_equal(im, im2)
|
assert_image_equal(im, im2)
|
||||||
|
|
||||||
def test_image_mask_1(self):
|
@pytest.mark.parametrize("mode", ["RGBA", "RGB", "L"])
|
||||||
for mode in ("RGBA", "RGB", "L"):
|
def test_image_mask_1(self, mode):
|
||||||
im = Image.new(mode, (200, 200), "white")
|
im = Image.new(mode, (200, 200), "white")
|
||||||
im2 = getattr(self, "gradient_" + mode)
|
im2 = getattr(self, "gradient_" + mode)
|
||||||
|
|
||||||
|
@ -133,8 +135,8 @@ class TestImagingPaste:
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_image_mask_L(self):
|
@pytest.mark.parametrize("mode", ["RGBA", "RGB", "L"])
|
||||||
for mode in ("RGBA", "RGB", "L"):
|
def test_image_mask_L(self, mode):
|
||||||
im = Image.new(mode, (200, 200), "white")
|
im = Image.new(mode, (200, 200), "white")
|
||||||
im2 = getattr(self, "gradient_" + mode)
|
im2 = getattr(self, "gradient_" + mode)
|
||||||
|
|
||||||
|
@ -155,8 +157,8 @@ class TestImagingPaste:
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_image_mask_LA(self):
|
@pytest.mark.parametrize("mode", ["RGBA", "RGB", "L"])
|
||||||
for mode in ("RGBA", "RGB", "L"):
|
def test_image_mask_LA(self, mode):
|
||||||
im = Image.new(mode, (200, 200), "white")
|
im = Image.new(mode, (200, 200), "white")
|
||||||
im2 = getattr(self, "gradient_" + mode)
|
im2 = getattr(self, "gradient_" + mode)
|
||||||
|
|
||||||
|
@ -177,8 +179,8 @@ class TestImagingPaste:
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_image_mask_RGBA(self):
|
@pytest.mark.parametrize("mode", ["RGBA", "RGB", "L"])
|
||||||
for mode in ("RGBA", "RGB", "L"):
|
def test_image_mask_RGBA(self, mode):
|
||||||
im = Image.new(mode, (200, 200), "white")
|
im = Image.new(mode, (200, 200), "white")
|
||||||
im2 = getattr(self, "gradient_" + mode)
|
im2 = getattr(self, "gradient_" + mode)
|
||||||
|
|
||||||
|
@ -199,8 +201,8 @@ class TestImagingPaste:
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_image_mask_RGBa(self):
|
@pytest.mark.parametrize("mode", ["RGBA", "RGB", "L"])
|
||||||
for mode in ("RGBA", "RGB", "L"):
|
def test_image_mask_RGBa(self, mode):
|
||||||
im = Image.new(mode, (200, 200), "white")
|
im = Image.new(mode, (200, 200), "white")
|
||||||
im2 = getattr(self, "gradient_" + mode)
|
im2 = getattr(self, "gradient_" + mode)
|
||||||
|
|
||||||
|
@ -221,8 +223,8 @@ class TestImagingPaste:
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_color_solid(self):
|
@pytest.mark.parametrize("mode", ["RGBA", "RGB", "L"])
|
||||||
for mode in ("RGBA", "RGB", "L"):
|
def test_color_solid(self, mode):
|
||||||
im = Image.new(mode, (200, 200), "black")
|
im = Image.new(mode, (200, 200), "black")
|
||||||
|
|
||||||
rect = (12, 23, 128 + 12, 128 + 23)
|
rect = (12, 23, 128 + 12, 128 + 23)
|
||||||
|
@ -234,8 +236,8 @@ class TestImagingPaste:
|
||||||
assert head[255] == 128 * 128
|
assert head[255] == 128 * 128
|
||||||
assert sum(head[:255]) == 0
|
assert sum(head[:255]) == 0
|
||||||
|
|
||||||
def test_color_mask_1(self):
|
@pytest.mark.parametrize("mode", ["RGBA", "RGB", "L"])
|
||||||
for mode in ("RGBA", "RGB", "L"):
|
def test_color_mask_1(self, mode):
|
||||||
im = Image.new(mode, (200, 200), (50, 60, 70, 80)[: len(mode)])
|
im = Image.new(mode, (200, 200), (50, 60, 70, 80)[: len(mode)])
|
||||||
color = (10, 20, 30, 40)[: len(mode)]
|
color = (10, 20, 30, 40)[: len(mode)]
|
||||||
|
|
||||||
|
@ -256,8 +258,8 @@ class TestImagingPaste:
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_color_mask_L(self):
|
@pytest.mark.parametrize("mode", ["RGBA", "RGB", "L"])
|
||||||
for mode in ("RGBA", "RGB", "L"):
|
def test_color_mask_L(self, mode):
|
||||||
im = getattr(self, "gradient_" + mode).copy()
|
im = getattr(self, "gradient_" + mode).copy()
|
||||||
color = "white"
|
color = "white"
|
||||||
|
|
||||||
|
@ -278,8 +280,8 @@ class TestImagingPaste:
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_color_mask_RGBA(self):
|
@pytest.mark.parametrize("mode", ["RGBA", "RGB", "L"])
|
||||||
for mode in ("RGBA", "RGB", "L"):
|
def test_color_mask_RGBA(self, mode):
|
||||||
im = getattr(self, "gradient_" + mode).copy()
|
im = getattr(self, "gradient_" + mode).copy()
|
||||||
color = "white"
|
color = "white"
|
||||||
|
|
||||||
|
@ -300,8 +302,8 @@ class TestImagingPaste:
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_color_mask_RGBa(self):
|
@pytest.mark.parametrize("mode", ["RGBA", "RGB", "L"])
|
||||||
for mode in ("RGBA", "RGB", "L"):
|
def test_color_mask_RGBa(self, mode):
|
||||||
im = getattr(self, "gradient_" + mode).copy()
|
im = getattr(self, "gradient_" + mode).copy()
|
||||||
color = "white"
|
color = "white"
|
||||||
|
|
||||||
|
|
|
@ -226,21 +226,21 @@ deps = {
|
||||||
"filename": "lcms2-2.13.1.tar.gz",
|
"filename": "lcms2-2.13.1.tar.gz",
|
||||||
"dir": "lcms2-2.13.1",
|
"dir": "lcms2-2.13.1",
|
||||||
"patch": {
|
"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
|
# default is /MD for x86 and /MT for x64, we need /MD always
|
||||||
"<RuntimeLibrary>MultiThreaded</RuntimeLibrary>": "<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>", # noqa: E501
|
"<RuntimeLibrary>MultiThreaded</RuntimeLibrary>": "<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>", # noqa: E501
|
||||||
# retarget to default toolset (selected by vcvarsall.bat)
|
# 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)
|
# retarget to latest (selected by vcvarsall.bat)
|
||||||
"<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>": "<WindowsTargetPlatformVersion>$(WindowsSDKVersion)</WindowsTargetPlatformVersion>", # noqa: E501
|
"<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>": "<WindowsTargetPlatformVersion>$(WindowsSDKVersion)</WindowsTargetPlatformVersion>", # noqa: E501
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"build": [
|
"build": [
|
||||||
cmd_rmdir("Lib"),
|
cmd_rmdir("Lib"),
|
||||||
cmd_rmdir(r"Projects\VC2019\Release"),
|
cmd_rmdir(r"Projects\VC2022\Release"),
|
||||||
cmd_msbuild(r"Projects\VC2019\lcms2.sln", "Release", "Clean"),
|
cmd_msbuild(r"Projects\VC2022\lcms2.sln", "Release", "Clean"),
|
||||||
cmd_msbuild(
|
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}"),
|
cmd_xcopy("include", "{inc_dir}"),
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in New Issue
Block a user