Files
gods-eye-view/src/data/transitPresetStyle.test.mjs
T
Said Turksever 39a60b4034 Remove the Snow visual preset
Snow is no longer offered anywhere a style can be chosen: the Visual
Presets tray, keyboard shortcut 7, the Cockpit vision carousel, and the
set_visual_style voice action. The shader and its labels go with it;
weather snowfall and the SNOW weather condition are unaffected.

Share links keep working. Snow's enum code (6) stays reserved, so a
compact or long-form link that names it opens on Normal and drops the
Snow shader parameters without reporting them as unknown. A Scene
Director shot saved with Snow plays on Normal too. Snow's frozen share
defaults matched Normal's apart from those parameters, so no other
setting in an old link changes meaning.

The legacy voice-schema pins restore Snow before hashing, so the
unchanged pins still prove nothing else moved; the complete Realtime
payload digest is re-derived.
2026-10-29 11:20:49 +00:00

96 lines
3.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import test from 'node:test';
import assert from 'node:assert/strict';
import {
TRANSIT_TIER_KEYS,
presetSpriteOutlinePx,
presetSpriteRgba,
presetSpriteScale,
transitModeTier,
transitStyleProfile,
} from './transitPresetStyle.js';
import { TRANSIT_MODES } from './transitFeeds.js';
test('profile mapping: NVG/FLIR/noir and cockpit nvg are mono, retro is crt, everything else normal', () => {
for (const mono of ['surveillance', 'thermal', 'noir', 'nvg'])
assert.equal(transitStyleProfile(mono), 'mono', mono);
assert.equal(transitStyleProfile('retro'), 'crt');
for (const plain of [
'normal',
'anime',
'minecraft',
'',
null,
undefined,
'optical',
])
assert.equal(transitStyleProfile(plain), 'normal', String(plain));
});
test('normal uses mode colour, unit scale and a one-pixel halo', () => {
for (const mode of TRANSIT_MODES) {
assert.equal(presetSpriteRgba('normal', mode), null);
assert.equal(presetSpriteRgba(undefined, mode), null);
}
assert.equal(presetSpriteScale('normal'), 1);
assert.equal(presetSpriteOutlinePx('normal'), 1);
});
test('mono: every mode is a white core, larger, with a dark halo in screen pixels', () => {
for (const style of ['surveillance', 'thermal', 'noir', 'nvg']) {
for (const mode of TRANSIT_MODES) {
assert.deepEqual(
presetSpriteRgba(style, mode),
[255, 255, 255, 1],
`${style} ${mode}`,
);
}
for (const selected of [false, true]) {
assert.equal(
presetSpriteScale(style, selected),
presetSpriteScale('retro', selected),
);
assert.equal(presetSpriteOutlinePx(style, selected), 2);
}
}
});
test('crt: saturated per-mode colours, distinct, upsized, thinner halo', () => {
const seen = new Set();
for (const mode of TRANSIT_MODES) {
const rgba = presetSpriteRgba('retro', mode);
assert.ok(Array.isArray(rgba) && rgba.length === 4, mode);
seen.add(rgba.slice(0, 3).join(','));
const [r, g, b] = rgba;
assert.ok(
Math.max(r, g, b) === 255,
`${mode} is fully saturated on one channel`,
);
}
assert.equal(seen.size, TRANSIT_MODES.length, 'no two modes share a colour');
assert.ok(presetSpriteScale('retro') > 1.2);
assert.ok(
presetSpriteOutlinePx('retro') > 0 &&
presetSpriteOutlinePx('retro') < presetSpriteOutlinePx('thermal'),
);
});
test('every mode has its own bracket tier, unknown modes fall to transit_unknown', () => {
const tiers = new Set();
for (const mode of TRANSIT_MODES) tiers.add(transitModeTier(mode));
assert.equal(tiers.size, TRANSIT_MODES.length);
assert.equal(transitModeTier('spaceship'), 'transit_unknown');
assert.equal(transitModeTier(undefined), 'transit_unknown');
assert.deepEqual([...tiers].sort(), [...TRANSIT_TIER_KEYS].sort());
});
test('all styled tuples are valid rgba: channels 0–255 ints, alpha in (0, 1]', () => {
for (const style of ['thermal', 'retro']) {
for (const mode of TRANSIT_MODES) {
const [r, g, b, a] = presetSpriteRgba(style, mode);
for (const c of [r, g, b])
assert.ok(Number.isInteger(c) && c >= 0 && c <= 255);
assert.ok(a > 0 && a <= 1);
}
}
});