mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
- KML/KMZ import: a per-file canvas budget and cache for ground overlays, limits on rings and vertices of raised polygons, overlays across 360° and near the poles, degenerate holes, polar and single-latitude fills, absolute overlays at their altitude, overlay order by drawOrder as on Cesium, and pins on tiles keep their measured height. - Points on the surface: OSM Places and Street Level cones share the surface sampler and sit on the terrain before they are measured, within a sampling budget per pass; Cockpit's contact-dot bank keeps the dot atlas, and a failed fleet model loads again after a pause. - Startup: the loading screen lifts after the share-link view is restored, the retry screen names the failed engine and takes focus, and the fallback toast stays for 6 s. - Engines: an engine switch lands a running camera flight at its destination (camera.completeFlight on both engines), the sighting card leaves focus on the engine picker after a switch, and a Cesium model error stays with the instance that failed. - The MCP panel builds again: its wind-mesh alias resolves to the stub. - QA: the wildlife switch waits for the camera to rest, GBFS --w2 says it needs the dev server, and test fixtures are shared instead of copied.
114 lines
3.2 KiB
JavaScript
114 lines
3.2 KiB
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { readFileSync } from 'node:fs';
|
|
import { quantile, slope } from './qa-strict-session.mjs';
|
|
import { strictArguments, waitForCameraAtRest } from './qa-strict-harness.mjs';
|
|
|
|
test('slope is the least-squares growth per step', () => {
|
|
assert.equal(slope([[0, 5]]), 0);
|
|
assert.equal(
|
|
slope([
|
|
[20, 100],
|
|
[50, 103],
|
|
[100, 108],
|
|
]).toFixed(3),
|
|
'0.100',
|
|
);
|
|
assert.equal(
|
|
slope([
|
|
[1, 7],
|
|
[2, 7],
|
|
[3, 7],
|
|
]),
|
|
0,
|
|
);
|
|
});
|
|
|
|
test('quantile takes the nearest rank', () => {
|
|
assert.equal(quantile([], 0.5), null);
|
|
assert.equal(quantile([5, 1, 3, 2, 4], 0.5), 3);
|
|
assert.equal(
|
|
quantile(
|
|
[...Array(100)].map((_, i) => i + 1),
|
|
0.95,
|
|
),
|
|
95,
|
|
);
|
|
});
|
|
|
|
test('the runner hands each scenario its layers and its manifest path', () => {
|
|
assert.deepEqual(
|
|
strictArguments(['node', 'x', '--layers=a,b', '--evidence=/tmp/e.json']),
|
|
{ layers: ['a', 'b'], evidence: '/tmp/e.json' },
|
|
);
|
|
assert.deepEqual(strictArguments(['node', 'x', '--layers=']), {
|
|
layers: null,
|
|
evidence: process.env.QA_STRICT_EVIDENCE ?? null,
|
|
});
|
|
});
|
|
|
|
// A page whose camera answers one sampled position (x, metres) and input
|
|
// state per waitForFunction poll; `polls()` counts the polls taken.
|
|
function cameraPage(t, positions, inputs, globals = {}) {
|
|
let frame = 0;
|
|
const engine = {
|
|
camera: {
|
|
pose: () => ({ position: { x: positions[frame], y: 0, z: 6.4e6 } }),
|
|
},
|
|
input: { cameraInputsEnabled: () => inputs[frame] },
|
|
};
|
|
const previous = globalThis.window;
|
|
globalThis.window = { __godsEyeView: { engine }, ...globals };
|
|
t.after(() => {
|
|
globalThis.window = previous;
|
|
});
|
|
const page = {
|
|
evaluate: async (fn) => fn(),
|
|
async waitForFunction(fn) {
|
|
for (; frame < positions.length; frame++) if (fn()) return;
|
|
throw new Error('timed out');
|
|
},
|
|
};
|
|
return { page, polls: () => frame };
|
|
}
|
|
|
|
test('the camera is at rest once a flight has landed and it stays still', async (t) => {
|
|
// A selection's flight holds the inputs off; once they are on, the camera
|
|
// still moves one more sample before it stays put.
|
|
const { page, polls } = cameraPage(
|
|
t,
|
|
[0, 400, 900, 900, 1250, 1250, 1250],
|
|
[false, false, false, false, true, true, true],
|
|
);
|
|
await waitForCameraAtRest(page);
|
|
// Not while the flight holds the inputs (sample 3 repeats a pose), nor
|
|
// while the camera moves (sample 4).
|
|
assert.equal(polls(), 5);
|
|
});
|
|
|
|
test('qa-wildlife-switch waits for the focus flight even when the camera was already still', async (t) => {
|
|
// A rest the scenario recorded before the click is no rest of the flight.
|
|
const { page, polls } = cameraPage(
|
|
t,
|
|
[0, 0, 100, 500, 500],
|
|
[false, false, false, true, true],
|
|
{
|
|
__qaWildPose: { key: '0.0,0.0,6400000.0', at: performance.now() - 5000 },
|
|
},
|
|
);
|
|
const source = readFileSync(
|
|
new URL('./qa-wildlife-switch.mjs', import.meta.url),
|
|
'utf8',
|
|
);
|
|
const still = new Function(
|
|
'p',
|
|
'waitForCameraAtRest',
|
|
`${source.slice(
|
|
source.indexOf(' const still ='),
|
|
source.indexOf(' // What the engine draws'),
|
|
)}\nreturn still;`,
|
|
)(page, waitForCameraAtRest);
|
|
await still();
|
|
assert.equal(polls(), 4);
|
|
});
|