Files
palemoon27/toolkit/devtools/shared/test/browser_cubic-bezier-03.js
T
roytam1 bfa8452350 import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1084525 - Part 2: Refactor expectState from memory-bridge.js to common.js r=fitzgen (241c8d7cd)
- Bug 1084525 - Part 3: Add attach and detach methods to PromisesActor r=fitzgen (df0dea46d)
- Avoid infinite recursion when lazy-loading devtools modules and stepping into promise code in chrome debugging (bug 1149910). r=jlongster,fitzgen (a8e372285)
- Bug 1136341 - fix source actors representing inline scripts in XUL files so breakpoints work r=ejpbruel (904825023)
- Bug 1158498 - Can't set a JS breakpoint in inline JS;r=jlong (bbf9200ed)
- Bug 1166844 - treat eval'ed code from the console as unnamed eval sources r=ejpbruel (98d19de4e)
- Bug 1166852 - handle named eval sources from the console correctly r=ejpbruel (447b21b07)
- Bug 1163024 - Part 1: Stylesheet actors should use the common DevToolsUtils.fetch(). r=bgrins (2871b6295)
- Bug 1148893 - Miscellaneous fixes to multiple style editor tests. r=bgrins (073392349)
- Bug 1150005 - Don't wait for "editor-selected" event in browser_styleeditor_fetch-from-cache.js as it may have already been emitted. r=bgrins (c68786780)
- Bug 1163024 - Part 2: Ignore network requests from chrome code in a content toolbox. r=ochameau (6fd22227c)
- fix misspatch? (f1c0c1012)
- Bug 1161072 - Destroy inspector actor on disconnect. r=pbrosset (62bc54dfe)
- Bug 1168088 - Remove SpiderMonkey-specific syntax from toolkit/devtools. r=pbrosset (1f177ae4b)
- Bug 1134568 - Implement a preset gallery for CubicBezierWidget incl. 8 preset functions for categories: ease-in, ease-out, and ease-in-out. r=pbrosset (3ae37e757)
- Bug 1055181 - Mochitests for the CSS Filter tooltip; r=pbrosset (981c13b02)
- Bug 1149671 - Use alt/na/shift to step 0.1/1/10 at a time. r=pbrosset (fd70b5f1b)
- Bug 1126457 - Implement a worker utility to easily offload tasks into a worker. r=bgrins (2681ad8a1)
- fix misspatch (7afd26b57)
2021-04-17 08:04:03 +08:00

70 lines
2.6 KiB
JavaScript

/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Tests that coordinates can be changed programatically in the CubicBezierWidget
const TEST_URI = "chrome://global/content/devtools/cubic-bezier-frame.xhtml";
const {CubicBezierWidget} =
devtools.require("devtools/shared/widgets/CubicBezierWidget");
const {PREDEFINED} = require("devtools/shared/widgets/CubicBezierPresets");
add_task(function*() {
yield promiseTab("about:blank");
let [host, win, doc] = yield createHost("bottom", TEST_URI);
let container = doc.querySelector("#container");
let w = new CubicBezierWidget(container, PREDEFINED.linear);
yield coordinatesCanBeChangedByProvidingAnArray(w);
yield coordinatesCanBeChangedByProvidingAValue(w);
w.destroy();
host.destroy();
gBrowser.removeCurrentTab();
});
function* coordinatesCanBeChangedByProvidingAnArray(widget) {
info("Listening for the update event");
let onUpdated = widget.once("updated");
info("Setting new coordinates");
widget.coordinates = [0,1,1,0];
let bezier = yield onUpdated;
ok(true, "The updated event was fired as a result of setting coordinates");
is(bezier.P1[0], 0, "The new P1 time coordinate is correct");
is(bezier.P1[1], 1, "The new P1 progress coordinate is correct");
is(bezier.P2[0], 1, "The new P2 time coordinate is correct");
is(bezier.P2[1], 0, "The new P2 progress coordinate is correct");
}
function* coordinatesCanBeChangedByProvidingAValue(widget) {
info("Listening for the update event");
let onUpdated = widget.once("updated");
info("Setting linear css value");
widget.cssCubicBezierValue = "linear";
let bezier = yield onUpdated;
ok(true, "The updated event was fired as a result of setting cssValue");
is(bezier.P1[0], 0, "The new P1 time coordinate is correct");
is(bezier.P1[1], 0, "The new P1 progress coordinate is correct");
is(bezier.P2[0], 1, "The new P2 time coordinate is correct");
is(bezier.P2[1], 1, "The new P2 progress coordinate is correct");
info("Setting a custom cubic-bezier css value");
onUpdated = widget.once("updated");
widget.cssCubicBezierValue = "cubic-bezier(.25,-0.5, 1, 1.45)";
bezier = yield onUpdated;
ok(true, "The updated event was fired as a result of setting cssValue");
is(bezier.P1[0], .25, "The new P1 time coordinate is correct");
is(bezier.P1[1], -.5, "The new P1 progress coordinate is correct");
is(bezier.P2[0], 1, "The new P2 time coordinate is correct");
is(bezier.P2[1], 1.45, "The new P2 progress coordinate is correct");
}