Skip to content

Commit

Permalink
DBG - let's see those inconsistencies
Browse files Browse the repository at this point in the history
  • Loading branch information
mvollmer committed Feb 20, 2025
1 parent 18bd608 commit 498d8da
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions test/common/testlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1380,10 +1380,15 @@ def relative_clips(sels: Collection[str]) -> Collection[tuple[int, int, int, int
ret = self.bidi("browsingContext.captureScreenshot", quiet=True,
context=self.driver.top_context,
clip=rect)
png_now = base64.standard_b64decode(ret["data"])
if ret1["data"] != ret["data"]:
print("WARNING: Inconsistent screenshots for", base)
png_now = base64.standard_b64decode(ret["data"])
png_ref = os.path.exists(ref_filename) and open(ref_filename, "rb").read()
# XXX - for temporarily seeing what kind of inconsistencies we actually get
png_ref = base64.standard_b64decode(ret1["data"])
inconsistent = True
else:
png_ref = os.path.exists(ref_filename) and open(ref_filename, "rb").read()
inconsistent = False
if not png_ref:
with open(filename, 'wb') as f:
f.write(png_now)
Expand Down Expand Up @@ -1455,10 +1460,10 @@ def img_eq(ref: Image.Image, now: Image.Image, delta: Image.Image) -> bool:
assert isinstance(now_pixel, tuple)

if ref_pixel != now_pixel:
if (
if (not inconsistent and (
masked(ref_pixel) or
ignorable_coord(x, y) or
ignorable_change(ref_pixel, now_pixel)
ignorable_change(ref_pixel, now_pixel))
):
data_delta[x, y] = (0, 255, 0, 255)
else:
Expand Down

0 comments on commit 498d8da

Please sign in to comment.