Added test for vertical lines.

The behavior is consistent with horizontal lines, see previous commit
for details.
This commit is contained in:
Terseus 2014-04-04 12:45:47 +02:00
parent fee2faa8dc
commit 1c02d467ef
4 changed files with 25 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 B

View File

@ -95,3 +95,28 @@ def test_line_horizontal():
img, draw = create_base_image_draw((20, 20))
draw.line((14, 5, 5, 5), BLACK, 3)
assert_image_equal(img, expected)
def test_line_vertical():
# Normal 2px line
expected = Image.open(os.path.join(IMAGES_PATH, 'line_vertical_w2px_normal.png'))
expected.load()
img, draw = create_base_image_draw((20, 20))
draw.line((5, 5, 5, 14), BLACK, 2)
assert_image_equal(img, expected)
# Inverted 2px line
expected = Image.open(os.path.join(IMAGES_PATH, 'line_vertical_w2px_inverted.png'))
expected.load()
img, draw = create_base_image_draw((20, 20))
draw.line((5, 14, 5, 5), BLACK, 2)
assert_image_equal(img, expected)
# Normal 3px line
expected = Image.open(os.path.join(IMAGES_PATH, 'line_vertical_w3px.png'))
expected.load()
img, draw = create_base_image_draw((20, 20))
draw.line((5, 5, 5, 14), BLACK, 3)
assert_image_equal(img, expected)
# Inverted 3px line
img, draw = create_base_image_draw((20, 20))
draw.line((5, 14, 5, 5), BLACK, 3)
assert_image_equal(img, expected)