blob: 8a5457f7b2b8c5f922bd2d3ebc10f952e504aaa3 [file] [log] [blame]
<!doctype html>
<html>
<head>
<title>
Test Panner.setPosition and Panner.setOrientation Errors
</title>
<script src="../../imported/w3c/web-platform-tests/resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../resources/audit-util.js"></script>
<script src="../resources/audit.js"></script>
<script src="../resources/set-position-vs-curve-test.js"></script>
</head>
<body>
<script id="layout-test-code">
// Fairly arbitrary rate
let sampleRate = 16000;
// For the tests we need to render for at least two render quanta.
// Otherwise, pretty arbitrary.
let renderFrames = 256;
let renderDuration = renderFrames / sampleRate;
// The curve duration for the test. Anything less than one render quantum
// is fine. Arbitrarily choose something small.
let curveDurationFrames = 8;
let curveDuration = curveDurationFrames / sampleRate;
// When to call setPosition, after the setValueCurve has ended. Any value
// after the end of the first render quantum is fine.
let suspendFrame = 129;
let audit = Audit.createTaskRunner();
// Array of tests to do. Each element of this array is used to create a
// task to test the entry.
let tests = [
// Test setPosition against positionX, positionY, and positionZ
// setValueCurves. Include test where there's overlap and where there
// isn't.
{
name: 'Panner setPosition X error',
options: {paramName: 'positionX', curveDuration: renderDuration}
},
{
name: 'Panner setPosition X no error',
options: {
paramName: 'positionX',
curveDuration: curveDuration,
suspendFrame: suspendFrame
}
},
{
name: 'Panner setPosition Y error',
options: {paramName: 'positionY', curveDuration: renderDuration}
},
{
name: 'Panner setPosition Y no error',
options: {
paramName: 'positionY',
curveDuration: curveDuration,
suspendFrame: suspendFrame
}
},
{
name: 'Panner setPosition Z error',
options: {paramName: 'positionZ', curveDuration: renderDuration}
},
{
name: 'Panner setPosition Z no error',
options: {
paramName: 'positionZ',
curveDuration: curveDuration,
suspendFrame: suspendFrame
}
},
// Now do the same with setOrientation.
{
name: 'Panner setOrientation X error',
options: {paramName: 'orientationX', curveDuration: renderDuration}
},
{
name: 'Panner setOrientation X no error',
options: {
paramName: 'orientationX',
curveDuration: curveDuration,
suspendFrame: suspendFrame
}
},
{
name: 'Panner setOrientation Y error',
options: {paramName: 'orientationY', curveDuration: renderDuration}
},
{
name: 'Panner setOrientation Y no error',
options: {
paramName: 'orientationY',
curveDuration: curveDuration,
suspendFrame: suspendFrame
}
},
{
name: 'Panner setOrientation Z error',
options: {paramName: 'orientationZ', curveDuration: renderDuration}
},
{
name: 'Panner setOrientation Z no error',
options: {
paramName: 'orientationZ',
curveDuration: curveDuration,
suspendFrame: suspendFrame
}
},
];
// Create an audit test for each entry in |tests|.
tests.forEach(test => {
audit.define(test.name, (task, should) => {
let context = new OfflineAudioContext(1, renderFrames, sampleRate);
testPositionSetterVsCurve(
should, context,
Object.assign(
{testName: test.name, nodeName: 'panner'}, test.options))
.then(() => task.done());
});
});
audit.run();
</script>
</body>
</html>