michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: /** michael@0: * Tests if draw calls inside a single animation frame generate and retrieve michael@0: * the correct "end result" screenshot. michael@0: */ michael@0: michael@0: function ifTestingSupported() { michael@0: let [target, debuggee, front] = yield initCanavsDebuggerBackend(SIMPLE_CANVAS_URL); michael@0: michael@0: let navigated = once(target, "navigate"); michael@0: michael@0: yield front.setup({ reload: true }); michael@0: ok(true, "The front was setup up successfully."); michael@0: michael@0: yield navigated; michael@0: ok(true, "Target automatically navigated when the front was set up."); michael@0: michael@0: let snapshotActor = yield front.recordAnimationFrame(); michael@0: ok(snapshotActor, michael@0: "A snapshot actor was sent after recording."); michael@0: michael@0: let animationOverview = yield snapshotActor.getOverview(); michael@0: ok(snapshotActor, michael@0: "An animation overview could be retrieved after recording."); michael@0: michael@0: let screenshot = animationOverview.screenshot; michael@0: ok(screenshot, michael@0: "A screenshot was sent after recording."); michael@0: michael@0: is(screenshot.index, 6, michael@0: "The screenshot's index is correct."); michael@0: is(screenshot.width, 128, michael@0: "The screenshot's width is correct."); michael@0: is(screenshot.height, 128, michael@0: "The screenshot's height is correct."); michael@0: is(screenshot.flipped, false, michael@0: "The screenshot's flipped flag is correct."); michael@0: is([].find.call(screenshot.pixels, e => e > 0), 4290822336, michael@0: "The screenshot's pixels seem to not be completely transparent."); michael@0: michael@0: yield removeTab(target.tab); michael@0: finish(); michael@0: }