mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 08:42:21 +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
@@ -171,81 +171,6 @@ function collectionsUnder(viewer) {
|
||||
);
|
||||
}
|
||||
|
||||
test('movers and lines draw on the scene, answer picks with their pickId and go with the engine', async () => {
|
||||
const geo = await import('../../geo/index.js');
|
||||
const viewer = createFakeViewer();
|
||||
const reasons = [];
|
||||
const engine = createCesiumEngine(viewer, {
|
||||
requestRender: (reason) => reasons.push(reason),
|
||||
});
|
||||
const set = engine.movers.createSet({
|
||||
id: 'horizon-points',
|
||||
pickable: true,
|
||||
kind: 'point',
|
||||
capacity: 2,
|
||||
point: { sizePx: 8 },
|
||||
});
|
||||
// The fake camera is at x = 7e6 (over 0°, 0°): 0°E is in front, 180° behind.
|
||||
set.set(0, { position: geo.cartesian3.fromDegrees(0, 1, 0), pickId: 'a' });
|
||||
set.set(1, { position: geo.cartesian3.fromDegrees(180, 1, 0), pickId: 'b' });
|
||||
set.setCount(2);
|
||||
set.commit();
|
||||
const line = engine.lines.createLine({
|
||||
id: 'orbit',
|
||||
widthPx: 2,
|
||||
color: [1, 1, 1, 1],
|
||||
pickId: 'orbit-1',
|
||||
});
|
||||
assert.deepEqual(engine.movers.list(), [
|
||||
{ id: 'horizon-points', kind: 'point', count: 2, capacity: 2 },
|
||||
]);
|
||||
assert.deepEqual(engine.lines.list(), [
|
||||
{ id: 'orbit', points: 0, shown: true },
|
||||
]);
|
||||
assert.ok(reasons.includes('movers'));
|
||||
assert.equal(viewer.primitiveList.length, 2, 'one root each');
|
||||
const [points] = collectionsUnder(viewer).filter(
|
||||
(item) => item instanceof Cesium.PointPrimitiveCollection,
|
||||
);
|
||||
const front = points.get(0);
|
||||
const back = points.get(1);
|
||||
const lineSlot = { gevLine: 'orbit' };
|
||||
viewer.scene.drillPick = () => [
|
||||
{ primitive: back, id: 'b' },
|
||||
{ primitive: front, id: 'stale' },
|
||||
{ primitive: lineSlot, id: 'orbit-1' },
|
||||
];
|
||||
assert.deepEqual(
|
||||
engine.picker
|
||||
.drillPick({ x: 1, y: 1 })
|
||||
.map(({ id, owner, instance }) => [id, owner, instance]),
|
||||
[
|
||||
['a', 'horizon-points', 0],
|
||||
['orbit-1', 'orbit', undefined],
|
||||
],
|
||||
'the instance behind the horizon is left out',
|
||||
);
|
||||
viewer.scene.pick = () => ({ primitive: front, id: 'stale' });
|
||||
assert.equal(engine.picker.pick({ x: 1, y: 1 }).id, 'a');
|
||||
// A mover set in a surface exclusion is hidden for the sample only.
|
||||
let shownDuring;
|
||||
viewer.scene.sampleHeight = (position, excluded) => {
|
||||
shownDuring = [points.show, excluded];
|
||||
return 5;
|
||||
};
|
||||
const place = geo.cartographic.fromDegrees(0, 1, 0);
|
||||
assert.equal(engine.surface.sampleHeight(place, [set]), 5);
|
||||
assert.deepEqual(shownDuring, [false, []]);
|
||||
assert.equal(points.show, true);
|
||||
engine.destroy();
|
||||
assert.equal(points.isDestroyed(), true);
|
||||
assert.deepEqual(viewer.primitiveList, []);
|
||||
assert.deepEqual(engine.movers.list(), []);
|
||||
assert.deepEqual(engine.lines.list(), []);
|
||||
assert.equal(set.isDestroyed(), true);
|
||||
assert.throws(() => line.show(false), /destroyed/);
|
||||
});
|
||||
|
||||
test('the contract suite movers and lines checks pass on the Cesium engine (no pixels or pointer)', async (t) => {
|
||||
// Cesium's Material sorts uniform values with instanceof checks against
|
||||
// these DOM classes; Node has none of them.
|
||||
|
||||
Reference in new issue
Block a user