Files
gods-eye-view/src/ui/cctvVideo.test.mjs
T
0251c74109 feat(weather): add globe wind, observed weather and cyclone context (#617)
Wind (NOAA GFS and ECMWF IFS: animated particles, colour field, a reading at map centre), observed weather (NOAA MRMS radar, GOES and NESDIS infrared clouds, lightning density) on one shared history timeline, NHC and CPHC cyclone advisories with tracks and cones, and a WEATHER panel in the right rail. On 3D Tiles the observed products render as raised shells with a sharper window around the view.

Co-authored-by: Gustavo Beneduzi <[email protected]>
Co-authored-by: Daniel Slay <[email protected]>
Co-authored-by: Rehaan Delmotra <[email protected]>
Co-authored-by: Cursor Agent <[email protected]>
2026-09-22 17:45:39 -05:00

41 lines
997 B
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import { createCctvVideoSurface } from './cctvVideo.js';
test('second surface uses shared decoder, caps draws, clears switch and cancels teardown', () => {
let callback;
let draws = 0;
let clears = 0;
let cancelled = 0;
const canvas = {
width: 1,
height: 1,
getContext: () => ({ drawImage: () => draws++, clearRect: () => clears++ }),
};
let v = {
readyState: 2,
videoWidth: 1920,
videoHeight: 1080,
currentTime: 1,
};
const surface = createCctvVideoSurface(canvas, () => v, {
requestFrame: (fn) => {
callback = fn;
return 1;
},
cancelFrame: () => cancelled++,
});
callback(0);
callback(20);
callback(80);
assert.equal(draws, 1);
assert.equal(canvas.width, 640);
v = { ...v };
callback(160);
assert.equal(draws, 2);
assert.equal(clears, 2);
surface.stop();
callback(200);
assert.equal(cancelled, 1);
assert.equal(draws, 2);
});