mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-15 15:52:21 +00:00
- src/geo drops the ported debug argument checks and the tests that bitExact already covers; package boundaries accept a directory entry, so src/geo/ is listed once per group. - Cesium no longer carries movers and lines nobody draws with: they are optional engine capabilities. The fake engine and the Cesium camera use the shared cameraMath; unused contract tables, clock.ticked, the 'finest' surface detail and Navara click statistics are gone. - ALPR keeps one overlay core and one presentation model for both engines, bikeshare one station bookkeeping, the Navara ground effects one definition helper; image atlases, view centres, mover banks and colours are shared. - The legacy switch route, the clock offset and rate controls and other unused exports are removed. - The acceptance runs the Navara draw, geo import and scope checks; scenarios use the harness switch and page helpers; the main chunk check keeps the size budget only and runs once in CI.
134 lines
4.4 KiB
JavaScript
134 lines
4.4 KiB
JavaScript
import { fromDegrees } from '../src/geo/cartesian3.js';
|
|
import assert from 'node:assert/strict';
|
|
import { readFileSync } from 'node:fs';
|
|
import {
|
|
createStrict,
|
|
localPreview,
|
|
openPage,
|
|
waitForEngine,
|
|
} from './qa-strict-harness.mjs';
|
|
|
|
const base = localPreview(process.argv[2]);
|
|
base.search = '?engine=navara&welcome=0&look=cinematic';
|
|
base.hash =
|
|
'v=2&lat=55.3241&lon=10.7995&alt=25000&heading=0&pitch=-90&roll=0&map=sentinel2&l=';
|
|
const CABLES = 'telegeography-submarine-cables';
|
|
// Cables plus landing points in the bundled TeleGeography files.
|
|
const FEATURES = ['cable-geo', 'landing-point-geo']
|
|
.map(
|
|
(name) =>
|
|
JSON.parse(
|
|
readFileSync(
|
|
new URL(
|
|
`../src/data/local_data/telegeography_submarine_cables/${name}.json`,
|
|
import.meta.url,
|
|
),
|
|
'utf8',
|
|
),
|
|
).features.length,
|
|
)
|
|
.reduce((a, b) => a + b, 0);
|
|
const strict = createStrict({
|
|
origin: base.origin,
|
|
layers: ['telegeography-submarine-cables'],
|
|
});
|
|
await strict.run({}, async (b) => {
|
|
const { page: p, errors } = await openPage(b, { shaderErrors: true });
|
|
const reads = [];
|
|
p.on('request', (req) => {
|
|
const path = new URL(req.url()).pathname;
|
|
if (/\/(cable-geo|landing-point-geo).*\.json$/.test(path)) reads.push(path);
|
|
});
|
|
await p.goto(base.href);
|
|
await waitForEngine(p, 'navara');
|
|
await p.evaluate(async () => {
|
|
const { dataManager, tileset } = window.__godsEyeView;
|
|
if (tileset || window.__GOOGLE_MAPS_API_KEY__)
|
|
throw Error('Keyless preview required');
|
|
window.qaCables = dataManager.layers.get(
|
|
'telegeography-submarine-cables',
|
|
).module;
|
|
await dataManager.setEnabled(window.qaCables.id, true, { origin: 'user' });
|
|
});
|
|
for (const kind of ['navara', 'cesium', 'navara']) {
|
|
if ((await p.evaluate(() => window.__godsEyeView.engine.kind)) !== kind) {
|
|
await strict.switchTo(p, kind);
|
|
}
|
|
await p.waitForFunction(
|
|
() => window.qaCables.getStats().referenceLabelCount > 0,
|
|
{ timeout: 90000 },
|
|
);
|
|
const check = await p.evaluate(() => {
|
|
const { dataManager } = window.__godsEyeView;
|
|
const mod = dataManager.layers.get(
|
|
'telegeography-submarine-cables',
|
|
).module;
|
|
return { same: mod === window.qaCables, ...mod.getStats() };
|
|
});
|
|
console.log(kind, check);
|
|
assert.equal(check.same, true);
|
|
assert.equal(check.count, FEATURES);
|
|
assert.ok(check.referenceLabelCount <= 160);
|
|
assert.equal(check.error, null);
|
|
await strict.passed(
|
|
p,
|
|
CABLES,
|
|
`same model, all ${FEATURES} cables and landing points of the bundled files, at most 160 labels`,
|
|
{ count: check.count, labels: check.referenceLabelCount },
|
|
);
|
|
{
|
|
// Click-picking on this engine, from the starting view: a click on a
|
|
// landing point flies the camera to it.
|
|
await p.evaluate(
|
|
(destination) => {
|
|
const { camera, render } = window.__godsEyeView.engine;
|
|
camera.cancelFlight();
|
|
camera.setView({
|
|
destination,
|
|
orientation: { heading: 0, pitch: -Math.PI / 2, roll: 0 },
|
|
});
|
|
render.request('qa-home');
|
|
},
|
|
fromDegrees(10.7995, 55.3241, 25000),
|
|
);
|
|
await new Promise((resolve) => setTimeout(resolve, 2500));
|
|
const screen = await p.evaluate(
|
|
(world) => {
|
|
const { engine } = window.__godsEyeView;
|
|
const at = engine.projector.worldToWindow(world, {});
|
|
const rect = engine.host.canvas.getBoundingClientRect();
|
|
return { x: rect.left + at.x, y: rect.top + at.y };
|
|
},
|
|
fromDegrees(10.799480647390464, 55.324102015186114),
|
|
);
|
|
await p.mouse.click(screen.x, screen.y);
|
|
await p.waitForFunction(
|
|
() => {
|
|
const c = window.__godsEyeView.engine.camera.pose();
|
|
return (
|
|
Math.abs(c.cartographic.height - 6500) < 80 &&
|
|
Math.abs(c.pitch + (52 * Math.PI) / 180) < 0.03
|
|
);
|
|
},
|
|
{ timeout: 20000 },
|
|
);
|
|
await strict.passed(
|
|
p,
|
|
CABLES,
|
|
'a click on a landing point flies the camera to it',
|
|
);
|
|
}
|
|
}
|
|
await strict.check(
|
|
p,
|
|
CABLES,
|
|
'each bundled file read once',
|
|
reads.length === 2,
|
|
reads,
|
|
);
|
|
assert.deepEqual(errors, []);
|
|
console.log(
|
|
'PASS full bundled cable dataset, bounded labels, landing-point fly-to and one read per file',
|
|
);
|
|
});
|