| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../resources/testharness.js"></script> | 4 <script src="../../resources/testharness.js"></script> |
| 5 <script src="../../resources/testharnessreport.js"></script> | 5 <script src="../../resources/testharnessreport.js"></script> |
| 6 <script src="../resources/audit-util.js"></script> | 6 <script src="../resources/audit-util.js"></script> |
| 7 <script src="../resources/audio-testing.js"></script> | 7 <script src="../resources/audit.js"></script> |
| 8 <script src="../resources/panner-formulas.js"></script> | 8 <script src="../resources/panner-formulas.js"></script> |
| 9 <title>Test setValueCurveAtTime Copies the Curve Data</title> | 9 <title>Test setValueCurveAtTime Copies the Curve Data</title> |
| 10 </head> | 10 </head> |
| 11 | 11 |
| 12 <body> | 12 <body> |
| 13 <script> | 13 <script> |
| 14 | 14 |
| 15 var sampleRate = 48000; | 15 var sampleRate = 48000; |
| 16 var renderFrames = 1024; | 16 var renderFrames = 1024; |
| 17 var renderDuration = renderFrames / sampleRate; | 17 var renderDuration = renderFrames / sampleRate; |
| 18 | 18 |
| 19 var audit = Audit.createTaskRunner(); | 19 var audit = Audit.createTaskRunner(); |
| 20 | 20 |
| 21 // Test that changing the curve array to setValueCurveAtTime doesn't | 21 // Test that changing the curve array to setValueCurveAtTime doesn't |
| 22 // change the automation output. | 22 // change the automation output. |
| 23 audit.defineTask("test-copy", function (done) { | 23 audit.define("test-copy", (task, should) => { |
| 24 // Two-channel context; channel 0 is the test result, and channel 1 is | 24 // Two-channel context; channel 0 is the test result, and channel 1 is |
| 25 // the expected result. | 25 // the expected result. |
| 26 var context = new OfflineAudioContext(2, renderFrames, sampleRate); | 26 var context = new OfflineAudioContext(2, renderFrames, sampleRate); |
| 27 | 27 |
| 28 var source = context.createBufferSource(); | 28 var source = context.createBufferSource(); |
| 29 source.buffer = createConstantBuffer(context, 1, 1); | 29 source.buffer = createConstantBuffer(context, 1, 1); |
| 30 source.loop = true; | 30 source.loop = true; |
| 31 | 31 |
| 32 // Create two gain nodes. gainRef is the reference with the expected | 32 // Create two gain nodes. gainRef is the reference with the expected |
| 33 // automation results. gainTest is the test which will have the curve | 33 // automation results. gainTest is the test which will have the curve |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 // Start the test! | 70 // Start the test! |
| 71 source.start(); | 71 source.start(); |
| 72 | 72 |
| 73 context.startRendering().then(function (resultBuffer) { | 73 context.startRendering().then(function (resultBuffer) { |
| 74 var testData = resultBuffer.getChannelData(0); | 74 var testData = resultBuffer.getChannelData(0); |
| 75 var refData = resultBuffer.getChannelData(1); | 75 var refData = resultBuffer.getChannelData(1); |
| 76 | 76 |
| 77 // The test result and the reference should be identical since | 77 // The test result and the reference should be identical since |
| 78 // changing the curve data should not affect the automation. | 78 // changing the curve data should not affect the automation. |
| 79 var success = Should("setValueCurve output", testData).beEqualToArray(
refData); | 79 should(testData, "setValueCurve output").beEqualToArray(refData); |
| 80 | 80 }).then(() => task.done()); |
| 81 Should("Changing the curve data", success) | |
| 82 .summarize("did not change the result", "unexpectedly changed the re
sult"); | |
| 83 }).then(done); | |
| 84 }); | 81 }); |
| 85 | 82 |
| 86 audit.defineTask("finish", function (done) { | 83 audit.run(); |
| 87 done(); | |
| 88 }); | |
| 89 | |
| 90 audit.runTasks(); | |
| 91 </script> | 84 </script> |
| 92 </body> | 85 </body> |
| 93 </html> | 86 </html> |
| OLD | NEW |