fix: match the idle line and keep the found folder

The handheld launcher compared the idle close's line without install.py's RetroBIOS: prefix, and its test fake printed it the same way, so the device still waited 300 s: a test now ties both to TUI_IDLE_WORDS. The interface offered the built-in default folder when the folder found here could not be opened, a folder RetroArch does not read.
This commit is contained in:
Abdessamad Derraz committed 2026-10-24 01:03:36 +02:00
1 parent 699f007cf0
commit 859f2c8a22
6 files changed
+25 -7

No files matched your search

+10 -1
View File
@@ -486,7 +486,7 @@ if os.environ.get("FAKE_HOLD"):
sys.exit(0)
if os.environ.get("FAKE_IDLE_ERROR"):
# RETROBIOS_IDLE_EXIT on an error screen: the idle line, then the error.
print("No button pressed, closing.", file=sys.stderr)
print("RetroBIOS: No button pressed, closing.", file=sys.stderr)
print("Error: " + os.environ["FAKE_IDLE_ERROR"], file=sys.stderr)
if os.environ.get("FAKE_ERROR"):
print("Error: " + os.environ["FAKE_ERROR"], file=sys.stderr)
@@ -1214,6 +1214,15 @@ class ThePortMasterPort(unittest.TestCase):
self.assertNotIn("No button pressed", device.screen)
device.assert_console_restored()
def test_the_idle_line_is_the_one_install_py_writes(self):
"""The launcher keyed on the words without install.py's prefix, and
its fake printed them the same way: the test passed, the device
still waited 300 s."""
line = f"RetroBIOS: {install.TUI_IDLE_WORDS}"
tui = (REPO_ROOT / "ports" / "shared" / "tui.txt").read_text(encoding="utf-8")
self.assertIn(f'= "{line}" ]', tui)
self.assertIn(f'print("{line}", file=sys.stderr)', FAKE_INSTALL)
def test_start_select_before_the_interface_handles_signals(self):
"""A SIGTERM before run_tui installs its handlers ends Python on the
default action, status 143."""
+4
View File
@@ -2923,6 +2923,10 @@ class AFolderThisUserCannotOpen(unittest.TestCase):
state.stack = ["setup"]
self.assertEqual(install.tui_update(state, Key("enter")), [])
self.assertEqual(state.screen, "folder")
# The folder found is the one RetroArch reads: its built-in default
# is not, and was offered with Enter on "Use this folder".
self.assertIsNone(state.folder_default)
self.assertNotIn("reads its BIOS files from", self.said(state))
self.assertIn(f"This user cannot open {install._short_path(self.lock, state.home)} "
"(Permission denied)", self.said(state))