| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Test Constructor: Panner</title> | 4 <title>Test Constructor: Panner</title> |
| 5 <script src="../../resources/testharness.js"></script> | 5 <script src="../../resources/testharness.js"></script> |
| 6 <script src="../../resources/testharnessreport.js"></script> | 6 <script src="../../resources/testharnessreport.js"></script> |
| 7 <script src="../resources/audit-util.js"></script> | 7 <script src="../resources/audit-util.js"></script> |
| 8 <script src="../resources/audio-testing.js"></script> | 8 <script src="../resources/audio-testing.js"></script> |
| 9 </head> | 9 </head> |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 "correctly threw errors", | 41 "correctly threw errors", |
| 42 "did not throw errors in all cases"); | 42 "did not throw errors in all cases"); |
| 43 | 43 |
| 44 taskDone(); | 44 taskDone(); |
| 45 }); | 45 }); |
| 46 | 46 |
| 47 audit.defineTask("default constructor", function (taskDone) { | 47 audit.defineTask("default constructor", function (taskDone) { |
| 48 var node; | 48 var node; |
| 49 var success = true; | 49 var success = true; |
| 50 | 50 |
| 51 success = Should("node = new PannerNode(context)", function () { | 51 success = Should("node0 = new PannerNode(context)", function () { |
| 52 node = new PannerNode(context); | 52 node = new PannerNode(context); |
| 53 }).notThrow(); | 53 }).notThrow(); |
| 54 success = Should("node instanceof PannerNode", node instanceof PannerNod
e) | 54 success = Should("node0 instanceof PannerNode", node instanceof PannerNo
de) |
| 55 .beEqualTo(true) && success; | 55 .beEqualTo(true) && success; |
| 56 | 56 |
| 57 success = Should("node.panningModel", node.panningModel) | 57 success = Should("node0.panningModel", node.panningModel) |
| 58 .beEqualTo("equalpower") && success; | 58 .beEqualTo("equalpower") && success; |
| 59 success = Should("node.positionX.value", node.positionX.value) | 59 success = Should("node0.positionX.value", node.positionX.value) |
| 60 .beEqualTo(0) && success; | 60 .beEqualTo(0) && success; |
| 61 success = Should("node.positionY.value", node.positionY.value) | 61 success = Should("node0.positionY.value", node.positionY.value) |
| 62 .beEqualTo(0) && success; | 62 .beEqualTo(0) && success; |
| 63 success = Should("node.positionZ.value", node.positionZ.value) | 63 success = Should("node0.positionZ.value", node.positionZ.value) |
| 64 .beEqualTo(0) && success; | 64 .beEqualTo(0) && success; |
| 65 success = Should("node.orientationX.value", node.orientationX.value) | 65 success = Should("node0.orientationX.value", node.orientationX.value) |
| 66 .beEqualTo(1) && success; | 66 .beEqualTo(1) && success; |
| 67 success = Should("node.orientationY.value", node.orientationY.value) | 67 success = Should("node0.orientationY.value", node.orientationY.value) |
| 68 .beEqualTo(0) && success; | 68 .beEqualTo(0) && success; |
| 69 success = Should("node.orientationZ.value", node.orientationZ.value) | 69 success = Should("node0.orientationZ.value", node.orientationZ.value) |
| 70 .beEqualTo(0) && success; | 70 .beEqualTo(0) && success; |
| 71 success = Should("node.distanceModel", node.distanceModel) | 71 success = Should("node0.distanceModel", node.distanceModel) |
| 72 .beEqualTo("inverse") && success; | 72 .beEqualTo("inverse") && success; |
| 73 success = Should("node.refDistance", node.refDistance) | 73 success = Should("node0.refDistance", node.refDistance) |
| 74 .beEqualTo(1) && success; | 74 .beEqualTo(1) && success; |
| 75 success = Should("node.maxDistance", node.maxDistance) | 75 success = Should("node0.maxDistance", node.maxDistance) |
| 76 .beEqualTo(10000) && success; | 76 .beEqualTo(10000) && success; |
| 77 success = Should("node.rolloffFactor", node.rolloffFactor) | 77 success = Should("node0.rolloffFactor", node.rolloffFactor) |
| 78 .beEqualTo(1) && success; | 78 .beEqualTo(1) && success; |
| 79 success = Should("node.coneInnerAngle", node.coneInnerAngle) | 79 success = Should("node0.coneInnerAngle", node.coneInnerAngle) |
| 80 .beEqualTo(360) && success; | 80 .beEqualTo(360) && success; |
| 81 success = Should("node.coneOuterAngle", node.coneOuterAngle) | 81 success = Should("node0.coneOuterAngle", node.coneOuterAngle) |
| 82 .beEqualTo(360) && success; | 82 .beEqualTo(360) && success; |
| 83 success = Should("node.coneOuterGain", node.coneOuterGain) | 83 success = Should("node0.coneOuterGain", node.coneOuterGain) |
| 84 .beEqualTo(0) && success; | 84 .beEqualTo(0) && success; |
| 85 | 85 |
| 86 // Test the listener too, while we're at it. | 86 // Test the listener too, while we're at it. |
| 87 success = Should("context.listener.positionX.value", context.listener.po
sitionX.value) | 87 success = Should("context.listener.positionX.value", context.listener.po
sitionX.value) |
| 88 .beEqualTo(0) && success; | 88 .beEqualTo(0) && success; |
| 89 success = Should("context.listener.positionY.value", context.listener.po
sitionY.value) | 89 success = Should("context.listener.positionY.value", context.listener.po
sitionY.value) |
| 90 .beEqualTo(0) && success; | 90 .beEqualTo(0) && success; |
| 91 success = Should("context.listener.positionZ.value", context.listener.po
sitionZ.value) | 91 success = Should("context.listener.positionZ.value", context.listener.po
sitionZ.value) |
| 92 .beEqualTo(0) && success; | 92 .beEqualTo(0) && success; |
| 93 success = Should("context.listener.forwardX.value", context.listener.for
wardX.value) | 93 success = Should("context.listener.forwardX.value", context.listener.for
wardX.value) |
| 94 .beEqualTo(0) && success; | 94 .beEqualTo(0) && success; |
| 95 success = Should("context.listener.forwardY.value", context.listener.for
wardY.value) | 95 success = Should("context.listener.forwardY.value", context.listener.for
wardY.value) |
| 96 .beEqualTo(0) && success; | 96 .beEqualTo(0) && success; |
| 97 success = Should("context.listener.forwardZ.value", context.listener.for
wardZ.value) | 97 success = Should("context.listener.forwardZ.value", context.listener.for
wardZ.value) |
| 98 .beEqualTo(-1) && success; | 98 .beEqualTo(-1) && success; |
| 99 success = Should("context.listener.upX.value", context.listener.upX.valu
e) | 99 success = Should("context.listener.upX.value", context.listener.upX.valu
e) |
| 100 .beEqualTo(0) && success; | 100 .beEqualTo(0) && success; |
| 101 success = Should("context.listener.upY.value", context.listener.upY.valu
e) | 101 success = Should("context.listener.upY.value", context.listener.upY.valu
e) |
| 102 .beEqualTo(1) && success; | 102 .beEqualTo(1) && success; |
| 103 success = Should("context.listener.upZ.value", context.listener.upZ.valu
e) | 103 success = Should("context.listener.upZ.value", context.listener.upZ.valu
e) |
| 104 .beEqualTo(0) && success; | 104 .beEqualTo(0) && success; |
| 105 | 105 |
| 106 success = Should("node.channelCount", node.channelCount) | 106 success = Should("node0.channelCount", node.channelCount) |
| 107 .beEqualTo(2) && success; | 107 .beEqualTo(2) && success; |
| 108 success = Should("node.channelCountMode", node.channelCountMode) | 108 success = Should("node0.channelCountMode", node.channelCountMode) |
| 109 .beEqualTo("clamped-max") && success; | 109 .beEqualTo("clamped-max") && success; |
| 110 success = Should("node.channelInterpretation", node.channelInterpretatio
n) | 110 success = Should("node0.channelInterpretation", node.channelInterpretati
on) |
| 111 .beEqualTo("speakers") && success; | 111 .beEqualTo("speakers") && success; |
| 112 | 112 |
| 113 Should("new PannerNode(context)", success) | 113 Should("new PannerNode(context)", success) |
| 114 .summarize( | 114 .summarize( |
| 115 "constructed node with correct attributes", | 115 "constructed node with correct attributes", |
| 116 "did not construct correct node correctly") | 116 "did not construct correct node correctly") |
| 117 | 117 |
| 118 taskDone(); | 118 taskDone(); |
| 119 }); | 119 }); |
| 120 | 120 |
| 121 audit.defineTask("test AudioNodeOptions", function (taskDone) { | 121 audit.defineTask("test AudioNodeOptions", function (taskDone) { |
| 122 // Can't use testAudioNodeOptions because the constraints for this node | 122 // Can't use testAudioNodeOptions because the constraints for this node |
| 123 // are not supported there. | 123 // are not supported there. |
| 124 var node; | 124 var node; |
| 125 var success = true; | 125 var success = true; |
| 126 | 126 |
| 127 // Test that we can set the channel count to 1 or 2. | 127 // Test that we can set the channel count to 1 or 2. |
| 128 var options = { | 128 var options = { |
| 129 channelCount: 1 | 129 channelCount: 1 |
| 130 }; | 130 }; |
| 131 success = Should("new PannerNode(c, " + JSON.stringify(options) + ")", | 131 success = Should("node1 = new PannerNode(c, " + JSON.stringify(options)
+ ")", |
| 132 function () { | 132 function () { |
| 133 node = new PannerNode(context, options); | 133 node = new PannerNode(context, options); |
| 134 }).notThrow() && success; | 134 }).notThrow() && success; |
| 135 success = Should("node.channelCount", node.channelCount) | 135 success = Should("node1.channelCount", node.channelCount) |
| 136 .beEqualTo(options.channelCount) && success; | 136 .beEqualTo(options.channelCount) && success; |
| 137 | 137 |
| 138 options = { | 138 options = { |
| 139 channelCount: 2 | 139 channelCount: 2 |
| 140 }; | 140 }; |
| 141 success = Should("new PannerNode(c, " + JSON.stringify(options) + ")", | 141 success = Should("node2 = new PannerNode(c, " + JSON.stringify(options)
+ ")", |
| 142 function () { | 142 function () { |
| 143 node = new PannerNode(context, options); | 143 node = new PannerNode(context, options); |
| 144 }).notThrow() && success; | 144 }).notThrow() && success; |
| 145 success = Should("node.channelCount", node.channelCount) | 145 success = Should("node2.channelCount", node.channelCount) |
| 146 .beEqualTo(options.channelCount) && success; | 146 .beEqualTo(options.channelCount) && success; |
| 147 | 147 |
| 148 // Test that other channel counts throw an error | 148 // Test that other channel counts throw an error |
| 149 options = { | 149 options = { |
| 150 channelCount: 0 | 150 channelCount: 0 |
| 151 }; | 151 }; |
| 152 success = Should("new PannerNode(c, " + JSON.stringify(options) + ")", | 152 success = Should("new PannerNode(c, " + JSON.stringify(options) + ")", |
| 153 function () { | 153 function () { |
| 154 node = new PannerNode(context, options); | 154 node = new PannerNode(context, options); |
| 155 }).throw("NotSupportedError") && success; | 155 }).throw("NotSupportedError") && success; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 168 success = Should("new PannerNode(c, " + JSON.stringify(options) + ")", | 168 success = Should("new PannerNode(c, " + JSON.stringify(options) + ")", |
| 169 function () { | 169 function () { |
| 170 node = new PannerNode(context, options); | 170 node = new PannerNode(context, options); |
| 171 }).throw("NotSupportedError") && success; | 171 }).throw("NotSupportedError") && success; |
| 172 | 172 |
| 173 // Test channelCountMode. A mode of "max" is illegal, but others are | 173 // Test channelCountMode. A mode of "max" is illegal, but others are |
| 174 // ok. | 174 // ok. |
| 175 options = { | 175 options = { |
| 176 channelCountMode: "clamped-max" | 176 channelCountMode: "clamped-max" |
| 177 }; | 177 }; |
| 178 success = Should("new PannerNode(c, " + JSON.stringify(options) + ")", | 178 success = Should("node3 = new PannerNode(c, " + JSON.stringify(options)
+ ")", |
| 179 function () { | 179 function () { |
| 180 node = new PannerNode(context, options); | 180 node = new PannerNode(context, options); |
| 181 }).notThrow() && success; | 181 }).notThrow() && success; |
| 182 success = Should("node.channelCountMode", node.channelCountMode) | 182 success = Should("node3.channelCountMode", node.channelCountMode) |
| 183 .beEqualTo(options.channelCountMode) && success; | 183 .beEqualTo(options.channelCountMode) && success; |
| 184 | 184 |
| 185 options = { | 185 options = { |
| 186 channelCountMode: "explicit" | 186 channelCountMode: "explicit" |
| 187 }; | 187 }; |
| 188 success = Should("new PannerNode(c, " + JSON.stringify(options) + ")", | 188 success = Should("node4 = new PannerNode(c, " + JSON.stringify(options)
+ ")", |
| 189 function () { | 189 function () { |
| 190 node = new PannerNode(context, options); | 190 node = new PannerNode(context, options); |
| 191 }).notThrow() && success; | 191 }).notThrow() && success; |
| 192 success = Should("node.channelCountMode", node.channelCountMode) | 192 success = Should("node4.channelCountMode", node.channelCountMode) |
| 193 .beEqualTo(options.channelCountMode); | 193 .beEqualTo(options.channelCountMode); |
| 194 | 194 |
| 195 options = { | 195 options = { |
| 196 channelCountMode: "max" | 196 channelCountMode: "max" |
| 197 }; | 197 }; |
| 198 success = Should("new PannerNode(c, " + JSON.stringify(options) + ")", | 198 success = Should("new PannerNode(c, " + JSON.stringify(options) + ")", |
| 199 function () { | 199 function () { |
| 200 node = new PannerNode(context, options); | 200 node = new PannerNode(context, options); |
| 201 }).throw("NotSupportedError") && success; | 201 }).throw("NotSupportedError") && success; |
| 202 | 202 |
| 203 options = { | 203 options = { |
| 204 channelCountMode: "foobar" | 204 channelCountMode: "foobar" |
| 205 }; | 205 }; |
| 206 success = Should('new PannerNode(c, " + JSON.stringify(options) + ")', | 206 success = Should('new PannerNode(c, " + JSON.stringify(options) + ")', |
| 207 function () { | 207 function () { |
| 208 node = new PannerNode(context, options); | 208 node = new PannerNode(context, options); |
| 209 }).throw("TypeError") && success; | 209 }).throw("TypeError") && success; |
| 210 | 210 |
| 211 // Test channelInterpretation. | 211 // Test channelInterpretation. |
| 212 options = { | 212 options = { |
| 213 channelInterpretation: "speakers" | 213 channelInterpretation: "speakers" |
| 214 }; | 214 }; |
| 215 success = Should("new PannerNode(c, " + JSON.stringify(options) + ")", | 215 success = Should("node5 = new PannerNode(c, " + JSON.stringify(options)
+ ")", |
| 216 function () { | 216 function () { |
| 217 node = new PannerNode(context, options); | 217 node = new PannerNode(context, options); |
| 218 }).notThrow() && success; | 218 }).notThrow() && success; |
| 219 success = Should("node.channelInterpretation", node.channelInterpretatio
n) | 219 success = Should("node5.channelInterpretation", node.channelInterpretati
on) |
| 220 .beEqualTo(options.channelInterpretation) && success; | 220 .beEqualTo(options.channelInterpretation) && success; |
| 221 | 221 |
| 222 options = { | 222 options = { |
| 223 channelInterpretation: "discrete" | 223 channelInterpretation: "discrete" |
| 224 }; | 224 }; |
| 225 success = Should("new PannerNode(c, " + JSON.stringify(options) + ")", | 225 success = Should("node6 = new PannerNode(c, " + JSON.stringify(options)
+ ")", |
| 226 function () { | 226 function () { |
| 227 node = new PannerNode(context, options); | 227 node = new PannerNode(context, options); |
| 228 }).notThrow() && success; | 228 }).notThrow() && success; |
| 229 success = Should("node.channelInterpretation", node.channelInterpretatio
n) | 229 success = Should("node6.channelInterpretation", node.channelInterpretati
on) |
| 230 .beEqualTo(options.channelInterpretation) && success; | 230 .beEqualTo(options.channelInterpretation) && success; |
| 231 | 231 |
| 232 options = { | 232 options = { |
| 233 channelInterpretation: "foobar" | 233 channelInterpretation: "foobar" |
| 234 }; | 234 }; |
| 235 success = Should("new PannerNode(c, " + JSON.stringify(options) + ")", | 235 success = Should("new PannerNode(c, " + JSON.stringify(options) + ")", |
| 236 function () { | 236 function () { |
| 237 node = new PannerNode(context, options); | 237 node = new PannerNode(context, options); |
| 238 }).throw("TypeError") && success; | 238 }).throw("TypeError") && success; |
| 239 | 239 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 "constructed with correct attributes", | 318 "constructed with correct attributes", |
| 319 "was not constructed correctly"); | 319 "was not constructed correctly"); |
| 320 | 320 |
| 321 taskDone(); | 321 taskDone(); |
| 322 }); | 322 }); |
| 323 | 323 |
| 324 audit.runTasks(); | 324 audit.runTasks(); |
| 325 </script> | 325 </script> |
| 326 </body> | 326 </body> |
| 327 </html> | 327 </html> |
| OLD | NEW |