Files
qbz/scripts/test_qt_kiosk_art.mjs
T
vicrodh b1dba198c9 feat(qt): kiosk profile release hardening
Integrate the Kiosk profile hardening round: 12 dedicated Kiosk views plus
22 shared opt-in hosts, shared navigation history with Back/Forward, Albums
as the default library tab, native paged Local Library (artists/tracks),
lightweight MyQBZ grid and detail, Ephemeral lifecycle, bounded lists and
artwork sized to the physical frame, static skeletons, 64px transport bar,
Settings touch reflow and a persistent Immersive exit.

Desktop keeps its prior behavior: every shared component defaults to the
desktop path and only opts into Kiosk behavior through explicit properties
(origin-relative ScrollMemory, viewport-bounded artwork requests).

Regression coverage: kiosk navigation and artwork Node tests added to the
runtime gate, scroll-origin fixtures for fixed and grouped rows, i18n
strings for all eight locales.

Verified by 750 release tests, six QML audits, Kiosk smokes at 800x480 and
1280x800 and a Desktop A/B with seven pixel-identical captures.

cc
2026-09-07 08:23:11 -06:00

22 lines
1.3 KiB
JavaScript

#!/usr/bin/env node
// Exercise the production artwork URL policy without Qt, network or audio.
import assert from 'node:assert/strict';
import fs from 'node:fs';
import vm from 'node:vm';
const source = fs.readFileSync(new URL('../crates/qbz-qt/qml/assets/kiosk-art.js', import.meta.url), 'utf8');
const policy = vm.createContext({});
vm.runInContext(source.replace(/^\.pragma library\s*/, ''), policy);
const cover = 'https://static.qobuz.com/images/covers/AB/CD/123_600.jpg';
assert.equal(policy.sizedUrl(cover, 96), cover.replace('_600', '_100'));
assert.equal(policy.sizedUrl(cover, 192), cover.replace('_600', '_230'));
assert.equal(policy.sizedUrl(cover.replace('_600', '_50'), 320), cover);
assert.equal(policy.sizedUrl(cover.replace('_600', '_org') + '?v=1', 192), cover.replace('_600', '_230') + '?v=1');
for (const path of ['/music/album_600.jpg', 'file:///music/album_600.jpg',
'https://example.org/album_600.jpg',
'https://qobuz.com.example.org/album_600.jpg']) {
assert.equal(policy.sizedUrl(path, 96), path);
}
assert.equal(policy.sizedUrl(cover, 0), cover);
assert.equal(policy.sizedUrl(cover, 720), cover);
console.log('Kiosk artwork: physical DPR targets, undersized input, query strings and foreign/local paths pass');