mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 16:55:40 +00:00
Bug 1618225 - Added wpt test for loop with duration r=padenot
Silenced the mochitest Differential Revision: https://phabricator.services.mozilla.com/D79875
This commit is contained in:
parent
2ef567c825
commit
76419cd0d4
@ -49,6 +49,7 @@ skip-if = !asan && toolkit != android # These are tested in web-platform-tests,
|
||||
[test_audioBufferSourceNode.html]
|
||||
[test_audioBufferSourceNodeEnded.html]
|
||||
[test_audioBufferSourceNodeLazyLoopParam.html]
|
||||
skip-if = !asan && toolkit != android # These are tested in web-platform-tests, except on ASan and Android which don't run WPT.
|
||||
[test_audioBufferSourceNodeLoop.html]
|
||||
[test_audioBufferSourceNodeLoopStartEnd.html]
|
||||
[test_audioBufferSourceNodeLoopStartEndSame.html]
|
||||
|
@ -0,0 +1,52 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
Test AudioBufferSourceNode With Looping And Duration
|
||||
</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/webaudio/resources/audit-util.js"></script>
|
||||
<script src="/webaudio/resources/audit.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script id="layout-test-code">
|
||||
let audit = Audit.createTaskRunner();
|
||||
audit.define('loop with duration', (task, should) => {
|
||||
// Create the context
|
||||
let context = new OfflineAudioContext(1, 4096, 48000);
|
||||
|
||||
// Create the sample buffer and fill the second half with 1
|
||||
let buffer = context.createBuffer(1, 2048, context.sampleRate);
|
||||
for(let i = 1024; i < 2048; i++) {
|
||||
buffer.getChannelData(0)[i] = 1;
|
||||
}
|
||||
|
||||
// Create the source and set its value
|
||||
let source = context.createBufferSource();
|
||||
source.loop = true;
|
||||
source.loopStart = 1024 / context.sampleRate;
|
||||
source.loopEnd = 2048 / context.sampleRate;
|
||||
source.buffer = buffer;
|
||||
source.connect(context.destination);
|
||||
source.start(0, 1024 / context.sampleRate, 2048 / context.sampleRate);
|
||||
// Render it!
|
||||
context.startRendering()
|
||||
.then(function(audioBuffer) {
|
||||
for(let i = 0; i < 2048; i++) {
|
||||
assert_equals(audioBuffer.getChannelData(0)[i], 1,
|
||||
"audioBuffer did not loop as intended");
|
||||
}
|
||||
for(let i = 2048; i < 4096; i++) {
|
||||
assert_equals(audioBuffer.getChannelData(0)[i], 0,
|
||||
"audioBuffer did not respect duration");
|
||||
}
|
||||
})
|
||||
.then(task.done());
|
||||
});
|
||||
|
||||
audit.run();
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user