fix(shot): A1 — blank-retry keeps the LARGER frame (retry snapped to temp path, os.replace only if >= first; worse late frame discarded + temp cleaned); regression test [9999,4801]->9999; 207 unit tests pass, lint PASS
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@ -94,6 +94,19 @@ def test_snap_retry_keeps_late_frame_even_if_still_blank(tmp_path):
|
||||
S._snap_with_blank_retry(page, out)
|
||||
assert page.shots == 2
|
||||
assert os.path.getsize(out) == 4801
|
||||
assert not os.path.exists(out + ".retry"), "temp retry frame must be cleaned up"
|
||||
|
||||
|
||||
def test_snap_retry_never_regresses_to_smaller_frame(tmp_path):
|
||||
"""Adversary finding A1: a partial-but-real first frame (just under the threshold) must
|
||||
survive a retry that comes back WORSE (page regressed to blank during the extra settle) —
|
||||
the larger frame wins."""
|
||||
out = str(tmp_path / "shot.png")
|
||||
page = _FakePage([9999, 4801])
|
||||
S._snap_with_blank_retry(page, out)
|
||||
assert page.shots == 2
|
||||
assert os.path.getsize(out) == 9999, "retry must never overwrite a larger frame (A1)"
|
||||
assert not os.path.exists(out + ".retry"), "temp retry frame must be cleaned up"
|
||||
|
||||
|
||||
def test_blank_threshold_brackets_observed_sizes():
|
||||
|
||||
Reference in New Issue
Block a user