mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-20 10:12:18 +00:00
Test layers on one engine and share selection and shader helpers
Layer display tests no longer re-check Cesium primitives in every layer: they run on the fake engine, and one Cesium translation check per ground kind lives in the Cesium engine's ground tests. Their harnesses are shared, and the fake-engine, Cesium-engine and flights tests that repeated the contract suite are gone, 340 tests in all. The press-travel measurement is shared by the selection dispatcher and CCTV, which loses its ScreenSpaceEventHandler shim and world-click module. ALPR, installations and bikeshare share one selection keeper and selected marker write. Layers with their own click rules keep their handlers. Navara's pulse is a class like the ground pass, the ground and imagery passes share the surface uniforms, and the colour, log-depth and occlusion GLSL lives in one chunk module, each caller keeping its depth bias. The ground suite runs inside the contract suite (--only=ground:), and fixture and script names say what they test. Behaviour is unchanged on both engines.
This commit is contained in:
1 parent
7f478e3815
commit
b4556f9763
101 files changed
+1095
-4071
No files matched your search
@@ -215,85 +215,6 @@ test('the flights logic draws and follows on the aircraft display (fake engine)'
|
||||
engine.destroy();
|
||||
});
|
||||
|
||||
test('the flights logic draws, tracks and follows on the Cesium engine through the same display', async () => {
|
||||
const { createCesiumMoversEngine } =
|
||||
await import('../../testSupport/cesiumMoversEngine.mjs');
|
||||
const { createFlightsDisplay } = await import('./render/display.js');
|
||||
const { aircraftAtlasLayout } = await import('../aircraft/render/display.js');
|
||||
const layout = aircraftAtlasLayout();
|
||||
const { engine, viewer, frame, primitive } = createCesiumMoversEngine();
|
||||
engine.camera.setView({
|
||||
destination: geo.cartesian3.fromDegrees(-97.5, 30.3, 400_000),
|
||||
});
|
||||
let display = null;
|
||||
const layer = createApplicationFlights({
|
||||
surface: defaultSurface,
|
||||
source: {
|
||||
label: 'Fixture aircraft',
|
||||
getSnapshot: async () => snapshotOf(['abc123', 'def456']),
|
||||
},
|
||||
militaryRegistry,
|
||||
renderer: {
|
||||
// The registry's factory, with the test's atlas.
|
||||
create: ({ engine: given }) =>
|
||||
(display = createFlightsDisplay(given, {
|
||||
drawAtlas: async () => ({
|
||||
canvas: { width: layout.width, height: layout.height },
|
||||
cells: layout.cells,
|
||||
}),
|
||||
})),
|
||||
},
|
||||
});
|
||||
layer.init(viewer, { engine });
|
||||
layer.enable();
|
||||
try {
|
||||
await display.whenReady();
|
||||
await layer.update(null);
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
const [sprites] = engine.movers
|
||||
.list()
|
||||
.filter(({ id }) => id.startsWith('flights-sprites'));
|
||||
assert.equal(sprites.count, 2);
|
||||
const billboards = primitive(sprites.id);
|
||||
assert.equal(billboards.length, 2, 'one Cesium billboard per contact');
|
||||
assert.deepEqual([billboards.get(0).id, billboards.get(1).id].sort(), [
|
||||
'abc123',
|
||||
'def456',
|
||||
]);
|
||||
assert.deepEqual(
|
||||
layer
|
||||
.qaDrawn()
|
||||
.map((row) => row.id)
|
||||
.sort(),
|
||||
['abc123', 'def456'],
|
||||
);
|
||||
// Tracking follows through Cesium's trackedEntity, with the readout.
|
||||
assert.equal(layer.trackById('def456', { origin: 'voice' }), true);
|
||||
const following = engine.camera.following();
|
||||
assert.equal(following?.label?.id, 'flights:def456');
|
||||
assert.equal(viewer.trackedEntity?.gevTrackedId, 'flights:def456');
|
||||
frame();
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
const tracked = engine.movers
|
||||
.list()
|
||||
.find(({ id }) => id.startsWith('flights-tracked'));
|
||||
assert.equal(tracked.count, 1);
|
||||
assert.equal(
|
||||
primitive(tracked.id).get(0).disableDepthTestDistance,
|
||||
Number.POSITIVE_INFINITY,
|
||||
);
|
||||
assert.equal(layer.stopTracking(), true);
|
||||
assert.equal(engine.camera.following(), null);
|
||||
assert.equal(viewer.trackedEntity, undefined);
|
||||
} finally {
|
||||
layer.disable();
|
||||
layer.destroy(viewer);
|
||||
}
|
||||
assert.equal(engine.movers.list().length, 0, 'no mover set left behind');
|
||||
assert.equal(engine.lines.list().length, 0, 'no line left behind');
|
||||
engine.destroy();
|
||||
});
|
||||
|
||||
test('a failed engine switch, its rollback and the retry re-follow the tracked aircraft as a restore', async () => {
|
||||
const { createCesiumMoversEngine } =
|
||||
await import('../../testSupport/cesiumMoversEngine.mjs');
|
||||
|
||||
Reference in new issue
Block a user