Follow through the camera port in the remaining tests

- The tests that faked a follow by setting the viewer's tracked entity,
  or by raising its change event, follow through the camera port
  (followEntity, or a port with follow and followChanged), and check
  followedOf: camera handoffs, globe rotation, tilt, ground guard,
  vessels, ALPR, CCTV, Contacts, radio, orientation, share links and
  follow offsets, the tracked readout and the shell's camera listeners.
- The fake Cesium camera port delivers followChanged from the port itself.
- A ride handed to another aircraft is adopted by the follow's change, as
  the application does, not by the test calling the adoption.
- The unbound-factory record lists the scene, the map defaults, share
  restoration and the World Packet as entries whose caller loads the
  factories; the map startup test stubs the default renderer load.
This commit is contained in:
Sameh Khamis committed 2026-11-10 18:10:14 -08:00
1 parent 9a13aeab48
commit 1fbe546531
21 files changed
+476 -148

No files matched your search

+10 -3
View File
@@ -3,7 +3,10 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
import * as Cesium from 'cesium';
import { bindFakeCesiumCamera } from '../testSupport/fakeCameraPort.mjs';
import {
bindFakeCesiumCamera,
followEntity,
} from '../testSupport/fakeCameraPort.mjs';
import { fakeScenePorts } from '../testSupport/fakeCesiumScene.mjs';
import alprCamerasLayer, {
createAlprCamerasLayer,
@@ -337,6 +340,10 @@ function cameraHarness(layer = alprCamerasLayer) {
postRender: new Cesium.Event(),
pick: () => picked,
},
// Cesium's entity tracking, without entities of its own: the camera
// port follows on a tracking widget of the fake's.
trackedEntityChanged: new Cesium.Event(),
entities: {},
};
const ports = fakeScenePorts(viewer);
bindFakeCesiumCamera(viewer, ports);
@@ -1240,14 +1247,14 @@ test('nearby count and discovery control frame a real loaded camera without fetc
);
assert.equal(flights[0].options.offset.range, 800);
assert.equal(h.requests.length, 1);
h.viewer.trackedEntity = {};
followEntity(h.viewer, {});
assert.equal(alprCamerasLayer.getRowControls().chips[0].disabled, true);
assert.equal(
controls.chips[0].onClick(),
false,
'a stale button cannot steal the follow camera',
);
h.viewer.trackedEntity = undefined;
followEntity(h.viewer, null);
alprCamerasLayer.disable();
assert.equal(alprCamerasLayer.getStats().countLabel, '');
assert.equal(controls.chips[0].onClick(), false);