feat(overlay): TV graphics OBS layout with title plate, timing tower and start position (1.76.0)
This commit is contained in:
1 parent
50a99fe33f
commit
3d0ab0c4b7
11 files changed
+144
-8
No files matched your search
@@ -87,4 +87,28 @@ export async function runOverlaySmoke({ evaluate }) {
|
||||
assert.equal(obs.finalRows[2], "13L 13/5:01.000 0:21.000 +1L", "same place as at the start: no arrow");
|
||||
assert.equal(obs.practiceRow, "23L 0:15.833 -", "practice: the best lap once, not twice");
|
||||
console.log("PASS OBS overlay shows places gained/lost since the start in finals, and the best lap once in practice");
|
||||
|
||||
// TV graphics: a title plate and a tower with columns, the start position next to the place.
|
||||
const tv = await evaluate(`(async () => {
|
||||
const { renderObsOverlay } = await import('/src/overlays.js');
|
||||
const { escapeHtml } = await import('/src/html_escape.js');
|
||||
const config = { layout: 'broadcast', rows: 10, showClock: true, showFastest: true, showLaps: true, showResult: true, showBest: false, showGap: true, showPositionChange: false, showStart: true };
|
||||
const deps = { t: (key) => key, escapeHtml, formatLap: (ms) => (ms / 1000).toFixed(3), formatTeamActiveMemberLabel: () => '', getVisiblePassings: () => [], getEventName: () => 'Winter Cup', getSessionTypeLabel: () => 'Final', getStartModeLabel: () => 'Position', getStatusLabel: () => 'Running', getObsOverlayConfig: () => config, normalizeStartMode: (v) => v, renderPositionGrid: () => '', getSessionGridEntries: () => [], getSessionGridOrder: () => ['a', 'b', 'c'] };
|
||||
const rows = [
|
||||
{ key: 'c', driverId: 'c', displayName: 'Cid', laps: 14, resultDisplay: '14/5:02.312', bestLapMs: 20100, gapDisplay: '-' },
|
||||
{ key: 'a', driverId: 'a', displayName: 'Ann', laps: 14, resultDisplay: '14/5:05.000', bestLapMs: 20300, gapDisplay: '+2.688' },
|
||||
];
|
||||
const box = document.createElement('div');
|
||||
const cells = () => [...box.querySelectorAll('.obs-tv-row:not(.obs-tv-labels)')].map((row) => [...row.children].map((cell) => cell.textContent.trim()).join('|'));
|
||||
box.innerHTML = renderObsOverlay({ eventId: 'e', name: '4WD A-final 2', type: 'final', startMode: 'position', status: 'running' }, rows, {}, { remainingMs: 217000 }, {}, deps);
|
||||
const final = { plate: box.querySelector('.obs-tv-session').textContent, event: box.querySelector('.obs-tv-event').textContent, rows: cells(), podium: box.querySelector('.obs-tv-row.is-p1') !== null, clock: box.querySelector('.obs-tv-clock[data-overlay-clock]') !== null };
|
||||
box.innerHTML = renderObsOverlay({ eventId: 'e', name: 'Open practice', type: 'open_practice', startMode: 'mass', status: 'running' }, [{ key: 'p', driverId: 'a', displayName: 'Pia', laps: 23, resultDisplay: '0:15.833', bestLapMs: 15833, gapDisplay: '-' }], {}, { untimed: true, elapsedMs: 1000 }, {}, deps);
|
||||
return { final, practice: cells() };
|
||||
})()`);
|
||||
assert.equal(tv.final.plate, "4WD A-final 2");
|
||||
assert.equal(tv.final.event, "Winter Cup");
|
||||
assert.deepEqual(tv.final.rows, ["1|/3|Cid|14|5:02.312|", "2|/1|Ann|14|5:05.000|+2.688"], "place / start, then laps and time without the laps prefix");
|
||||
assert.ok(tv.final.podium && tv.final.clock, "podium colours and the live clock");
|
||||
assert.deepEqual(tv.practice, ["1|Pia|23|0:15.833|"], "practice has no start column");
|
||||
console.log("PASS OBS TV graphics: title plate, tower with place / start position, laps, time and gap");
|
||||
}
|
||||
Reference in new issue
Block a user