browser/devtools/canvasdebugger/test/browser_canvas-actor-test-05.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/canvasdebugger/test/browser_canvas-actor-test-05.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,45 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +/**
     1.8 + * Tests if draw calls inside a single animation frame generate and retrieve
     1.9 + * the correct "end result" screenshot.
    1.10 + */
    1.11 +
    1.12 +function ifTestingSupported() {
    1.13 +  let [target, debuggee, front] = yield initCanavsDebuggerBackend(SIMPLE_CANVAS_URL);
    1.14 +
    1.15 +  let navigated = once(target, "navigate");
    1.16 +
    1.17 +  yield front.setup({ reload: true });
    1.18 +  ok(true, "The front was setup up successfully.");
    1.19 +
    1.20 +  yield navigated;
    1.21 +  ok(true, "Target automatically navigated when the front was set up.");
    1.22 +
    1.23 +  let snapshotActor = yield front.recordAnimationFrame();
    1.24 +  ok(snapshotActor,
    1.25 +    "A snapshot actor was sent after recording.");
    1.26 +
    1.27 +  let animationOverview = yield snapshotActor.getOverview();
    1.28 +  ok(snapshotActor,
    1.29 +    "An animation overview could be retrieved after recording.");
    1.30 +
    1.31 +  let screenshot = animationOverview.screenshot;
    1.32 +  ok(screenshot,
    1.33 +    "A screenshot was sent after recording.");
    1.34 +
    1.35 +  is(screenshot.index, 6,
    1.36 +    "The screenshot's index is correct.");
    1.37 +  is(screenshot.width, 128,
    1.38 +    "The screenshot's width is correct.");
    1.39 +  is(screenshot.height, 128,
    1.40 +    "The screenshot's height is correct.");
    1.41 +  is(screenshot.flipped, false,
    1.42 +    "The screenshot's flipped flag is correct.");
    1.43 +  is([].find.call(screenshot.pixels, e => e > 0), 4290822336,
    1.44 +    "The screenshot's pixels seem to not be completely transparent.");
    1.45 +
    1.46 +  yield removeTab(target.tab);
    1.47 +  finish();
    1.48 +}

mercurial