mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
A stack kept after a failed photoreal switch still falls back on tile failures
- When showing the photoreal base fails and the stack before it stays, its tile-failure listener is bound again for the switch that kept it, so Esri's OSM fallback still runs. - The Cockpit test of a ride handed to another aircraft checks that the follow's change adopted it (the Cockpit took the camera).
This commit is contained in:
1 parent
1fbe546531
commit
691cb0cd79
3 files changed
+43
-2
No files matched your search
@@ -173,6 +173,23 @@ test('a photoreal stack that fails to come back leaves the stack before it in pl
|
||||
googleTileset: loaded.tileset,
|
||||
onError: (message) => errors.push(message),
|
||||
});
|
||||
// The tile-failure listeners of the layers it adds, to fail their tiles.
|
||||
const tileErrors = new Set();
|
||||
const add = renderer.globe.imagery.add;
|
||||
renderer.globe.imagery.add = (...args) => {
|
||||
const layer = add(...args);
|
||||
const on = layer.on;
|
||||
layer.on = (event, listener) => {
|
||||
const off = on(event, listener);
|
||||
if (event !== 'tileError') return off;
|
||||
tileErrors.add(listener);
|
||||
return () => {
|
||||
tileErrors.delete(listener);
|
||||
off();
|
||||
};
|
||||
};
|
||||
return layer;
|
||||
};
|
||||
await controller.setStack('esri-imagery', { silent: true });
|
||||
assert.equal(renderer.globe.imagery.list().length, 1);
|
||||
renderer.globe.setPhotoreal = async (spec) => ({
|
||||
@@ -190,5 +207,10 @@ test('a photoreal stack that fails to come back leaves the stack before it in pl
|
||||
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/);
|
||||
// Its tile failures still fall back, heard for the switch that kept it.
|
||||
for (const listener of [...tileErrors]) listener({});
|
||||
for (const listener of [...tileErrors]) listener({});
|
||||
for (let i = 0; i < 20; i++) await new Promise((r) => setTimeout(r, 0));
|
||||
assert.equal(controller.getState().activeId, 'osm');
|
||||
controller.destroy();
|
||||
});
|
||||
Reference in new issue
Block a user