Share one render loop fixture across the render failure tests

Four test files built the same widget on CesiumWidget.prototype, viewer
proxy, store and notice; renderLoopFixture.mjs now does it once. The notice
test drives Cesium.Event instead of a hand-made double. frameEvents() drops
tileset.tileLoad, which Cesium raises inside its own error handling, and the
notice no longer guards a viewer without a canvas or requestRender.
This commit is contained in:
German Khokhlov committed 2026-11-13 20:16:08 +04:00
1 parent df41c0affb
commit 73bd952736
8 files changed
+127 -252

No files matched your search

+4 -5
View File
@@ -21,7 +21,7 @@ export function installRenderFailureNotice(
} = {},
) {
const { scene } = viewer;
const canvas = viewer.canvas ?? scene.canvas;
const { canvas } = viewer;
let notice = null;
let contextLost = false;
// With rethrowRenderErrors, Scene throws the error it has just raised;
@@ -36,7 +36,7 @@ export function installRenderFailureNotice(
return;
}
viewer.useDefaultRenderLoop = true;
scene.requestRender?.();
scene.requestRender();
}
function reset() {
@@ -113,11 +113,11 @@ export function installRenderFailureNotice(
raisedByScene = null;
}),
);
canvas?.addEventListener?.('webglcontextlost', onContextLost);
canvas.addEventListener('webglcontextlost', onContextLost);
return () => {
removeRenderError();
unguard.forEach((restore) => restore());
canvas?.removeEventListener?.('webglcontextlost', onContextLost);
canvas.removeEventListener('webglcontextlost', onContextLost);
clear();
};
}
@@ -147,7 +147,6 @@ function frameEvents(viewer) {
tileset?.loadProgress,
tileset?.allTilesLoaded,
tileset?.initialTilesLoaded,
tileset?.tileLoad,
);
}
return events;