diff --git a/crates/ui-egui/src/media_bar_tests.rs b/crates/ui-egui/src/media_bar_tests.rs index 55fc048d8..6bfe922db 100644 --- a/crates/ui-egui/src/media_bar_tests.rs +++ b/crates/ui-egui/src/media_bar_tests.rs @@ -46,23 +46,8 @@ fn play_on_the_editor_media_bar_plays_the_selected_clip() { s.execute("slide.new", &json!({"layout": "blank"})).unwrap(); let r = s.execute("insert.audio", &json!({"name": "tone.wav", "data": deckcraft_engine::cmd::base64_encode(&wav(2.0))})).unwrap(); let id = ShapeId(r["id"].as_u64().unwrap() as u32); -<<<<<<< HEAD let mut h = test_harness::harness_with(s, Services::default(), Harness::builder().with_size(vec2(1400.0, 900.0)).with_step_dt(1.0 / 60.0), |_| {}); -======= - let app = SlideApp::new(s, Services::default()); - let mut h = Harness::builder() - .with_context_setup(crate::framework::install_headless) - .with_size(vec2(1400.0, 900.0)) - .with_step_dt(1.0 / 60.0) - .build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - app, - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 h.run_steps(3); let d = h.state().session.active().unwrap(); assert_eq!(d.selection.shapes, vec![id], "the inserted clip is selected"); @@ -117,27 +102,10 @@ fn the_media_bar_never_paints_or_clicks_into_the_notes_pane() { // Dragged across the bottom edge of the slide, onto the pasteboard. let h_slide = s.doc().unwrap().doc.slide_size.height; s.execute("shape.setBounds", &json!({"ids": [id.0], "x": 300.0, "y": h_slide - 10.0, "w": 120.0, "h": 60.0})).unwrap(); -<<<<<<< HEAD let mut h = test_harness::harness_with(s, Services::default(), Harness::builder().with_size(vec2(1400.0, 900.0)).with_step_dt(1.0 / 60.0), |_| {}); h.state_mut().ui.notes = true; h.state_mut().ui.notes_height = 140.0; -======= - let mut app = SlideApp::new(s, Services::default()); - app.ui.notes = true; - app.ui.notes_height = 140.0; - let mut h = Harness::builder() - .with_context_setup(crate::framework::install_headless) - .with_size(vec2(1400.0, 900.0)) - .with_step_dt(1.0 / 60.0) - .build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - app, - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 h.run_steps(3); let notes = h.query_all_by_role(Role::MultilineTextInput).next().map(|n| n.rect()).expect("the notes field"); let canvas = h.state().canvas_rect().unwrap(); diff --git a/crates/ui-egui/src/panels/background_tests.rs b/crates/ui-egui/src/panels/background_tests.rs index 99e3c647f..f396626c8 100644 --- a/crates/ui-egui/src/panels/background_tests.rs +++ b/crates/ui-egui/src/panels/background_tests.rs @@ -13,23 +13,10 @@ use crate::{Services, SlideApp}; /// 1×1 PNG. const PNG: &str = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg=="; -<<<<<<< HEAD fn harness(session: Session) -> Harness<'static, SlideApp> { let mut h = crate::test_harness::harness_with(session, Services::default(), Harness::builder().with_size(egui::vec2(1800.0, 1100.0)), |_| {}); h.state_mut().ui.tab = "Design".into(); h.state_mut().ui.pane = Some("background".into()); -======= -fn harness(mut app: SlideApp) -> Harness<'static, SlideApp> { - app.ui.tab = "Design".into(); - app.ui.pane = Some("background".into()); - let mut h = Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(1800.0, 1100.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - app, - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 h.run_steps(3); h } diff --git a/crates/ui-egui/src/panels/effect_presets_tests.rs b/crates/ui-egui/src/panels/effect_presets_tests.rs index c68d49c44..530dcdc04 100644 --- a/crates/ui-egui/src/panels/effect_presets_tests.rs +++ b/crates/ui-egui/src/panels/effect_presets_tests.rs @@ -15,22 +15,9 @@ fn harness() -> Harness<'static, SlideApp> { let r = s.execute("shape.insert", &json!({"preset": "rect", "rect": [80.0, 80.0, 200.0, 120.0]})).unwrap(); let id = r.get("id").and_then(|v| v.as_u64()).unwrap(); s.execute("edit.select", &json!({"ids": [id]})).unwrap(); -<<<<<<< HEAD let mut h = crate::test_harness::harness_with(s, Services::default(), Harness::builder().with_size(egui::vec2(1800.0, 1100.0)), |_| {}); h.state_mut().ui.pane = Some("format".into()); h.state_mut().ui.format_tab = "fill".into(); -======= - let mut app = SlideApp::new(s, Services::default()); - app.ui.pane = Some("format".into()); - app.ui.format_tab = "effects".into(); - let mut h = Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(1800.0, 1100.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - app, - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 h.run_steps(3); click(&mut h, "Effects"); h diff --git a/crates/ui-egui/src/panels/pattern_fill_tests.rs b/crates/ui-egui/src/panels/pattern_fill_tests.rs index e7b92374e..a33e8b718 100644 --- a/crates/ui-egui/src/panels/pattern_fill_tests.rs +++ b/crates/ui-egui/src/panels/pattern_fill_tests.rs @@ -12,21 +12,9 @@ use serde_json::json; use crate::{Services, SlideApp}; -<<<<<<< HEAD fn harness(session: Session, pane: &str) -> Harness<'static, SlideApp> { let mut h = crate::test_harness::harness_with(session, Services::default(), Harness::builder().with_size(egui::vec2(1800.0, 1100.0)), |_| {}); h.state_mut().ui.pane = Some(pane.into()); -======= -fn harness(mut app: SlideApp, pane: &str) -> Harness<'static, SlideApp> { - app.ui.pane = Some(pane.into()); - let mut h = Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(1800.0, 1100.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - app, - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 h.run_steps(3); h } diff --git a/crates/ui-egui/src/panels/selpane/ui_tests.rs b/crates/ui-egui/src/panels/selpane/ui_tests.rs index 706e08270..2296f5238 100644 --- a/crates/ui-egui/src/panels/selpane/ui_tests.rs +++ b/crates/ui-egui/src/panels/selpane/ui_tests.rs @@ -23,24 +23,8 @@ fn harness() -> (Harness<'static, SlideApp>, Vec) { s.execute("shape.rename", &json!({"id": g, "name": "G"})).unwrap(); s.execute("edit.select", &json!({"ids": []})).unwrap(); ids.push(g); -<<<<<<< HEAD let mut h = crate::test_harness::harness(s, Services::default()); h.state_mut().run("view.pane", json!({"pane": "selection"})).unwrap(); -======= - let mut app = SlideApp::new(s, Services::default()); - app.ui.pane = Some("selection".into()); - let mut h = Harness::builder() - .with_context_setup(crate::framework::install_headless) - .with_size(egui::vec2(1400.0, 900.0)) - .with_step_dt(1.0 / 60.0) - .build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - app, - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 h.run_steps(3); (h, ids) } diff --git a/crates/ui-egui/src/panels/smartart_tests.rs b/crates/ui-egui/src/panels/smartart_tests.rs index 90a9eb2d2..39347ec7c 100644 --- a/crates/ui-egui/src/panels/smartart_tests.rs +++ b/crates/ui-egui/src/panels/smartart_tests.rs @@ -23,24 +23,8 @@ fn text_pane_types_adds_and_demotes() { let mut s = Session::with_new(); s.execute("slide.new", &json!({"layout": "blank"})).unwrap(); s.execute("insert.smartArt", &json!({"kind": "list", "items": ["Plan", "Build"]})).unwrap(); -<<<<<<< HEAD let mut h = harness(s, Services::default()); h.state_mut().ui.pane = Some("smartart".into()); -======= - let mut app = SlideApp::new(s, Services::default()); - app.ui.pane = Some("smartart".into()); - let mut h = Harness::builder() - .with_context_setup(crate::framework::install_headless) - .with_size(egui::vec2(1400.0, 900.0)) - .with_step_dt(1.0 / 60.0) - .build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - app, - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 h.run_steps(3); assert!(h.query_all_by_label("Text Pane").any(|n| n.accesskit_node().role() != egui::accesskit::Role::Button), "the pane is titled"); let initial = levels(&h); @@ -119,22 +103,7 @@ fn home_convert_to_smartart_gallery_converts_the_text() { let mut s = Session::with_new(); s.execute("slide.new", &json!({"layout": "blank"})).unwrap(); s.execute("insert.textBox", &json!({"text": "Goals\nRevenue\nGrowth"})).unwrap(); -<<<<<<< HEAD let mut h = harness_with(s, Services::default(), Harness::builder().with_size(egui::vec2(1600.0, 900.0)).with_step_dt(1.0 / 60.0), |_| {}); -======= - let app = SlideApp::new(s, Services::default()); - let mut h = Harness::builder() - .with_context_setup(crate::framework::install_headless) - .with_size(egui::vec2(1600.0, 900.0)) - .with_step_dt(1.0 / 60.0) - .build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - app, - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 h.run_steps(3); h.get_by_label("Convert to Diagram").click(); h.run_steps(3); @@ -153,24 +122,8 @@ fn layout_gallery_shows_cached_pictures_and_previews_on_hover() { let mut s = Session::with_new(); s.execute("slide.new", &json!({"layout": "blank"})).unwrap(); s.execute("insert.smartArt", &json!({"kind": "process", "items": ["Plan", "Build", "Ship"]})).unwrap(); -<<<<<<< HEAD let mut h = harness_with(s, Services::default(), Harness::builder().with_size(egui::vec2(1600.0, 900.0)).with_step_dt(1.0 / 60.0), |_| {}); h.state_mut().ui.tab = "SmartArt Design".into(); -======= - let mut app = SlideApp::new(s, Services::default()); - app.ui.tab = "SmartArt Design".into(); - let mut h = Harness::builder() - .with_context_setup(crate::framework::install_headless) - .with_size(egui::vec2(1600.0, 900.0)) - .with_step_dt(1.0 / 60.0) - .build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - app, - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 h.run_steps(3); h.get_by_role_and_label(egui::accesskit::Role::Button, "Layouts").click(); h.run_steps(3); diff --git a/crates/ui-egui/src/panels/thesaurus_tests.rs b/crates/ui-egui/src/panels/thesaurus_tests.rs index a65ad78da..0456cb5a5 100644 --- a/crates/ui-egui/src/panels/thesaurus_tests.rs +++ b/crates/ui-egui/src/panels/thesaurus_tests.rs @@ -17,24 +17,8 @@ fn thesaurus_pane_swaps_the_word_at_the_caret() { s.execute("text.edit", &json!({"id": id})).unwrap(); s.execute("text.insert", &json!({"text": original})).unwrap(); s.execute("text.edit", &json!({"id": id, "at": [0, 6]})).unwrap(); -<<<<<<< HEAD let mut h = crate::test_harness::harness(s, Services::default()); h.state_mut().ui.tab = "Review".into(); -======= - let mut app = SlideApp::new(s, Services::default()); - app.ui.tab = "Review".into(); - let mut h = Harness::builder() - .with_context_setup(crate::framework::install_headless) - .with_size(egui::vec2(1400.0, 900.0)) - .with_step_dt(1.0 / 60.0) - .build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - app, - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 h.run_steps(3); h.get_by_label("Thesaurus").click(); h.run_steps(3); diff --git a/crates/ui-egui/src/reflection_pane_tests.rs b/crates/ui-egui/src/reflection_pane_tests.rs index 1265002d2..0f252370e 100644 --- a/crates/ui-egui/src/reflection_pane_tests.rs +++ b/crates/ui-egui/src/reflection_pane_tests.rs @@ -20,22 +20,9 @@ fn reflection_none_clears_after_a_second_preset() { s.execute("slide.new", &json!({"layout": "blank"})).unwrap(); let id = s.execute("shape.insert", &json!({"preset": "rect", "rect": [72.0, 36.0, 144.0, 108.0]})).unwrap()["id"].as_u64().unwrap(); s.execute("edit.select", &json!({"ids": [id]})).unwrap(); -<<<<<<< HEAD let mut h = crate::test_harness::harness_with(s, Services::default(), Harness::builder().with_size(egui::vec2(1400.0, 900.0)), |_| {}); h.state_mut().ui.pane = Some("format".into()); h.state_mut().ui.format_tab = "effects".into(); -======= - let mut app = SlideApp::new(s, Services::default()); - app.ui.pane = Some("format".into()); - app.ui.format_tab = "effects".into(); - let mut h = Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(1400.0, 900.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - app, - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 h.run_steps(3); for preset in ["Tight", "Half", "Full"] { h.get_by_role_and_label(egui::accesskit::Role::RadioGroup, "Reflection").get_by_label(preset).click(); @@ -46,36 +33,3 @@ fn reflection_none_clears_after_a_second_preset() { assert!(!has_reflection(&h), "None clears the {preset} reflection"); } } -<<<<<<< HEAD -======= - -#[test] -fn reflection_none_stays_cleared_when_a_slider_only_had_focus() { - let mut s = Session::with_new(); - s.execute("slide.new", &json!({"layout": "blank"})).unwrap(); - let id = s.execute("shape.insert", &json!({"preset": "rect", "rect": [72.0, 36.0, 144.0, 108.0]})).unwrap()["id"].as_u64().unwrap(); - s.execute("edit.select", &json!({"ids": [id]})).unwrap(); - let mut app = SlideApp::new(s, Services::default()); - app.ui.pane = Some("format".into()); - app.ui.format_tab = "effects".into(); - let mut h = Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(1400.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("Tight").click(); - h.run_steps(4); - // Focus a reflection slider without editing it, then click "None": the slider's value must not - // be written back over the cleared reflection. - // The reflection's Size comes before the glow's (the same label). - h.get_all_by_role_and_label(egui::accesskit::Role::Slider, "Size").next().unwrap().focus(); - h.run_steps(4); - assert!(h.get_all_by_role_and_label(egui::accesskit::Role::Slider, "Size").next().unwrap().is_focused(), "the reflection size slider has focus"); - h.get_all_by_label("None").last().unwrap().click(); - h.run_steps(4); - assert!(!has_reflection(&h), "a slider that only had focus does not re-add the reflection"); -} ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 diff --git a/crates/ui-egui/src/replacefonts_tests.rs b/crates/ui-egui/src/replacefonts_tests.rs index 5e68f5369..eaf49b5c9 100644 --- a/crates/ui-egui/src/replacefonts_tests.rs +++ b/crates/ui-egui/src/replacefonts_tests.rs @@ -15,26 +15,8 @@ fn harness() -> Harness<'static, SlideApp> { s.execute("text.exit", &json!({})).unwrap(); s.execute("format.font", &json!({"family": "Comic Neue"})).unwrap(); s.execute("format.size", &json!({"size": 40})).unwrap(); -<<<<<<< HEAD let builder = Harness::builder().with_size(egui::vec2(1440.0, 900.0)).with_step_dt(1.0 / 60.0); let mut h = crate::test_harness::harness_with(s, Services::default(), builder, |_| {}); -======= - let app = SlideApp::new(s, Services::default()); - // The product's default window. The Home ribbon overflows here with the bundled interface - // fonts; the ribbon's own edge chevron must make its Editing group reachable instead of the - // regression widening the fixture past the width the app actually opens at. - let mut h = Harness::builder() - .with_context_setup(crate::framework::install_headless) - .with_size(egui::vec2(1440.0, 900.0)) - .with_step_dt(1.0 / 60.0) - .build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - app, - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 h.run_steps(3); h } diff --git a/crates/ui-egui/src/reuse_picker_tests.rs b/crates/ui-egui/src/reuse_picker_tests.rs index 6e1a6c638..8bfa3dd2d 100644 --- a/crates/ui-egui/src/reuse_picker_tests.rs +++ b/crates/ui-egui/src/reuse_picker_tests.rs @@ -24,33 +24,12 @@ fn deck_bytes(titles: &[&str]) -> Vec { fn harness(files: &Arc) -> Harness<'static, SlideApp> { let mut s = Session::with_new(); s.execute("slide.new", &json!({"layout": "blank"})).unwrap(); -<<<<<<< HEAD let builder = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).with_step_dt(1.0 / 60.0); let files = Arc::clone(files); // PLAN: assumed sh.A11 harness_with(session, services, builder, adjust) -> Harness<'static, SlideApp> (shell-w11) let mut h = crate::test_harness::harness_with(s, Services::default(), builder, move |platform| { platform.host = platform.host.with_files(files); }); -======= - let f = Rc::clone(file); - let services = Services { - pick_open: Some(Box::new(|_| Some("/tmp/src.deckcraft".to_string()))), - read: Some(Box::new(move |_| Ok(f.borrow().clone()))), - ..Services::default() - }; - let app = SlideApp::new(s, services); - let mut h = Harness::builder() - .with_context_setup(crate::framework::install_headless) - .with_size(egui::vec2(1400.0, 900.0)) - .with_step_dt(1.0 / 60.0) - .build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - app, - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 h.run_steps(3); h } diff --git a/crates/ui-egui/src/ribbon/align_tests.rs b/crates/ui-egui/src/ribbon/align_tests.rs index a55e206c5..1c60a18c0 100644 --- a/crates/ui-egui/src/ribbon/align_tests.rs +++ b/crates/ui-egui/src/ribbon/align_tests.rs @@ -24,20 +24,8 @@ fn harness(select: &[usize]) -> (Harness<'static, SlideApp>, Vec) { .collect(); let picked: Vec = select.iter().map(|&i| ids[i].0).collect(); s.execute("selection.select", &json!({"ids": picked})).unwrap(); -<<<<<<< HEAD let mut h = crate::test_harness::harness_with(s, Services::default(), Harness::builder().with_size(egui::vec2(1800.0, 900.0)), |_| {}); h.state_mut().ui.tab = "Shape Format".into(); -======= - let mut app = SlideApp::new(s, Services::default()); - app.ui.tab = "Shape Format".into(); - let mut h = Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(1800.0, 900.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - app, - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 h.run_steps(3); (h, ids) } diff --git a/crates/ui-egui/src/ribbon/drawtable_tests.rs b/crates/ui-egui/src/ribbon/drawtable_tests.rs index ad0de1aba..07821f950 100644 --- a/crates/ui-egui/src/ribbon/drawtable_tests.rs +++ b/crates/ui-egui/src/ribbon/drawtable_tests.rs @@ -33,7 +33,6 @@ fn table(h: &Harness<'_, SlideApp>) -> Option<(deckcraft_model::Table, deckcraft fn draw_a_table_split_it_and_erase_the_border() { let mut s = Session::with_new(); s.execute("slide.new", &json!({"layout": "blank"})).unwrap(); -<<<<<<< HEAD let mut h = crate::test_harness::harness_with( s, Services::default(), @@ -41,21 +40,6 @@ fn draw_a_table_split_it_and_erase_the_border() { |_| {}, ); h.state_mut().ui.tab = "Insert".into(); -======= - let mut app = SlideApp::new(s, Services::default()); - app.ui.tab = "Insert".into(); - let mut h = Harness::builder() - .with_context_setup(crate::framework::install_headless) - .with_size(egui::vec2(1400.0, 900.0)) - .with_step_dt(1.0 / 60.0) - .build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - app, - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 h.run_steps(3); h.get_by_label("Table").click(); h.run_steps(2); diff --git a/crates/ui-egui/src/ribbon/inktoshape_tests.rs b/crates/ui-egui/src/ribbon/inktoshape_tests.rs index 12ee7f56e..d03abbf17 100644 --- a/crates/ui-egui/src/ribbon/inktoshape_tests.rs +++ b/crates/ui-egui/src/ribbon/inktoshape_tests.rs @@ -14,7 +14,6 @@ fn pen_a_rectangle_then_ink_to_shape() { let _gpu = crate::gpu_lock::gpu_lock(); let mut s = Session::with_new(); s.execute("slide.new", &json!({"layout": "blank"})).unwrap(); -<<<<<<< HEAD let mut h = crate::test_harness::harness_with( s, Services::default(), @@ -22,21 +21,6 @@ fn pen_a_rectangle_then_ink_to_shape() { |_| {}, ); h.state_mut().ui.tab = "Draw".into(); -======= - let mut app = SlideApp::new(s, Services::default()); - app.ui.tab = "Draw".into(); - let mut h = Harness::builder() - .with_context_setup(crate::framework::install_headless) - .with_size(egui::vec2(1400.0, 900.0)) - .with_step_dt(1.0 / 60.0) - .build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - app, - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 h.run_steps(3); h.get_by_label("Black Pen").click(); h.run_steps(2); diff --git a/crates/ui-egui/src/ribbon/master_layout_tests.rs b/crates/ui-egui/src/ribbon/master_layout_tests.rs index 62616c29c..6cbf7f931 100644 --- a/crates/ui-egui/src/ribbon/master_layout_tests.rs +++ b/crates/ui-egui/src/ribbon/master_layout_tests.rs @@ -10,20 +10,9 @@ use serde_json::json; use crate::{Services, SlideApp}; -<<<<<<< HEAD fn harness(session: Session) -> Harness<'static, SlideApp> { let mut h = crate::test_harness::harness_with(session, Services::default(), Harness::builder().with_size(egui::vec2(1800.0, 900.0)), |_| {}); h.state_mut().ui.tab = "Slide Master".into(); -======= -fn harness(app: SlideApp) -> Harness<'static, SlideApp> { - let mut h = Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(1800.0, 900.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - app, - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 h.run_steps(3); h } diff --git a/crates/ui-egui/src/ribbon/picture_styles_tests.rs b/crates/ui-egui/src/ribbon/picture_styles_tests.rs index 0e8be2244..042e0068e 100644 --- a/crates/ui-egui/src/ribbon/picture_styles_tests.rs +++ b/crates/ui-egui/src/ribbon/picture_styles_tests.rs @@ -19,20 +19,8 @@ fn picture_format(width: f32) -> Harness<'static, SlideApp> { let data = deckcraft_engine::cmd::base64_encode(&png); let id = s.execute("insert.picture", &json!({"data": data, "name": "a.png", "rect": [200, 100, 400, 250]})).unwrap()["id"].clone(); s.execute("edit.select", &json!({"ids": [id]})).unwrap(); -<<<<<<< HEAD let mut h = crate::test_harness::harness_with(s, Services::default(), Harness::builder().with_size(egui::vec2(width, 900.0)), |_| {}); h.state_mut().ui.tab = "Picture Format".into(); -======= - let mut app = SlideApp::new(s, Services::default()); - app.ui.tab = "Picture Format".into(); - let mut h = Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(width, 900.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - app, - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 h.run_steps(4); h } diff --git a/crates/ui-egui/src/show/tests.rs b/crates/ui-egui/src/show/tests.rs index ce5d9acf2..e2ca66a8e 100644 --- a/crates/ui-egui/src/show/tests.rs +++ b/crates/ui-egui/src/show/tests.rs @@ -49,24 +49,9 @@ fn a_still_cursor_hides_over_a_clickable_shape() { let size = session.active().unwrap().doc.slide_size; let r = session.execute("shape.insert", &json!({"preset": "rect", "rect": [0.0, 0.0, size.width, size.height]})).unwrap(); session.execute("insert.hyperlink", &json!({"url": "https://example.org", "ids": [r["id"]]})).unwrap(); -<<<<<<< HEAD let mut harness = harness_with(session, Services::default(), egui_kittest::Harness::builder().with_size(vec2(1000.0, 700.0)).with_step_dt(0.25), |_| {}); harness.state_mut().ui.presenter_view = false; -======= - let app = SlideApp::new(session, crate::Services::default()); - let mut harness = egui_kittest::Harness::builder() - .with_context_setup(crate::framework::install_headless) - .with_size(vec2(1000.0, 700.0)) - .with_step_dt(0.25) - .build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - app, - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 harness.run_steps(3); harness.state_mut().start_show(0, false); harness.run_steps(2); @@ -117,27 +102,10 @@ fn keep_cursor_visible_leaves_a_still_cursor_over_a_link() { session.execute("slide.go", &json!({"index": 0})).unwrap(); let r = session.execute("shape.insert", &json!({"preset": "rect", "rect": [0.0, 0.0, size.width, size.height]})).unwrap(); session.execute("insert.hyperlink", &json!({"slide": 1, "ids": [r["id"]]})).unwrap(); -<<<<<<< HEAD let mut harness = harness_with(session, Services::default(), egui_kittest::Harness::builder().with_size(vec2(1000.0, 700.0)).with_step_dt(0.25), |_| {}); harness.state_mut().ui.presenter_view = false; harness.state_mut().run("show.keepCursor", json!({"on": true})).unwrap(); -======= - let mut app = SlideApp::new(session, crate::Services::default()); - app.ui.presenter_view = false; - app.run("show.keepCursor", json!({"on": true})).unwrap(); - let mut harness = egui_kittest::Harness::builder() - .with_context_setup(crate::framework::install_headless) - .with_size(vec2(1000.0, 700.0)) - .with_step_dt(0.25) - .build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - app, - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 harness.run_steps(3); harness.state_mut().start_show(0, false); harness.run_steps(2); @@ -158,24 +126,12 @@ fn keep_cursor_visible_leaves_a_still_cursor_over_a_link() { fn set_up_slide_show_keeps_the_cursor_visible() { use egui_kittest::kittest::Queryable; -<<<<<<< HEAD let mut harness = harness_with( deckcraft_engine::Session::with_new(), Services::default(), egui_kittest::Harness::builder().with_size(vec2(1200.0, 800.0)), |_| {}, ); -======= - let app = SlideApp::new(deckcraft_engine::Session::with_new(), crate::Services::default()); - let mut harness = - egui_kittest::Harness::builder().with_context_setup(crate::framework::install_headless).with_size(vec2(1200.0, 800.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - app, - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 for on in [true, false] { harness.state_mut().run("app.dialog", json!({"id": "setupShow"})).unwrap(); harness.run_steps(6); @@ -283,26 +239,8 @@ fn show_with_clip() -> (egui_kittest::Harness<'static, SlideApp>, ShapeId, Pos2) }) .unwrap(); // Presenter view opens an embedded window over the whole screen here, which takes the clicks. -<<<<<<< HEAD let mut harness = harness_with(session, Services::default(), egui_kittest::Harness::builder().with_size(size).with_step_dt(0.25), |_| {}); harness.state_mut().ui.presenter_view = false; -======= - let mut app = SlideApp::new(session, crate::Services::default()); - app.ui.presenter_view = false; - let mut harness = - egui_kittest::Harness::builder().with_context_setup(crate::framework::install_headless).with_size(size).with_step_dt(0.25).build_ui_state( - move |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - if let (Some(show), Some(d)) = (app.show.as_ref(), app.session.active()) { - let now = ui.input(|i| i.time); - seen.set(pointer_on_media_bar(ui.ctx(), ui, &d.doc, show, now)); - slide_seen.set(shown_slide_rect(ui, show, &d.doc)); - } - app.ui(ui); - }, - app, - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 harness.run_steps(3); harness.state_mut().start_show(0, false); harness.run_steps(2); @@ -390,30 +328,9 @@ fn show_with_gif() -> (egui_kittest::Harness<'static, SlideApp>, ShapeId, Pos2) Ok(()) }) .unwrap(); -<<<<<<< HEAD let mut harness = harness_with(session, Services::default(), egui_kittest::Harness::builder().with_size(vec2(1000.0, 700.0)).with_step_dt(0.25), |_| {}); harness.state_mut().ui.presenter_view = false; -======= - let slide = std::rc::Rc::new(std::cell::Cell::new(Rect::NOTHING)); - let slide_seen = slide.clone(); - let mut app = SlideApp::new(session, crate::Services::default()); - app.ui.presenter_view = false; - let mut harness = egui_kittest::Harness::builder() - .with_context_setup(crate::framework::install_headless) - .with_size(vec2(1000.0, 700.0)) - .with_step_dt(0.25) - .build_ui_state( - move |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - if let (Some(show), Some(d)) = (app.show.as_ref(), app.session.active()) { - slide_seen.set(shown_slide_rect(ui, show, &d.doc)); - } - app.ui(ui); - }, - app, - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 harness.run_steps(3); harness.state_mut().start_show(1, false); harness.run_steps(2); @@ -520,21 +437,8 @@ fn slideshow_navigation_advances_once_with_presenter_view() { let mut session = deckcraft_engine::Session::with_new(); session.execute("slide.new", &json!({})).unwrap(); session.execute("slide.new", &json!({})).unwrap(); -<<<<<<< HEAD let mut harness = harness_with(session, Services::default(), egui_kittest::Harness::builder().with_size(vec2(1000.0, 700.0)), |_| {}); harness.state_mut().ui.presenter_view = true; -======= - let mut app = SlideApp::new(session, crate::Services::default()); - app.ui.presenter_view = true; - let mut harness = - egui_kittest::Harness::builder().with_context_setup(crate::framework::install_headless).with_size(vec2(1000.0, 700.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - app, - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 harness.run_steps(3); harness.state_mut().start_show(0, false); harness.run_steps(2); @@ -830,25 +734,9 @@ fn show_of_three() -> egui_kittest::Harness<'static, SlideApp> { let mut session = deckcraft_engine::Session::with_new(); session.execute("slide.new", &json!({})).unwrap(); session.execute("slide.new", &json!({})).unwrap(); -<<<<<<< HEAD let mut harness = harness_with(session, Services::default(), egui_kittest::Harness::builder().with_size(vec2(1000.0, 700.0)).with_step_dt(1.0 / 60.0), |_| {}); harness.state_mut().ui.presenter_view = false; -======= - let mut app = SlideApp::new(session, crate::Services::default()); - app.ui.presenter_view = false; - let mut harness = egui_kittest::Harness::builder() - .with_context_setup(crate::framework::install_headless) - .with_size(vec2(1000.0, 700.0)) - .with_step_dt(1.0 / 60.0) - .build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - app, - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 harness.run_steps(3); harness.state_mut().start_show(0, false); harness.run_steps(2); @@ -1166,21 +1054,9 @@ fn back_leaves_a_slide_whose_first_animation_is_with_previous() { session .execute("animation.add", &json!({"effect": "fade", "class": "entrance", "ids": [id.0], "start": "withPrevious", "duration": 500})) .unwrap(); -<<<<<<< HEAD // PLAN: plan error: the kept Back animation trial needs 0.25 s steps to finish its entrance in eight steps. let mut harness = harness_with(session, Services::default(), egui_kittest::Harness::builder().with_size(vec2(1000.0, 700.0)).with_step_dt(0.25), |_| {}); -======= - let app = SlideApp::new(session, crate::Services::default()); - let mut harness = - egui_kittest::Harness::builder().with_context_setup(crate::framework::install_headless).with_size(vec2(1000.0, 700.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - app, - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 harness.run_steps(3); harness.state_mut().start_show(0, false); harness.run_steps(2); @@ -1305,23 +1181,9 @@ fn remote_presenter_uses_the_audience_state_and_closes_with_the_show() { let mut session = deckcraft_engine::Session::with_new(); session.execute("slide.new", &json!({})).unwrap(); session.execute("slide.new", &json!({})).unwrap(); -<<<<<<< HEAD let services = Services { presenter: Some(Box::new(Mock(bridge.clone()))) }; let mut h = harness_with(session, services, egui_kittest::Harness::builder().with_size(vec2(1000.0, 700.0)), |_| {}); h.state_mut().ui.presenter_view = true; -======= - let services = crate::Services { presenter: Some(Box::new(Mock(bridge.clone()))), ..Default::default() }; - let mut app = SlideApp::new(session, services); - app.ui.presenter_view = true; - let mut h = - egui_kittest::Harness::builder().with_context_setup(crate::framework::install_headless).with_size(vec2(1000.0, 700.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - app, - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 h.run_steps(3); h.state_mut().start_show(0, false); let ctx = h.ctx.clone(); diff --git a/crates/ui-egui/src/slide_size_tests.rs b/crates/ui-egui/src/slide_size_tests.rs index 207d6b677..619151e96 100644 --- a/crates/ui-egui/src/slide_size_tests.rs +++ b/crates/ui-egui/src/slide_size_tests.rs @@ -18,21 +18,12 @@ fn open_with_size(w: f64, h: f64) -> egui_kittest::Harness<'static, SlideApp> { let mut s = Session::new(); s.execute("file.open", &json!({"path": path.to_string_lossy()})).unwrap(); let _ = std::fs::remove_file(&path); -<<<<<<< HEAD crate::test_harness::harness_with( s, Services::default(), egui_kittest::Harness::::builder().with_size(egui::vec2(1280.0, 800.0)).with_step_dt(1.0 / 60.0), |_| {}, -======= - egui_kittest::Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(1280.0, 800.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - SlideApp::new(s, Services::default()), ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 ) } diff --git a/crates/ui-egui/src/sorter/ui_tests.rs b/crates/ui-egui/src/sorter/ui_tests.rs index c1355a601..6d4747b86 100644 --- a/crates/ui-egui/src/sorter/ui_tests.rs +++ b/crates/ui-egui/src/sorter/ui_tests.rs @@ -20,7 +20,6 @@ fn harness(with_sections: bool) -> Harness<'static, Framed> { s.execute("section.add", &json!({"name": "Alpha", "at": 0})).unwrap(); s.execute("section.add", &json!({"name": "Beta", "at": 2})).unwrap(); } -<<<<<<< HEAD let mut h = crate::test_harness::harness_framed( s, Services::default(), @@ -36,21 +35,6 @@ fn harness(with_sections: bool) -> Harness<'static, Framed> { }, ); h.state_mut().ui.view = crate::ViewMode::Sorter; -======= - let mut app = SlideApp::new(s, Services::default()); - app.ui.view = crate::ViewMode::Sorter; - let mut h = Harness::builder() - .with_context_setup(crate::framework::install_headless) - .with_size(egui::vec2(1400.0, 900.0)) - .with_step_dt(1.0 / 60.0) - .build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - app, - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 h.run_steps(3); h } diff --git a/crates/ui-egui/src/split_button_tests.rs b/crates/ui-egui/src/split_button_tests.rs index 2e79f9fb2..bc8270942 100644 --- a/crates/ui-egui/src/split_button_tests.rs +++ b/crates/ui-egui/src/split_button_tests.rs @@ -21,20 +21,8 @@ fn harness(tab: &str) -> (Harness<'static, SlideApp>, [ShapeId; 2]) { ids[i] = ShapeId(r["id"].as_u64().unwrap() as u32); } s.execute("selection.select", &json!({"ids": [ids[0].0, ids[1].0]})).unwrap(); -<<<<<<< HEAD let mut h = crate::test_harness::harness_with(s, Services::default(), Harness::builder().with_size(egui::vec2(1800.0, 900.0)), |_| {}); h.state_mut().ui.tab = tab.into(); -======= - let mut app = SlideApp::new(s, Services::default()); - app.ui.tab = tab.into(); - let mut h = Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(1800.0, 900.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - app, - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 h.run_steps(3); (h, ids) } diff --git a/crates/ui-egui/src/tests.rs b/crates/ui-egui/src/tests.rs index 472336fb0..4e0d5a894 100644 --- a/crates/ui-egui/src/tests.rs +++ b/crates/ui-egui/src/tests.rs @@ -41,18 +41,7 @@ fn shape_rot(app: &SlideApp) -> f64 { /// letting go is one undo step. Off the canvas it does nothing. #[test] fn a_trackpad_twist_rotates_the_shape_under_the_canvas() { -<<<<<<< HEAD let mut harness = crate::test_harness::harness(Session::with_new(), Services::default()); -======= - let mut harness = - egui_kittest::Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(1200.0, 800.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - SlideApp::new(Session::with_new(), Services::default()), - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 harness.run_steps(2); let id = harness.state_mut().session.execute("shape.insert", &json!({"preset": "rect", "rect": [80.0, 80.0, 100.0, 60.0]})).unwrap(); let id = id.get("id").and_then(|v| v.as_u64()).unwrap(); @@ -171,18 +160,7 @@ fn title_text(app: &SlideApp) -> String { #[test] fn quick_access_toolbar_adds_removes_resets_and_persists() { -<<<<<<< HEAD let mut harness = crate::test_harness::harness(Session::with_new(), Services::default()); -======= - let mut harness = - egui_kittest::Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(1200.0, 800.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - SlideApp::new(Session::with_new(), Services::default()), - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 harness.run_steps(2); let ids = |app: &SlideApp| app.ui.qat.iter().map(|q| q.id.clone()).collect::>(); assert_eq!(ids(harness.state()), ["app.home", "file.save", "app.exportDialog", "edit.undo", "edit.redo", "show.fromStart"]); @@ -242,18 +220,7 @@ fn opening_a_file_with_missing_fonts_shows_a_toast_once() { body.paragraphs[0].runs[0].props.font = Some("Qqq Nonexistent Sans".into()); slide.shapes[0].text = Some(body); let data = deckcraft_engine::cmd::base64_encode(&deckcraft_engine::cmd::file::save_bytes(&p, "pptx").unwrap()); -<<<<<<< HEAD let mut harness = crate::test_harness::harness(Session::with_new(), Services::default()); -======= - let mut harness = - egui_kittest::Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(1200.0, 800.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - SlideApp::new(Session::with_new(), Services::default()), - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 harness.run_steps(2); assert!(notices(&harness.ctx).is_empty(), "a new presentation has nothing to say"); harness.state_mut().session.execute("file.openBytes", &json!({"name": "a.pptx", "data": data})).unwrap(); @@ -313,18 +280,7 @@ fn change_picture_replaces_the_selected_picture() { /// #17: Home created a new blank presentation instead of going to the start screen. #[test] fn home_shows_the_start_screen_over_the_open_presentation() { -<<<<<<< HEAD let mut harness = crate::test_harness::harness(Session::with_new(), Services::default()); -======= - let mut harness = - egui_kittest::Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(1200.0, 800.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - SlideApp::new(Session::with_new(), Services::default()), - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 // The app keeps requesting repaints, so step frames instead of run(). harness.run_steps(2); let title = harness.state().session.active().unwrap().doc.slides[0].shapes[0].id.0; @@ -366,18 +322,7 @@ fn ctrl_word_keys_edit_text() { let mut session = Session::with_new(); session.mac_keys = false; session.prefs.autocorrect = false; -<<<<<<< HEAD let mut harness = crate::test_harness::harness(session, Services::default()); -======= - let mut harness = - egui_kittest::Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(1200.0, 800.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - SlideApp::new(session, Services::default()), - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 harness.run_steps(2); let title = harness.state().session.active().unwrap().doc.slides[0].shapes[0].id.0; harness.state_mut().session.execute("text.edit", &json!({"id": title})).unwrap(); @@ -446,32 +391,6 @@ fn ctrl_word_keys_edit_text() { assert!(size(&mut harness).unwrap_or(f64::MAX) < after, "Ctrl+[ shrinks"); } -<<<<<<< HEAD -======= -/// Export… had no visible control: only the command palette reached it. -#[test] -fn title_bar_export_opens_the_export_dialog() { - let mut harness = - egui_kittest::Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(1200.0, 800.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - SlideApp::new(Session::with_new(), Services::default()), - ); - harness.run_steps(2); - assert!(harness.state().dialog.is_none()); - // Quick access: Home, Save, Export, each 24 points wide with 2 between, from x = 10. - let pos = egui::pos2(10.0 + 2.0 * 26.0 + 12.0, ribbon::TITLE_H / 2.0); - harness.hover_at(pos); - harness.run_steps(1); - harness.event(egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed: true, modifiers: egui::Modifiers::NONE }); - harness.event(egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed: false, modifiers: egui::Modifiers::NONE }); - harness.run_steps(2); - assert_eq!(harness.state().dialog.as_ref().map(|d| d.id.as_str()), Some("export")); -} - ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 /// A browser's Copy Image puts the picture on the clipboard with text that only names it: the /// address (and the alt text), and an `` fragment as HTML. Ctrl+V pastes the picture, as /// PowerPoint does, instead of a text box with the link. Without a picture the link pastes as text. @@ -492,7 +411,6 @@ fn ctrl_v_pastes_the_picture_a_browser_copied_not_its_link() { let d = session.active().unwrap(); deckcraft_engine::cmd::file::render_png(&d.doc, 0, 0.1, false).0 }; -<<<<<<< HEAD let mut harness = crate::test_harness::harness(session, Services::default()); let mut offer = vec![ClipItem::Text(text.clone().into())]; if let Some(html) = html { @@ -506,23 +424,6 @@ fn ctrl_v_pastes_the_picture_a_browser_copied_not_its_link() { )))); } assert_eq!(ClipboardHandle::of(&harness.ctx).offer(&offer).unwrap(), Written::Written); -======= - let services = Services { - clipboard_image: Some(Box::new(move || with_picture.then(|| png.clone()))), - clipboard_html: Some(Box::new(move || html.clone())), - ..Default::default() - }; - let mut harness = egui_kittest::Harness::builder() - .with_context_setup(crate::framework::install_headless) - .with_size(egui::vec2(1200.0, 800.0)) - .build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - SlideApp::new(session, services), - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 harness.run_steps(2); let shapes_before = harness.state().session.active().unwrap().doc.slides[0].shapes.len(); harness.event(egui::Event::Paste(text.clone())); @@ -542,27 +443,8 @@ fn ctrl_v_pastes_the_picture_a_browser_copied_not_its_link() { /// An image-only clipboard is pasted by the window's Paste chord without a text Paste event. #[test] fn ctrl_v_pastes_an_image_when_no_paste_event_arrives() { -<<<<<<< HEAD let mut h = crate::test_harness::harness(Session::with_new(), Services::default()); h.run_steps(2); -======= - let session = Session::with_new(); - let png = { - let d = session.active().unwrap(); - deckcraft_engine::cmd::file::render_png(&d.doc, 0, 0.1, false).0 - }; - assert!(!png.is_empty()); - let services = Services { clipboard_image: Some(Box::new(move || Some(png.clone()))), ..Default::default() }; - let mut harness = - egui_kittest::Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(1200.0, 800.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - SlideApp::new(session, services), - ); - harness.run_steps(2); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 let pictures = |app: &SlideApp| { app.session.active().unwrap().doc.slides[0].shapes.iter().filter(|s| matches!(s.kind, deckcraft_model::ShapeKind::Picture { .. })).count() }; @@ -579,24 +461,9 @@ fn ctrl_v_pastes_an_image_when_no_paste_event_arrives() { /// #78: after Tab in a text box, typing and deleting no longer reached the text. #[test] fn typing_goes_on_after_tab_in_a_text_box() { -<<<<<<< HEAD let mut session = Session::with_new(); session.prefs.autocorrect = false; let mut harness = crate::test_harness::harness(session, Services::default()); -======= - let mut harness = - egui_kittest::Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(1200.0, 800.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - { - let mut session = Session::with_new(); - session.prefs.autocorrect = false; - SlideApp::new(session, Services::default()) - }, - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 harness.run_steps(2); let title = harness.state().session.active().unwrap().doc.slides[0].shapes[0].id.0; harness.state_mut().session.execute("text.edit", &json!({"id": title})).unwrap(); @@ -629,18 +496,7 @@ fn typing_goes_on_after_tab_in_a_text_box() { /// list could neither be typed into nor continued with Enter. #[test] fn tab_in_an_edited_list_keeps_the_keyboard() { -<<<<<<< HEAD let mut harness = crate::test_harness::harness(Session::with_new(), Services::default()); -======= - let mut harness = - egui_kittest::Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(1200.0, 800.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - SlideApp::new(Session::with_new(), Services::default()), - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 harness.run_steps(2); let title = harness.state().session.active().unwrap().doc.slides[0].shapes[0].id.0; harness.state_mut().session.execute("text.edit", &json!({"id": title})).unwrap(); @@ -729,53 +585,8 @@ fn grid_options_sets_spacing_and_display_or_opens_the_dialog() { app.run("view.gridOptions", json!({})).unwrap(); assert!((app.session.prefs.grid_spacing - 72.0).abs() < 1e-9); -<<<<<<< HEAD harness.run_steps(1); assert!(crate::dialogs::open_keys(&ctx).iter().any(|key| key == "gridOptions")); -======= -} - -#[test] -fn grid_options_dialog_lists_spacing_and_display() { - use egui_kittest::kittest::Queryable; - let mut harness = - egui_kittest::Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(1200.0, 800.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - SlideApp::new(Session::with_new(), Services::default()), - ); - harness.run_steps(2); - harness.state_mut().run("view.gridOptions", json!({})).unwrap(); - harness.run_steps(2); - assert!(harness.query_by_label_contains("Display grid on screen").is_some()); - assert!(harness.query_by_label_contains("Snap objects to grid").is_some()); - assert!(harness.query_by_label_contains("Spacing (pt)").is_some()); - let show_grid = harness - .query_all_by_role_and_label(egui::accesskit::Role::CheckBox, "Display grid on screen") - .next() - .unwrap_or_else(|| panic!("no grid checkbox")); - show_grid.click_accesskit(); - harness.run_steps(2); - harness.query_all_by_role_and_label(egui::accesskit::Role::Button, "OK").next().unwrap_or_else(|| panic!("no OK button")).click_accesskit(); - harness.run_steps(2); - assert!(harness.state().dialog.is_none(), "OK closes Grid Options"); - assert!(harness.state().ui.gridlines, "OK applies the grid checkbox"); - assert!((harness.state().session.prefs.grid_spacing - 6.0).abs() < 1e-9); - - harness.state_mut().run("view.gridOptions", json!({})).unwrap(); - harness.run_steps(2); - harness - .query_all_by_role_and_label(egui::accesskit::Role::Button, "Cancel") - .next() - .unwrap_or_else(|| panic!("no Cancel button")) - .click_accesskit(); - harness.run_steps(2); - assert!(harness.state().dialog.is_none(), "Cancel closes Grid Options"); - assert!(harness.state().ui.gridlines, "Cancel leaves the grid on"); - assert!((harness.state().session.prefs.grid_spacing - 6.0).abs() < 1e-9); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 } /// Preferences (#752): Cancel, Esc and the window's close button put back what the dialog @@ -783,18 +594,7 @@ fn grid_options_dialog_lists_spacing_and_display() { #[test] fn preferences_cancel_restores_the_settings_done_keeps_them() { use egui_kittest::kittest::Queryable; -<<<<<<< HEAD let mut harness = crate::test_harness::harness(Session::with_new(), Services::default()); -======= - let mut harness = - egui_kittest::Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(1200.0, 800.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - SlideApp::new(Session::with_new(), Services::default()), - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 harness.run_steps(2); let before = harness.state().session.prefs.clone(); let dark_before = harness.state().ui.brightness; @@ -844,56 +644,8 @@ fn preferences_cancel_restores_the_settings_done_keeps_them() { assert_ne!(s.session.prefs.snap_to_grid, before.snap_to_grid, "Done keeps snap to grid"); } -<<<<<<< HEAD fn canvas_harness() -> egui_kittest::Harness<'static, SlideApp> { let mut harness = crate::test_harness::harness(Session::with_new(), Services::default()); -======= -/// About dialog: Close and Cancel each close the dialog. -#[test] -fn about_dialog_close_and_cancel_close_it() { - use egui_kittest::kittest::Queryable; - let mut harness = - egui_kittest::Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(1200.0, 800.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - SlideApp::new(Session::with_new(), Services::default()), - ); - harness.run_steps(2); - harness.state_mut().run("app.about", json!({})).unwrap(); - harness.run_steps(2); - assert!(harness.state().dialog.is_some()); - harness - .query_all_by_role_and_label(egui::accesskit::Role::Button, "Cancel") - .next() - .unwrap_or_else(|| panic!("no Cancel button in About dialog")) - .click_accesskit(); - harness.run_steps(2); - assert!(harness.state().dialog.is_none(), "Cancel closes About dialog"); - - harness.state_mut().run("app.about", json!({})).unwrap(); - harness.run_steps(2); - assert!(harness.state().dialog.is_some()); - harness - .query_all_by_role_and_label(egui::accesskit::Role::Button, "Close") - .next() - .unwrap_or_else(|| panic!("no Close button in About dialog")) - .click_accesskit(); - harness.run_steps(2); - assert!(harness.state().dialog.is_none(), "Close closes About dialog"); -} - -fn canvas_harness() -> egui_kittest::Harness<'static, SlideApp> { - let mut harness = - egui_kittest::Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(1200.0, 800.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - SlideApp::new(Session::with_new(), Services::default()), - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 harness.run_steps(2); let app = harness.state_mut(); // Zoomed out, the canvas shows plenty of pasteboard around the slide. @@ -995,18 +747,7 @@ fn the_canvas_renders_only_the_slide_when_nothing_is_off_it() { /// Ctrl+X do. #[test] fn copy_and_cut_commands_reach_the_system_clipboard() { -<<<<<<< HEAD let mut harness = crate::test_harness::harness(Session::with_new(), Services::default()); -======= - let mut harness = - egui_kittest::Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(1200.0, 800.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - SlideApp::new(Session::with_new(), Services::default()), - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 harness.run_steps(2); let clipboard = ClipboardHandle::of(&harness.ctx); let copied = |_: &egui_kittest::Harness<'_, SlideApp>| clipboard.read_text().unwrap(); @@ -1034,18 +775,7 @@ fn copy_and_cut_commands_reach_the_system_clipboard() { /// egui-winit drops Ctrl+V when the system clipboard is empty; the context menu worked. #[test] fn copy_then_paste_shortcut_duplicates_an_object_without_text() { -<<<<<<< HEAD let mut harness = crate::test_harness::harness(Session::with_new(), Services::default()); -======= - let mut harness = - egui_kittest::Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(1200.0, 800.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - SlideApp::new(Session::with_new(), Services::default()), - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 harness.run_steps(2); harness.state_mut().session.execute("shape.insert", &json!({"preset": "rect", "rect": [10, 10, 50, 50]})).unwrap(); let count = |h: &egui_kittest::Harness<'_, SlideApp>| h.state().session.doc().unwrap().current_slide().unwrap().shapes.len(); @@ -1065,18 +795,7 @@ fn copy_then_paste_shortcut_duplicates_an_object_without_text() { /// canvas focused it still selects shapes. #[test] fn select_all_follows_the_focused_pane() { -<<<<<<< HEAD let mut harness = crate::test_harness::harness(Session::with_new(), Services::default()); -======= - let mut harness = - egui_kittest::Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(1200.0, 800.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - SlideApp::new(Session::with_new(), Services::default()), - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 harness.run_steps(2); for _ in 0..2 { harness.state_mut().run("slide.new", json!({})).unwrap(); @@ -1107,35 +826,7 @@ fn select_all_follows_the_focused_pane() { } fn harness() -> egui_kittest::Harness<'static, SlideApp> { -<<<<<<< HEAD crate::test_harness::harness(Session::new(), Services::default()) -======= - egui_kittest::Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(1200.0, 800.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - SlideApp::new(Session::new(), Services::default()), - ) ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 -} - -/// With the framework runtime installed, the window's keys still reach DeckCraft's own routing: Alt+1 runs the -/// first Quick Access Toolbar item (Alt+numpad code entry leaves the claimed chord alone off macOS), and Escape with -/// nothing focused leaves the File tab. -#[test] -fn alt_digit_and_escape_reach_the_app_through_the_runtime() { - let mut h = harness(); - h.state_mut().run("file.new", json!({})).unwrap(); - h.state_mut().session.mac_keys = false; - h.run_steps(3); - assert!(!h.state().backstage_open()); - h.key_press_modifiers(egui::Modifiers::ALT, egui::Key::Num1); - h.run_steps(2); - assert!(h.state().backstage_open(), "Alt+1 runs app.home, which opens the File tab"); - h.key_press(egui::Key::Escape); - h.run_steps(2); - assert!(!h.state().backstage_open(), "Escape leaves the File tab"); } /// #172: a recent file that no longer exists is marked on File › Home, and clicking it draws @@ -1185,18 +876,7 @@ fn recent_exists_tells_missing_from_present() { #[test] fn the_language_dialog_marks_the_selected_text() { use egui_kittest::kittest::Queryable; -<<<<<<< HEAD let mut harness = crate::test_harness::harness(Session::with_new(), Services::default()); -======= - let mut harness = - egui_kittest::Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(1200.0, 800.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - SlideApp::new(Session::with_new(), Services::default()), - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 harness.run_steps(2); let title = harness.state().session.active().unwrap().doc.slides[0].shapes[0].id.0; harness.state_mut().session.execute("text.edit", &json!({"id": title})).unwrap(); @@ -1216,62 +896,12 @@ fn the_language_dialog_marks_the_selected_text() { assert_eq!(body.paragraphs[0].runs[0].props.lang.as_deref(), Some("fr-FR")); } -<<<<<<< HEAD -======= -/// Review > Language > Whole presentation marks every text box, not only the selected one. -#[test] -fn the_language_dialog_marks_the_whole_presentation() { - use egui_kittest::kittest::Queryable; - let mut harness = - egui_kittest::Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(1200.0, 800.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - SlideApp::new(Session::with_new(), Services::default()), - ); - harness.run_steps(2); - let s = &mut harness.state_mut().session; - let title = s.active().unwrap().doc.slides[0].shapes[0].id.0; - s.execute("text.edit", &json!({"id": title})).unwrap(); - s.execute("text.insert", &json!({"text": "Hola"})).unwrap(); - s.execute("slide.new", &json!({"title": "Adiós"})).unwrap(); - s.execute("text.edit", &json!({"id": s.active().unwrap().doc.slides[1].shapes[0].id.0})).unwrap(); - s.execute("text.selectAll", &json!({})).unwrap(); - harness.state_mut().run("app.dialog", json!({"id": "language"})).unwrap(); - harness.run_steps(4); - harness.get_by_label("Whole presentation").click(); - harness.run_steps(2); - harness.get_by_label("Español (España)").click(); - harness.run_steps(2); - harness.get_by_label("OK").click(); - harness.run_steps(2); - assert!(harness.state().dialog.is_none()); - let d = harness.state().session.active().unwrap(); - for sl in &d.doc.slides { - let body = sl.shapes[0].text.as_ref().unwrap(); - assert_eq!(body.paragraphs[0].runs[0].props.lang.as_deref(), Some("es-ES")); - } -} - ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 /// With nothing selected, Review > Language applies to the whole presentation without /// choosing it, and Selected text can't be picked. #[test] fn the_language_dialog_marks_the_whole_presentation_with_nothing_selected() { use egui_kittest::kittest::{NodeT, Queryable}; -<<<<<<< HEAD let mut harness = crate::test_harness::harness(Session::with_new(), Services::default()); -======= - let mut harness = - egui_kittest::Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(1200.0, 800.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - SlideApp::new(Session::with_new(), Services::default()), - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 harness.run_steps(2); let s = &mut harness.state_mut().session; let title = s.active().unwrap().doc.slides[0].shapes[0].id.0; @@ -1325,18 +955,7 @@ fn editing_notes_in_the_pane_keeps_their_formatting() { }; let mut session = Session::with_new(); session.execute("slide.notes", &json!({"index": 0, "body": notes})).unwrap(); -<<<<<<< HEAD let mut harness = crate::test_harness::harness(session, Services::default()); -======= - let mut harness = - egui_kittest::Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(1200.0, 800.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - SlideApp::new(session, Services::default()), - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 harness.run_steps(2); // Five paragraphs run past the pane's visible height, so the click goes on the first line, not the node's centre. let first_line = harness.get_by_role_and_label(egui::accesskit::Role::MultilineTextInput, "Notes").rect().left_top() + egui::vec2(40.0, 8.0); @@ -1380,18 +999,7 @@ fn editing_notes_in_the_pane_keeps_their_formatting() { } fn step_app(services: Services) -> egui_kittest::Harness<'static, SlideApp> { -<<<<<<< HEAD let mut h = crate::test_harness::harness(Session::with_new(), services); -======= - let mut h = - egui_kittest::Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(1200.0, 800.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - SlideApp::new(Session::with_new(), services), - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 h.run_steps(2); h } @@ -1493,26 +1101,12 @@ fn preview_hides_an_entrance_until_it_plays() { #[test] fn animation_preview_plays_on_the_canvas_then_stops() { -<<<<<<< HEAD let mut harness = crate::test_harness::harness_with( Session::with_new(), Services::default(), egui_kittest::Harness::builder().with_size(egui::vec2(1440.0, 900.0)).with_step_dt(0.05), |_| {}, ); -======= - let mut harness = egui_kittest::Harness::builder() - .with_context_setup(crate::framework::install_headless) - .with_size(egui::vec2(1200.0, 800.0)) - .with_step_dt(0.05) - .build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - SlideApp::new(Session::with_new(), Services::default()), - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 harness.run_steps(2); let none = harness.state_mut().run("animation.preview", json!({})).unwrap(); assert_eq!(none["playing"], false); @@ -1573,21 +1167,7 @@ fn animation_preview_plays_on_the_canvas_then_stops() { } fn flick_harness() -> egui_kittest::Harness<'static, SlideApp> { -<<<<<<< HEAD let mut harness = crate::test_harness::harness(Session::with_new(), Services::default()); -======= - let mut harness = egui_kittest::Harness::builder() - .with_context_setup(crate::framework::install_headless) - .with_size(egui::vec2(1200.0, 800.0)) - .with_step_dt(1.0 / 60.0) - .build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - SlideApp::new(Session::with_new(), Services::default()), - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 harness.run_steps(2); // Fitted: the slide is smaller than the window, so a flick turns the page instead of panning. harness.state_mut().ui.zoom = Some(0.4); @@ -1715,18 +1295,7 @@ fn the_pen_ignores_a_swipe_during_the_show() { /// until the pointer lets go, so the slider doesn't grow under the pointer mid-drag. #[test] fn interface_size_applies_when_the_slider_is_let_go() { -<<<<<<< HEAD let mut harness = crate::test_harness::harness(Session::with_new(), Services::default()); -======= - let mut harness = - egui_kittest::Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(1200.0, 800.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - SlideApp::new(Session::with_new(), Services::default()), - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 harness.run_steps(2); harness.state_mut().run("app.preferences", json!({})).unwrap(); harness.run_steps(4); @@ -1746,56 +1315,13 @@ fn interface_size_applies_when_the_slider_is_let_go() { harness.run_steps(2); let after = harness.state().ui.ui_scale; assert!(after > before + 0.3, "letting go applies the size dragged to: {before} -> {after}"); -<<<<<<< HEAD assert!(crate::dialogs::modal_open(&harness.ctx), "Preferences stays open"); -======= - assert!(harness.state().dialog.is_some(), "Preferences stays open"); -} -/// The status bar's zoom slider has no room for a visible label; it still needs an accessible -/// name, and adding that name must not change the slider's shared control geometry at either -/// size. -#[test] -fn status_zoom_slider_is_named_without_growing_the_status_bar() { - for size in [egui::vec2(900.0, 560.0), egui::vec2(1440.0, 900.0)] { - let mut harness = egui_kittest::Harness::builder().with_context_setup(crate::framework::install_headless).with_size(size).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - SlideApp::new(Session::with_new(), Services::default()), - ); - harness.run_steps(3); - let mut zoom = harness.query_all_by_role_and_label(egui::accesskit::Role::Slider, "Zoom"); - let rect = zoom.next().unwrap_or_else(|| panic!("a named Zoom slider at {size:?}")).rect(); - assert!(zoom.next().is_none(), "exactly one Zoom slider"); - // egui 0.37's slider uses its own `slider_width` and the theme's control height - // (22 px), not the old hard-coded 110x18. Assert that real, shared geometry so the - // status row stays consistent with every other control instead of loosening a bound. - let style = harness.ctx.global_style(); - let (expected_w, expected_h) = (style.spacing.slider_width, style.spacing.interact_size.y); - assert!( - (rect.width() - expected_w).abs() <= 0.5 && (rect.height() - expected_h).abs() <= 0.5, - "the status-bar slider uses the shared {expected_w}x{expected_h} control size at {size:?}: {rect:?}" - ); - } ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 } /// The Format Shape fill page exposes one named Transparency slider. #[test] fn preferences_and_format_pane_name_every_input() { -<<<<<<< HEAD let mut harness = crate::test_harness::harness(Session::with_new(), Services::default()); -======= - let mut harness = - egui_kittest::Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(1200.0, 800.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - SlideApp::new(Session::with_new(), Services::default()), - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 harness.run_steps(3); harness.state_mut().run("shape.insert", json!({"preset": "rect", "rect": [100, 100, 200, 100]})).unwrap(); harness.state_mut().ui.pane = Some("format".into()); @@ -1807,7 +1333,6 @@ fn preferences_and_format_pane_name_every_input() { assert!(sliders[0].rect().width() > 40.0, "the slider keeps room next to its one visible label: {:?}", sliders[0].rect()); } -<<<<<<< HEAD /// A hidden logic iteration answers requests without a UI pass. #[test] fn logic_drains_control_without_a_ui_pass() { @@ -1816,60 +1341,6 @@ fn logic_drains_control_without_a_ui_pass() { let (req, reply) = craft::automation::control::ControlRequest::new("engine.execute", json!({"command": "slide.new", "params": {}})); let before = h.state().session.active().unwrap().doc.slides.len(); tx.send(req).unwrap(); -======= -/// A control `ui.screenshot` is admitted once, issued from a settled real UI pass, completed by -/// kittest's screenshot callback, and replied to exactly once after a logic drain. -#[test] -fn ui_screenshot_round_trips_through_the_callable_slot() { - let mut harness = - egui_kittest::Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(900.0, 600.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - SlideApp::new(Session::with_new(), Services::default()), - ); - let (tx, rx) = std::sync::mpsc::channel(); - harness.state_mut().control_rx = Some(rx); - let (req, reply) = ControlRequest::new("ui.screenshot", json!({})); - tx.send(req).unwrap(); - harness.run_steps(2); - assert_eq!(harness.state().capture.pending(), 1, "the request is admitted"); - harness.state_mut().capture.force_settle(); - harness.run_steps(4); - let reply = reply.recv_timeout(std::time::Duration::from_secs(5)).expect("screenshot reply"); - assert_eq!(reply["ok"], true, "{reply}"); - assert!(reply["result"]["width"].as_u64().is_some_and(|w| w > 0)); - assert_eq!(harness.state().capture.pending(), 0); - assert_eq!(harness.state().capture.reserved_bytes(), 0, "the reservation is released after the reply"); -} - -/// A hidden/logic-only iteration drains control requests and autosave/screenshot queues; it does -/// not need a painted frame for those side effects. -#[test] -fn logic_drains_control_without_a_ui_pass() { - let mut app = SlideApp::new(Session::with_new(), Services::default()); - let ctx = egui::Context::default(); - crate::framework::install_headless(&ctx); - let (tx, rx) = std::sync::mpsc::channel(); - app.control_rx = Some(rx); - let (req, reply) = ControlRequest::new("ui.inspect", json!({})); - tx.send(req).unwrap(); - app.logic(&ctx); - let v = reply.recv_timeout(std::time::Duration::from_secs(1)).expect("reply from a logic-only call"); - assert_eq!(v["ok"], true, "{v}"); -} - -/// One synthetic pointer batch is injected at most once while it waits for a real UI pass. -/// eframe carries the whole `RawInput` from a logic-only frame into the next full pass, so a -/// document or layout change between them must retract the already-appended events too. -#[test] -fn synthetic_input_is_one_pending_batch_and_never_replays() { - let mut app = SlideApp::new(Session::with_new(), Services::default()); - let ctx = egui::Context::default(); - crate::framework::install_headless(&ctx); - app.queue_input(egui::Event::PointerMoved(egui::pos2(10.0, 10.0))); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 let mut raw = egui::RawInput::default(); raw.viewports.entry(egui::ViewportId::ROOT).or_default().minimized = Some(true); // As eframe's logic-only iteration does: the input hook, then logic, with no UI pass. @@ -1880,92 +1351,11 @@ fn synthetic_input_is_one_pending_batch_and_never_replays() { assert_eq!(h.state().session.active().unwrap().doc.slides.len(), before + 1); } -<<<<<<< HEAD /// A queued document request waits until the old target has consumed its injected click. -======= -/// The first real pass installs the interface fonts and asks egui to discard it before any -/// layout. A control click that arrived in that same pass has already been consumed by egui, -/// so the app must put it back in the queue for the next frame instead of acknowledging and -/// losing it. -#[test] -fn a_control_click_on_the_first_font_discard_is_requeued_and_lands() { - let mut app = SlideApp::new(Session::with_new(), Services::default()); - app.fonts_ready = true; - app.styled = true; - let ctx = egui::Context::default(); - crate::framework::install_headless(&ctx); - let pass = |app: &mut SlideApp, time: f64| { - let mut raw = egui::RawInput { time: Some(time), ..Default::default() }; - raw.viewports.insert( - egui::ViewportId::ROOT, - egui::ViewportInfo { minimized: Some(false), occluded: Some(false), native_pixels_per_point: Some(1.0), ..Default::default() }, - ); - app.raw_input_hook(&ctx, &mut raw); - ctx.run_ui(raw, |ui| { - app.logic(ui.ctx()); - app.ui(ui); - }) - .drop_without_applying_deltas(); - }; - pass(&mut app, 1.0); - let size = app.session.active().unwrap().doc.slide_size; - app.session.execute("shape.insert", &json!({"preset": "rect", "rect": [0.0, 0.0, size.width, size.height]})).unwrap(); - app.session.execute("edit.deselect", &json!({})).unwrap(); - pass(&mut app, 2.0); - let point = app.slide_rect.expect("the canvas has been laid out").center(); - assert!(app.session.active().unwrap().selection.shapes.is_empty()); - - // Back to the first-frame state: the next pass installs fonts and is discarded. - app.styled = false; - app.fonts_ready = false; - app.queue_input(egui::Event::PointerMoved(point)); - app.queue_input(egui::Event::PointerButton { pos: point, button: egui::PointerButton::Primary, pressed: true, modifiers: egui::Modifiers::NONE }); - app.queue_input(egui::Event::PointerButton { - pos: point, - button: egui::PointerButton::Primary, - pressed: false, - modifiers: egui::Modifiers::NONE, - }); - pass(&mut app, 3.0); - assert!(app.session.active().unwrap().selection.shapes.is_empty(), "the discarded pass did not run the canvas"); - assert!(!app.synthetic.is_empty(), "the click was requeued for the next frame"); - - // One pointer event is injected per pass: move, press, release. - for time in [4.0, 5.0, 6.0] { - pass(&mut app, time); - } - assert!(!app.session.active().unwrap().selection.shapes.is_empty(), "the requeued click selected the slide's shape"); - assert!(!app.synthetic_pending && app.synthetic.is_empty(), "the click was consumed exactly once"); -} - -/// A modal opening changes what a queued window-point event means even when the document and -/// canvas are unchanged; the injected batch is retracted before it reaches the modal. -#[test] -fn synthetic_batch_is_retracted_when_a_modal_opens_first() { - let mut app = SlideApp::new(Session::with_new(), Services::default()); - let ctx = egui::Context::default(); - crate::framework::install_headless(&ctx); - app.queue_input(egui::Event::PointerMoved(egui::pos2(10.0, 10.0))); - let mut raw = egui::RawInput::default(); - app.raw_input_hook(&ctx, &mut raw); - assert_eq!(raw.events.len(), 1); - app.dialog = Some(crate::dialogs::Dialog::new("replaceFonts")); - app.raw_input_hook(&ctx, &mut raw); - assert!(raw.events.is_empty(), "the click queued for the canvas does not reach the modal"); - assert!(!app.synthetic_pending); -} - -/// A control click is admitted for the full pass it was queued for. In that pass egui has -/// already derived `PointerState` from the injected press/release, so retracting only the raw -/// events would still let the click reach a document opened by the same pass's logic. The -/// control request therefore waits: the old target's real `logic` + `ui` pass consumes the -/// whole pointer gesture, and the next pass (no synthetic input) applies the document change. ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 #[test] fn synthetic_click_is_consumed_on_its_old_target_before_logic_changes_the_document() { let mut destination = Session::with_new(); let size = destination.active().unwrap().doc.slide_size; -<<<<<<< HEAD destination.execute("shape.insert", &json!({"preset": "rect", "rect": [0, 0, size.width, size.height]})).unwrap(); let data = destination.execute("file.saveBytes", &json!({})).unwrap()["data"].clone(); let (mut h, tx) = control_harness(Session::with_new()); @@ -1982,52 +1372,6 @@ fn synthetic_click_is_consumed_on_its_old_target_before_logic_changes_the_docume "engine.execute", json!({"command": "file.openBytes", "params": {"name": "destination.deckcraft", "data": data}}), ); -======= - destination.execute("shape.insert", &json!({"preset": "rect", "rect": [0.0, 0.0, size.width, size.height]})).unwrap(); - let data = destination.execute("file.saveBytes", &json!({})).unwrap()["data"].as_str().unwrap().to_string(); - - let mut app = SlideApp::new(Session::with_new(), Services::default()); - app.fonts_ready = true; - app.styled = true; - let ctx = egui::Context::default(); - crate::framework::install_headless(&ctx); - let pass = |app: &mut SlideApp, time: f64| { - let mut raw = egui::RawInput { time: Some(time), ..Default::default() }; - raw.viewports.insert( - egui::ViewportId::ROOT, - egui::ViewportInfo { minimized: Some(false), occluded: Some(false), native_pixels_per_point: Some(1.0), ..Default::default() }, - ); - app.raw_input_hook(&ctx, &mut raw); - ctx.run_ui(raw, |ui| { - app.logic(ui.ctx()); - app.ui(ui); - }) - .drop_without_applying_deltas(); - }; - - pass(&mut app, 1.0); - app.run("shape.insert", json!({"preset": "rect", "rect": [100.0, 100.0, 200.0, 100.0]})).unwrap(); - assert!(!app.session.active().unwrap().selection.shapes.is_empty(), "the old document has a selection to clear"); - pass(&mut app, 2.0); - let old = app.session.active().unwrap().uid; - let slide = app.slide_rect.expect("the canvas has been laid out"); - // Well away from the inserted rectangle, so a press on the bare canvas clears the - // selection in the old document. - let point = egui::pos2(slide.min.x + slide.width() * 0.8, slide.min.y + slide.height() * 0.8); - app.queue_input(egui::Event::PointerMoved(point)); - app.queue_input(egui::Event::PointerButton { pos: point, button: egui::PointerButton::Primary, pressed: true, modifiers: egui::Modifiers::NONE }); - app.queue_input(egui::Event::PointerButton { - pos: point, - button: egui::PointerButton::Primary, - pressed: false, - modifiers: egui::Modifiers::NONE, - }); - - let (tx, rx) = std::sync::mpsc::channel(); - app.control_rx = Some(rx); - let (req, reply) = - ControlRequest::new("engine.execute", json!({"command": "file.openBytes", "params": {"name": "destination.deckcraft", "data": data}})); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 tx.send(req).unwrap(); for _ in 0..8 { if host.injected_idle() { @@ -2050,7 +1394,6 @@ fn synthetic_click_is_consumed_on_its_old_target_before_logic_changes_the_docume /// Every target-changing app state withdraws a click captured for the earlier state. #[test] fn input_target_changes_retract_a_queued_click() { -<<<<<<< HEAD let ribbon_arrow = |h: &egui_kittest::Harness<'_, SlideApp>| h.get_by_label("Scroll ribbon right").rect().center(); for case in [ "show", @@ -2169,232 +1512,13 @@ fn input_target_changes_retract_a_queued_click() { h.run_steps(8); assert!(!h.state().session.active().unwrap().selection.shapes.is_empty(), "{case}: the withdrawn bare-canvas click must not clear selection"); } -======= - let mut app = SlideApp::new(Session::with_new(), Services::default()); - let ctx = egui::Context::default(); - let pointer = || egui::Event::PointerMoved(egui::pos2(10.0, 10.0)); - - app.queue_input(pointer()); - app.start_show(0, true); - let mut raw = egui::RawInput::default(); - app.raw_input_hook(&ctx, &mut raw); - assert!(raw.events.is_empty(), "a click queued for the editor does not enter the slideshow"); - assert!(app.synthetic.is_empty()); - app.show = None; - - app.queue_input(pointer()); - app.opening = Some(crate::opening::Opening::for_test("/tmp/quarterly.pptx")); - let mut raw = egui::RawInput::default(); - app.raw_input_hook(&ctx, &mut raw); - assert!(raw.events.is_empty(), "a click queued for the editor does not enter the opening window"); - app.opening = None; - - app.palette = Some(("open".into(), 0)); - app.queue_input(pointer()); - app.palette = Some(("open".into(), 1)); - let mut raw = egui::RawInput::default(); - app.raw_input_hook(&ctx, &mut raw); - assert!(raw.events.is_empty(), "a click queued for one palette selection does not activate another"); - assert!(app.synthetic.is_empty()); -} - -/// A logic-only callback does not consume events, but eframe carries the whole RawInput into -/// the next full pass. The hook injects without guessing the phase; when a control request -/// drained by that logic-only callback changes the document, the carried batch is retracted at -/// the next hook instead of being delivered into the new document. -#[test] -fn hidden_logic_pass_carries_a_synthetic_batch_and_drops_it_when_the_document_changes() { - let mut app = SlideApp::new(Session::with_new(), Services::default()); - let ctx = egui::Context::default(); - crate::framework::install_headless(&ctx); - let (tx, rx) = std::sync::mpsc::channel(); - app.control_rx = Some(rx); - app.queue_input(egui::Event::PointerMoved(egui::pos2(10.0, 10.0))); - let mut hidden = egui::RawInput::default(); - hidden.viewports.insert( - egui::ViewportId::ROOT, - egui::ViewportInfo { minimized: Some(true), occluded: Some(true), native_pixels_per_point: Some(1.0), ..Default::default() }, - ); - app.raw_input_hook(&ctx, &mut hidden); - assert_eq!(hidden.events.len(), 1, "the batch is injected into the RawInput eframe will carry"); - assert!(app.synthetic.is_empty()); - assert!(app.synthetic_pending, "run_logic leaves the batch unacknowledged"); - - let (req, reply) = ControlRequest::new("engine.execute", json!({"command": "file.new", "params": {}})); - tx.send(req).unwrap(); - let _ = ctx.run_logic(&hidden, |ctx| app.logic(ctx)); - let v = reply.recv_timeout(std::time::Duration::from_secs(1)).expect("control reply from the hidden pass"); - assert_eq!(v["ok"], true, "{v}"); - assert_eq!(app.session.documents().len(), 2, "the hidden pass opened another document"); - assert!(app.synthetic_pending, "a logic-only callback cannot retract the carried batch"); - - // eframe hands the hidden RawInput to the next visible pass, appending new host input. - let mut visible = hidden.clone(); - visible.viewports.insert( - egui::ViewportId::ROOT, - egui::ViewportInfo { minimized: Some(false), occluded: Some(false), native_pixels_per_point: Some(1.0), ..Default::default() }, - ); - let host = egui::Event::Text("host".into()); - visible.events.push(host.clone()); - app.raw_input_hook(&ctx, &mut visible); - assert_eq!(visible.events, vec![host.clone()], "the click queued for the old document is dropped"); - assert!(app.synthetic.is_empty()); - ctx.run_ui(visible, |ui| { - app.logic(ui.ctx()); - app.ui(ui); - }) - .drop_without_applying_deltas(); - assert!(app.synthetic.is_empty(), "nothing replays after the visible pass"); -} - -/// eframe may run logic-only for a *visible* root when a redraw deadline is overdue. The -/// previous pass's InputState is still live, so retraction must not drain an identical event -/// from it; the batch belongs to the carried RawInput and is removed at the next hook. -#[test] -fn visible_logic_pass_does_not_retract_from_the_previous_input_state() { - let mut app = SlideApp::new(Session::with_new(), Services::default()); - let ctx = egui::Context::default(); - let (tx, rx) = std::sync::mpsc::channel(); - app.control_rx = Some(rx); - let pointer = egui::Event::PointerMoved(egui::pos2(10.0, 10.0)); - - // Live InputState from the previous full pass, with an identical event at the same index. - let mut previous = egui::RawInput { time: Some(1.0), ..Default::default() }; - previous.events.push(pointer.clone()); - ctx.run_ui(previous, |_ui| {}).drop_without_applying_deltas(); - - app.queue_input(pointer.clone()); - let mut raw = egui::RawInput { time: Some(2.0), ..Default::default() }; - raw.viewports.insert( - egui::ViewportId::ROOT, - egui::ViewportInfo { minimized: Some(false), occluded: Some(false), native_pixels_per_point: Some(1.0), ..Default::default() }, - ); - app.raw_input_hook(&ctx, &mut raw); - assert_eq!(raw.events, vec![pointer.clone()]); - - let (req, reply) = ControlRequest::new("engine.execute", json!({"command": "file.new", "params": {}})); - tx.send(req).unwrap(); - let _ = ctx.run_logic(&raw, |ctx| app.logic(ctx)); - let v = reply.recv_timeout(std::time::Duration::from_secs(1)).expect("control reply from the visible logic pass"); - assert_eq!(v["ok"], true, "{v}"); - assert_eq!(app.session.documents().len(), 2); - assert!(app.synthetic_pending, "the carried batch is still pending"); - assert_eq!(ctx.input(|i| i.events.clone()), vec![pointer.clone()], "the previous pass's events are untouched"); - - let mut next = raw.clone(); - next.time = Some(3.0); - let host = egui::Event::Text("host".into()); - next.events.push(host.clone()); - app.raw_input_hook(&ctx, &mut next); - assert_eq!(next.events, vec![host.clone()], "the stale batch is removed from the carried RawInput"); - assert!(!app.synthetic_pending); - assert!(app.synthetic.is_empty()); -} - -/// A batch injected in a logic-only pass is carried into the full pass with a refreshed -/// `RawInput::time`. That full pass must consume it on the old target: a control request -/// drained by the same logic waits until the next pass instead of changing the document -/// after egui has already derived the carried pointer state. -#[test] -fn carried_batch_is_consumed_before_the_full_pass_applies_a_control_change() { - let mut app = SlideApp::new(Session::with_new(), Services::default()); - app.fonts_ready = true; - app.styled = true; - let ctx = egui::Context::default(); - crate::framework::install_headless(&ctx); - let (tx, rx) = std::sync::mpsc::channel(); - app.control_rx = Some(rx); - app.queue_input(egui::Event::PointerMoved(egui::pos2(10.0, 10.0))); - let mut hidden = egui::RawInput { time: Some(1.0), ..Default::default() }; - hidden.viewports.insert( - egui::ViewportId::ROOT, - egui::ViewportInfo { minimized: Some(true), occluded: Some(true), native_pixels_per_point: Some(1.0), ..Default::default() }, - ); - app.raw_input_hook(&ctx, &mut hidden); - let _ = ctx.run_logic(&hidden, |ctx| app.logic(ctx)); - assert!(app.synthetic_pending, "the logic-only pass keeps the carried batch"); - - // eframe refreshes the carried input's time before calling the hook for the full pass. - let mut full = hidden.clone(); - full.time = Some(2.0); - app.raw_input_hook(&ctx, &mut full); - assert!(app.synthetic_pending, "the carried batch is not injected twice"); - - let (req, reply) = ControlRequest::new("engine.execute", json!({"command": "file.new", "params": {}})); - tx.send(req).unwrap(); - ctx.run_ui(full, |ui| { - app.logic(ui.ctx()); - app.ui(ui); - }) - .drop_without_applying_deltas(); - assert_eq!(app.session.documents().len(), 1, "the full pass's UI sees its captured document"); - assert!(!app.synthetic_pending, "the full pass consumed the carried batch"); - - // The next pass has no synthetic input, so logic applies the deferred request. - let mut next = egui::RawInput { time: Some(3.0), ..Default::default() }; - next.viewports.insert( - egui::ViewportId::ROOT, - egui::ViewportInfo { minimized: Some(false), occluded: Some(false), native_pixels_per_point: Some(1.0), ..Default::default() }, - ); - app.raw_input_hook(&ctx, &mut next); - ctx.run_ui(next, |ui| { - app.logic(ui.ctx()); - app.ui(ui); - }) - .drop_without_applying_deltas(); - let v = reply.recv_timeout(std::time::Duration::from_secs(1)).expect("control reply after the full pass"); - assert_eq!(v["ok"], true, "{v}"); - assert_eq!(app.session.documents().len(), 2, "the deferred control request ran on the next pass"); -} - -/// `visible() == false` does not prove a logic-only pass: a screenshot or -/// `RequestPaintWhileHidden` makes eframe run the full UI. The synthetic batch must be -/// delivered there, not postponed until the viewport is visible. -#[test] -fn hidden_full_pass_receives_synthetic_ui_input() { - let mut app = SlideApp::new(Session::with_new(), Services::default()); - app.fonts_ready = true; - app.styled = true; - app.dialog = Some(crate::dialogs::Dialog::new("replaceFonts")); - app.queue_input(egui::Event::Key { key: egui::Key::Escape, physical_key: None, pressed: true, repeat: false, modifiers: egui::Modifiers::NONE }); - let ctx = egui::Context::default(); - crate::framework::install_headless(&ctx); - let mut hidden = egui::RawInput { time: Some(4.0), ..Default::default() }; - hidden.viewports.insert( - egui::ViewportId::ROOT, - egui::ViewportInfo { minimized: Some(true), occluded: Some(true), native_pixels_per_point: Some(1.0), ..Default::default() }, - ); - app.raw_input_hook(&ctx, &mut hidden); - assert_eq!(hidden.events.len(), 1, "a forced hidden full pass still gets the event"); - assert!(app.synthetic_pending); - - ctx.run_ui(hidden, |ui| { - app.logic(ui.ctx()); - app.ui(ui); - }) - .drop_without_applying_deltas(); - assert!(app.dialog.is_none(), "the synthetic Escape reached the UI in the hidden full pass"); - assert!(!app.synthetic_pending, "the full pass acknowledged the batch"); - assert!(app.synthetic.is_empty()); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 } /// egui 0.37 carries a clipboard image as `Event::PasteImage`; it inserts once, without /// asking the host clipboard service for the same image again. #[test] fn paste_image_event_inserts_one_picture() { -<<<<<<< HEAD let mut harness = crate::test_harness::harness(Session::with_new(), Services::default()); -======= - let mut harness = - egui_kittest::Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(900.0, 600.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - SlideApp::new(Session::with_new(), Services::default()), - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 harness.run_steps(2); let before = harness.state().session.active().unwrap().doc.slides[0].shapes.len(); let image = egui::ColorImage::filled([2, 2], egui::Color32::from_rgb(1, 2, 3)); @@ -2428,11 +1552,6 @@ fn hidden_viewport_advances_show_and_presenter_clocks_from_logic() { app.session.execute("transition.timing", &json!({"index": 0, "after": 1000})).unwrap(); app.session.execute("transition.timing", &json!({"index": 1, "after": null})).unwrap(); app.start_show(0, false); -<<<<<<< HEAD -======= - let ctx = egui::Context::default(); - crate::framework::install_headless(&ctx); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 // A real visible UI pass starts the show and its clocks. There is no renderer here, so // each frame's texture uploads are cleared explicitly (egui 0.37 panics on drop). @@ -2498,11 +1617,6 @@ fn overdue_visible_logic_does_not_reanchor_a_later_hidden_show() { app.session.execute("transition.timing", &json!({"index": 0, "after": 2500})).unwrap(); app.session.execute("transition.timing", &json!({"index": 1, "after": null})).unwrap(); app.start_show(0, false); -<<<<<<< HEAD -======= - let ctx = egui::Context::default(); - crate::framework::install_headless(&ctx); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 // The full visible pass is the only pass that anchors the show: egui time 10. ctx.run_ui(raw_at(10.0, false, false), |ui| { @@ -2529,18 +1643,7 @@ fn overdue_visible_logic_does_not_reanchor_a_later_hidden_show() { /// frame until it stuck at its widest and dragging its edge did nothing. #[test] fn comments_pane_keeps_its_width_and_resizes() { -<<<<<<< HEAD let mut h = crate::test_harness::harness(Session::with_new(), Services::default()); -======= - let mut h = - egui_kittest::Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(1200.0, 800.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - SlideApp::new(Session::with_new(), Services::default()), - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 h.run_steps(3); h.state_mut().run("comment.add", json!({"text": "Check the figures on this slide"})).unwrap(); h.state_mut().run("comment.add", json!({"text": "Resolved one"})).unwrap(); diff --git a/crates/ui-egui/src/texture_limit_tests.rs b/crates/ui-egui/src/texture_limit_tests.rs index c77f4faaa..e2c929ff3 100644 --- a/crates/ui-egui/src/texture_limit_tests.rs +++ b/crates/ui-egui/src/texture_limit_tests.rs @@ -10,19 +10,6 @@ use crate::show::commands::{ShowCommands, ShowWindow, run_command}; use crate::test_harness::harness_with; use deckcraft_engine::Session; -<<<<<<< HEAD -======= -fn harness(session: Session, size: egui::Vec2) -> egui_kittest::Harness<'static, SlideApp> { - egui_kittest::Harness::builder().with_context_setup(crate::framework::install_headless).with_size(size).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - SlideApp::new(session, Services::default()), - ) -} - ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 /// The tallest slide allowed (1 × 56): its thumbnails and presenter-view preview are tens of /// thousands of pixels high at their usual widths. fn tall_deck() -> Session { diff --git a/crates/ui-egui/src/ui_soak_tests.rs b/crates/ui-egui/src/ui_soak_tests.rs index b2cabeccc..7204b2a50 100644 --- a/crates/ui-egui/src/ui_soak_tests.rs +++ b/crates/ui-egui/src/ui_soak_tests.rs @@ -71,20 +71,8 @@ const KEYS: &[Key] = &[ fn harness() -> Harness<'static, SlideApp> { let mut s = Session::new(); deckcraft_engine::sample::open_sample(&mut s).unwrap(); -<<<<<<< HEAD let mut h = crate::test_harness::harness_with(s, crate::Services::default(), Harness::builder().with_size(vec2(W, H)).with_step_dt(1.0 / 60.0), |_| {}); -======= - let app = SlideApp::new(s, Services::default()); - let mut h = - Harness::builder().with_context_setup(crate::framework::install_headless).with_size(vec2(W, H)).with_step_dt(1.0 / 60.0).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - app, - ); ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 h.run_steps(3); h } diff --git a/crates/ui-egui/src/units_tests.rs b/crates/ui-egui/src/units_tests.rs index be818a77c..f9ae88048 100644 --- a/crates/ui-egui/src/units_tests.rs +++ b/crates/ui-egui/src/units_tests.rs @@ -11,19 +11,8 @@ use crate::{Services, SlideApp}; use deckcraft_engine::Session; use deckcraft_geom::Unit; -<<<<<<< HEAD fn harness(session: Session) -> Harness<'static, SlideApp> { crate::test_harness::harness(session, Services::default()) -======= -fn harness(app: SlideApp) -> Harness<'static, SlideApp> { - Harness::builder().with_context_setup(crate::framework::install_headless).with_size(egui::vec2(1400.0, 900.0)).build_ui_state( - |ui, app: &mut SlideApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - app, - ) ->>>>>>> b6dd921b46498082f4f451673ff694ee83413c08 } /// A blank slide with one 2" x 1.5" rectangle at (1", 0.5"), selected.