Skip to content

Commit

Permalink
add tests for msi widget
Browse files Browse the repository at this point in the history
  • Loading branch information
time4tea committed Feb 10, 2024
1 parent 882e012 commit 356e98b
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions tests/widgets/test_widgets_msi.py
Original file line number Diff line number Diff line change
@@ -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
)
]
)

0 comments on commit 356e98b

Please sign in to comment.