From 3743e1e9aa560dcc827f3c30d6df42fdf2bc9992 Mon Sep 17 00:00:00 2001 From: "Kwabena W. Agyeman" Date: Fri, 29 Jun 2018 11:23:45 -0400 Subject: [PATCH] Fix unit tests * Fix find line segments test * Fix drawing script --- .../unittest/script/12-find_line_segments.py | 23 ++++++++----------- scripts/unittest/script/20-drawing.py | 2 +- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/scripts/unittest/script/12-find_line_segments.py b/scripts/unittest/script/12-find_line_segments.py index 19cebaabd..6cd210182 100644 --- a/scripts/unittest/script/12-find_line_segments.py +++ b/scripts/unittest/script/12-find_line_segments.py @@ -1,17 +1,12 @@ def unittest(data_path, temp_path): import image img = image.Image("unittest/data/shapes.ppm", copy_to_fb=True) - lines = img.find_line_segments(threshold = 10000, theta_margin = 15, rho_margin = 15, segment_threshold = 100) - return len(lines) == 6 and\ - lines[0][0:] == (56, 38, 24, 38, 32, 19, 90, 38) and\ - lines[1][0:] == (26, 74, 54, 74, 28, 14, 90, 74) and\ - lines[2][0:] == (104, 70, 114, 76, 12, 2, 121, 6) and\ - lines[3][0:] == (139, 51, 133, 41, 12, 2, 149, -93) and\ - lines[4][0:] == (109, 37, 100, 46, 13, 12, 45, 103) and\ - lines[5][0:] == (127, 75, 138, 64, 16, 1, 45, 143) - - - - - - + lines = img.find_line_segments() + return len(lines) == 7 and\ + lines[0][0:] == (23, 58, 22, 58, 1, 16, 90, 58) and\ + lines[1][0:] == (24, 74, 56, 74, 32, 19, 90, 74) and\ + lines[2][0:] == (54, 38, 26, 38, 28, 14, 90, 38) and\ + lines[3][0:] == (104, 70, 114, 76, 12, 2, 121, 6) and\ + lines[4][0:] == (139, 51, 133, 41, 12, 2, 149, -93) and\ + lines[5][0:] == (109, 37, 100, 46, 13, 12, 45, 103) and\ + lines[6][0:] == (127, 75, 138, 64, 16, 1, 45, 143) diff --git a/scripts/unittest/script/20-drawing.py b/scripts/unittest/script/20-drawing.py index 019074837..32b492baa 100644 --- a/scripts/unittest/script/20-drawing.py +++ b/scripts/unittest/script/20-drawing.py @@ -9,7 +9,7 @@ def unittest(data_path, temp_path): img.draw_line([img.width()//2-50, 50, img.width()//2+50, 50]) img.draw_rectangle([img.width()//2-25, img.height()//2-25, 50, 50]) img.draw_circle(img.width()//2, img.height()//2, 40) - img.draw_string(10, 10, "HelloWorld!") + img.draw_string(11, 10, "HelloWorld!") img.draw_cross(img.width()//2, img.height()//2) sensor.flush() img.difference(data_path+"/drawing.pgm")