Skip to content

Commit

Permalink
Connect tests to live suite
Browse files Browse the repository at this point in the history
Co-authored-by: terryzfeng <terryzfeng@users.noreply.github.com>
  • Loading branch information
Kizjkre and terryzfeng committed Jun 28, 2024
1 parent ed1a633 commit c28ee78
Show file tree
Hide file tree
Showing 15 changed files with 116 additions and 349 deletions.
38 changes: 0 additions & 38 deletions src/tests/live-suite/processors/recorder/recorder-main.js

This file was deleted.

20 changes: 0 additions & 20 deletions src/tests/live-suite/processors/recorder/recorder-processor.js

This file was deleted.

33 changes: 0 additions & 33 deletions src/tests/live-suite/scripts/converter.js

This file was deleted.

6 changes: 0 additions & 6 deletions src/tests/live-suite/scripts/main.js

This file was deleted.

162 changes: 0 additions & 162 deletions src/tests/live-suite/util/audioBufferToWav.js

This file was deleted.

16 changes: 0 additions & 16 deletions src/tests/live-suite/util/concat.js

This file was deleted.

41 changes: 19 additions & 22 deletions src/tests/playwright/pages/audioworklet-addmodule-resolution.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,28 @@

const filePath = 'processors/dummy-processor.js';

window.tests = {
...window.tests,
addModulesPromise: new Promise(async (resolve, reject) => {
await realtimeContext.audioWorklet.addModule(filePath);
await offlineContext.audioWorklet.addModule(filePath);
window.tests = new Promise(async (resolve, reject) => {
await realtimeContext.audioWorklet.addModule(filePath);
await offlineContext.audioWorklet.addModule(filePath);

try {
// Test if the browser does not crash upon addModule() call after the
// realtime context construction.
let realtimeDummyWorklet = new AudioWorkletNode(realtimeContext, 'dummy');
realtimeDummyWorklet.connect(realtimeContext.destination);
window.realtimeDummyWorkletLoaded = realtimeDummyWorklet instanceof AudioWorkletNode;
try {
// Test if the browser does not crash upon addModule() call after the
// realtime context construction.
let realtimeDummyWorklet = new AudioWorkletNode(realtimeContext, 'dummy');
realtimeDummyWorklet.connect(realtimeContext.destination);
window.realtimeDummyWorkletLoaded = realtimeDummyWorklet instanceof AudioWorkletNode;

// Test if the browser does not crash upon addModule() call after the
// offline context construction.
let offlineDummyWorklet = new AudioWorkletNode(offlineContext, 'dummy');
offlineDummyWorklet.connect(offlineContext.destination);
window.offlineDummyWorkletLoaded = offlineDummyWorklet instanceof AudioWorkletNode;
// Test if the browser does not crash upon addModule() call after the
// offline context construction.
let offlineDummyWorklet = new AudioWorkletNode(offlineContext, 'dummy');
offlineDummyWorklet.connect(offlineContext.destination);
window.offlineDummyWorkletLoaded = offlineDummyWorklet instanceof AudioWorkletNode;

resolve();
} catch(error) {
reject(error);
}
})
};
resolve();
} catch(error) {
reject(error);
}
});
</script>
<title>AudioWorklet Add Module Resolution</title>
</head>
Expand Down
42 changes: 20 additions & 22 deletions src/tests/playwright/pages/dsp-graph-evaluation.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,28 @@
import { evaluateGraph } from './util/audio-comparer.js';

// My Render Length (seconds)
window.tests = {
...window.tests,
graphEvalPromise: new Promise(async (resolve) => {
const length = 1;
// My DSP Graph (function)
const myGraph = ctx => {
const osc = new OscillatorNode(ctx);
osc.type = 'sawtooth';
const gain = new GainNode(ctx);
gain.gain.value = 2.2;
const biq = new BiquadFilterNode(ctx);
biq.type = 'bandpass';
biq.frequency.value = 1000;
biq.Q.value = 10;
osc.connect(gain).connect(biq).connect(ctx.destination);
// noinspection JSConstantReassignment,JSValidateTypes
window.test = new Promise(async (resolve) => {
const length = 1;
// My DSP Graph (function)
const myGraph = ctx => {
const osc = new OscillatorNode(ctx);
osc.type = 'sawtooth';
const gain = new GainNode(ctx);
gain.gain.value = 2.2;
const biq = new BiquadFilterNode(ctx);
biq.type = 'bandpass';
biq.frequency.value = 1000;
biq.Q.value = 10;
osc.connect(gain).connect(biq).connect(ctx.destination);

osc.start();
osc.stop(ctx.currentTime + length);
}
osc.start();
osc.stop(ctx.currentTime + length);
}

const score = await evaluateGraph(myGraph, length);
resolve({ "score": score });
})
}
const score = await evaluateGraph(myGraph, length);
resolve({score});
});
</script>
<title>DSP Graph Evaluation</title>
</head>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://unpkg.com/terminal.css@0.7.4/dist/terminal.min.css" />
<link rel="stylesheet" href="style.css" />
<script defer type="module" src="scripts/main.js"></script>
<link rel="stylesheet" href="live-suite/style.css" />
<script defer type="module" src="live-suite/scripts/main.js"></script>
<title>Web Audio Test Suite</title>
</head>
<body class="terminal">
Expand Down
Loading

0 comments on commit c28ee78

Please sign in to comment.