-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
webdriver: add screenshot test utilities
This adds some test utilities to the WebDriver WPT tests for dealing with screenshots and document dimensions. Depends on D6886 Differential Revision: https://phabricator.services.mozilla.com/D6887 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1431148 gecko-commit: e30ce73ca4f120f38d619c1b626ff9f91f48a2f4 gecko-integration-branch: autoland gecko-reviewers: whimboo
- Loading branch information
1 parent
f105c05
commit ee3ff96
Showing
3 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import base64 | ||
import struct | ||
|
||
from tests.support.asserts import assert_png | ||
|
||
|
||
def png_dimensions(screenshot): | ||
assert_png(screenshot) | ||
image = base64.decodestring(screenshot) | ||
width, height = struct.unpack(">LL", image[16:24]) | ||
return int(width), int(height) |