Cut duplicated and dead code across the engines, the layers and the QA scripts

- 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.
This commit is contained in:
German Khokhlov committed 2026-11-05 13:32:39 +04:00
1 parent c502404e1d
commit 7abf74518f
272 files changed
+4828 -10213

No files matched your search

+77 -80
View File
@@ -6,86 +6,83 @@ const url = localPreview(process.argv[2]);
url.search = '?engine=navara&welcome=0';
url.hash = 'v=2&lat=30.27&lon=-97.74&alt=12000&pitch=-90&map=sentinel2&l=';
const strict = createStrict({ origin: url.origin, layers: ['radio'] });
await strict.run(
{ args: ['--use-angle=metal', '--enable-gpu'] },
async (browser) => {
const page = await browser.newPage();
const errors = [];
page.on('pageerror', (e) => errors.push(e.message));
await installRadioFixture(page);
await page.goto(url.href);
await page.waitForFunction(
() =>
window.__godsEyeView?.engine?.kind === 'navara' &&
document.querySelector('#loading-screen.hidden'),
);
await page.evaluate(async (id) => {
const { dataManager, styleManager, tileset } = window.__godsEyeView;
await styleManager.initialRestorePromise;
if (window.__GOOGLE_MAPS_API_KEY__ || tileset)
throw Error('Expected keyless preview');
window.qaLayer = dataManager.layers.get('radio').module;
await dataManager.setEnabled('radio', true, { origin: 'user' });
}, stations[0].id);
await page.waitForFunction(() => window.qaLayer?.getStats().count === 750);
await page.evaluate((id) => {
window.qaLayer.selectStation(id, {
autoplay: true,
focus: false,
origin: 'user',
});
window.qaLayer.setRadioVolume(0.36);
}, stations[10].id);
await page.waitForFunction(
() =>
window.__qaRadio.plays.length === 1 &&
window.qaLayer.getUIState().audioState === 'playing',
);
const first = await page.evaluate(() => {
window.qaAudio = window.qaPlayer;
window.qaSnapshot = window.qaLayer.getAcceptedCatalogSnapshot();
return window.__qaRadio.reads;
await strict.run({}, async (browser) => {
const page = await browser.newPage();
const errors = [];
page.on('pageerror', (e) => errors.push(e.message));
await installRadioFixture(page);
await page.goto(url.href);
await page.waitForFunction(
() =>
window.__godsEyeView?.engine?.kind === 'navara' &&
document.querySelector('#loading-screen.hidden'),
);
await page.evaluate(async (id) => {
const { dataManager, styleManager, tileset } = window.__godsEyeView;
await styleManager.initialRestorePromise;
if (window.__GOOGLE_MAPS_API_KEY__ || tileset)
throw Error('Expected keyless preview');
window.qaLayer = dataManager.layers.get('radio').module;
await dataManager.setEnabled('radio', true, { origin: 'user' });
}, stations[0].id);
await page.waitForFunction(() => window.qaLayer?.getStats().count === 750);
await page.evaluate((id) => {
window.qaLayer.selectStation(id, {
autoplay: true,
focus: false,
origin: 'user',
});
for (const kind of ['cesium', 'navara']) {
await strict.switchTo(page, kind);
const state = await page.evaluate(() => ({
same:
window.qaLayer ===
window.__godsEyeView.dataManager.layers.get('radio').module,
player: window.qaAudio === window.qaPlayer,
snapshot:
window.qaSnapshot === window.qaLayer.getAcceptedCatalogSnapshot(),
plays: window.__qaRadio.plays.length,
reads: window.__qaRadio.reads,
state: window.qaLayer.getUIState(),
count: window.qaLayer.getStats().count,
}));
console.log(
kind,
state.count,
state.state.selected?.id,
state.state.audioState,
state.plays,
state.reads,
);
assert.ok(state.same && state.player && state.snapshot);
assert.equal(state.plays, 1);
assert.equal(state.reads, first);
assert.equal(state.count, 750);
assert.equal(state.state.audioState, 'playing');
assert.equal(state.state.selected.id, stations[10].id);
assert.equal(state.state.volume, 0.36);
// The fixture's HTMLMediaElement.prototype.play counts play() calls: the
// switch must not start the stream again.
await strict.passed(
page,
'radio',
'same model, player element and catalog snapshot; 750 stations, one catalog read, no second play(), same station playing at volume 0.36',
);
}
assert.deepEqual(errors, []);
window.qaLayer.setRadioVolume(0.36);
}, stations[10].id);
await page.waitForFunction(
() =>
window.__qaRadio.plays.length === 1 &&
window.qaLayer.getUIState().audioState === 'playing',
);
const first = await page.evaluate(() => {
window.qaAudio = window.qaPlayer;
window.qaSnapshot = window.qaLayer.getAcceptedCatalogSnapshot();
return window.__qaRadio.reads;
});
for (const kind of ['cesium', 'navara']) {
await strict.switchTo(page, kind);
const state = await page.evaluate(() => ({
same:
window.qaLayer ===
window.__godsEyeView.dataManager.layers.get('radio').module,
player: window.qaAudio === window.qaPlayer,
snapshot:
window.qaSnapshot === window.qaLayer.getAcceptedCatalogSnapshot(),
plays: window.__qaRadio.plays.length,
reads: window.__qaRadio.reads,
state: window.qaLayer.getUIState(),
count: window.qaLayer.getStats().count,
}));
console.log(
'PASS one live radio player, one station directory and the same selection',
kind,
state.count,
state.state.selected?.id,
state.state.audioState,
state.plays,
state.reads,
);
},
);
assert.ok(state.same && state.player && state.snapshot);
assert.equal(state.plays, 1);
assert.equal(state.reads, first);
assert.equal(state.count, 750);
assert.equal(state.state.audioState, 'playing');
assert.equal(state.state.selected.id, stations[10].id);
assert.equal(state.state.volume, 0.36);
// The fixture's HTMLMediaElement.prototype.play counts play() calls: the
// switch must not start the stream again.
await strict.passed(
page,
'radio',
'same model, player element and catalog snapshot; 750 stations, one catalog read, no second play(), same station playing at volume 0.36',
);
}
assert.deepEqual(errors, []);
console.log(
'PASS one live radio player, one station directory and the same selection',
);
});