openmv/scripts/unittest/tests/drawing.py
iabdalkader 4b1837f72e scripts: Update unit tests.
Co-authored-by: Kwabena W Agyeman <kwagyeman@users.noreply.github.com>
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-10-18 17:14:36 +02:00

17 lines
643 B
Python

def unittest(data_path, temp_path):
import image
img = image.Image(160, 120, image.GRAYSCALE)
img.set_pixel(img.width() // 2 + 50, 120, 255)
img.set_pixel(img.width() // 2 - 50, 120, 255)
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(11, 10, "HelloWorld!")
img.draw_cross(img.width() // 2, img.height() // 2)
stats = img.difference(data_path + "/drawing.pgm").get_statistics()
return stats.max() == 0 and stats.min() == 0