diff --git a/crates/ui-egui/src/ribbon/popup_tests.rs b/crates/ui-egui/src/ribbon/popup_tests.rs index dd629b494..2a0878061 100644 --- a/crates/ui-egui/src/ribbon/popup_tests.rs +++ b/crates/ui-egui/src/ribbon/popup_tests.rs @@ -1,57 +1,28 @@ -//! Ribbon popups: what they open with, and that they stay in the window. +//! Ribbon popups: what they open with and how they name their rows. #![allow(clippy::unwrap_used, clippy::expect_used)] -use deckcraft_engine::Session; use egui::accesskit::{Role, Toggled}; -use egui_kittest::Harness; use egui_kittest::kittest::{NodeT, Queryable}; use super::picture_styles_tests::picture_format; -use crate::{Services, SlideApp}; -const WINDOW: egui::Vec2 = egui::vec2(1440.0, 900.0); - -/// Whether the node labelled `label` lies inside the window. -fn in_window(h: &Harness<'_, SlideApp>, label: &str) -> bool { - egui::Rect::from_min_size(egui::Pos2::ZERO, WINDOW).contains_rect(h.get_by_label(label).rect()) -} +const WIDTH: f32 = 1440.0; #[test] fn compress_options_open_with_the_print_resolution_chosen() { - let mut h = picture_format(WINDOW.x); + let mut h = picture_format(WIDTH); h.get_by_label("Compress Pictures").click(); h.run_steps(4); let print = h.get_by_role_and_label(Role::RadioButton, "Print (220 ppi): excellent quality on most printers and screens"); assert_eq!(print.accesskit_node().toggled(), Some(Toggled::True), "the session's resolution is chosen when the options open"); } -#[test] -fn the_recolor_tiles_stay_in_the_window() { - let mut h = picture_format(WINDOW.x); - h.get_by_role_and_label(Role::Button, "Color").click(); - h.run_steps(4); - for (_, label) in deckcraft_engine::cmd::recolor::presets() { - assert!(in_window(&h, &label), "the Recolor tile {label} runs out of the window"); - } -} - #[test] fn add_animation_shows_effect_names_as_written() { - let mut h = picture_format(WINDOW.x); + let mut h = picture_format(WIDTH); h.state_mut().ui.tab = "Animations".into(); h.run_steps(4); h.get_by_role_and_label(Role::Button, "Add Animation").click(); h.run_steps(4); assert!(h.query_by_label("Grow & Turn").is_some(), "the ampersand of an effect name is taken as a mnemonic marker"); } - -#[test] -fn background_styles_keep_their_reset_row_in_the_window() { - let mut h = crate::test_harness::harness_with(Session::with_new(), Services::default(), Harness::builder().with_size(WINDOW), |_| {}); - h.state_mut().ui.tab = "Design".into(); - h.run_steps(4); - h.get_by_role_and_label(Role::Button, "Background Styles").click(); - h.run_steps(4); - assert!(in_window(&h, "Style 12"), "the last style runs out of the window"); - assert!(in_window(&h, "Reset Slide Background"), "the reset row is pushed out of the window"); -}