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 -7
View File
@@ -9,7 +9,10 @@ import {
moveCamera,
} from './cameraVerbs.js';
import { createGevActionRunner } from './voice/gevActions.js';
import { bindFakeCesiumCamera } from './testSupport/fakeCameraPort.mjs';
import {
bindFakeCesiumCamera,
followEntity,
} from './testSupport/fakeCameraPort.mjs';
import {
fakeSceneFrame,
fakeSceneQuery,
@@ -56,8 +59,10 @@ function harness(
const double = {
camera,
scene,
trackedEntity: undefined,
// 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: {},
clock: { onTick: new Cesium.Event() },
};
// The Cesium renderer's own camera port over the real camera; frames from
@@ -251,9 +256,7 @@ test('a pivoting tilt yields when tracking takes the camera', (t) => {
const h = harness(t);
assert.equal(moveCamera({ motion: 'tilt', pitchDeg: -45 }).ok, true);
h.tick();
const entity = { id: 'tracked' };
h.viewer.trackedEntity = entity;
h.viewer.trackedEntityChanged.raiseEvent(entity);
followEntity(h.viewer, { id: 'tracked' });
assert.equal(getActiveCameraMotion(), null);
});
@@ -560,10 +563,10 @@ test('a regional tilt-up nudge goes to the camera horizon limit', (t) => {
test('a voice tilt from a tracked view judges its limit from the camera pitch', (t) => {
const h = harness(t, { height: 20000, pitch: -5.2 });
h.viewer.trackedEntity = { id: 'tracked' };
followEntity(h.viewer, { id: 'tracked' });
// Voice releases the follow camera before the motion starts.
const release = (start) => {
h.viewer.trackedEntity = undefined;
followEntity(h.viewer, null);
return start();
};
const result = moveCamera({ motion: 'tilt', direction: 'up' }, release);