mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-10-28 17:13:54 +08:00
Type Ford CAN and developer panel test fixtures
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
"""Both actual Developer panels expose only qualified Ford release opt-in."""
|
||||
from tempfile import TemporaryDirectory
|
||||
from types import SimpleNamespace
|
||||
from typing import Any
|
||||
from unittest.mock import patch
|
||||
import pytest
|
||||
from opendbc.car import gen_empty_fingerprint
|
||||
@@ -18,17 +17,19 @@ def panel_for(module, cp, params):
|
||||
ui = SimpleNamespace(CP=cp.as_reader(), params=params, is_release=True, engaged=False, has_longitudinal_control=False,
|
||||
is_offroad=lambda: True, update_params=lambda: None)
|
||||
layout = large.DeveloperLayout if module is large else compact.DeveloperLayoutMici
|
||||
panel: Any = layout.__new__(layout)
|
||||
panel._alpha_long_toggle = Toggle()
|
||||
panel._alpha_long_toggle.title, panel._alpha_long_toggle.description = 'Alpha Long', 'Existing alpha confirmation'
|
||||
panel._long_maneuver_toggle = Toggle()
|
||||
panel._lat_maneuver_toggle = Toggle()
|
||||
panel = layout.__new__(layout)
|
||||
alpha = Toggle()
|
||||
alpha.title, alpha.description = 'Alpha Long', 'Existing alpha confirmation'
|
||||
attributes: list[tuple[str, object]] = [('_alpha_long_toggle', alpha), ('_long_maneuver_toggle', Toggle()),
|
||||
('_lat_maneuver_toggle', Toggle())]
|
||||
if module is large:
|
||||
panel._params, panel._is_release = params, True
|
||||
for name in ('_joystick_toggle', '_adb_toggle', '_ssh_toggle', '_ui_debug_toggle', '_cellular_disabled_toggle'):
|
||||
setattr(panel, name, Toggle())
|
||||
attributes.extend((('_params', params), ('_is_release', True)))
|
||||
attributes.extend((name, Toggle()) for name in
|
||||
('_joystick_toggle', '_adb_toggle', '_ssh_toggle', '_ui_debug_toggle', '_cellular_disabled_toggle'))
|
||||
else:
|
||||
panel._refresh_toggles = (('AlphaLongitudinalEnabled', panel._alpha_long_toggle),)
|
||||
attributes.append(('_refresh_toggles', (('AlphaLongitudinalEnabled', alpha),)))
|
||||
for name, value in attributes:
|
||||
setattr(panel, name, value)
|
||||
return panel, ui
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user