Align runtime test fixtures with current presentation and planner inputs

This commit is contained in:
firestar5683
2026-11-11 20:29:45 -06:00
parent f1ceae914a
commit fbaddd5ddd
19 changed files with 78 additions and 19 deletions
@@ -23483,3 +23483,10 @@ msgstr "Totwinkelwarnung bei deaktivierter Querführung"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Warns when signaling toward a detected blind-spot vehicle with steering assistance off or paused. Independent of Loud Blindspot Alert. Hazards do not trigger it."
msgstr "Warnt beim Blinken in Richtung eines erkannten Fahrzeugs im toten Winkel, wenn die Lenkunterstützung ausgeschaltet oder pausiert ist. Unabhängig von der Lauten Totwinkelwarnung. Die Warnblinkanlage löst sie nicht aus."
msgid "Improves stopping behavior at traffic lights and enables automatic stopping at detected stop signs. Press the accelerator to continue."
msgstr "Verbessert das Anhalten an Ampeln und ermöglicht automatisches Anhalten an erkannten Stoppschildern. Zum Weiterfahren das Gaspedal betätigen."
msgid "Enhanced Stops"
msgstr "Verbessertes Anhalten"
@@ -23483,3 +23483,10 @@ msgstr "Alerta de punto ciego con control lateral desactivado"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Warns when signaling toward a detected blind-spot vehicle with steering assistance off or paused. Independent of Loud Blindspot Alert. Hazards do not trigger it."
msgstr "Advierte al señalizar hacia un vehículo detectado en el punto ciego con la asistencia de dirección desactivada o en pausa. Es independiente de la Alerta fuerte de punto ciego. Los intermitentes de emergencia no la activan."
msgid "Improves stopping behavior at traffic lights and enables automatic stopping at detected stop signs. Press the accelerator to continue."
msgstr "Mejora la detención en los semáforos y permite detenerse automáticamente ante las señales de stop detectadas. Pisa el acelerador para continuar."
msgid "Enhanced Stops"
msgstr "Paradas mejoradas"
@@ -23483,3 +23483,10 @@ msgstr "Alerte d’angle mort lorsque le contrôle latéral est désactivé"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Warns when signaling toward a detected blind-spot vehicle with steering assistance off or paused. Independent of Loud Blindspot Alert. Hazards do not trigger it."
msgstr "Émet un avertissement si vous signalez un changement de direction vers un véhicule détecté dans l’angle mort alors que l’assistance de direction est désactivée ou en pause. Indépendant de l’Alerte sonore forte d’angle mort. Les feux de détresse ne la déclenchent pas."
msgid "Improves stopping behavior at traffic lights and enables automatic stopping at detected stop signs. Press the accelerator to continue."
msgstr "Améliore les arrêts aux feux et permet l’arrêt automatique aux panneaux stop détectés. Appuyez sur l’accélérateur pour repartir."
msgid "Enhanced Stops"
msgstr "Arrêts améliorés"
@@ -23479,3 +23479,10 @@ msgstr "横方向支援オフ時の死角警告"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Warns when signaling toward a detected blind-spot vehicle with steering assistance off or paused. Independent of Loud Blindspot Alert. Hazards do not trigger it."
msgstr "ステアリング支援がオフまたは一時停止中に、検出された死角の車両の方向へウインカーを出すと警告します。大きな死角警告とは独立しています。ハザードランプでは作動しません。"
msgid "Improves stopping behavior at traffic lights and enables automatic stopping at detected stop signs. Press the accelerator to continue."
msgstr "信号での停止動作を改善し、検出した一時停止標識で自動停止します。発進するにはアクセルを踏んでください。"
msgid "Enhanced Stops"
msgstr "停止機能の強化"
@@ -23479,3 +23479,10 @@ msgstr "횡방향 제어 꺼짐 시 사각지대 경고"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Warns when signaling toward a detected blind-spot vehicle with steering assistance off or paused. Independent of Loud Blindspot Alert. Hazards do not trigger it."
msgstr "조향 보조가 꺼져 있거나 일시 정지된 상태에서 감지된 사각지대 차량 쪽으로 방향지시등을 켜면 경고합니다. 큰 사각지대 경고음과 별개입니다. 비상등은 경고를 작동시키지 않습니다."
msgid "Improves stopping behavior at traffic lights and enables automatic stopping at detected stop signs. Press the accelerator to continue."
msgstr "신호등에서의 정차 동작을 개선하고 감지된 정지 표지판에서 자동으로 정차합니다. 출발하려면 가속 페달을 밟으세요."
msgid "Enhanced Stops"
msgstr "향상된 정차"
@@ -23479,3 +23479,10 @@ msgstr "Cảnh báo điểm mù khi tắt hỗ trợ lái ngang"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Warns when signaling toward a detected blind-spot vehicle with steering assistance off or paused. Independent of Loud Blindspot Alert. Hazards do not trigger it."
msgstr "Cảnh báo khi bật xi nhan về phía xe được phát hiện trong điểm mù lúc hỗ trợ đánh lái đang tắt hoặc tạm dừng. Độc lập với Cảnh báo điểm mù âm lượng lớn. Đèn cảnh báo nguy hiểm không kích hoạt tính năng này."
msgid "Improves stopping behavior at traffic lights and enables automatic stopping at detected stop signs. Press the accelerator to continue."
msgstr "Cải thiện cách dừng xe tại đèn giao thông và cho phép tự động dừng tại biển dừng được phát hiện. Nhấn bàn đạp ga để tiếp tục."
msgid "Enhanced Stops"
msgstr "Dừng xe nâng cao"
@@ -89,14 +89,14 @@ for (const invalid of [null, {}, { ...choice, version: true }, { ...choice, vali
function instance() {
const vm = { ...FlmPage.data(), activePage: true, mode: "local", unauthorized: () => vm.auth++, auth: 0,
poller: { stop() {} } }
poller: { stop() {} }, $nextTick: callback => Promise.resolve().then(callback) }
for (const [name, method] of Object.entries(FlmPage.methods)) vm[name] = method.bind(vm)
for (const [name, method] of Object.entries(FlmPage.computed)) Object.defineProperty(vm, name, { get: () => method.call(vm) })
return vm
}
const originalFetch = globalThis.fetch, originalDocument = globalThis.document
try {
globalThis.document = { hidden: false, addEventListener() {}, removeEventListener() {} }
globalThis.document = { getElementById: () => null, hidden: false, addEventListener() {}, removeEventListener() {} }
const mounted = instance()
mounted.load = () => {}
FlmPage.mounted.call(mounted)
@@ -122,9 +122,9 @@ try {
const focused = []
const event = { key: 'ArrowRight', preventDefault() {}, currentTarget: { parentElement: { querySelectorAll: () =>
['overview', 'tune', 'activity', 'plots'].map(name => ({ focus: () => focused.push(name) })) } } }
vm.tabKey(event); assert.equal(vm.view, 'tune'); assert.deepEqual(focused, ['tune'])
event.key = 'End'; vm.tabKey(event); assert.equal(vm.view, 'plots')
event.key = 'Home'; vm.tabKey(event); assert.equal(vm.view, 'overview')
vm.tabKey(event); await Promise.resolve(); assert.equal(vm.view, 'tune'); assert.deepEqual(focused, ['tune'])
event.key = 'End'; vm.tabKey(event); await Promise.resolve(); assert.equal(vm.view, 'plots')
event.key = 'Home'; vm.tabKey(event); await Promise.resolve(); assert.equal(vm.view, 'overview')
globalThis.fetch = async () => { throw new TypeError("offline") }
await vm.load(); assert(!vm.currentApplied); assert.equal(vm.report, value)
globalThis.fetch = async () => ({ ok: false, status: 401, json: async () => ({ error: "Sign in" }) })
@@ -140,6 +140,6 @@ try {
console.log("Auto Learn canonical routing, exact full30 data, missing/stale application, auth and cancellation contracts passed")
assert.doesNotMatch(FlmPage.template, /Steering settings|One change\. A fair comparison\.|Comparable driving windows establish/)
assert.match(FlmPage.template, /Tuning and Analysis/)
assert.match(FlmPage.template, /<h2>Your steering<\/h2>/)
assert.match(FlmPage.template, /<PlotsPage[^>]+:active="view === 'plots'"[^>]+embedded/)
assert.doesNotMatch(FlmPage.template, /gx-tuner__plots-link/)
@@ -159,6 +159,7 @@ class TestOffroadConfigurationPages(unittest.TestCase):
self.assert_no_car_cache()
def test_saved_configuration_cruise_force_stop_and_wheel_edits(self):
self.params.put_bool("ForceStops", False, block=True)
selection = self.params.get('VehicleSelection')
profiles = self.page('profiles')
rows = {row['label']: row for row in profiles['rows']}
@@ -149,11 +149,12 @@ def test_manual_descriptions_explain_direction_dependencies_and_pid_limits():
def test_alpha_longitudinal_has_one_plain_description(monkeypatch):
from types import SimpleNamespace
from typing import cast
from openpilot.starpilot.ui import feature_settings_owner as owner_module
monkeypatch.setattr(owner_module, 'read_saved', lambda *args: (b'0', True))
owner = SimpleNamespace(_alpha_long_capability=lambda: ('qualified',), params=object(),
authority=lambda name: True, vehicle_fingerprint=lambda: 'HYUNDAI_IONIQ_6')
row = owner_module.FeatureSettingsOwner._alpha_long_rows(owner, True)[0]
row = owner_module.FeatureSettingsOwner._alpha_long_rows(cast(owner_module.FeatureSettingsOwner, owner), True)[0]
expected = ('Let StarPilot control acceleration and braking instead of factory ACC. ' +
'Takes effect next drive. May disable factory Automatic Emergency Braking.')
assert description(row) == expected
@@ -14,6 +14,7 @@ def attach_inputs(controls):
inputs.messages = lambda: controls.sm
inputs.takeoff_preferences = None
inputs.faster_takeoffs = False
inputs.force_stop_distance_braking = False
for name in ('ev9_long_enabled', 'blended_longitudinal_enabled', 'toyota_sienna_replay', 'toyota_sienna_production', 'toyota_corolla_stop',
'ioniq6_start_enabled', 'gm_start_enabled', 'gm_volt_enabled', 'gm_euv_enabled',
'gm_cc_enabled', 'gm_cc_stop_enabled', 'gm_ascm_enabled', 'gm_suburban_enabled'):
@@ -41,7 +41,7 @@ class TestLaboratoryFrame(unittest.TestCase):
from types import SimpleNamespace
source = Path(__file__).resolve().parents[3] / "selfdrive/modeld/modeld.py"
main = next(node for node in ast.parse(source.read_text()).body if isinstance(node, ast.FunctionDef) and node.name == "main")
assignments = [node for node in ast.walk(main) if isinstance(node, ast.Assign) and
assignments: list[ast.stmt] = [node for node in ast.walk(main) if isinstance(node, ast.Assign) and
any(isinstance(target, ast.Name) and target.id in ("turn_models", "turn_supported") for target in node.targets)]
caller = compile(ast.fix_missing_locations(ast.Module(body=assignments, type_ignores=[])), str(source), "exec")
def supported(model):
@@ -1,4 +1,5 @@
from dataclasses import replace
from typing import Any, cast
from unittest.mock import Mock, patch
from openpilot.starpilot.models.catalog import BUNDLED_CURRENT, model_entries
@@ -21,14 +22,14 @@ def test_actual_pair_status_reaches_home_and_galaxy_and_expires():
patch.object(source, 'laboratory_configuration', return_value=config), \
patch('openpilot.starpilot.models.runtime.process_start_ticks', return_value=54321), \
patch('openpilot.starpilot.models.runtime.read_pair_receipt', return_value=load) as receipt:
status = source.json()['laboratory']
status = cast(dict[str, Any], source.json())['laboratory']
assert status['active'] and status['pendingNextStart']
assert (status['lateralModel'], status['longitudinalModel']) == tuple(ids)
assert '/' in source.home_label()
sm.valid['drivingModelData'] = False
assert source.json()['laboratory']['health'] == 'stale'
assert cast(dict[str, Any], source.json())['laboratory']['health'] == 'stale'
assert source.home_label() == '/'.join(model_display_text(model_entries()[mid].name) for mid in reversed(ids))
sm.valid['drivingModelData'] = True
receipt.return_value = replace(load, process_start_ticks=99999)
assert not source.json()['laboratory']['active']
assert not cast(dict[str, Any], source.json())['laboratory']['active']
assert '/' in source.home_label()
@@ -328,6 +328,7 @@ class AppearanceSettingsTests(unittest.TestCase):
def test_stock_confidence_rail_requires_fresh_source_and_road_camera(self):
from openpilot.starpilot.ui.appearance_preferences import CameraViewChoice
view = onroad.OnroadView.__new__(onroad.OnroadView)
view._fade = Mock()
view.personality = Mock()
view.navigation = Mock()
view.background_layer = None
@@ -628,6 +629,7 @@ class AppearanceSettingsTests(unittest.TestCase):
self.assertAlmostEqual(y, 86.07, places=2)
for profile in (Profile.LARGE, Profile.COMPACT):
view = onroad.OnroadView.__new__(onroad.OnroadView)
view._fade = Mock()
view.personality = Mock()
view.navigation = Mock()
view.background_layer = None
@@ -72,6 +72,7 @@ class DeveloperPreviewRenderTests(unittest.TestCase):
for profile in (Profile.LARGE, Profile.COMPACT):
with self.subTest(profile=profile):
view = OnroadView.__new__(OnroadView)
view._fade = Mock()
view.personality = Mock()
fonts = Mock()
fonts.profile = profile
@@ -111,6 +112,7 @@ class DeveloperPreviewRenderTests(unittest.TestCase):
def test_large_nonalert_draws_canonical_gauge_and_preview_labels_without_real_curve(self):
view = OnroadView.__new__(OnroadView)
view._fade = Mock()
view.personality = Mock()
fonts = Mock()
fonts.profile = Profile.LARGE
@@ -419,6 +419,7 @@ class FeatureSettingsOwnerTests(unittest.TestCase):
self.assertIsNone(self.params.get("QOLLongitudinal"))
def test_force_stop_preserves_cruise_master_and_offset_bounds(self):
self.params.put_bool("ForceStops", False, block=True)
self.assertTrue(self._row("profiles", "ForceStops").available)
self.params.put_bool("QOLLongitudinal", True, block=True)
force = self._row("profiles", "ForceStops")
@@ -1,9 +1,11 @@
from types import SimpleNamespace
from unittest.mock import Mock
from typing import cast
from unittest.mock import Mock, patch
from openpilot.starpilot.models.catalog import model_entries, BUNDLED_CURRENT
from openpilot.starpilot.models.status import ModelStatus, ModelHealth
from openpilot.starpilot.ui.home import HomeView
from openpilot.starpilot.ui.home_state import HomeState
from openpilot.starpilot.ui.models_state import home_model_label, model_display_text
@@ -22,7 +24,7 @@ def test_compact_keeps_both_names_inside_the_model_row():
view = HomeView.__new__(HomeView)
view._text = Mock()
view._icon = Mock()
view._measure = lambda text, role, size: SimpleNamespace(width=len(text) * size * .6)
measure = Mock(side_effect=lambda text, role, size: SimpleNamespace(width=len(text) * size * .6))
state = SimpleNamespace(version="7", branch="Dom", commit_date="", model_label="A" * 60 + "/" + "B" * 60,
network="none", network_strength=0)
# Stop after rendering the header; later sections need unrelated home state.
@@ -30,11 +32,12 @@ def test_compact_keeps_both_names_inside_the_model_row():
pass
view._icon.side_effect = EndHeader
try:
view._compact(state)
with patch.object(view, "_measure", measure):
view._compact(cast(HomeState, state))
except EndHeader:
pass
drawn = next(call.args for call in view._text.call_args_list if len(call.args) > 4 and call.args[4] == 140)
text, role, size, x, y, color = drawn
assert text.startswith("A") and "/B" in text
assert "Lateral" not in text and "Longitudinal" not in text
assert view._measure(text, role, size).width <= 520
assert measure(text, role, size).width <= 520
@@ -1,3 +1,4 @@
from dataclasses import replace
from types import SimpleNamespace
import unittest
from unittest.mock import Mock
@@ -30,7 +31,9 @@ class TestOnroadLeafScope(unittest.TestCase):
ui.params.values["ShowCSCStatus"] = str(frame % 2)
expected = full.build(ShellMode.ONROAD, now_ns=now)
actual = view.build(ShellMode.ONROAD, now_ns=now, onroad_view_only=True)
self.assertEqual(actual.onroad, expected.onroad)
self.assertEqual(actual.onroad.developer_metrics, ())
self.assertTrue(expected.onroad.developer_metrics)
self.assertEqual(actual.onroad, replace(expected.onroad, developer_metrics=()))
self.assertEqual(actual.home, expected.home)
self.assertEqual(actual.settings, expected.settings)
self.assertEqual(actual.device.offroad, expected.device.offroad)
@@ -45,7 +48,9 @@ class TestOnroadLeafScope(unittest.TestCase):
full = adapter.build(ShellMode.ONROAD, now_ns=NOW)
self.assertNotEqual(narrow.device.dongle_id, full.device.dongle_id)
self.assertEqual(full.device.dongle_id, "actual-device")
self.assertEqual(narrow.onroad, full.onroad)
self.assertEqual(narrow.onroad.developer_metrics, ())
self.assertTrue(full.onroad.developer_metrics)
self.assertEqual(narrow.onroad, replace(full.onroad, developer_metrics=()))
live = adapter.build(ShellMode.ONROAD, now_ns=NOW + 1, onroad_view_only=True)
self.assertEqual(live.onroad.observed_ns, NOW + 1)
self.assertEqual(narrow.onroad.observed_ns, NOW)
@@ -86,6 +86,6 @@ def test_vision_sign_and_slc_cap_use_configured_units_without_rewriting_set(prof
texts = render(output.message.slcState, car.vCruise)
assert str(number) in texts
assert str(round(90. if metric else 90. * CV.KPH_TO_MPH)) in texts
assert 'SET' in texts
assert ('SET' if profile == Profile.LARGE else 'MAX') in texts
assert ('SET IS LOW' in texts) == set_is_low
assert ('RAISE SET' in texts) == set_is_low
+1 -1
View File
@@ -1 +1 @@
{"protected_inventory_sha256": "76c34c188a169a4f52fd90347885da5e30b219d17f1f51bb278e3f32d3538df2", "schema_version": 1}
{"protected_inventory_sha256": "856baef0fe09a0676da055fec208181f30db2f6157559422535d69e44f24f578", "schema_version": 1}