gecko-dev/devtools/client/webaudioeditor/test/browser_audionode-actor-get-automation-data-02.js
J. Ryan Stinnett 30b2b7ce44 Bug 1271084 - Apply ESLint autofixes to ignored /devtools files. r=tromey
For simple rules like function spacing, we can auto-fix these across the code
base so they are followed in a consistent way.

To generate this patch, I ran:

./mach eslint devtools --no-ignore --fix

After this, I reverted any changes to third party files that we really do want
to ignore.

MozReview-Commit-ID: 6Q8BApkAW20
2016-05-18 12:49:23 -05:00

43 lines
1.7 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Test AudioNode#addAutomationEvent() when automation series ends with
* `setTargetAtTime`, which approaches its target to infinity.
*/
add_task(function* () {
let { target, front } = yield initBackend(SIMPLE_CONTEXT_URL);
let [_, [destNode, oscNode, gainNode]] = yield Promise.all([
front.setup({ reload: true }),
get3(front, "create-node")
]);
yield oscNode.addAutomationEvent("frequency", "setValueAtTime", [300, 0.1]);
yield oscNode.addAutomationEvent("frequency", "linearRampToValueAtTime", [500, 0.4]);
yield oscNode.addAutomationEvent("frequency", "exponentialRampToValueAtTime", [200, 0.6]);
// End with a setTargetAtTime event, as the target approaches infinity, which will
// give us more points to render than the default 2000
yield oscNode.addAutomationEvent("frequency", "setTargetAtTime", [1000, 2, 0.5]);
var { events, values } = yield oscNode.getAutomationData("frequency");
is(events.length, 4, "4 recorded events returned.");
is(values.length, 4000, "4000 value points returned when ending with exponentiall approaching automator.");
checkAutomationValue(values, 2.01, 215.055);
checkAutomationValue(values, 2.1, 345.930);
checkAutomationValue(values, 3, 891.601);
checkAutomationValue(values, 5, 998.01);
// Refetch the automation data to ensure it recalculates correctly (bug 1118071)
var { events, values } = yield oscNode.getAutomationData("frequency");
checkAutomationValue(values, 2.01, 215.055);
checkAutomationValue(values, 2.1, 345.930);
checkAutomationValue(values, 3, 891.601);
checkAutomationValue(values, 5, 998.01);
yield removeTab(target.tab);
});