feat: refine vehicle console and self-repair workflow
This commit is contained in:
@@ -47,6 +47,49 @@ class FrontendVehicleStateSyncContractTests(unittest.TestCase):
|
||||
self.extension_source,
|
||||
)
|
||||
|
||||
def test_shared_twin_theme_tracks_demo_role_and_extension_is_always_user(self) -> None:
|
||||
self.assertIn("function applyTwinSceneTheme(", self.app_source)
|
||||
self.assertIn('canvas.dataset.themeRole = themeRole', self.app_source)
|
||||
self.assertIn(
|
||||
'canvas.dataset.themeAccent = `#${palette.accent.toString(16).padStart(6, "0")}`',
|
||||
self.app_source,
|
||||
)
|
||||
self.assertIn("accent: 0x0e7773", self.app_source)
|
||||
self.assertIn("accent: 0x315eaa", self.app_source)
|
||||
self.assertIn(
|
||||
'if (document.body.dataset.module === "self-extension") return "user"',
|
||||
self.app_source,
|
||||
)
|
||||
self.assertIn(
|
||||
'const themeRole = document.body.dataset.module === "self-extension"',
|
||||
self.app_source,
|
||||
)
|
||||
self.assertIn(
|
||||
'window.addEventListener("cognitive-agent:demo-role-change"',
|
||||
self.app_source,
|
||||
)
|
||||
|
||||
def test_shared_twin_ground_uses_theme_radial_alpha_texture(self) -> None:
|
||||
self.assertIn("function createTwinGroundTexture(", self.app_source)
|
||||
self.assertIn("new THREE.PlaneGeometry(30, 30)", self.app_source)
|
||||
self.assertIn(
|
||||
'surfaceGradient.addColorStop(0, "rgba(255, 255, 255, 1)")',
|
||||
self.app_source,
|
||||
)
|
||||
self.assertIn(
|
||||
'surfaceGradient.addColorStop(1, "rgba(255, 255, 255, 0)")',
|
||||
self.app_source,
|
||||
)
|
||||
self.assertIn("const outerRadius = size * 0.48", self.app_source)
|
||||
self.assertIn(
|
||||
"const gridColor = accent.clone().lerp(new THREE.Color(0xffffff), 0.52)",
|
||||
self.app_source,
|
||||
)
|
||||
self.assertIn("gridContext.lineWidth = major ? 0.9 : 0.45", self.app_source)
|
||||
self.assertIn('gridContext.globalCompositeOperation = "destination-in"', self.app_source)
|
||||
self.assertIn("applyTwinGroundTheme(twin, palette)", self.app_source)
|
||||
self.assertNotIn("new THREE.GridHelper(10, 20", self.app_source)
|
||||
|
||||
def test_lan_http_origin_does_not_require_crypto_random_uuid(self) -> None:
|
||||
id_source = function_source(
|
||||
self.app_source,
|
||||
|
||||
@@ -4,6 +4,8 @@ import json
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from cognitive_agent.application.self_repair.healing_model import (
|
||||
PHASE_DIAGNOSED,
|
||||
PHASE_INJECTED,
|
||||
@@ -75,6 +77,30 @@ def test_service_is_safe_without_machine_specific_tool_paths() -> None:
|
||||
assert service.run_self_test() is True
|
||||
|
||||
|
||||
def test_runtime_must_start_before_fault_injection() -> None:
|
||||
service = SelfRepairService()
|
||||
|
||||
with pytest.raises(ValueError, match="请先启动座椅连续运行"):
|
||||
service.start_healing({
|
||||
"case_id": "FI-FIELD-01",
|
||||
"execution_mode": "shadow",
|
||||
})
|
||||
|
||||
runtime = service.set_runtime({"active": True, "execution_mode": "shadow"})
|
||||
assert runtime["active"] is True
|
||||
assert runtime["motion_profile"] == "四电机协同自由运动"
|
||||
assert runtime["events"][0]["title"] == "座椅自由运动任务已启动"
|
||||
|
||||
healing = service.start_healing({
|
||||
"case_id": "FI-FIELD-01",
|
||||
"execution_mode": "shadow",
|
||||
})
|
||||
assert healing["case_id"] == "FI-FIELD-01"
|
||||
|
||||
snapshot = service.snapshot()
|
||||
assert snapshot["runtime"]["injected_count"] == 1
|
||||
|
||||
|
||||
def test_bridge_manager_does_not_arm_visible_tooling_by_default(tmp_path: Path) -> None:
|
||||
manager = ZcanBridgeManager(
|
||||
tmp_path / "bridge.json",
|
||||
|
||||
Reference in New Issue
Block a user