diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /dom/media/webaudio/test/test_retrospective-linearRampToValueAtTime.html | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/webaudio/test/test_retrospective-linearRampToValueAtTime.html')
-rw-r--r-- | dom/media/webaudio/test/test_retrospective-linearRampToValueAtTime.html | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/dom/media/webaudio/test/test_retrospective-linearRampToValueAtTime.html b/dom/media/webaudio/test/test_retrospective-linearRampToValueAtTime.html new file mode 100644 index 0000000000..1594a30bd1 --- /dev/null +++ b/dom/media/webaudio/test/test_retrospective-linearRampToValueAtTime.html @@ -0,0 +1,51 @@ +<!doctype html> +<meta charset=utf-8> +<title>Test linearRampToValue with end time in the past</title> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<script> +function do_test(t, context) { + var source = context.createConstantSource(); + source.start(); + + var test = context.createGain(); + test.gain.linearRampToValueAtTime(0.1, 0.5*context.currentTime); + test.gain.linearRampToValueAtTime(0.9, 2.0); + + var reference = context.createGain(); + reference.gain.linearRampToValueAtTime(0.1, context.currentTime); + reference.gain.linearRampToValueAtTime(0.9, 2.0); + + source.connect(test); + source.connect(reference); + + var merger = context.createChannelMerger(); + test.connect(merger, 0, 0); + reference.connect(merger, 0, 1); + + var processor = context.createScriptProcessor(0, 2, 0); + merger.connect(processor); + processor.onaudioprocess = + t.step_func_done((e) => { + source.stop(); + processor.onaudioprocess = null; + + var testValue = e.inputBuffer.getChannelData(0)[0]; + var referenceValue = e.inputBuffer.getChannelData(1)[0]; + + assert_equals(testValue, referenceValue, + "value matches expected"); + }); +} + +async_test(function(t) { + var context = new AudioContext; + (function waitForTimeAdvance() { + if (context.currentTime == 0) { + t.step_timeout(waitForTimeAdvance, 0); + } else { + do_test(t, context); + } + })(); +}); +</script> |