OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <html> |
| 3 <head> |
| 4 <title>Test Constructor: ConstantSource</title> |
| 5 <script src="../../resources/testharness.js"></script> |
| 6 <script src="../../resources/testharnessreport.js"></script> |
| 7 <script src="../resources/audio-testing.js"></script> |
| 8 </head> |
| 9 |
| 10 <body> |
| 11 <script> |
| 12 var context; |
| 13 |
| 14 var audit = Audit.createTaskRunner(); |
| 15 |
| 16 audit.defineTask("initialize", function (taskDone) { |
| 17 Should("context = new OfflineAudioContext(...)", function () { |
| 18 context = new OfflineAudioContext(1, 1, 48000); |
| 19 }).notThrow(); |
| 20 taskDone(); |
| 21 }); |
| 22 |
| 23 audit.defineTask("invalid constructor", function (taskDone) { |
| 24 var node; |
| 25 var success = true; |
| 26 |
| 27 succes = Should("new ConstantSourceNode()", function () { |
| 28 node = new ConstantSourceNode(); |
| 29 }).throw("TypeError"); |
| 30 success = Should("new ConstantSourceNode(1)", function () { |
| 31 node = new ConstantSourceNode(1); |
| 32 }).throw("TypeError") && success; |
| 33 success = Should("new ConstantSourceNode(context, 42)", function () { |
| 34 node = new ConstantSourceNode(context, 42); |
| 35 }).throw("TypeError") && success; |
| 36 |
| 37 Should("*** Invalid constructors", success) |
| 38 .summarize( |
| 39 "correctly threw errors", |
| 40 "did not throw errors in all cases"); |
| 41 taskDone(); |
| 42 }); |
| 43 |
| 44 audit.defineTask("default constructor", function (taskDone) { |
| 45 var node; |
| 46 var success = true; |
| 47 |
| 48 success = Should("node = new ConstantSourceNode(context)", function () { |
| 49 node = new ConstantSourceNode(context); |
| 50 }).notThrow(); |
| 51 success = Should("node instanceOf ConstantSourceNode", node instanceof C
onstantSourceNode) |
| 52 .beEqualTo(true) && success; |
| 53 success = Should("node.offset.value", node.offset.value) |
| 54 .beEqualTo(1) && success; |
| 55 |
| 56 success = Should("node.channelCount", node.channelCount) |
| 57 .beEqualTo(2) && success; |
| 58 success = Should("node.channelCountMode", node.channelCountMode) |
| 59 .beEqualTo("max") && success; |
| 60 success = Should("node.channelInterpretation", node.channelInterpretatio
n) |
| 61 .beEqualTo("speakers") && success; |
| 62 |
| 63 success = Should("*** new AnalyserNode(context)", success) |
| 64 .summarize( |
| 65 "constructed node with correct attributes", |
| 66 "did not construct correct node correctly") |
| 67 |
| 68 taskDone(); |
| 69 }); |
| 70 |
| 71 audit.runTasks(); |
| 72 </script> |
| 73 </body> |
| 74 </html> |
OLD | NEW |