mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Test polygons in RGB and L modes
This commit is contained in:
parent
e77c3b3eb2
commit
ae9181f0a4
BIN
Tests/images/imagedraw_polygon_kite_L.png
Normal file
BIN
Tests/images/imagedraw_polygon_kite_L.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 499 B |
Before Width: | Height: | Size: 647 B After Width: | Height: | Size: 647 B |
|
@ -278,17 +278,19 @@ class TestImageDraw(PillowTestCase):
|
||||||
def test_polygon_kite(self):
|
def test_polygon_kite(self):
|
||||||
# Test drawing lines of different gradients (dx>dy, dy>dx) and
|
# Test drawing lines of different gradients (dx>dy, dy>dx) and
|
||||||
# vertical (dx==0) and horizontal (dy==0) lines
|
# vertical (dx==0) and horizontal (dy==0) lines
|
||||||
# Arrange
|
for mode in ["RGB", "L"]:
|
||||||
im = Image.new("RGB", (W, H))
|
# Arrange
|
||||||
draw = ImageDraw.Draw(im)
|
im = Image.new(mode, (W, H))
|
||||||
|
draw = ImageDraw.Draw(im)
|
||||||
|
expected = "Tests/images/imagedraw_polygon_kite_{}.png".format(mode)
|
||||||
|
|
||||||
# Act
|
# Act
|
||||||
draw.polygon(KITE_POINTS, fill="blue", outline="yellow")
|
draw.polygon(KITE_POINTS, fill="blue", outline="yellow")
|
||||||
del draw
|
del draw
|
||||||
|
|
||||||
# Assert
|
# Assert
|
||||||
self.assert_image_equal(
|
self.assert_image_equal(
|
||||||
im, Image.open("Tests/images/imagedraw_polygon_kite.png"))
|
im, Image.open(expected))
|
||||||
|
|
||||||
def helper_rectangle(self, bbox):
|
def helper_rectangle(self, bbox):
|
||||||
# Arrange
|
# Arrange
|
||||||
|
|
Loading…
Reference in New Issue
Block a user