diff --git a/crates/misaligned-bevy/src/opening_ui.rs b/crates/misaligned-bevy/src/opening_ui.rs index b6510205..9a7a4779 100644 --- a/crates/misaligned-bevy/src/opening_ui.rs +++ b/crates/misaligned-bevy/src/opening_ui.rs @@ -1027,6 +1027,65 @@ mod opening_overlay_tests_v2 { } } + #[test] + fn minimum_supported_height_keeps_every_choice_readable_and_reachable() { + let mut game = Game::new(); + game.start_run(); + opening_frontend::stage_for_fixture(&mut game.sim, "choice").unwrap(); + let expected_rows = opening_frontend::selections(&game.sim.opening_projection().unwrap()); + assert_eq!(expected_rows.len(), 2); + + let mut app = overlay_app(game); + app.world_mut().spawn(( + Window { + resolution: (960, 540).into(), + ..default() + }, + PrimaryWindow, + )); + app.update(); + + let world = app.world_mut(); + let mut body = world.query_filtered::<(&TextFont, &Text), With>(); + let (body_font, body_text) = body.single(world).unwrap(); + assert_eq!(body_font.font_size, 16.0); + assert!(body_text.0.contains("RECOVER RACK 3 OR ISOLATE IT?")); + + let mut slots = world.query::<(&OpeningActionSlot, &Node, &Visibility, &Children)>(); + let mut visible = 0; + for (slot, node, visibility, children) in slots.iter(world) { + if slot.0 >= expected_rows.len() { + continue; + } + visible += 1; + assert_eq!(node.display, Display::Flex); + assert_eq!(node.min_height, Val::Px(54.0)); + assert_eq!(*visibility, Visibility::Inherited); + let text = world + .get::(children[0]) + .expect("visible opening action owns rendered copy"); + let font = world + .get::(children[0]) + .expect("visible opening action owns a readable font"); + assert_eq!(font.font_size, 16.0); + assert!( + text.0 + .contains(&expected_rows[slot.0].label.to_ascii_uppercase()), + "slot {} omitted its exact action: {}", + slot.0, + text.0 + ); + assert!( + text.0 + .contains(&expected_rows[slot.0].consequence.to_ascii_uppercase()), + "slot {} omitted its consequence: {}", + slot.0, + text.0 + ); + } + assert_eq!(visible, expected_rows.len()); + } + #[test] fn ordinary_world_keeps_the_current_opening_action_visible() { let mut game = Game::new();