Files
StarPilot/openpilot/starpilot/ui/tests/test_speed_font_roles.py
T
firestar5683 a82935f326 User interfaces and Android Auto
Integrate onroad views, configurable widgets, local settings, steering-profile contracts, Bluetooth and Android Auto with their device and runtime services.

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
Co-authored-by: Daniel Koepping <elkoled@gmail.com>
Co-authored-by: Danny <dannyirwin31@yahoo.com>
Co-authored-by: DimitriChrysafis <Dimitri.chrysafis@gmail.com>
Co-authored-by: Dom <168790843+firestar5683@users.noreply.github.com>
Co-authored-by: Harald Schäfer <harald.the.engineer@gmail.com>
Co-authored-by: Prabhaav Pillai <prabhaav@msu.edu>
Co-authored-by: Shane Smiskol <shane@smiskol.com>
Co-authored-by: dirwin31 <83434411+dirwin31@users.noreply.github.com>
Co-authored-by: firestarsdog <229254897+firestarsdog@users.noreply.github.com>
Co-authored-by: stef <19478336+stefpi@users.noreply.github.com>
Co-authored-by: whoisdomi <dcantu83@gmail.com>

Co-authored-by: Intelli <contact@intelli.software>
Co-authored-by: pharmacomaniac <blittle65@gmail.com>

Co-authored-by: prabhaavp <prabhaav@msu.edu>
2026-10-14 20:02:39 -05:00

21 lines
1.0 KiB
Python

from openpilot.starpilot.ui.presentation import BitmapFonts, FontRole, Profile, font_filename
def test_compact_set_speed_uses_custom_face_without_changing_current_speed():
assert font_filename(Profile.COMPACT, FontRole.SET_SPEED) == "DINish-Speed.fnt"
assert font_filename(Profile.COMPACT, FontRole.SPEED) == "Inter-Bold.fnt"
assert font_filename(Profile.COMPACT, FontRole.DISPLAY) == "Inter-Bold.fnt"
assert font_filename(Profile.COMPACT, FontRole.SEMI_BOLD) == "Inter-SemiBold.fnt"
def test_speed_optical_style_is_scoped_to_requested_faces():
fonts = BitmapFonts.__new__(BitmapFonts)
fonts.profile = Profile.LARGE
assert fonts._optical_style(FontRole.SPEED) == (1.04, .85)
assert fonts._optical_style(FontRole.BRAND) == (1., 0.)
fonts.profile = Profile.COMPACT
assert fonts._optical_style(FontRole.SET_SPEED) == (1., .65)
assert fonts._optical_style(FontRole.SPEED) == (1., 0.)
assert fonts._optical_style(FontRole.DISPLAY) == (1., 0.)
assert fonts._optical_style(FontRole.SET_SPEED, fallback=True) == (1., 0.)