fix: tick lists wrap, tests follow the new keys

This commit is contained in:
Abdessamad Derraz committed 2026-11-03 14:24:51 +01:00
1 parent 485df3714a
commit 2478c2a96c
5 files changed
+33 -21

No files matched your search

+1 -1
View File
@@ -16,7 +16,7 @@
# and Invoke-WebRequest throws on a cut transfer before the hash is read:
# the site's build rewrites this line there (scripts/sitebootstrap.py).
$mismatchAdvice = "The download was most likely cut short: try again. Within minutes of an update of this project the two files can come from caches of different ages. Waiting five minutes settles that."
$defaultInstallSha256 = "a5713bf93a8b48b5649aa7040a429ec4ac2a2ae62b14b07eb6c91cb96c15d984"
$defaultInstallSha256 = "5f933d4ab032e6e401341818a35eeee9b4018932fde7ad5111fa789375fb350a"
$maximumInstallerBytes = 2MB
$installerExit = 0
$installer = if ($PSScriptRoot) { Join-Path $PSScriptRoot "install.py" } else { $null }
+3 -1
View File
@@ -17686,7 +17686,9 @@ def tui_update(state: TuiState, key: TuiKey) -> list[tuple]:
row = rows[focus]
last = len(rows) - 1
page = _page_step(state) if key.name in ("pgup", "pgdn") else 1
wrap = len(rows) < 10
# A list of ticks wraps at any length: None and Done, at its end, are
# a few presses up from its first item on a pad (tui_audit_17 P3-1).
wrap = len(rows) < 10 or screen in (*_CHECKLISTS, "regions")
name = key.name
if name == "up" or char == "k":
focus = last if wrap and focus == 0 else max(0, focus - 1)
+1 -1
View File
@@ -23,7 +23,7 @@ DEFAULT_INSTALL_URL="https://raw.githubusercontent.com/Abdess/retrobios/main/ins
# curl or wget stop on a cut transfer before the hash is read: the site's
# build rewrites this line there (scripts/sitebootstrap.py).
MISMATCH_ADVICE="The download was most likely cut short: try again. Within minutes of an update of this project the two files can come from caches of different ages. Waiting five minutes settles that."
DEFAULT_INSTALL_SHA256="a5713bf93a8b48b5649aa7040a429ec4ac2a2ae62b14b07eb6c91cb96c15d984"
DEFAULT_INSTALL_SHA256="5f933d4ab032e6e401341818a35eeee9b4018932fde7ad5111fa789375fb350a"
MAX_INSTALLER_BYTES=2097152
cleanup() {
+8 -8
View File
@@ -27,8 +27,8 @@
{
"dest": "roms/ports/retrobios/install.py",
"repo_path": "install.py",
"size": 984900,
"sha256": "403b6e8a7efcd24858b0f46ffa19c2b9012cdeef149768729d8e48d0b68a296a",
"size": 996363,
"sha256": "5f933d4ab032e6e401341818a35eeee9b4018932fde7ad5111fa789375fb350a",
"executable": false
},
{
@@ -71,8 +71,8 @@
"muos": {
"archive": {
"dest": "ARCHIVE/RetroBIOS.muxapp",
"size": 1038077,
"sha256": "49b9de6afa23afda4f6c786fa0968c36af1bd2ec9b52cb0927df4c527dcc701c"
"size": 1049540,
"sha256": "a7a9c2f9b7d018d0aca34731957a13d9d8ab22ea747381e6750d45abbfb70390"
},
"members": [
{
@@ -92,8 +92,8 @@
{
"name": "RetroBIOS/install.py",
"repo_path": "install.py",
"size": 984900,
"sha256": "403b6e8a7efcd24858b0f46ffa19c2b9012cdeef149768729d8e48d0b68a296a",
"size": 996363,
"sha256": "5f933d4ab032e6e401341818a35eeee9b4018932fde7ad5111fa789375fb350a",
"executable": false
},
{
@@ -166,8 +166,8 @@
{
"dest": ".config/modules/retrobios/install.py",
"repo_path": "install.py",
"size": 984900,
"sha256": "403b6e8a7efcd24858b0f46ffa19c2b9012cdeef149768729d8e48d0b68a296a",
"size": 996363,
"sha256": "5f933d4ab032e6e401341818a35eeee9b4018932fde7ad5111fa789375fb350a",
"executable": false
},
{
+20 -10
View File
@@ -3493,7 +3493,10 @@ class OneSystemInFewPresses(unittest.TestCase):
# On its first system (tui_audit_17 P3-1), None at the list's end.
self.assertEqual(install.tui_rows(state)[state.focus["systems"]].action, "system")
paging = pad != "muxterm" or fast
count += self.go_to(state, pad, "none", paging)
# Up from the first item wraps to the list's end: Done, then None.
while install.tui_rows(state)[state.focus["systems"]].action != "none":
self.press_button(state, pad, "up")
count += 1
self.press_button(state, pad, "A")
count += 1
count += self.go_to(state, pad, "sys-45", paging)
@@ -3513,10 +3516,11 @@ class OneSystemInFewPresses(unittest.TestCase):
# focus, and muxterm had no page key).
# A page is the rows drawn since tui_audit_9 P2-2, ten here where it
# was nine: sys-45 is four pages and five Downs away, not five pages.
# None now at the list's end (tui_audit_17 P3-1): reached by pages.
self.assertEqual(self.presses("gptokeyb", fast=True), self.presses("gptokeyb", False))
self.assertLessEqual(self.presses("gptokeyb", fast=True), 22)
self.assertLessEqual(self.presses("muxterm", fast=True), 22)
# None now at the list's end (tui_audit_17 P3-1), three presses up
# from the first system: the list wraps. fast pages down to sys-45.
self.assertEqual(self.presses("gptokeyb", fast=True), 21)
self.assertEqual(self.presses("muxterm", fast=False), 57)
self.assertEqual(self.presses("muxterm", fast=True), 21)
def test_a_on_a_system_with_none_ticked_takes_it_alone(self):
state = self.long_list("keys")
@@ -4832,7 +4836,7 @@ class EndToEnd(unittest.TestCase):
self.assertIn("> [ ] nintendo-gba", screen)
self.assertIn("[x] sony-playstation", screen)
term.send("\x1b")
term.wait("for 1 of 2 systems")
term.wait("About 3 files")
# Install counts the choice on Confirm first.
term.send("\r")
screen = term.wait("files to download")
@@ -12070,7 +12074,11 @@ class TwoTapsOnlyWhereFilesAreWritten(unittest.TestCase):
lines = drawn(state, 80, 24)
self.assertEqual(tap(state, 2, len(lines) - 1), [("run", "confirm")])
self.assertEqual(state.screen, "confirm")
install.tui_receive(state, ("event", state.run_id, CHECK))
# Counted for the choice: another plan than the check's, so Confirm
# waits for its own Install.
install.tui_receive(state, ("event", state.run_id, {
**CHECK, "files": 1, "present": 0, "missing": 1, "wrong_hash": 0,
"bytes_needed": 16384}))
install.tui_receive(state, ("ended", state.run_id, 1, []))
lines = drawn(state, 80, 24)
self.assertIn("A/Enter Install", str(lines[-1]))
@@ -12817,8 +12825,8 @@ class AuditTwentyTwoAndFifteen(unittest.TestCase):
self.assertIn("ArkOS SD card (ROMS2", text)
text, asked = self.line_run(_args(manifest=self.game_listing(), dry_run=True,
declared_only=False), [], mounts=mounts)
self.assertIn("ArkOS SD card (EASYROMS)", text)
self.assertIn("ArkOS SD card (ROMS2)", text)
self.assertIn("1) ArkOS SD card (EASYROMS", text)
self.assertIn("2) ArkOS SD card (ROMS2", text)
self.assertNotIn("in the reader", text)
def test_a_fixed_partition_is_told_from_a_card(self):
@@ -13848,7 +13856,9 @@ class AuditTwentyThreeAndSixteen(unittest.TestCase):
def test_nothing_found_is_said_once(self):
"""tui_audit_16 P3-2: "Nothing was found here." twice, and after "A
card is in the reader"."""
text, _asked = self.line_run(_args(declared_only=False), [])
# The standalone emulators' lists come from the network: none here.
with mock.patch.object(install, "_install_standalone_folders", return_value=False):
text, _asked = self.line_run(_args(declared_only=False), [])
self.assertEqual(text.count("Nothing was found here."), 1)
card = games_part(self.root / "media" / "EASYROMS")
text, _asked = self.line_run(_args(declared_only=False), [], mounts=[card])