Bug 1488586 [wpt PR 12834] - Throw errors for invalid rolloffFactor and coneOuterGain, a=testonly

Automatic update from web-platform-testsThrow errors for invalid rolloffFactor and coneOuterGain

The WebAudio spec says we must throw errors for a negative
rolloffFactor and for a coneOuterGain outside the interval [0,
1]. Make it so.

Also add some additional tests to ctor-panner.html to verify that a
rolloffFactor of 0 or 100 do not throw errors and that a
coneOuterGain of 0 or 1 do not throw errors.

Remove invalid tests from panner-rolloff-clamping.html because
negative rolloffFactor now throws an error.

Finally remove text expectation for ctor-panner.html test, which
passes now.

Bug: 879845
Test: the-pannernode-interface/ctor-panner.html, the-pannernode-interface/panner-rolloff-clamping.html
Change-Id: Ie90e9fe13e82fd3cc955060dc9e77266ef4ff591
Reviewed-on: https://chromium-review.googlesource.com/1205099
Commit-Queue: Raymond Toy <rtoy@chromium.org>
Reviewed-by: Hongchan Choi <hongchan@chromium.org>
Reviewed-by: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#589045}

--

wpt-commits: 7b9c733915fab4723a453e03d692f9c396a8c6fb
wpt-pr: 12834
This commit is contained in:
Raymond Toy 2018-09-07 11:00:44 +00:00 коммит произвёл moz-wptsync-bot
Родитель 00eaeeafb7
Коммит c33b50ec25
3 изменённых файлов: 56 добавлений и 39 удалений

Просмотреть файл

@ -656136,7 +656136,7 @@
"support"
],
"webaudio/the-audio-api/the-pannernode-interface/ctor-panner.html": [
"cdad5977c70251edc0e8ecfac68c42cc4d2c7e41",
"d330c9c3de4482ee70c036e0ab7ff8feb1fd5a36",
"testharness"
],
"webaudio/the-audio-api/the-pannernode-interface/distance-exponential.html": [
@ -656176,7 +656176,7 @@
"testharness"
],
"webaudio/the-audio-api/the-pannernode-interface/panner-rolloff-clamping.html": [
"e1519f8c3027b3e38004e54ba6088ae819bedff1",
"387f87301092ebd725ed240cc70f0df7ec69a5ab",
"testharness"
],
"webaudio/the-audio-api/the-pannernode-interface/pannernode-basic.html": [

Просмотреть файл

@ -218,6 +218,16 @@
},
'new PannerNode(c, ' + JSON.stringify(options) + ')')
.throw(RangeError);
options = {rolloffFactor: 0};
should(
() => {
node = new PannerNode(context, options);
},
'node8 = new PannerNode(c, ' + JSON.stringify(options) + ')')
.notThrow();
should(node.rolloffFactor, 'node8.rolloffFactor')
.beEqualTo(options.rolloffFactor);
options = {rolloffFactor: 0.5};
should(
() => {
@ -228,6 +238,16 @@
should(node.rolloffFactor, 'node8.rolloffFactor')
.beEqualTo(options.rolloffFactor);
options = {rolloffFactor: 100};
should(
() => {
node = new PannerNode(context, options);
},
'node8 = new PannerNode(c, ' + JSON.stringify(options) + ')')
.notThrow();
should(node.rolloffFactor, 'node8.rolloffFactor')
.beEqualTo(options.rolloffFactor);
// Test coneOuterGain
options = {coneOuterGain: -1};
should(
@ -235,14 +255,23 @@
node = new PannerNode(context, options);
},
'new PannerNode(c, ' + JSON.stringify(options) + ')')
.throw('InvalidStateError');
.throw(DOMException, 'InvalidStateError');
options = {coneOuterGain: 1.1};
should(
() => {
node = new PannerNode(context, options);
},
'new PannerNode(c, ' + JSON.stringify(options) + ')')
.throw('InvalidStateError');
.throw(DOMException, 'InvalidStateError');
options = {coneOuterGain: 0.0};
should(
() => {
node = new PannerNode(context, options);
},
'node9 = new PannerNode(c, ' + JSON.stringify(options) + ')')
.notThrow();
should(node.coneOuterGain, 'node9.coneOuterGain')
.beEqualTo(options.coneOuterGain);
options = {coneOuterGain: 0.5};
should(
() => {
@ -253,6 +282,16 @@
should(node.coneOuterGain, 'node9.coneOuterGain')
.beEqualTo(options.coneOuterGain);
options = {coneOuterGain: 1.0};
should(
() => {
node = new PannerNode(context, options);
},
'node9 = new PannerNode(c, ' + JSON.stringify(options) + ')')
.notThrow();
should(node.coneOuterGain, 'node9.coneOuterGain')
.beEqualTo(options.coneOuterGain);
task.done();
});

Просмотреть файл

@ -17,41 +17,19 @@
let audit = Audit.createTaskRunner();
audit.define('linear-clamp-low', (task, should) => {
runTest(should, {
distanceModel: 'linear',
// Fairly arbitrary value outside the nominal range
rolloffFactor: -1,
clampedRolloff: 0
}).then(() => task.done());
});
audit.define('linear-clamp-high', (task, should) => {
runTest(should, {
distanceModel: 'linear',
// Fairly arbitrary value outside the nominal range
rolloffFactor: 2,
clampedRolloff: 1
}).then(() => task.done());
});
audit.define('inverse-clamp', (task, should) => {
runTest(should, {
distanceModel: 'inverse',
// Fairly arbitrary value outside the nominal range
rolloffFactor: -1,
clampedRolloff: 0
}).then(() => task.done());
});
audit.define('exponential-clamp', (task, should) => {
runTest(should, {
distanceModel: 'exponential',
// Fairly arbitrary value outside the nominal range
rolloffFactor: -2,
clampedRolloff: 0
}).then(() => task.done());
});
audit.define(
{
label: 'linear-clamp-high',
description: 'rolloffFactor clamping for linear distance model'
},
(task, should) => {
runTest(should, {
distanceModel: 'linear',
// Fairly arbitrary value outside the nominal range
rolloffFactor: 2,
clampedRolloff: 1
}).then(() => task.done());
});
// Test clamping of the rolloffFactor. The test is done by comparing the
// output of a panner with the rolloffFactor set outside the nominal range