fix: use live V2X vehicles only in preview

This commit is contained in:
2026-08-24 14:42:31 +08:00
parent ee273c5cd6
commit b7031f145a
10 changed files with 240 additions and 52 deletions

View File

@@ -267,7 +267,8 @@ assert.match(html, /id="semanticToggles" class="control-subgroup hidden"/);
const previewRuntime = fs.readFileSync(path.join(__dirname, "lib", "cesium-preview.js"), "utf8");
const v2xRuntime = fs.readFileSync(path.join(__dirname, "lib", "v2x-cesium-overlay.js"), "utf8");
const buildAreaSource = fs.readFileSync(path.join(__dirname, "build-area.js"), "utf8");
assert.match(buildAreaSource, /vehicleModelNames\.map\(\(name\) => `_preview\/\$\{name\}`\)/);
assert.match(buildAreaSource, /const vehicleModelNames = \[\];/);
assert.doesNotMatch(buildAreaSource, /buildNativeTrafficSimulation/);
const countdownFont = path.join(__dirname, "..", "assets", "fonts", "7LED-1.ttf");
assert.ok(fs.existsSync(countdownFont), "7LED countdown font must be versioned with the project");
assert.doesNotMatch(previewRuntime, /cylinder: \{ length: 6\.7/);
@@ -278,7 +279,11 @@ assert.match(v2xRuntime, /\/facilities\/api\/sys\/login/);
assert.match(v2xRuntime, /sessionStorage/);
assert.match(v2xRuntime, /GCJ-02 -> WGS84 once/);
assert.match(v2xRuntime, /\/network\/ws\/network\/signal/);
assert.match(v2xRuntime, /\/network\/ws\/network\/obuPosition/);
assert.match(v2xRuntime, /\/network\/ws\/network\/targetPosition/);
assert.match(v2xRuntime, /gcj02ToWgs84/);
assert.match(previewRuntime, /createLiveVehicleState\(\)/);
assert.doesNotMatch(previewRuntime, /const cruise = addVehicleCruises\(/);
assert.match(previewRuntime, /new Cesium\.ScreenSpaceEventHandler/);
assert.match(previewRuntime, /vehicleId: record\.id/);
assert.match(previewRuntime, /status === "breakdown"\s+\? "vehicle-breakdown\.png"/);
@@ -289,9 +294,7 @@ assert.match(previewRuntime, /\(\) => record\?\.status === "normal"/);
assert.match(previewRuntime, /Cesium\.SceneTransforms\.worldToWindowCoordinates/);
assert.match(previewRuntime, /TrafficSignalDynamic_/);
assert.match(previewRuntime, /TrafficSignalDynamic_\$\{nodeKey\}_countdown_\$\{String\(value\)\.padStart\(2, "0"\)\}/);
assert.match(previewRuntime, /native-preview-traffic-simulation\/v1/);
assert.match(previewRuntime, /leader-gap/);
assert.match(previewRuntime, /stopReason = "traffic-signal"/);
assert.doesNotMatch(previewRuntime, /native-preview-traffic-simulation\/v1/);
assert.match(previewRuntime, /ColorBlendMode\.REPLACE/);
assert.match(previewRuntime, /setBuildingGhost/);
assert.match(previewRuntime, /fetch\(url, \{ cache: "no-store" \}\)/);