mirror of
https://github.com/storytold/deckcraft.git
synced 2026-12-01 10:13:09 -06:00
Ribbon popup tests: keep only the two that fail without their fix
The window-fit checks passed on the old 128 pt tiles too, so they guarded nothing; the popup sizes are checked by look pairs instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
3378866889
commit
fecdb875a2
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user