mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Added tests for lines with 1px slope
This tests are designed to guarantee that the wide lines behave exactly like normal lines drawn with the Bresenham's algorithm. This tests are somewhat subjective since this is non-defined behavior, but I think that mimic the Bresenham's algorithm is reliable enough. Currently the horizontal version of this test **fail**.
This commit is contained in:
parent
4b7236f460
commit
b987d90568
BIN
Tests/images/imagedraw/line_horizontal_slope1px_w2px.png
Normal file
BIN
Tests/images/imagedraw/line_horizontal_slope1px_w2px.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 147 B |
BIN
Tests/images/imagedraw/line_vertical_slope1px_w2px.png
Normal file
BIN
Tests/images/imagedraw/line_vertical_slope1px_w2px.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 153 B |
|
@ -92,6 +92,11 @@ def test_line_horizontal():
|
||||||
img, draw = create_base_image_draw((200, 110))
|
img, draw = create_base_image_draw((200, 110))
|
||||||
draw.line((5, 55, 195, 55), BLACK, 101)
|
draw.line((5, 55, 195, 55), BLACK, 101)
|
||||||
assert_image_equal(img, expected, 'line straigth horizontal 101px wide failed')
|
assert_image_equal(img, expected, 'line straigth horizontal 101px wide failed')
|
||||||
|
expected = Image.open(os.path.join(IMAGES_PATH, 'line_horizontal_slope1px_w2px.png'))
|
||||||
|
expected.load()
|
||||||
|
img, draw = create_base_image_draw((20, 20))
|
||||||
|
draw.line((5, 5, 14, 6), BLACK, 2)
|
||||||
|
assert_image_equal(img, expected, 'line horizontal 1px slope 2px wide failed')
|
||||||
|
|
||||||
|
|
||||||
def test_line_vertical():
|
def test_line_vertical():
|
||||||
|
@ -118,6 +123,11 @@ def test_line_vertical():
|
||||||
img, draw = create_base_image_draw((110, 200))
|
img, draw = create_base_image_draw((110, 200))
|
||||||
draw.line((55, 5, 55, 195), BLACK, 101)
|
draw.line((55, 5, 55, 195), BLACK, 101)
|
||||||
assert_image_equal(img, expected, 'line straigth vertical 101px wide failed')
|
assert_image_equal(img, expected, 'line straigth vertical 101px wide failed')
|
||||||
|
expected = Image.open(os.path.join(IMAGES_PATH, 'line_vertical_slope1px_w2px.png'))
|
||||||
|
expected.load()
|
||||||
|
img, draw = create_base_image_draw((20, 20))
|
||||||
|
draw.line((5, 5, 6, 14), BLACK, 2)
|
||||||
|
assert_image_equal(img, expected, 'line vertical 1px slope 2px wide failed')
|
||||||
|
|
||||||
|
|
||||||
def test_line_oblique_45():
|
def test_line_oblique_45():
|
||||||
|
|
Loading…
Reference in New Issue
Block a user