A photoreal base that fails to come back keeps the stack before it

- The map source controller waits for a base that loads as it is shown
  (the globe engine's tilesetReady) before it takes the stack before it
  down: one that fails throws there, so that stack and its imagery stay
  and the error is reported, as from any failed switch. The Cesium map
  engine has no tilesetReady, so its switches are unchanged.
- A failed default renderer load is tried again by the next call, and
  the standalone page's early load does not report a failure nobody
  awaited yet.
- The adapter ratchet's on-demand import rule refuses a default or an
  empty destructuring.
- The stub boot check fails a layer whose manager answers false rather
  than throwing, or that is not on (or off) afterwards; a field drawn
  counts as drawn; the dev server is closed when the browser cannot
  start.
This commit is contained in:
Sameh Khamis committed 2026-11-10 18:10:07 -08:00
1 parent 8a4867b1b7
commit 9a13aeab48
8 files changed
+108 -13

No files matched your search

+41 -1
View File
@@ -5,6 +5,8 @@ import { mapEngineFor, provideMapEngine } from './engine.js';
import { bindRenderer } from '../render/rendererOf.js';
import { provideApplicationHooks } from '../render/applicationHooks.js';
import { createStubRenderer } from '../render/stub/index.js';
import { MapSourceController } from './controller.js';
import { createDefaultMapSources } from './defaultSources.js';
function scene(capabilities) {
const renderer = createStubRenderer(capabilities ? { capabilities } : {});
@@ -105,6 +107,7 @@ test('photoreal loads through the port, hides and shows, and is released', async
engine.showTileset(handle, false);
assert.equal(engine.tilesetShown(handle), false);
assert.equal(calls(renderer, 'setPhotoreal').at(-1).args[0], null);
await engine.tilesetReady(handle);
engine.showTileset(handle, true);
assert.equal(calls(renderer, 'setPhotoreal').at(-1).args[0], spec);
engine.release(handle);
@@ -138,7 +141,11 @@ test('photoreal that fails to come back leaves the globe shown, and is tried aga
console.warn = () => {};
try {
engine.showTileset(handle, true);
await new Promise((resolve) => setTimeout(resolve, 0));
await assert.rejects(
engine.tilesetReady(handle),
/refused/,
'the map stack hears it failed',
);
} finally {
console.warn = warn;
}
@@ -152,3 +159,36 @@ test('photoreal that fails to come back leaves the globe shown, and is tried aga
engine.showTileset(handle, true);
assert.equal(tried, 1, 'a later switch tries again');
});
test('a photoreal stack that fails to come back leaves the stack before it in place', async () => {
const { host, renderer } = scene(['photoreal']);
const loaded = await engine.loadPhotoreal(host, { googleApiKey: 'key' });
const errors = [];
const controller = new MapSourceController(host, {
registry: createDefaultMapSources({
googleTileset: loaded.tileset,
engine,
}),
engine,
googleTileset: loaded.tileset,
onError: (message) => errors.push(message),
});
await controller.setStack('esri-imagery', { silent: true });
assert.equal(renderer.globe.imagery.list().length, 1);
renderer.globe.setPhotoreal = async (spec) => ({
route: spec ? 'none' : 'google',
error: { code: 'refused', message: 'refused' },
});
const warn = console.warn;
console.warn = () => {};
try {
await controller.setStack('photoreal', { silent: true });
} finally {
console.warn = warn;
}
assert.equal(controller.getState().activeId, 'esri-imagery');
assert.equal(renderer.globe.imagery.list().length, 1, 'its imagery stays');
assert.equal(engine.globeShown(host), true, 'on the shown globe');
assert.match(errors.at(-1), /refused/);
controller.destroy();
});