From 356e98b0cfb3772a66b04b1cb37d7b2a0b6781da Mon Sep 17 00:00:00 2001 From: James Richardson Date: Sat, 10 Feb 2024 14:08:49 +0000 Subject: [PATCH] add tests for msi widget --- tests/widgets/test_widgets_msi.py | 65 +++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 tests/widgets/test_widgets_msi.py diff --git a/tests/widgets/test_widgets_msi.py b/tests/widgets/test_widgets_msi.py new file mode 100644 index 0000000..2e18c2e --- /dev/null +++ b/tests/widgets/test_widgets_msi.py @@ -0,0 +1,65 @@ +import pytest + +from gopro_overlay.dimensions import Dimension +from gopro_overlay.point import Coordinate +from gopro_overlay.widgets.asi import AirspeedIndicator +from gopro_overlay.widgets.msi import MotorspeedIndicator +from gopro_overlay.widgets.widgets import Translate +from tests.widgets import test_widgets_setup +from tests.approval import approve_image +from tests.widgets.test_widgets import time_rendering + +font = test_widgets_setup.font +ts = test_widgets_setup.ts + + +@pytest.mark.gfx +@approve_image +def test_gauge(): + size = 256 + return time_rendering( + name="test_gauge", + dimensions=Dimension(size, size), + widgets=[ + MotorspeedIndicator( + size=size, font=font, green=40, yellow=46, end=200, + needle=1, + reading=lambda: 125 + ) + ] + ) + + +@pytest.mark.gfx +@approve_image +def test_gauge_rotate_90(): + size = 256 + return time_rendering( + name="test_gauge_rotate_90", + dimensions=Dimension(size, size), + widgets=[ + MotorspeedIndicator( + size=size, font=font, green=40, yellow=46, end=200, + needle=1, + rotate=90, + reading=lambda: 125 + ) + ] + ) + + +@pytest.mark.gfx +@approve_image +def test_no_needle(): + size = 256 + return time_rendering( + name="test_gauge", + dimensions=Dimension(size, size), + widgets=[ + MotorspeedIndicator( + size=size, font=font, green=40, yellow=46, end=200, + needle=0, + reading=lambda: 125 + ) + ] + )