Added tests

This commit is contained in:
Andrew Murray 2018-01-05 11:26:24 +11:00
parent 4e69b9c553
commit 4d3339b703
13 changed files with 41 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 263 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 B

View File

@ -572,6 +572,47 @@ class TestImageDraw(PillowTestCase):
draw.textsize("\n")
draw.textsize("test\n")
def test_same_color_outline(self):
# Prepare shape
x0, y0 = 5, 5
x1, y1 = 5, 50
x2, y2 = 95, 50
x3, y3 = 95, 5
s = ImageDraw.Outline()
s.move(x0, y0)
s.curve(x1, y1, x2, y2, x3, y3)
s.line(x0, y0)
# Begin
for mode in ["RGB", "L"]:
for fill, outline in [
["red", None],
["red", "red"],
["red", "#f00"]
]:
for operation, args in {
'chord':[BBOX1, 0, 180],
'ellipse':[BBOX1],
'shape':[s],
'pieslice':[BBOX1, -90, 45],
'polygon':[[(18, 30), (85, 30), (60, 72)]],
'rectangle':[BBOX1]
}.items():
# Arrange
im = Image.new(mode, (W, H))
draw = ImageDraw.Draw(im)
# Act
draw_method = getattr(draw, operation)
args += [fill, outline]
draw_method(*args)
# Assert
expected = ("Tests/images/imagedraw_outline"
"_{}_{}.png".format(operation, mode))
self.assert_image_similar(im, Image.open(expected), 1)
if __name__ == '__main__':
unittest.main()