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

+12 -4
View File
@@ -5,6 +5,7 @@ import {
fakeCameraPort,
} from '../testSupport/fakeCameraPort.mjs';
import { bindRenderer } from '../render/rendererOf.js';
import { entityFollowTarget, followedOf } from './followed.js';
import { fakeDrawPort } from '../testSupport/fakeDrawPort.mjs';
import {
buildRadioTunerBand,
@@ -1666,16 +1667,23 @@ test('Radio recovery preserves closer altitude and caps extreme full-globe zoom'
test('Radio camera navigation yields to every live tracked-entity owner', () => {
const viewer = {};
bindRenderer(viewer, { camera: fakeCameraPort().port });
// A camera port that follows: the layers' tracked entities are followed
// through it.
const { port: camera } = fakeCameraPort();
camera.followed = null;
camera.follow = (target) => {
camera.followed = target;
};
bindRenderer(viewer, { camera });
assert.equal(radioCameraNavigationAllowed(viewer), true);
assert.equal(radioCameraNavigationAllowed({}), false, 'no camera to move');
for (const trackedId of ['flights:abc123', 'military:def456']) {
const trackedEntity = withEntityRecord({}, { trackedId });
viewer.trackedEntity = trackedEntity;
camera.follow(entityFollowTarget(trackedEntity, {}));
assert.equal(radioCameraNavigationAllowed(viewer), false, trackedId);
assert.equal(viewer.trackedEntity, trackedEntity);
assert.equal(followedOf(viewer)?.entity, trackedEntity);
}
viewer.trackedEntity = undefined;
camera.follow(null);
assert.equal(radioCameraNavigationAllowed(viewer), true);
assert.equal(radioCameraNavigationAllowed({ trackedEntity: {} }), false);
assert.equal(radioCameraNavigationAllowed(null), false);