Skip to content

Minecraft: Java Edition 26.3 rewritten from scratch in Rust, checked against vanilla with 281 differential harnesses. Get it with the Horizon launcher.

Startup: the startup menu's test Loading has the title-frame fields; a test of the handoff's wait

Ludovic Marie337bb3ad1e71
diff --git a/crates/horizon-client/src/game/startup_menu.rs b/crates/horizon-client/src/game/startup_menu.rs
index fee3580cd..187c44c9c 100644
--- a/crates/horizon-client/src/game/startup_menu.rs
+++ b/crates/horizon-client/src/game/startup_menu.rs
@@ -1241,11 +1241,30 @@ mod tests {
delivered: false,
handle: None,
shown: false,
+ ui_at: None,
+ title_drawn: false,
menu: StartupMenu::default(),
error: None,
}
}
+ #[test]
+ fn the_world_renderer_waits_for_the_first_title_frame() {
+ let (_send, receiver) = std::sync::mpsc::channel();
+ let mut loading = loading(receiver);
+ // No menu bundle yet: nothing to wait for.
+ assert!(loading.ready_for_handoff());
+ // The title artwork is up but no frame of it was presented.
+ loading.ui_at = Some(Instant::now());
+ assert!(!loading.ready_for_handoff());
+ loading.title_drawn = true;
+ assert!(loading.ready_for_handoff());
+ // A window never asked to redraw doesn't hold the start for long.
+ loading.title_drawn = false;
+ loading.ui_at = Instant::now().checked_sub(Duration::from_secs(2));
+ assert!(loading.ready_for_handoff());
+ }
+
#[test]
fn menu_is_usable_while_the_core_worker_is_blocked() {
let root = std::env::temp_dir().join("horizon-startup-menu-no-world-resources");