Bug 1472550 - Add a little regression test. r=karlt
authorPaul Adenot <paul@paul.cx>
Fri, 06 Jul 2018 18:58:21 +0200
changeset 426490 70b5a9fca55ba14785e52935fdc69df965818e47
parent 426489 5b8172ac07f62ad785c0d8df160696d3173bd9fe
child 426491 32557eba9675521f6cd4a538fcd92bf899d57697
push id34274
push usernerli@mozilla.com
push dateFri, 13 Jul 2018 21:51:36 +0000
treeherdermozilla-central@e37eeb019cf8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt
bugs1472550
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1472550 - Add a little regression test. r=karlt A more involved test exists as a web-platform-tests, but we can't run it because it makes use of AudioListener AudioParam, that we don't have right now. MozReview-Commit-ID: 8QJ12cGVRbQ
dom/media/webaudio/test/mochitest.ini
dom/media/webaudio/test/test_pannerNode_audioparam_distance.html
--- a/dom/media/webaudio/test/mochitest.ini
+++ b/dom/media/webaudio/test/mochitest.ini
@@ -193,16 +193,17 @@ skip-if = toolkit == 'android' # bug 109
 [test_oscillatorNode.html]
 [test_oscillatorNode2.html]
 [test_oscillatorNodeNegativeFrequency.html]
 [test_oscillatorNodePassThrough.html]
 [test_oscillatorNodeStart.html]
 [test_oscillatorTypeChange.html]
 [test_pannerNode.html]
 [test_pannerNode_equalPower.html]
+[test_pannerNode_audioparam_distance.html]
 [test_pannerNodeAbove.html]
 [test_pannerNodeAtZeroDistance.html]
 [test_pannerNodeChannelCount.html]
 [test_pannerNodeHRTFSymmetry.html]
 [test_pannerNodeTail.html]
 [test_pannerNode_maxDistance.html]
 [test_setValueCurveWithNonFiniteElements.html]
 [test_stereoPannerNode.html]
new file mode 100644
--- /dev/null
+++ b/dom/media/webaudio/test/test_pannerNode_audioparam_distance.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>Distance effect of a PannerNode with the position set via AudioParams (Bug 1472550)</title>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="text/javascript" src="webaudio.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+ SimpleTest.waitForExplicitFinish();
+ var o = new OfflineAudioContext(2, 256, 44100);
+
+ // We want a stereo constant source.
+ var b = o.createBuffer(2, 1, 44100);
+ b.getChannelData(0)[0] = 1;
+ b.getChannelData(1)[0] = 1;
+ var c = o.createBufferSource();
+ c.buffer = b;
+ c.loop = true;
+
+ var p = o.createPanner();
+ p.positionY.setValueAtTime(1, 0);
+ p.positionX.setValueAtTime(1, 0);
+ p.positionZ.setValueAtTime(1, 0);
+
+ // Set the listener somewhere far
+ o.listener.setPosition(20, 2, 20);
+
+ c.start();
+ c.connect(p).connect(o.destination);
+
+ o.startRendering().then((ab) => {
+   // Check that the distance attenuates the sound.
+   ok(ab.getChannelData(0)[0] < 0.1, "left channel must be very quiet");
+   ok(ab.getChannelData(1)[0] < 0.1, "right channel must be very quiet");
+   SimpleTest.finish();
+ });
+</script>
+</pre>
+</body>
+</html>