qemu: wait_hit and wait_region poll a settling page
A hit or region check fired once, so a check one second after `nav` raced a page still laying itself out (flare-edge #175). wait_hit X Y CLASS TIMEOUT_S [box=...] [TEXT] and wait_region NAME TOLERANCE TIMEOUT_S run the same judgement every 0.5 s until it holds or the deadline passes, and report how long they waited. The assert_hit judgement moves into judge_hit so both verbs mean the same thing by a match; a missing reference or foreign tolerance stays fatal on the first answer, since waiting cannot fix either. Offline tests cover both verbs and the timeout. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N3G6m9Aw5RyVY4ZowtKzEj
This commit is contained in:
@@ -133,11 +133,14 @@ class DriveVerbs(unittest.TestCase):
|
||||
"capture_region r1 0 0 8 8 exact\n"
|
||||
"assert_region r1 exact\n"
|
||||
"assert_region r1\n"
|
||||
"wait_hit 47 676 obj 2 box=12,640,72x72\n"
|
||||
"wait_region r1 exact 2\n"
|
||||
"scroll 360 400 300\n"
|
||||
"home\n"
|
||||
)
|
||||
self.assertIsNone(rc, [r for r in rows if r["status"] != "ok"])
|
||||
self.assertEqual(len(rows), 14)
|
||||
self.assertEqual(len(rows), 16)
|
||||
self.assertIn("waited", by["wait_hit 47 676 obj 2 box=12,640,72x72"]["detail"])
|
||||
self.assertTrue(all(r["status"] == "ok" for r in rows))
|
||||
|
||||
def test_mismatches_are_fails_not_stops(self):
|
||||
@@ -149,13 +152,16 @@ class DriveVerbs(unittest.TestCase):
|
||||
"assert_json a.zz eq 1\n"
|
||||
"assert_stat fps lt 0\n"
|
||||
"scroll 360 400 0\n"
|
||||
"wait_hit 47 676 obj 1 box=0,0,1x1\n"
|
||||
"assert_page Demo/Rows\n"
|
||||
)
|
||||
self.assertEqual(rc, 1)
|
||||
self.assertEqual([r["status"] for r in rows],
|
||||
["fail", "fail", "fail", "fail", "fail", "fail", "ok"])
|
||||
["fail", "fail", "fail", "fail", "fail", "fail", "fail", "ok"])
|
||||
self.assertIn("moved", by["assert_hit 47 676 obj box=0,0,1x1"]["detail"])
|
||||
self.assertGreaterEqual(time.monotonic() - t0, 1.0, "wait_json must honour its timeout")
|
||||
self.assertIn("moved", by["wait_hit 47 676 obj 1 box=0,0,1x1"]["detail"])
|
||||
self.assertGreaterEqual(time.monotonic() - t0, 2.0,
|
||||
"wait_json and wait_hit must each honour their timeout")
|
||||
|
||||
def test_region_faults_are_per_step_fatal(self):
|
||||
# A pre-seeded reference whose box does not fit a 64x64 screendump,
|
||||
|
||||
Reference in New Issue
Block a user