| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/testharness.js"></script> |
| 5 <script src="../../resources/testharnessreport.js"></script> |
| 5 <script src="../resources/audit-util.js"></script> | 6 <script src="../resources/audit-util.js"></script> |
| 6 <script src="../resources/audio-testing.js"></script> | 7 <script src="../resources/audio-testing.js"></script> |
| 7 <script src="../resources/audioparam-testing.js"></script> | 8 <script src="../resources/audioparam-testing.js"></script> |
| 8 <title>Test Sampling of LinearRampToValueAtTime</title> | 9 <title>Test Sampling of LinearRampToValueAtTime</title> |
| 9 </head> | 10 </head> |
| 10 | 11 |
| 11 <body> | 12 <body> |
| 12 <script> | 13 <script> |
| 13 description("Test Sampling of LinearRampToValueAtTime"); | |
| 14 | 14 |
| 15 window.jsTestIsAsync = true; | |
| 16 var sampleRate = 12800; | 15 var sampleRate = 12800; |
| 17 var context; | 16 var context; |
| 18 | 17 |
| 19 var audit = Audit.createTaskRunner(); | 18 var audit = Audit.createTaskRunner(); |
| 20 | 19 |
| 21 function runTest(config) { | 20 function runTest(config) { |
| 22 // Create a short context with a constant signal source connected to a g
ain node that will | 21 // Create a short context with a constant signal source connected to a g
ain node that will |
| 23 // be automated. | 22 // be automated. |
| 24 context = new OfflineAudioContext(1, 256, sampleRate); | 23 context = new OfflineAudioContext(1, 256, sampleRate); |
| 25 | 24 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 57 |
| 59 var success = Should(config.desc + ": Sample " + startFrame, | 58 var success = Should(config.desc + ": Sample " + startFrame, |
| 60 resultData[startFrame], { | 59 resultData[startFrame], { |
| 61 precision: 7 | 60 precision: 7 |
| 62 }).beCloseTo(expectedStart, config.startValueThreshold); | 61 }).beCloseTo(expectedStart, config.startValueThreshold); |
| 63 success = Should(config.desc + ": Sample " + endFrame, | 62 success = Should(config.desc + ": Sample " + endFrame, |
| 64 resultData[endFrame], { | 63 resultData[endFrame], { |
| 65 precision: 7 | 64 precision: 7 |
| 66 }).beCloseTo(expectedEnd, config.endValueThreshold) && success; | 65 }).beCloseTo(expectedEnd, config.endValueThreshold) && success; |
| 67 | 66 |
| 68 if (success) | 67 Should(config.desc, success) |
| 69 testPassed(config.desc + " passed.\n"); | 68 .summarize("passed", "failed"); |
| 70 else | |
| 71 testFailed(config.desc + " failed.\n"); | |
| 72 }); | 69 }); |
| 73 } | 70 } |
| 74 | 71 |
| 75 function expectedLinear(t) { | 72 function expectedLinear(t) { |
| 76 var slope = (this.endValue - this.startValue) / (this.endTime - this.sta
rtTime); | 73 var slope = (this.endValue - this.startValue) / (this.endTime - this.sta
rtTime); |
| 77 return this.startValue + slope * (t - this.startTime); | 74 return this.startValue + slope * (t - this.startTime); |
| 78 }; | 75 }; |
| 79 | 76 |
| 80 function expectedExponential(t) { | 77 function expectedExponential(t) { |
| 81 var ratio = this.endValue / this.startValue; | 78 var ratio = this.endValue / this.startValue; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 } | 161 } |
| 165 | 162 |
| 166 // Create all of the tasks from the test configs | 163 // Create all of the tasks from the test configs |
| 167 for (var k = 0; k < testConfigs.length; ++k) { | 164 for (var k = 0; k < testConfigs.length; ++k) { |
| 168 var config = testConfigs[k]; | 165 var config = testConfigs[k]; |
| 169 var taskName = config.desc + ":task" + k; | 166 var taskName = config.desc + ":task" + k; |
| 170 audit.defineTask(taskName, createTaskFunction(config)); | 167 audit.defineTask(taskName, createTaskFunction(config)); |
| 171 } | 168 } |
| 172 | 169 |
| 173 audit.defineTask("finish", function (done) { | 170 audit.defineTask("finish", function (done) { |
| 174 finishJSTest(); | |
| 175 done(); | 171 done(); |
| 176 }); | 172 }); |
| 177 | 173 |
| 178 audit.runTasks(); | 174 audit.runTasks(); |
| 179 successfullyParsed = true; | 175 successfullyParsed = true; |
| 180 </script> | 176 </script> |
| 181 </body> | 177 </body> |
| 182 </html> | 178 </html> |
| OLD | NEW |