4 <script src="resources/audio-testing.js"></script>
5 <script src="../fast/js/resources/js-test-pre.js"></script>
9 <div id="description"></div>
10 <div id="console"></div>
13 description("Basic test for AudioPannerNode.");
16 if (window.testRunner) {
17 testRunner.dumpAsText();
18 testRunner.waitUntilDone();
21 window.jsTestIsAsync = true;
23 var context = new webkitAudioContext();
24 var panner = context.createPanner();
26 if (panner.numberOfInputs === 1)
27 testPassed("AudioPannerNode has one input.");
29 testFailed("AudioPannerNode should have one input.");
31 if (panner.numberOfOutputs === 1)
32 testPassed("AudioPannerNode has one output.");
34 testFailed("AudioPannerNode should have one output.");
36 if (panner.panningModel === panner.HRTF)
37 testPassed("panningModel default value is HRTF.");
39 testFailed("panningModel default value is not HRTF.");
41 // Set the panning model and see if it can be read back correctly.
42 panner.panningModel = panner.EQUALPOWER;
43 if (panner.panningModel === 0)
44 testPassed("panningModel set to EQUALPOWER model and read correctly.");
46 testFailed("panningModel set to EQUALPOWER (0) but returned " + panner.panningModel);
48 panner.panningModel = panner.HRTF;
49 if (panner.panningModel === 1)
50 testPassed("panningModel set to HRTF model and read correctly.");
52 testFailed("panningModel set to HRTF (1) but returned " + panner.panningModel);
54 // SOUNDFIELD should throw exception because it is not
55 // currently implemented. (See https://bugs.webkit.org/show_bug.cgi?id=77367)
57 panner.panningModel = panner.SOUNDFIELD;
58 testFailed("Setting panningModel to SOUNDFIELD should throw exception because it is not implemented.");
60 testPassed("Setting panningModel to SOUNDFIELD correctly throws exception because it is not implemented.");
63 // Other invalid models should throw an exception.
65 panner.panningModel = panner.SOUNDFIELD + 1;
66 testFailed("Illegal panningModel should throw exception.");
68 testPassed("Illegal panningModel correctly throws exception.");
71 panner.distanceModel = panner.LINEAR_DISTANCE;
72 if (panner.distanceModel === 0)
73 testPassed("distanceModel set to LINEAR_DISTANCE and read correctly.");
75 testFailed("distanceModel set to LINEAR_DISTANCE (0) but returned " + panner.distanceModel);
77 panner.distanceModel = panner.INVERSE_DISTANCE;
78 if (panner.distanceModel === 1)
79 testPassed("distanceModel set to INVERSE_DISTANCE and read correctly.");
81 testFailed("distanceModel set to INVERSE_DISTANCE (1) but returned " + panner.distanceModel);
83 panner.distanceModel = panner.EXPONENTIAL_DISTANCE;
84 if (panner.distanceModel === 2)
85 testPassed("distanceModel set to EXPONENTIAL_DISTANCE and read correctly.");
87 testFailed("distanceModel set to EXPONENTIAL_DISTANCE (2) but returned " + panner.distanceModel);
90 panner.distanceModel = panner.EXPONENTIAL_DISTANCE + 1;
91 testFailed("Illegal distanceModel should throw exception.");
93 testPassed("Illegal distanceModel correctly throws exception.");
100 successfullyParsed = true;
103 <script src="../fast/js/resources/js-test-post.js"></script>