Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / webaudio / pannernode-basic.html
blob41e021b358fc7cb3cb2a9526e120319e087cfe6a
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../resources/js-test.js"></script>
5 <script src="resources/compatibility.js"></script>
6 <script src="resources/audio-testing.js"></script>
7 </head>
9 <body>
10 <div id="description"></div>
11 <div id="console"></div>
13 <script>
14 description("Basic tests for PannerNode.");
16 var context = 0;
18 function runTest() {
19 if (window.testRunner) {
20 testRunner.dumpAsText();
21 testRunner.waitUntilDone();
24 window.jsTestIsAsync = true;
26 context = new AudioContext();
27 var panner = context.createPanner();
29 if (panner.numberOfInputs === 1)
30 testPassed("PannerNode has one input.");
31 else
32 testFailed("PannerNode should have one input.");
34 if (panner.numberOfOutputs === 1)
35 testPassed("PannerNode has one output.");
36 else
37 testFailed("PannerNode should have one output.");
39 if (panner.refDistance === 1)
40 testPassed("refDistance default value is 1.");
41 else
42 testFailed("refDistance default value should be 1.");
44 panner.refDistance = 270.52
45 if (panner.refDistance === 270.52)
46 testPassed("refDistance value is set to 270.52.");
47 else
48 testFailed("refDistance value should be set to 270.52.");
50 if (panner.maxDistance === 10000)
51 testPassed("maxDistance default value is 10000.");
52 else
53 testFailed("maxDistance default value should be 10000.");
55 panner.maxDistance = 100.55
56 if (panner.maxDistance === 100.55)
57 testPassed("maxDistance value is set to 100.55.");
58 else
59 testFailed("maxDistance value should be set to 100.55.");
61 if (panner.rolloffFactor === 1)
62 testPassed("rolloffFactor default value is 1.");
63 else
64 testFailed("rolloffFactor default value should be 1.");
66 panner.rolloffFactor = 0.83
67 if (panner.rolloffFactor === 0.83)
68 testPassed("rolloffFactor value is set to 0.83.");
69 else
70 testFailed("rolloffFactor value should be set to 0.83.");
72 if (panner.coneInnerAngle === 360)
73 testPassed("coneInnerAngle default value is 360.");
74 else
75 testFailed("coneInnerAngle default value should be 360.");
77 panner.coneInnerAngle = 240.45
78 if (panner.coneInnerAngle === 240.45)
79 testPassed("coneInnerAngle value is set to 240.45.");
80 else
81 testFailed("coneInnerAngle value should be set to 240.45.");
83 if (panner.coneOuterAngle === 360)
84 testPassed("coneOuterAngle default value is 360.");
85 else
86 testFailed("coneOuterAngle default value should be 360.");
88 panner.coneOuterAngle = 166.66
89 if (panner.coneOuterAngle === 166.66)
90 testPassed("coneOuterAngle value is set to 166.66.");
91 else
92 testFailed("coneOuterAngle value should be set to 166.66.");
94 if (panner.coneOuterGain === 0)
95 testPassed("coneOuterGain default value is 0.");
96 else
97 testFailed("coneOuterGain default value should be 0.");
99 panner.coneOuterGain = 0.35
100 if (panner.coneOuterGain === 0.35)
101 testPassed("coneOuterGain value is set to 0.35.");
102 else
103 testFailed("coneOuterGain value should be set to 0.35.");
105 if (panner.panningModel === "equalpower")
106 testPassed("PannerNode defaults to 'equalpower' panningModel.");
107 else
108 testFailed("PannerNode should default to 'equalpower' panningModel.");
110 if (panner.distanceModel === "inverse")
111 testPassed("PannerNode defaults to 'inverse' distanceModel.");
112 else
113 testFailed("PannerNode should default to 'inverse' distanceModel.");
115 // Check that the .panningModel attribute can be set to all legal values.
116 var panningModels = [{value: "equalpower", integerValue: panner.EQUALPOWER},
117 {value: "HRTF", integerValue: panner.HRTF},
120 for (var i = 0; i < panningModels.length; ++i) {
121 try {
122 panner.panningModel = panningModels[i].value;
123 if (panner.panningModel === panningModels[i].value) {
124 var message = "panningModel: '" + panningModels[i].value + "' is settable.";
125 testPassed(message);
126 } else {
127 var message = "panningModel: '" + panningModels[i].value + "' was not correctly set.";
128 testFailed(message);
130 } catch(e) {
131 var message = "Setting panningModel to '" + panningModels[i].value + "' should not throw exception.";
132 testFailed(message);
136 // Check that numerical values are no longer supported.
137 panner.panningModel = "HRTF";
138 panner.panningModel = 1;
139 if (panner.panningModel == 1) {
140 testFailed("panningModel incorrectly set to " + panner.panningModel + ".");
141 } else {
142 testPassed("panningModel correctly not set to 1.");
145 // Check that the .distanceModel attribute can be set to all legal values.
146 var distanceModels = [{value: "linear"},
147 {value: "inverse"},
148 {value: "exponential"}
151 for (var i = 0; i < distanceModels.length; ++i) {
152 try {
153 panner.distanceModel = distanceModels[i].value;
154 if (panner.distanceModel === distanceModels[i].value) {
155 var message = "distanceModel: '" + distanceModels[i].value + "' is settable.";
156 testPassed(message);
157 } else {
158 var message = "distanceModel: '" + distanceModels[i].value + "' was not correctly set.";
159 testFailed(message);
161 } catch(e) {
162 var message = "Setting distanceModel to '" + distanceModels[i].value + "' should not throw exception.";
163 testFailed(message);
167 // Check that numerical values are no longer supported.
168 panner.distanceModel = "inverse";
169 panner.distanceModel = 1;
170 if (panner.distanceModel == 1) {
171 testFailed("distanceModel incorrectly set to " + panner.distanceModel + ".");
172 } else {
173 testPassed("distanceModel correctly not set to 1.");
176 finishJSTest();
179 runTest();
181 </script>
183 </body>
184 </html>