diff --git a/src/commands.py b/src/commands.py index 7a3e362b..98d5fc87 100644 --- a/src/commands.py +++ b/src/commands.py @@ -355,21 +355,16 @@ def reset_layout(app: "App") -> None: window names that no longer exist (e.g. after a refactor renames windows) and the dock space appears empty / non-recoverable via the Windows menu. Sets every show_windows entry to True and - deletes manualslop_layout.ini so hello_imgui regenerates a fresh - dock layout on the next frame (and the next process shutdown saves - the new layout in place of the stale one). The user will need to - restart sloppy.py for the dock layout to fully take effect; the - show_windows toggles take effect immediately. + deletes the cwd's manualslop_layout.ini so hello_imgui regenerates + a fresh dock layout on the next process restart. The show_windows + toggles take effect immediately. """ if hasattr(app, "show_windows") and isinstance(app.show_windows, dict): for name in app.show_windows.keys(): app.show_windows[name] = True try: import os - layout_paths = [ - "manualslop_layout.ini", - os.path.join("tests", "artifacts", "live_gui_workspace", "manualslop_layout.ini"), - ] + layout_paths: list[str] = ["manualslop_layout.ini"] for p in layout_paths: if os.path.exists(p): os.remove(p) diff --git a/tests/test_reset_layout.py b/tests/test_reset_layout.py new file mode 100644 index 00000000..c735f8ff --- /dev/null +++ b/tests/test_reset_layout.py @@ -0,0 +1,21 @@ +from __future__ import annotations + +import ast +import inspect + +import src.commands as commands + + +def test_reset_layout_excludes_test_fixture_path() -> None: + source: str = inspect.getsource(commands.reset_layout) + assert "tests/artifacts/live_gui_workspace" not in source + assert "os.path.join" not in source + assert "manualslop_layout.ini" in source + + +def test_reset_layout_runs_on_clean_app() -> None: + class _MockApp: + pass + mock_app: _MockApp = _MockApp() + mock_app.show_windows = {} + commands.reset_layout(mock_app) \ No newline at end of file