mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-20 02:02:21 +00:00
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.
74 lines
2.1 KiB
JavaScript
74 lines
2.1 KiB
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import * as geo from '../../../geo/index.js';
|
|
import { registerHooks } from 'node:module';
|
|
|
|
const hook = registerHooks({
|
|
resolve(specifier, context, next) {
|
|
if (
|
|
specifier === '@navaramap/three' &&
|
|
context.parentURL?.endsWith('/ground/pulse.js')
|
|
)
|
|
return {
|
|
url: 'data:text/javascript,export class EffectDesc {} export class Effect {}',
|
|
shortCircuit: true,
|
|
};
|
|
return next(specifier, context);
|
|
},
|
|
});
|
|
let createNavaraPulseField;
|
|
try {
|
|
({ createNavaraPulseField } = await import('./pulse.js'));
|
|
} finally {
|
|
hook.deregister();
|
|
}
|
|
|
|
test('the Navara pulse disc draws only while the pulses run', () => {
|
|
const effects = [];
|
|
const view = {
|
|
registerEffect() {},
|
|
forceUpdate() {},
|
|
addEffect(config) {
|
|
const handle = {
|
|
config,
|
|
visible: config.visible,
|
|
deleted: false,
|
|
update(next) {
|
|
handle.visible = next.visible;
|
|
},
|
|
delete() {
|
|
handle.deleted = true;
|
|
},
|
|
};
|
|
effects.push(handle);
|
|
return handle;
|
|
},
|
|
};
|
|
const disc = createNavaraPulseField(
|
|
{ view },
|
|
{
|
|
center: geo.cartesian3.fromDegrees(3, 27, 0),
|
|
radiusM: 250_000,
|
|
heightM: 2500,
|
|
color: [0, 0, 1, 0.2],
|
|
lineColor: [0, 0, 1, 1],
|
|
haloColor: [0, 0, 0, 0.8],
|
|
depth: 0.35,
|
|
lineWidth: 3,
|
|
haloWidth: 1,
|
|
},
|
|
);
|
|
disc.draw({ level: 0, radii: [0.1, 0.4, 0.7], alphas: [0, 0, 0] });
|
|
assert.equal(effects.length, 0, 'nothing drawn at rest');
|
|
disc.draw({ level: 1, radii: [0.1, 0.4, 0.7], alphas: [0.5, 0.3, 0.2] });
|
|
assert.equal(effects.length, 1);
|
|
const owner = effects[0].config.gevGroundPulses.owner;
|
|
assert.deepEqual(owner.radii, [0.1, 0.4, 0.7, 0]);
|
|
assert.deepEqual(owner.alphas, [0.5, 0.3, 0.2, 0]);
|
|
assert.ok(Math.abs(owner.center.length() - 1) < 1e-9, 'a unit direction');
|
|
disc.draw({ level: 0, radii: [0, 0, 0], alphas: [0, 0, 0] });
|
|
assert.equal(effects[0].visible, false);
|
|
disc.destroy();
|
|
assert.equal(effects[0].deleted, true);
|
|
});
|