mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Application extras come from the renderer plugin; framing, occlusion and panel drawing are contract ports
A renderer plugin may supply applicationHooks(renderer) for what only its renderer has (map engine, own credits, stale commands, QA handles). What every renderer should do moves onto the contract: controls.keepEarthFramed (behind the keepEarthFramed capability), query.occlusionTest (behind occlusionTest), and panel drawing, which keepPanelRendering now does through resize and frame.renderNow through the contract. renderNow throws when the frame fails to draw. The Cesium port installs its zoom-out guard through keepEarthFramed (a setView no longer cancels its turn) and answers occlusionTest with the scene's probe; the stub answers it with a horizon test.
This commit is contained in:
1 parent
a755f63638
commit
619c19ea67
40 files changed
+737
-323
No files matched your search
@@ -2,7 +2,7 @@ import assert from 'node:assert/strict';
|
||||
import * as Cesium from 'cesium';
|
||||
import test from 'node:test';
|
||||
import { bindRenderer, findFrame, frameOf } from '../rendererOf.js';
|
||||
import './frame.js';
|
||||
import { renderNow } from './frame.js';
|
||||
|
||||
/** A viewer whose scene raises its phases when `tick` is called. */
|
||||
function fakeViewer() {
|
||||
@@ -189,3 +189,21 @@ test('a built frame port counts holds per reason, times out a wait, and settles
|
||||
await waiting;
|
||||
unbind();
|
||||
});
|
||||
|
||||
test('renderNow throws the error Cesium raises on renderError', () => {
|
||||
const listeners = new Set();
|
||||
const failure = new Error('worker failed');
|
||||
let fail = false;
|
||||
const scene = {
|
||||
renderError: {
|
||||
addEventListener: (cb) => (listeners.add(cb), () => listeners.delete(cb)),
|
||||
},
|
||||
forceRender() {
|
||||
if (fail) for (const cb of listeners) cb(scene, failure);
|
||||
},
|
||||
};
|
||||
renderNow(scene);
|
||||
fail = true;
|
||||
assert.throws(() => renderNow(scene), failure);
|
||||
assert.equal(listeners.size, 0, 'it stops listening either way');
|
||||
});
|
||||
Reference in new issue
Block a user