|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 /** |
|
5 * Tests if draw calls inside a single animation frame generate and retrieve |
|
6 * the correct "end result" screenshot. |
|
7 */ |
|
8 |
|
9 function ifTestingSupported() { |
|
10 let [target, debuggee, front] = yield initCanavsDebuggerBackend(SIMPLE_CANVAS_URL); |
|
11 |
|
12 let navigated = once(target, "navigate"); |
|
13 |
|
14 yield front.setup({ reload: true }); |
|
15 ok(true, "The front was setup up successfully."); |
|
16 |
|
17 yield navigated; |
|
18 ok(true, "Target automatically navigated when the front was set up."); |
|
19 |
|
20 let snapshotActor = yield front.recordAnimationFrame(); |
|
21 ok(snapshotActor, |
|
22 "A snapshot actor was sent after recording."); |
|
23 |
|
24 let animationOverview = yield snapshotActor.getOverview(); |
|
25 ok(snapshotActor, |
|
26 "An animation overview could be retrieved after recording."); |
|
27 |
|
28 let screenshot = animationOverview.screenshot; |
|
29 ok(screenshot, |
|
30 "A screenshot was sent after recording."); |
|
31 |
|
32 is(screenshot.index, 6, |
|
33 "The screenshot's index is correct."); |
|
34 is(screenshot.width, 128, |
|
35 "The screenshot's width is correct."); |
|
36 is(screenshot.height, 128, |
|
37 "The screenshot's height is correct."); |
|
38 is(screenshot.flipped, false, |
|
39 "The screenshot's flipped flag is correct."); |
|
40 is([].find.call(screenshot.pixels, e => e > 0), 4290822336, |
|
41 "The screenshot's pixels seem to not be completely transparent."); |
|
42 |
|
43 yield removeTab(target.tab); |
|
44 finish(); |
|
45 } |