feat(n7web): add pet settings and day night themes

This commit is contained in:
Miayui
2026-09-14 17:12:08 +08:00
parent aa6f59d3a6
commit 58f1a2da42
13 changed files with 901 additions and 114 deletions
@@ -47,14 +47,16 @@ class FrontendVehicleStateSyncContractTests(unittest.TestCase):
self.extension_source,
)
def test_shared_twin_theme_is_fixed_to_user(self) -> None:
def test_shared_twin_theme_tracks_persistent_day_and_night_mode(self) -> None:
self.assertIn("function applyTwinSceneTheme(", self.app_source)
self.assertIn('canvas.dataset.themeRole = "user"', self.app_source)
self.assertIn("function currentTwinThemeRole()", self.app_source)
self.assertIn("function currentTwinThemePalette()", self.app_source)
self.assertIn("canvas.dataset.themeRole = role", self.app_source)
self.assertIn(
'canvas.dataset.themeAccent = `#${palette.accent.toString(16).padStart(6, "0")}`',
self.app_source,
)
for glass_theme_token in (
for night_theme_token in (
"accent: 0x7b70f5",
"sceneBackground: 0x111426",
"floor: 0x1a2038",
@@ -64,7 +66,20 @@ class FrontendVehicleStateSyncContractTests(unittest.TestCase):
"glass: 0x4d8ed2",
"lamp: 0x4385cf",
):
self.assertIn(glass_theme_token, self.app_source)
self.assertIn(night_theme_token, self.app_source)
for day_theme_token in (
"accent: 0x2f80ed",
"sceneBackground: 0xeff6ff",
"floor: 0xe5f0fd",
"vehicleBody: 0x91c6f5",
"vehicleOutline: 0x2879d8",
"seatShell: 0x2b76c9",
"glass: 0x4b9bea",
"lamp: 0x2e7fd4",
):
self.assertIn(day_theme_token, self.app_source)
self.assertIn('"cognitive-agent:theme-change"', self.app_source)
self.assertIn("applyTwinReferenceVehicleTheme(twin.referenceVehicle, palette)", self.app_source)
self.assertNotIn("accent: 0x0e7773", self.app_source)
self.assertNotIn("cognitive-agent:demo-role-change", self.app_source)