test(tools): assert tap humanize actually jitters coords
This commit is contained in:
@@ -36,3 +36,15 @@ def test_tap_enabled_jitters_within_radius(monkeypatch):
|
||||
set_rng(None)
|
||||
px, py = driver.calls[-1][1]
|
||||
assert abs(px - 10) <= 5.0 and abs(py - 20) <= 5.0
|
||||
assert (px, py) != (10, 20), "jitter must move the point"
|
||||
|
||||
# second call with fresh seed must differ from first
|
||||
set_rng(random.Random(12))
|
||||
try:
|
||||
driver2 = FakeDriver()
|
||||
tap(10, 20, manager=_connected(driver2))
|
||||
finally:
|
||||
set_rng(None)
|
||||
px2, py2 = driver2.calls[-1][1]
|
||||
assert (px2, py2) != (10, 20)
|
||||
assert (px2, py2) != (px, py), "consecutive calls with different seeds must produce different jitter"
|
||||
|
||||
Reference in New Issue
Block a user