mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-23 07:10:33 +03:00
Merge pull request #8755 from hugovk/rm-_wedge
Remove debug `Image._wedge`
This commit is contained in:
commit
f8566b90eb
|
@ -22,9 +22,6 @@ from .helper import (
|
||||||
# sample gif stream
|
# sample gif stream
|
||||||
TEST_GIF = "Tests/images/hopper.gif"
|
TEST_GIF = "Tests/images/hopper.gif"
|
||||||
|
|
||||||
with open(TEST_GIF, "rb") as f:
|
|
||||||
data = f.read()
|
|
||||||
|
|
||||||
|
|
||||||
def test_sanity() -> None:
|
def test_sanity() -> None:
|
||||||
with Image.open(TEST_GIF) as im:
|
with Image.open(TEST_GIF) as im:
|
||||||
|
@ -37,12 +34,12 @@ def test_sanity() -> None:
|
||||||
|
|
||||||
@pytest.mark.skipif(is_pypy(), reason="Requires CPython")
|
@pytest.mark.skipif(is_pypy(), reason="Requires CPython")
|
||||||
def test_unclosed_file() -> None:
|
def test_unclosed_file() -> None:
|
||||||
def open() -> None:
|
def open_test_image() -> None:
|
||||||
im = Image.open(TEST_GIF)
|
im = Image.open(TEST_GIF)
|
||||||
im.load()
|
im.load()
|
||||||
|
|
||||||
with pytest.warns(ResourceWarning):
|
with pytest.warns(ResourceWarning):
|
||||||
open()
|
open_test_image()
|
||||||
|
|
||||||
|
|
||||||
def test_closed_file() -> None:
|
def test_closed_file() -> None:
|
||||||
|
@ -1348,7 +1345,7 @@ def test_save_I(tmp_path: Path) -> None:
|
||||||
def test_getdata(monkeypatch: pytest.MonkeyPatch) -> None:
|
def test_getdata(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||||
# Test getheader/getdata against legacy values.
|
# Test getheader/getdata against legacy values.
|
||||||
# Create a 'P' image with holes in the palette.
|
# Create a 'P' image with holes in the palette.
|
||||||
im = Image._wedge().resize((16, 16), Image.Resampling.NEAREST)
|
im = Image.linear_gradient(mode="L").resize((16, 16), Image.Resampling.NEAREST)
|
||||||
im.putpalette(ImagePalette.ImagePalette("RGB"))
|
im.putpalette(ImagePalette.ImagePalette("RGB"))
|
||||||
im.info = {"background": 0}
|
im.info = {"background": 0}
|
||||||
|
|
||||||
|
|
|
@ -22,28 +22,26 @@ def test_sanity() -> None:
|
||||||
Image.new("HSV", (100, 100))
|
Image.new("HSV", (100, 100))
|
||||||
|
|
||||||
|
|
||||||
def wedge() -> Image.Image:
|
def linear_gradient() -> Image.Image:
|
||||||
w = Image._wedge()
|
im = Image.linear_gradient(mode="L")
|
||||||
w90 = w.rotate(90)
|
im90 = im.rotate(90)
|
||||||
|
|
||||||
(px, h) = w.size
|
(px, h) = im.size
|
||||||
|
|
||||||
r = Image.new("L", (px * 3, h))
|
r = Image.new("L", (px * 3, h))
|
||||||
g = r.copy()
|
g = r.copy()
|
||||||
b = r.copy()
|
b = r.copy()
|
||||||
|
|
||||||
r.paste(w, (0, 0))
|
r.paste(im, (0, 0))
|
||||||
r.paste(w90, (px, 0))
|
r.paste(im90, (px, 0))
|
||||||
|
|
||||||
g.paste(w90, (0, 0))
|
g.paste(im90, (0, 0))
|
||||||
g.paste(w, (2 * px, 0))
|
g.paste(im, (2 * px, 0))
|
||||||
|
|
||||||
b.paste(w, (px, 0))
|
b.paste(im, (px, 0))
|
||||||
b.paste(w90, (2 * px, 0))
|
b.paste(im90, (2 * px, 0))
|
||||||
|
|
||||||
img = Image.merge("RGB", (r, g, b))
|
return Image.merge("RGB", (r, g, b))
|
||||||
|
|
||||||
return img
|
|
||||||
|
|
||||||
|
|
||||||
def to_xxx_colorsys(
|
def to_xxx_colorsys(
|
||||||
|
@ -79,8 +77,8 @@ def to_rgb_colorsys(im: Image.Image) -> Image.Image:
|
||||||
return to_xxx_colorsys(im, colorsys.hsv_to_rgb, "RGB")
|
return to_xxx_colorsys(im, colorsys.hsv_to_rgb, "RGB")
|
||||||
|
|
||||||
|
|
||||||
def test_wedge() -> None:
|
def test_linear_gradient() -> None:
|
||||||
src = wedge().resize((3 * 32, 32), Image.Resampling.BILINEAR)
|
src = linear_gradient().resize((3 * 32, 32), Image.Resampling.BILINEAR)
|
||||||
im = src.convert("HSV")
|
im = src.convert("HSV")
|
||||||
comparable = to_hsv_colorsys(src)
|
comparable = to_hsv_colorsys(src)
|
||||||
|
|
||||||
|
|
|
@ -2996,15 +2996,6 @@ class ImageTransformHandler:
|
||||||
# --------------------------------------------------------------------
|
# --------------------------------------------------------------------
|
||||||
# Factories
|
# Factories
|
||||||
|
|
||||||
#
|
|
||||||
# Debugging
|
|
||||||
|
|
||||||
|
|
||||||
def _wedge() -> Image:
|
|
||||||
"""Create grayscale wedge (for debugging only)"""
|
|
||||||
|
|
||||||
return Image()._new(core.wedge("L"))
|
|
||||||
|
|
||||||
|
|
||||||
def _check_size(size: Any) -> None:
|
def _check_size(size: Any) -> None:
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -4256,7 +4256,6 @@ static PyMethodDef functions[] = {
|
||||||
{"effect_noise", (PyCFunction)_effect_noise, METH_VARARGS},
|
{"effect_noise", (PyCFunction)_effect_noise, METH_VARARGS},
|
||||||
{"linear_gradient", (PyCFunction)_linear_gradient, METH_VARARGS},
|
{"linear_gradient", (PyCFunction)_linear_gradient, METH_VARARGS},
|
||||||
{"radial_gradient", (PyCFunction)_radial_gradient, METH_VARARGS},
|
{"radial_gradient", (PyCFunction)_radial_gradient, METH_VARARGS},
|
||||||
{"wedge", (PyCFunction)_linear_gradient, METH_VARARGS}, /* Compatibility */
|
|
||||||
|
|
||||||
/* Drawing support stuff */
|
/* Drawing support stuff */
|
||||||
{"font", (PyCFunction)_font_new, METH_VARARGS},
|
{"font", (PyCFunction)_font_new, METH_VARARGS},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user