Refactor GUI rendering and align RTA axis
This commit is contained in:
@@ -2,7 +2,7 @@ import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs';
|
||||
import vm from 'node:vm';
|
||||
import { getRtwCenters } from '../www/core/rtw_centers.js';
|
||||
import { selectLocalRtwPacket } from '../www/views/realtime.js';
|
||||
import { buildRtwTickPositions, selectLocalRtwPacket } from '../www/views/realtime.js';
|
||||
|
||||
const source = fs.readFileSync(new URL('../www/core/audio.js', import.meta.url), 'utf8');
|
||||
const functionSource = source.match(/export function buildRtaRuntimeConfig[\s\S]*?\n\}/)?.[0];
|
||||
@@ -87,4 +87,15 @@ assert.equal(selectedSixth.centers.length, getRtwCenters('1_6').length);
|
||||
assert.equal(selectedSixth.bands_avg.length, selectedSixth.centers.length);
|
||||
assert.equal(selectedSixth.bands_peak.length, selectedSixth.centers.length);
|
||||
|
||||
for (const mode of ['1_3', '1_6', '1_12']) {
|
||||
const centers = getRtwCenters(mode);
|
||||
const ticks = [20, 31.5, 63, 125, 250, 500, 1000, 2000, 4000, 8000, 16000];
|
||||
const positions = buildRtwTickPositions(centers, ticks);
|
||||
for (const tick of ticks) {
|
||||
const index = centers.indexOf(tick);
|
||||
assert.ok(index >= 0, `${mode} must contain the ${tick} Hz display band`);
|
||||
assert.equal(positions[String(tick)], (index + 0.5) / centers.length);
|
||||
}
|
||||
}
|
||||
|
||||
console.log('RTA profile regression tests passed');
|
||||
|
||||
Reference in New Issue
Block a user