mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-12 16:24:45 +03:00
order ImageDraw.rounded_rectangle() points
This commit is contained in:
parent
d48dca3dc4
commit
82a08d2032
|
@ -735,6 +735,22 @@ def test_rounded_rectangle(xy):
|
|||
assert_image_equal_tofile(im, "Tests/images/imagedraw_rounded_rectangle.png")
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"xy",
|
||||
((10, 20, 190, 180), (190, 20, 10, 180), (190, 180, 10, 20), (10, 180, 190, 20)),
|
||||
)
|
||||
def test_rounded_rectangle_unordered_points(xy):
|
||||
# Arrange
|
||||
im = Image.new("RGB", (200, 200))
|
||||
draw = ImageDraw.Draw(im)
|
||||
|
||||
# Act
|
||||
draw.rounded_rectangle(xy, 30, fill="red", outline="green", width=5)
|
||||
|
||||
# Assert
|
||||
assert_image_equal_tofile(im, "Tests/images/imagedraw_rounded_rectangle.png")
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"xy, radius, type",
|
||||
[
|
||||
|
|
|
@ -301,6 +301,7 @@ class ImageDraw:
|
|||
(x0, y0), (x1, y1) = xy
|
||||
else:
|
||||
x0, y0, x1, y1 = xy
|
||||
x0, y0, x1, y1 = min(x0, x1), min(y0, y1), max(x0, x1), max(y0, y1)
|
||||
|
||||
d = radius * 2
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user