OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Test Exceptions from setValueCurveAtTime</title> | 4 <title>Test Exceptions from setValueCurveAtTime</title> |
5 <script src="../resources/js-test.js"></script> | 5 <script src="../resources/js-test.js"></script> |
6 <script src="resources/compatibility.js"></script> | 6 <script src="resources/compatibility.js"></script> |
7 <script src="resources/audio-testing.js"></script> | 7 <script src="resources/audio-testing.js"></script> |
8 </head> | 8 </head> |
9 | 9 |
10 <body> | 10 <body> |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 107 |
108 var prefix = "setValueCurve overlapping existing automation functions"; | 108 var prefix = "setValueCurve overlapping existing automation functions"; |
109 if (success) | 109 if (success) |
110 testPassed(prefix + " correctly signaled errors.\n"); | 110 testPassed(prefix + " correctly signaled errors.\n"); |
111 else | 111 else |
112 testFailed(prefix + " failed to signal errors.\n"); | 112 testFailed(prefix + " failed to signal errors.\n"); |
113 | 113 |
114 done(); | 114 done(); |
115 }); | 115 }); |
116 | 116 |
| 117 audit.defineTask("start-end", function (done) { |
| 118 var success = true; |
| 119 var context = new OfflineAudioContext(1, testDurationFrames, sampleRate)
; |
| 120 var g = context.createGain(); |
| 121 var curve = new Float32Array(2); |
| 122 |
| 123 // Verify that a setValueCurve can start at the end of an automation. |
| 124 var time = 0; |
| 125 var timeInterval = testDurationSec / 50; |
| 126 success = Should("setValueAtTime(1, " + time + ")", function () { |
| 127 g.gain.setValueAtTime(1, time); |
| 128 }).notThrow(); |
| 129 |
| 130 time += timeInterval; |
| 131 success = Should("linearRampToValueAtTime(0, " + time + ")", function ()
{ |
| 132 g.gain.linearRampToValueAtTime(0, time); |
| 133 }).notThrow() && success; |
| 134 |
| 135 // setValueCurve starts at the end of the linear ramp. This should be fi
ne. |
| 136 success = Should("setValueCurveAtTime(..., " + time + ", " + timeInterva
l + ")", function () { |
| 137 g.gain.setValueCurveAtTime(curve, time, timeInterval); |
| 138 }).notThrow() && success; |
| 139 |
| 140 // exponentialRamp ending one interval past the setValueCurve should be
fine. |
| 141 time += 2*timeInterval; |
| 142 success = Should("exponentialRampToValueAtTime(1, " + time + ")", functi
on () { |
| 143 g.gain.exponentialRampToValueAtTime(1, time); |
| 144 }).notThrow() && success; |
| 145 |
| 146 // setValueCurve starts at the end of the exponential ramp. This should
be fine. |
| 147 success = Should("setValueCurveAtTime(..., " + time + ", " + timeInterva
l + ")", function () { |
| 148 g.gain.setValueCurveAtTime(curve, time, timeInterval); |
| 149 }).notThrow() && success; |
| 150 |
| 151 // setValueCurve at the end of the setValueCurve should be fine. |
| 152 time += timeInterval; |
| 153 success = Should("setValueCurveAtTime(..., " + time + ", " + timeInterva
l + ")", function () { |
| 154 g.gain.setValueCurveAtTime(curve, time, timeInterval); |
| 155 }).notThrow() && success; |
| 156 |
| 157 // setValueAtTime at the end of setValueCurve should be fine. |
| 158 time += timeInterval; |
| 159 success = Should("setValueAtTime(0, " + time + ")", function () { |
| 160 g.gain.setValueAtTime(0, time); |
| 161 }).notThrow() && success; |
| 162 |
| 163 // setValueCurve at the end of setValueAtTime should be fine. |
| 164 success = Should("setValueCurveAtTime(..., " + time + ", " + timeInterva
l + ")", function () { |
| 165 g.gain.setValueCurveAtTime(curve, time, timeInterval); |
| 166 }).notThrow() && success; |
| 167 |
| 168 // setTarget starting at the end of setValueCurve should be fine. |
| 169 time += timeInterval; |
| 170 success = Should("setTargetAtTime(1, " + time + ", 1)", function () { |
| 171 g.gain.setTargetAtTime(1, time, 1); |
| 172 }).notThrow() && success; |
| 173 |
| 174 var prefix = "setValueCurve with adjoining automation functions"; |
| 175 if (success) |
| 176 testPassed(prefix + " allowed as expected.\n"); |
| 177 else |
| 178 testFailed(prefix + " unexpectedly signaled errors.\n"); |
| 179 |
| 180 done(); |
| 181 }); |
| 182 |
117 audit.defineTask("finish", function (done) { | 183 audit.defineTask("finish", function (done) { |
118 finishJSTest(); | 184 finishJSTest(); |
119 done(); | 185 done(); |
120 }); | 186 }); |
121 | 187 |
122 audit.runTasks(); | 188 audit.runTasks(); |
123 successfullyParsed = true; | 189 successfullyParsed = true; |
124 </script> | 190 </script> |
125 </body> | 191 </body> |
126 </html> | 192 </html> |
127 | 193 |
128 | 194 |
129 | 195 |
130 | 196 |
131 | 197 |
132 | 198 |
133 | 199 |
134 | 200 |
135 | 201 |
OLD | NEW |