diff options
| author | blasty <blasty@local> | 2026-07-10 12:04:48 +0200 |
|---|---|---|
| committer | blasty <blasty@local> | 2026-07-10 12:04:48 +0200 |
| commit | bc03ad0a233927dfbcbe6d91c6ddd89d33e8ebc8 (patch) | |
| tree | 6c2f6b75fd3b5dfc780815c5b3d6099a3827bcec /tests | |
| parent | server: inject a del_type tool into ida-pro-mcp (enables struct delete) (diff) | |
| download | ida-tui-bc03ad0a233927dfbcbe6d91c6ddd89d33e8ebc8.tar.gz ida-tui-bc03ad0a233927dfbcbe6d91c6ddd89d33e8ebc8.tar.xz ida-tui-bc03ad0a233927dfbcbe6d91c6ddd89d33e8ebc8.zip | |
struct editor: discoverable, confirmed delete (d/Del + ConfirmScreen)
Delete was wired to the Del key but undiscoverable (modal has no footer) and
unguarded. Add a 'd' alias (Del still works), and route delete through a small
ConfirmScreen (Enter/y confirm, Esc/n cancel) since it's destructive. 'd' in the
editor pane types normally; only the list triggers delete. Hint updated to
'd/Del delete'.
Pilot: 'd' opens the confirm, Esc cancels (kept), Enter deletes. full suite 85/85.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_tui.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/tests/test_tui.py b/tests/test_tui.py index f2e38ff..90c882b 100644 --- a/tests/test_tui.py +++ b/tests/test_tui.py @@ -19,8 +19,8 @@ import sys sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from idatui.app import ( # noqa: E402 - DecompView, DisasmView, FunctionsPanel, IdaTui, StructEditor, SymbolPalette, - XrefsScreen, + ConfirmScreen, DecompView, DisasmView, FunctionsPanel, IdaTui, StructEditor, + SymbolPalette, XrefsScreen, ) from textual.widgets import DataTable, Input, OptionList, Static, TextArea # noqa: E402 from rich.text import Text # noqa: E402 @@ -185,17 +185,25 @@ async def run(db): check("Ctrl+S updates an existing struct in place", next((s.members for s in se._structs if s.name == sname), 0) == 3, "member count not 3") - # delete: removes it if the server supports del_type, else reports it + # delete: 'd' asks to confirm, Enter deletes (server del_type). If the + # server lacks del_type, the status reports it instead. idx = next(i for i, s in enumerate(se._structs) if s.name == sname) + se.query_one(OptionList).focus() se.query_one(OptionList).highlighted = idx - se.action_delete() + await pilot.press("d") + confirmed = await wait_until( + pilot, lambda: isinstance(app.screen, ConfirmScreen), 10) + check("delete asks for confirmation", confirmed, + f"screen={type(app.screen).__name__}") + await pilot.press("enter") + await wait_until(pilot, lambda: isinstance(app.screen, StructEditor), 10) await wait_until( pilot, lambda: not any(s.name == sname for s in se._structs) or "del_type" in str(se.query_one("#se-status").render()), 15) st = str(se.query_one("#se-status").render()) gone = not any(s.name == sname for s in se._structs) - check("delete removes the struct (or reports the missing server tool)", + check("confirming delete removes the struct (or reports missing tool)", gone or "del_type" in st, f"gone={gone} status={st!r}") se.query_one(OptionList).focus() await pilot.press("escape") |
