From 66824eba50d03d31062b200225ba6ee8192d865b Mon Sep 17 00:00:00 2001 From: Waozi Date: Tue, 27 Oct 2026 04:21:49 -0300 Subject: [PATCH] Give the Results test the real leaderboard screen instead of a stub Since Profile hosts the leaderboard, entity_host links the leaderboard screen, so session-results-zi-test defined leaderboard_screen_enter twice. The Results test now uses the real screen with a stub for the habit editor's leave check, and only the tests that do not link the screen keep its stub. This replaces a79ab2ac's foreign call from Profile, whose web build ended release-ready's music test on Habits instead of Settings; the app sources are those of 7ccb904f again. --- src/app/entity_host.zi | 4 +--- src/screens/leaderboard_screen.zi | 1 - tests/app_hooks_host.zi | 13 ------------- tests/habit_edit_hooks_host.zi | 9 +++++++++ tests/habit_form_zi_test.sh | 2 +- tests/habit_sessions_zi_test.sh | 2 +- tests/leaderboard_hooks_host.zi | 8 ++++++++ tests/session_results_zi_test.sh | 2 +- 8 files changed, 21 insertions(+), 20 deletions(-) create mode 100644 tests/habit_edit_hooks_host.zi create mode 100644 tests/leaderboard_hooks_host.zi diff --git a/src/app/entity_host.zi b/src/app/entity_host.zi index a6b576f09..a22a2adc8 100644 --- a/src/app/entity_host.zi +++ b/src/app/entity_host.zi @@ -3,6 +3,7 @@ Entity :: #import "entity/model"; #import "entity/dew_model" #import "entity/leaderboard_model" +#import, file "../screens/leaderboard_screen.zi"; Provider :: #import "entity/native_management"; #import "kryon/app_context_host" Portable :: #import "kryon/app_protocol"; @@ -44,9 +45,6 @@ Shared :: #import "entity/native_files"; // A profile reads the host's busy flag without importing the sync engine. c :: #system_library "c"; EntitySyncLoading :: () -> s32 #foreign c "app_sync_loading"; -// Profile's leaderboard boards come from the leaderboard screen, a separate -// translation unit, so the shared navigation does not link every screen. -InbeLeaderboardSnapshot :: (app: *InnerBreeze, request: string) -> string #foreign c; entity_context: AppContext; entity_opened: bool; diff --git a/src/screens/leaderboard_screen.zi b/src/screens/leaderboard_screen.zi index 8bbac30ca..55d23c48e 100644 --- a/src/screens/leaderboard_screen.zi +++ b/src/screens/leaderboard_screen.zi @@ -574,7 +574,6 @@ LeaderboardUiCall :: (context: *void, module: *u8, function: *u8, leaderboard_projection: string; EntityHostOpenLeaderboard :: () #foreign c; -#program_export InbeLeaderboardSnapshot :: (app: *InnerBreeze, request: string) -> string { page: ProfileLeaderboard account: AccountKeys diff --git a/tests/app_hooks_host.zi b/tests/app_hooks_host.zi index 247817cdf..af3a14cda 100644 --- a/tests/app_hooks_host.zi +++ b/tests/app_hooks_host.zi @@ -17,19 +17,6 @@ host_load_friends_cache :: (app: *void) { unused app } -#program_export "leaderboard_screen_enter" -host_enter_leaderboard :: (app: *void) { - unused app -} - -// No practice leaderboards in these tests. -#program_export "InbeLeaderboardSnapshot" -host_leaderboard_snapshot :: (app: *void, request: string) -> string { - unused app - unused request - return "" -} - #program_export "node_app_screen_enter" host_enter_node_app :: (app: *void) { unused app diff --git a/tests/habit_edit_hooks_host.zi b/tests/habit_edit_hooks_host.zi new file mode 100644 index 000000000..57d05adb7 --- /dev/null +++ b/tests/habit_edit_hooks_host.zi @@ -0,0 +1,9 @@ +// The habit editor's leave check, for tests that reach navigation without +// linking the editor: leaving is always allowed. + +#program_export "habit_edit_request_leave" +host_habit_edit_request_leave :: (app: *void, route: s32) -> bool { + unused app + unused route + return true +} diff --git a/tests/habit_form_zi_test.sh b/tests/habit_form_zi_test.sh index 016b638e4..b7493762e 100755 --- a/tests/habit_form_zi_test.sh +++ b/tests/habit_form_zi_test.sh @@ -21,7 +21,7 @@ mkdir -p "$work/generated" --module-path "$root/build/packages/daochi-client" \ --entry habit_form_behavior:Check \ -o "$work/generated" "$root/tests/habit_form_behavior.zi" \ - "$root/tests/sync_test_host.zi" "$root/tests/app_hooks_host.zi" + "$root/tests/sync_test_host.zi" "$root/tests/app_hooks_host.zi" "$root/tests/leaderboard_hooks_host.zi" cat > "$work/generated/main.c" <<'C' #include "habit_form_behavior.h" #include diff --git a/tests/habit_sessions_zi_test.sh b/tests/habit_sessions_zi_test.sh index 39821fc7b..f6761bf5c 100755 --- a/tests/habit_sessions_zi_test.sh +++ b/tests/habit_sessions_zi_test.sh @@ -22,7 +22,7 @@ mkdir -p "$work/generated" --entry habit_sessions_behavior:Check \ -o "$work/generated" "$root/tests/habit_sessions_behavior.zi" \ "$root/tests/sync_test_host.zi" \ - "$root/tests/app_hooks_host.zi" + "$root/tests/app_hooks_host.zi" "$root/tests/leaderboard_hooks_host.zi" cat > "$work/generated/main.c" <<'C' #include "habit_sessions_behavior.h" #include diff --git a/tests/leaderboard_hooks_host.zi b/tests/leaderboard_hooks_host.zi new file mode 100644 index 000000000..119a1173d --- /dev/null +++ b/tests/leaderboard_hooks_host.zi @@ -0,0 +1,8 @@ +// The leaderboard route, for tests whose program does not link the +// leaderboard screen. Profile's host links it, so tests that reach Profile +// use the real one. + +#program_export "leaderboard_screen_enter" +host_enter_leaderboard :: (app: *void) { + unused app +} diff --git a/tests/session_results_zi_test.sh b/tests/session_results_zi_test.sh index 46950ceb4..0c688ed8a 100755 --- a/tests/session_results_zi_test.sh +++ b/tests/session_results_zi_test.sh @@ -21,7 +21,7 @@ mkdir -p "$work/generated" --module-path "$root/build/packages/daochi-client" \ --entry session_results_behavior:Check \ -o "$work/generated" "$root/tests/session_results_behavior.zi" \ - "$root/tests/app_hooks_host.zi" "$root/tests/clock_host.zi" + "$root/tests/app_hooks_host.zi" "$root/tests/habit_edit_hooks_host.zi" "$root/tests/clock_host.zi" cat > "$work/generated/main.c" <<'C' #include "session_results_behavior.h" #include