mirror of
https://github.com/storytold/deckcraft.git
synced 2026-10-31 05:56:55 -06:00
Merge pull request #1007 from MarekSpodBiedry/issue-971
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
//! Insert > Icons popup (#971): clicking inside it, e.g. in the "Search icons" box, must not close it.
|
||||
#![allow(clippy::expect_used)]
|
||||
|
||||
use deckcraft_engine::Session;
|
||||
use egui_kittest::Harness;
|
||||
use egui_kittest::kittest::Queryable;
|
||||
|
||||
use crate::{Services, SlideApp};
|
||||
|
||||
#[test]
|
||||
fn clicking_inside_the_icons_popup_keeps_it_open() {
|
||||
let mut app = SlideApp::new(Session::with_new(), Services::default());
|
||||
app.ui.tab = "Insert".into();
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1800.0, 900.0)).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
app.logic(ui.ctx());
|
||||
app.ui(ui);
|
||||
},
|
||||
app,
|
||||
);
|
||||
h.run_steps(3);
|
||||
h.get_by_label("Icons").click();
|
||||
h.run_steps(3);
|
||||
// A category heading is plain popup content, like the search box: a click on it is a click inside.
|
||||
let first = deckcraft_engine::icons::icons().first().expect("the icon gallery is empty");
|
||||
h.get_by_label(first.category).click();
|
||||
h.run_steps(3);
|
||||
assert!(h.query_by_label(first.category).is_some(), "the icons popup closed after a click inside it");
|
||||
}
|
||||
@@ -1249,7 +1249,7 @@ fn insert(app: &mut SlideApp, ui: &mut Ui) {
|
||||
}
|
||||
});
|
||||
let r = big_button(ui, Icon::Icons, "Icons", enabled(app, "insert.icon"));
|
||||
egui::Popup::menu(&r).width(340.0).show(|ui| icon_library(app, ui));
|
||||
egui::Popup::menu(&r).close_behavior(egui::PopupCloseBehavior::CloseOnClickOutside).width(340.0).show(|ui| icon_library(app, ui));
|
||||
big(app, ui, Icon::SmartArt, "SmartArt", "app.dialog", json!({"id": "smartart"}));
|
||||
let r = big_button(ui, Icon::Chart, "Chart", enabled(app, "insert.chart"));
|
||||
egui::Popup::menu(&r).show(|ui| {
|
||||
@@ -3474,6 +3474,10 @@ mod effects_tests;
|
||||
#[path = "master_layout_tests.rs"]
|
||||
mod master_layout_tests;
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "icons_popup_tests.rs"]
|
||||
mod icons_popup_tests;
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "align_tests.rs"]
|
||||
mod align_tests;
|
||||
|
||||
Reference in New Issue
Block a user