From df028256fd84c654fd83c2b11b51a6a641cd3f62 Mon Sep 17 00:00:00 2001 From: blasty Date: Thu, 9 Jul 2026 20:07:26 +0200 Subject: test: fix stale row/function reuse across filter + xref-select blocks Two latent ordering bugs, exposed once the suite actually opened the big function: - the 'sub_1*' filter round-trip left the list filtered, so reusing biggest_i (an unfiltered row index) clamped move_cursor to a tiny stub function (4-line decompile, no calls), cascading into ~7 skipped/failed checks. Clear the filter before reusing biggest_i. - the xref-select sub-test navigates 'dis' to another function; the following column-cursor block assumed the original function was still loaded at call_idx, so h/l ran on an uncached (empty) line and clamped x to 0. Reload the original function and materialize the call line first. pilot suite 59/59. --- tests/test_tui.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/test_tui.py b/tests/test_tui.py index d14b525..26ef162 100644 --- a/tests/test_tui.py +++ b/tests/test_tui.py @@ -135,6 +135,11 @@ async def run(db): left.display and isinstance(app.focused, DataTable), f"display={left.display} focus={type(app.focused).__name__}") + # The 'sub_1*' round-trip above left the list filtered; clear it so the + # full table is back and biggest_i (an unfiltered row index) is valid. + app.clear_filter() + await wait_until(pilot, lambda: table.row_count == nfuncs, timeout=15) + # Decompiler toggle: open a function, Tab -> pseudocode, Shift+Tab -> back. table.focus() table.move_cursor(row=biggest_i) @@ -280,6 +285,7 @@ async def run(db): dis.cursor = call_idx dis.refresh() orig = app._cur.ea + orig_name = app._cur.name depth = len(app._nav) await pilot.press("enter") await wait_until(pilot, lambda: len(app._nav) > depth, timeout=25) @@ -338,11 +344,18 @@ async def run(db): f"cur={app._cur.ea:#x} (want {xref.fn_addr:#x}) " f"cursor={dis.cursor} (want {xexp})") + # The xref-select sub-test above navigated 'dis' to another function; + # return to the original and materialize the call line so the column + # cursor operates on a cached (non-empty) line. + app._open_function(orig, orig_name) + await wait_until(pilot, lambda: dis.total > 0 and app._cur.ea == orig, 20) + dis.model.lines(0, 400, prefetch=False) # Column cursor: h/l move it; following the symbol under the cursor. dis.focus() dis.cursor = call_idx dis.cursor_x = 5 dis.refresh() + await pilot.pause(0.05) await pilot.press("h") check("h moves the column cursor left", dis.cursor_x == 4, f"x={dis.cursor_x}") await pilot.press("l") -- cgit v1.3.1-sl0p