fix(modes): only activate peripherals and show individual seat actions

This commit is contained in:
Miayui
2026-09-22 13:34:29 +08:00
parent 6b9ee0f349
commit 2b365b3922
21 changed files with 176 additions and 215 deletions
+26 -6
View File
@@ -55,9 +55,9 @@ def action(capability, parameters, zone="driver"):
@pytest.mark.parametrize(
("parameters", "expected"),
[
({"state": "on", "level": 1}, "开启 · 高档"),
({"state": "on", "level": 2}, "开启 · 低档"),
({"state": "on"}, "开启 · 低档"),
({"state": "on", "level": 1}, "开启 · 3档(高)"),
({"state": "on", "level": 2}, "开启 · 1档(低)"),
({"state": "on"}, "开启 · 1档(低)"),
({"state": "off", "level": 1}, "关闭"),
],
)
@@ -135,7 +135,7 @@ def test_position_and_power_rows_keep_existing_values(render_rows):
action("seat.set_ventilation", {"state": "off", "level": 2}, "passenger"),
])
assert [(row["label"], row["value"]) for row in rows] == [
("副驾靠背角度", "81%(150°)"),
("副驾靠背位置", "81%(150°)"),
("氛围灯", "关闭"),
("副驾座椅通风", "关闭"),
]
@@ -193,7 +193,7 @@ def test_mode_preview_localizes_external_device_name_and_action_parameters(rende
assert "infrared.emit" not in json.dumps(rows, ensure_ascii=False)
def test_default_bundle_rows_show_power_window_and_grouped_passenger_comfort(render_rows):
def test_default_bundle_rows_show_each_passenger_action_separately(render_rows):
rows = render_rows([
action("climate.set_power", {"state": "on"}, "vehicle"),
action("window.set_position", {"position_pct": 0}, "front_left"),
@@ -205,5 +205,25 @@ def test_default_bundle_rows_show_power_window_and_grouped_passenger_comfort(ren
assert [(row["label"], row["value"]) for row in rows] == [
("空调电源", "开启"),
("主驾车窗", "完全关闭(目标开度 0%)"),
("副驾座椅舒适模式", "通风开启 1档 · 靠背 45% · 腿托 35%"),
("副驾座椅通风", "开启 · 1档"),
("副驾靠背位置", "45%"),
("副驾腿托位置", "35%"),
]
def test_cinema_draft_shows_all_four_axes_and_ventilation(render_rows):
actions = [
action("seat.set_longitudinal_position", {"position_pct": 51}, "passenger"),
action("seat.set_cushion_tilt", {"position_pct": 30}, "passenger"),
action("seat.set_backrest_recline", {"position_pct": 44}, "front_right"),
action("seat.set_legrest_height", {"position_pct": 53}, "front_right"),
action("seat.set_ventilation", {"state": "off"}, "passenger"),
]
rows = render_rows(actions, "进入浪漫影院模式")
assert [(row["label"], row["value"]) for row in rows] == [
("副驾座椅前后位置", "51%"),
("副驾坐垫位置", "30%"),
("副驾靠背位置", "44%"),
("副驾腿托位置", "53%"),
("副驾座椅通风", "关闭"),
]