OLD | NEW |
| (Empty) |
1 <!doctype html> | |
2 <html> | |
3 <head> | |
4 <title>Basic ConstantSourceNode Tests</title> | |
5 <script src="../resources/testharness.js"></script> | |
6 <script src="../resources/testharnessreport.js"></script> | |
7 <script src="resources/audit-util.js"></script> | |
8 <script src="resources/audio-testing.js"></script> | |
9 </head> | |
10 | |
11 <body> | |
12 <script> | |
13 var context = new AudioContext(); | |
14 | |
15 var audit = Audit.createTaskRunner(); | |
16 | |
17 audit.defineTask("createConstantSource()", function (taskDone) { | |
18 var node; | |
19 var success = true; | |
20 | |
21 success = Should("node = context.createConstantSource()", function () { | |
22 node = context.createConstantSource(); | |
23 }).notThrow(); | |
24 success = Should("node instance of ConstantSourceNode", | |
25 node instanceof ConstantSourceNode) | |
26 .beEqualTo(true) && success; | |
27 | |
28 success = verifyNodeDefaults(node) && success; | |
29 | |
30 Should("createConstantSource()", success) | |
31 .summarize( | |
32 "correctly created", | |
33 "incorrectly created"); | |
34 | |
35 taskDone(); | |
36 }); | |
37 | |
38 audit.defineTask("new ConstantSourceNode()", function (taskDone) { | |
39 var node; | |
40 var success = true; | |
41 | |
42 success = Should("node = new ConstantSourceNode()", function () { | |
43 node = new ConstantSourceNode(context); | |
44 }).notThrow(); | |
45 success = Should("node instance of ConstantSourceNode", | |
46 node instanceof ConstantSourceNode) | |
47 .beEqualTo(true) && success; | |
48 | |
49 | |
50 success = verifyNodeDefaults(node) && success; | |
51 | |
52 Should("new ConstantSourceNode(context)", success) | |
53 .summarize( | |
54 "correctly created", | |
55 "incorrectly created"); | |
56 | |
57 taskDone(); | |
58 }); | |
59 | |
60 function verifyNodeDefaults(node) { | |
61 var success = true; | |
62 | |
63 success = Should("node.numberOfInputs", node.numberOfInputs) | |
64 .beEqualTo(0); | |
65 success = Should("node.numberOfOutputs", node.numberOfOutputs) | |
66 .beEqualTo(1) && success; | |
67 success = Should("node.channelCount", node.channelCount) | |
68 .beEqualTo(2) && success; | |
69 success = Should("node.channelCountMode", node.channelCountMode) | |
70 .beEqualTo("max") && success; | |
71 success = Should("node.channelInterpretation", node.channelInterpretatio
n) | |
72 .beEqualTo("speakers") && success; | |
73 | |
74 success = Should("node.offset.value", node.offset.value) | |
75 .beEqualTo(1) && success; | |
76 success = Should("node.offset.defaultValue", node.offset.defaultValue) | |
77 .beEqualTo(1) && success; | |
78 success = Should("node.offset.minValue", node.offset.minValue) | |
79 .beEqualTo(Math.fround(-3.4028235e38)) && success; | |
80 success = Should("node.offset.maxValue", node.offset.maxValue) | |
81 .beEqualTo(Math.fround(3.4028235e38)) && success; | |
82 | |
83 return success; | |
84 } | |
85 | |
86 audit.runTasks(); | |
87 </script> | |
88 </body> | |
89 </html> | |
OLD | NEW |