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

+9 -2
View File
@@ -11,6 +11,7 @@ import { FREE_LOOK_MAX_HEIGHT_METERS } from '../globeInView.js';
import * as globeInView from '../globeInView.js';
import { createCesiumCamera } from '../render/cesium/camera.js';
import { bindRenderer } from '../render/rendererOf.js';
import { entityFollowTarget } from '../data/followed.js';
/** The camera port bound over each real Cesium camera a test makes. */
const cameraPorts = new WeakMap();
@@ -697,9 +698,15 @@ test('globe recovery leaves partial, low, locked and following views alone', ()
assert.equal(globeOutOfFrame(locked.camera), true);
assert.ok(moveEndKeepsView(locked.camera), 'locked camera');
// Tracking an entity that has no position yet keeps an identity transform.
// Following an entity that has no position yet keeps an identity transform.
const tracked = realCamera();
tracked.viewer.trackedEntity = { id: 'pending-fix' };
const pending = entityFollowTarget(
{ id: 'pending-fix' },
{ position: () => null },
);
Object.defineProperty(cameraPorts.get(tracked.camera), 'followed', {
get: () => pending,
});
installGlobeInViewRecovery(tracked.viewer);
aim(tracked.camera, reportedStuckView);
assert.ok(moveEndKeepsView(tracked.camera), 'tracked camera');