diff --git a/crates/mcp/src/backend.rs b/crates/mcp/src/backend.rs index d837de25e..363107f0e 100644 --- a/crates/mcp/src/backend.rs +++ b/crates/mcp/src/backend.rs @@ -87,7 +87,8 @@ impl Backend for Remote { } } -#[cfg(all(test, not(target_arch = "wasm32")))] +#[cfg(test)] +#[cfg(not(target_arch = "wasm32"))] mod tests { use super::*; use serde_json::json; diff --git a/crates/ui-egui/src/backstage/print.rs b/crates/ui-egui/src/backstage/print.rs index 4a9bdc835..85996e16a 100644 --- a/crates/ui-egui/src/backstage/print.rs +++ b/crates/ui-egui/src/backstage/print.rs @@ -251,7 +251,7 @@ fn preview(ui: &mut Ui, bs: &mut Backstage, doc: Arc deckcraft_render::layout_extent(render_doc, master, layout), diff --git a/crates/ui-egui/src/canvas/tests.rs b/crates/ui-egui/src/canvas/tests.rs index 998090684..1034c8ff2 100644 --- a/crates/ui-egui/src/canvas/tests.rs +++ b/crates/ui-egui/src/canvas/tests.rs @@ -340,20 +340,66 @@ fn right_click(h: &mut Harness<'_, SlideApp>, pos: Pos2) { h.run_steps(2); } +/// A rectangle in point editing, its outline opened at the first vertex when `open_path`, with canvas menu +/// input confined to one pass. +fn edit_points_harness(open_path: bool) -> Harness<'static, SlideApp> { + let mut h = harness(); + h.ctx.on_end_pass( + "canvas menu second pass", + Arc::new(|ui| { + if ui.ctx().current_pass_index() == 0 { + ui.ctx().request_discard("canvas menu input belongs to one pass"); + } + }), + ); + h.state_mut().run("slide.layout", json!({"layout": "blank"})).unwrap(); + h.state_mut().run("shape.insert", json!({"preset": "rect", "rect": [200, 150, 300, 200]})).unwrap(); + h.state_mut().run("shape.editPoints", json!({"on": true})).unwrap(); + if open_path { + h.state_mut().run("shape.openPath", json!({"path": 0, "index": 0})).unwrap(); + } + h.run_steps(3); + h +} + +/// The edited shape's `shape.points` answer and its first path's vertices. +fn path_points(h: &mut Harness<'_, SlideApp>) -> (Value, Vec) { + let value = h.state_mut().session.execute("shape.points", &json!({})).unwrap(); + let vertices = value["paths"][0].as_array().unwrap().iter().map(|p| Point::new(p[0].as_f64().unwrap(), p[1].as_f64().unwrap())).collect(); + (value, vertices) +} + +/// A point-editing menu command and the geometry it is asked for. +#[derive(Clone, Copy, Debug)] +enum Case { + Curve, + Add, + OpenSegment, + OpenVertex, + DeleteSegment, + DisabledDelete, + CloseVertex, + DeleteVertex, +} + +impl Case { + /// The slide point right-clicked on the rectangle with vertices `original`, and the menu row's label and role. + fn target(self, original: &[Point]) -> (Point, &'static str, Role) { + match self { + Case::Curve => (Point::new(500.0, 250.0), "Curved Segment", Role::MenuItemRadio), + Case::Add => (Point::new(275.0, 150.0), "Add Point", Role::MenuItem), + Case::OpenSegment => (Point::new(500.0, 250.0), "Open Path", Role::MenuItem), + Case::OpenVertex => (original[2], "Open Path", Role::MenuItem), + Case::DeleteSegment | Case::DisabledDelete => (Point::new(500.0, 250.0), "Delete Segment", Role::MenuItem), + Case::CloseVertex => (original[0], "Close Path", Role::MenuItem), + Case::DeleteVertex => (original[1], "Delete Point", Role::MenuItem), + } + } +} + /// Segment menus use the pointer's parameter and the segment's start, and renumbering drops stale picks. #[test] fn edit_points_segment_menu_adds_points_and_deletes_segments() { - #[derive(Clone, Copy, Debug)] - enum Case { - Curve, - Add, - OpenSegment, - OpenVertex, - DeleteSegment, - DisabledDelete, - CloseVertex, - DeleteVertex, - } for case in [ Case::Curve, Case::Add, @@ -364,37 +410,9 @@ fn edit_points_segment_menu_adds_points_and_deletes_segments() { Case::CloseVertex, Case::DeleteVertex, ] { - let mut h = harness(); - h.ctx.on_end_pass( - "canvas menu second pass", - Arc::new(|ui| { - if ui.ctx().current_pass_index() == 0 { - ui.ctx().request_discard("canvas menu input belongs to one pass"); - } - }), - ); - h.state_mut().run("slide.layout", json!({"layout": "blank"})).unwrap(); - h.state_mut().run("shape.insert", json!({"preset": "rect", "rect": [200, 150, 300, 200]})).unwrap(); - h.state_mut().run("shape.editPoints", json!({"on": true})).unwrap(); - if matches!(case, Case::DisabledDelete | Case::CloseVertex) { - h.state_mut().run("shape.openPath", json!({"path": 0, "index": 0})).unwrap(); - } - h.run_steps(3); - let query = |h: &mut Harness<'_, SlideApp>| h.state_mut().session.execute("shape.points", &json!({})).unwrap(); - let vertices = |value: &Value| -> Vec { - value["paths"][0].as_array().unwrap().iter().map(|p| Point::new(p[0].as_f64().unwrap(), p[1].as_f64().unwrap())).collect() - }; - let before = query(&mut h); - let original = vertices(&before); - let (at, label, role) = match case { - Case::Curve => (Point::new(500.0, 250.0), "Curved Segment", Role::MenuItemRadio), - Case::Add => (Point::new(275.0, 150.0), "Add Point", Role::MenuItem), - Case::OpenSegment => (Point::new(500.0, 250.0), "Open Path", Role::MenuItem), - Case::OpenVertex => (original[2], "Open Path", Role::MenuItem), - Case::DeleteSegment | Case::DisabledDelete => (Point::new(500.0, 250.0), "Delete Segment", Role::MenuItem), - Case::CloseVertex => (original[0], "Close Path", Role::MenuItem), - Case::DeleteVertex => (original[1], "Delete Point", Role::MenuItem), - }; + let mut h = edit_points_harness(matches!(case, Case::DisabledDelete | Case::CloseVertex)); + let (before, original) = path_points(&mut h); + let (at, label, role) = case.target(&original); let p = screen(h.state(), at.x, at.y); let asked = slide_point(&h, p); right_click(&mut h, p); @@ -407,8 +425,7 @@ fn edit_points_segment_menu_adds_points_and_deletes_segments() { assert!(!h.get_by_role_and_label(role, label).accesskit_node().is_disabled(), "{case:?}: the command is available"); h.get_by_role_and_label(role, label).click(); h.run_steps(3); - let after = query(&mut h); - let result = vertices(&after); + let (after, result) = path_points(&mut h); match case { Case::Curve => { let (path, index) = picks.0.unwrap(); @@ -447,16 +464,21 @@ fn edit_points_segment_menu_adds_points_and_deletes_segments() { assert!(!result.contains(&at), "the picked vertex is removed"); } } - if !matches!(case, Case::Curve) { - assert!( - h.state().session.tool.edit_segment.is_none() && h.state().session.tool.edit_vertex.is_none(), - "{case:?}: renumbering clears both picks" - ); - } - assert!(h.state().canvas_menu.is_none(), "a picked command closes the menu across the second pass"); + assert_command_settled(&h, case); } } +/// After `case`'s command: a renumbering command cleared both picks, and the menu closed. +fn assert_command_settled(h: &Harness<'_, SlideApp>, case: Case) { + if !matches!(case, Case::Curve) { + assert!( + h.state().session.tool.edit_segment.is_none() && h.state().session.tool.edit_vertex.is_none(), + "{case:?}: renumbering clears both picks" + ); + } + assert!(h.state().canvas_menu.is_none(), "a picked command closes the menu across the second pass"); +} + /// The menu follows live selection and text state, including a repeated word's actual character range. #[test] fn canvas_menu_rows_follow_the_selection() { diff --git a/crates/ui-egui/src/dialogs/choice_forms.rs b/crates/ui-egui/src/dialogs/choice_forms.rs index 15790bdf5..6c2345485 100644 --- a/crates/ui-egui/src/dialogs/choice_forms.rs +++ b/crates/ui-egui/src/dialogs/choice_forms.rs @@ -7,7 +7,9 @@ use serde_json::{Value, json}; /// The slide show configuration form. pub(crate) mod setup_show { - use super::*; + use super::{ + Bind, Context, DialogFields, DialogHost, HostedParamDialog, Param, ParamDialog, ParamKind, ParamLayout, ParamResult, SlideApp, Value, json, + }; /// Opens show options seeded from the deck and the cursor preference. pub(crate) fn open(app: &SlideApp, ctx: &Context, _: &Value) -> HostedParamDialog { @@ -62,7 +64,9 @@ pub(crate) mod setup_show { /// The clipboard representation form. pub(crate) mod paste_special { - use super::*; + use super::{ + Bind, Context, DialogFields, DialogHost, HostedParamDialog, Param, ParamDialog, ParamKind, ParamLayout, ParamResult, SlideApp, Value, json, + }; /// Opens paste choices with reasons for formats requiring copied shapes. pub(crate) fn open(app: &SlideApp, ctx: &Context, _: &Value) -> HostedParamDialog { diff --git a/crates/ui-egui/src/dialogs/insert_forms.rs b/crates/ui-egui/src/dialogs/insert_forms.rs index 35a27fb8d..5f7351699 100644 --- a/crates/ui-egui/src/dialogs/insert_forms.rs +++ b/crates/ui-egui/src/dialogs/insert_forms.rs @@ -14,7 +14,7 @@ fn form(ctx: &Context, id: &'static str, title: &'static str, fields: DialogFiel /// The table dimensions form. pub(crate) mod table { - use super::*; + use super::{Context, DialogFields, DialogHost, HostedParamDialog, Param, ParamKind, ParamResult, SlideApp, Value, form, json}; /// Opens the table dimensions with positive row and column counts. pub(crate) fn open(_: &SlideApp, ctx: &Context, _: &Value) -> HostedParamDialog { @@ -39,7 +39,7 @@ pub(crate) mod table { /// The comment composition form. pub(crate) mod comment { - use super::*; + use super::{Context, DialogFields, DialogHost, HostedParamDialog, Param, ParamKind, ParamResult, SlideApp, Value, form, json}; /// Opens a multiline comment editor. pub(crate) fn open(_: &SlideApp, ctx: &Context, _: &Value) -> HostedParamDialog { @@ -66,7 +66,7 @@ pub(crate) mod comment { /// The outline insertion form. pub(crate) mod outline { - use super::*; + use super::{Context, DialogFields, DialogHost, HostedParamDialog, Param, ParamKind, ParamResult, SlideApp, Value, form, json}; /// Opens an outline editor that preserves indentation. pub(crate) fn open(_: &SlideApp, ctx: &Context, _: &Value) -> HostedParamDialog { @@ -120,7 +120,7 @@ fn finish_rename(app: &mut SlideApp, result: &ParamResult) -> Result<(), String> /// The section rename form. pub(crate) mod rename_section { - use super::*; + use super::{Context, DialogHost, HostedParamDialog, ParamResult, SlideApp, Value, finish_rename, rename}; /// Opens a name editor carrying the section index. pub(crate) fn open(_: &SlideApp, ctx: &Context, params: &Value) -> HostedParamDialog { @@ -135,7 +135,7 @@ pub(crate) mod rename_section { /// The shape rename form. pub(crate) mod rename_shape { - use super::*; + use super::{Context, DialogHost, HostedParamDialog, ParamResult, SlideApp, Value, finish_rename, rename}; /// Opens a name editor carrying the shape id. pub(crate) fn open(_: &SlideApp, ctx: &Context, params: &Value) -> HostedParamDialog { @@ -150,7 +150,7 @@ pub(crate) mod rename_shape { /// The layout rename form. pub(crate) mod rename_layout { - use super::*; + use super::{Context, DialogHost, HostedParamDialog, ParamResult, SlideApp, Value, finish_rename, rename}; /// Opens the layout name editor. pub(crate) fn open(_: &SlideApp, ctx: &Context, params: &Value) -> HostedParamDialog { @@ -165,7 +165,7 @@ pub(crate) mod rename_layout { /// The linear equation insertion form. pub(crate) mod equation { - use super::*; + use super::{Context, DialogFields, DialogHost, HostedParamDialog, Param, ParamKind, ParamResult, SlideApp, Value, form, json}; /// Opens the equation editor with its linear notation guide. pub(crate) fn open(_: &SlideApp, ctx: &Context, _: &Value) -> HostedParamDialog { diff --git a/crates/ui-egui/src/opening.rs b/crates/ui-egui/src/opening.rs index a376a272f..314d9fb8b 100644 --- a/crates/ui-egui/src/opening.rs +++ b/crates/ui-egui/src/opening.rs @@ -108,6 +108,40 @@ impl SlideApp { } } +/// The native open queue and its monotonic attempt-key allocator. +#[cfg(not(target_arch = "wasm32"))] +pub(crate) struct OpeningJobs { + queue: craft::host::queue::JobQueue>, + next_key: u64, +} + +#[cfg(not(target_arch = "wasm32"))] +impl OpeningJobs { + /// Build the queue with the installed host's jobs and its window's repaint wake. + pub(crate) fn new(jobs: std::sync::Arc, wake: craft::host::Wake) -> Self { + Self { queue: craft::host::queue::JobQueue::new(jobs, wake, Default::default()), next_key: 0 } + } + + fn submit(&mut self, path: &str, host: &craft::host::Host) -> Result { + let key = self.next_key.checked_add(1).ok_or_else(|| "The opening attempt limit was reached".to_owned())?; + self.next_key = key; + let path = path.to_owned(); + let host = host.clone(); + let roots = deckcraft_engine::file_access::current(); + self.queue.submit(key, craft::host::queue::Priority::VISIBLE, move |_| { + deckcraft_engine::file_access::confine(roots.as_ref(), || { + deckcraft_engine::cmd::file::read_presentation_file_with( + &path, + |path| host.files().read_metadata(std::path::Path::new(path)).map_err(|error| error.to_string()), + |path| host.files().read(std::path::Path::new(path)).map_err(|error| error.to_string()), + ) + .map_err(|error| error.to_string()) + }) + }); + Ok(key) + } +} + #[cfg(test)] mod tests { #![allow(clippy::unwrap_used, clippy::expect_used)] @@ -302,37 +336,3 @@ mod tests { } } } - -/// The native open queue and its monotonic attempt-key allocator. -#[cfg(not(target_arch = "wasm32"))] -pub(crate) struct OpeningJobs { - queue: craft::host::queue::JobQueue>, - next_key: u64, -} - -#[cfg(not(target_arch = "wasm32"))] -impl OpeningJobs { - /// Build the queue with the installed host's jobs and its window's repaint wake. - pub(crate) fn new(jobs: std::sync::Arc, wake: craft::host::Wake) -> Self { - Self { queue: craft::host::queue::JobQueue::new(jobs, wake, Default::default()), next_key: 0 } - } - - fn submit(&mut self, path: &str, host: &craft::host::Host) -> Result { - let key = self.next_key.checked_add(1).ok_or_else(|| "The opening attempt limit was reached".to_owned())?; - self.next_key = key; - let path = path.to_owned(); - let host = host.clone(); - let roots = deckcraft_engine::file_access::current(); - self.queue.submit(key, craft::host::queue::Priority::VISIBLE, move |_| { - deckcraft_engine::file_access::confine(roots.as_ref(), || { - deckcraft_engine::cmd::file::read_presentation_file_with( - &path, - |path| host.files().read_metadata(std::path::Path::new(path)).map_err(|error| error.to_string()), - |path| host.files().read(std::path::Path::new(path)).map_err(|error| error.to_string()), - ) - .map_err(|error| error.to_string()) - }) - }); - Ok(key) - } -} diff --git a/crates/ui-egui/src/panels/color_row.rs b/crates/ui-egui/src/panels/color_row.rs index 694d4ef78..b6b5d2283 100644 --- a/crates/ui-egui/src/panels/color_row.rs +++ b/crates/ui-egui/src/panels/color_row.rs @@ -80,7 +80,7 @@ pub(crate) fn color_row_named( }); field.settle(|_, output| { let mut popup = Popover::new(Word::plain("Color"), Bind::kept().reset(false)) - .id_salt(&format!("{key}:menu")) + .id_salt(format!("{key}:menu")) .overlay(|overlay| overlay.opened_by(&output.response, Trigger::Click)) .show(ui, |ui, cx| color_menu(app, ui, cx, &key, none)); let picked = popup.settle(|_, pick| pick.take()).flatten(); diff --git a/crates/ui-egui/src/ribbon/galleries.rs b/crates/ui-egui/src/ribbon/galleries.rs index f594f0fff..0cf7159a1 100644 --- a/crates/ui-egui/src/ribbon/galleries.rs +++ b/crates/ui-egui/src/ribbon/galleries.rs @@ -65,18 +65,26 @@ const QUICK_STYLE_ASPECT: f32 = 40.0 / 26.0; /// Width over height of a slide layout picture: the 16:9 slide. const LAYOUT_TILE_ASPECT: f32 = 96.0 / 54.0; +/// The diagram a layout gallery previews and the command a picked layout runs. +pub(crate) struct LayoutPick<'a> { + /// The command run with the picked layout's `kind`. + pub cmd: &'a str, + /// Further command parameters. + pub extra: Value, + /// The layout shown as selected. + pub current: &'a str, + /// The quick style the previews draw in. + pub style: &'a str, + /// The colour scheme the previews draw in. + pub colors: &'a str, + /// The selected diagram's items, previewed in each layout. + pub nodes: Option<&'a [deckcraft_model::DiagramNode]>, +} + /// Shows diagram layouts by category, with a preview of the graphic's outline in each tooltip. -pub(crate) fn smartart_gallery( - app: &mut SlideApp, - ui: &mut Ui, - cx: &mut BodyCx<'_>, - cmd: &str, - extra: Value, - current: &str, - (style, colors): (&str, &str), - nodes: Option<&[deckcraft_model::DiagramNode]>, -) { +pub(crate) fn smartart_gallery(app: &mut SlideApp, ui: &mut Ui, cx: &mut BodyCx<'_>, pick: LayoutPick<'_>) { use deckcraft_engine::cmd::smartart::{LAYOUTS, category}; + let LayoutPick { cmd, extra, current, style, colors, nodes } = pick; let Some((doc, slide)) = app.session.active().map(|active| (active.doc.clone(), active.selection.slide)) else { return }; let thumbs = super::diagram_thumbs::thumbnails(ui.ctx()); let pictures = super::diagram_thumbs::DiagramThumbs::new(&doc, slide, style, colors, nodes); diff --git a/crates/ui-egui/src/ribbon/home.rs b/crates/ui-egui/src/ribbon/home.rs index 62f5c9f77..6c7c218a6 100644 --- a/crates/ui-egui/src/ribbon/home.rs +++ b/crates/ui-egui/src/ribbon/home.rs @@ -17,7 +17,7 @@ use egui::{Color32, Ui}; use serde_json::{Value, json}; use super::arrange::arrange_menu; -use super::galleries::{self, cref_param, effects_menu, layout_gallery, outline_menu, quick_styles, shapes_gallery, smartart_gallery}; +use super::galleries::{self, LayoutPick, cref_param, effects_menu, layout_gallery, outline_menu, quick_styles, shapes_gallery, smartart_gallery}; use super::{fmt_state, fonts}; use crate::SlideApp; use crate::icons::Icon; @@ -359,7 +359,8 @@ fn paragraph(app: &mut SlideApp, ui: &mut Ui) { .enabled(commands::resolve(ui.ctx(), "smartArt.fromText").enabled) .show(ui); Menu::new(Word::plain("Convert to Diagram")).opened_by(&diagram.response, Trigger::Click).show(ui, |ui, cx| { - smartart_gallery(app, ui, cx, "smartArt.fromText", json!({}), "", ("", ""), None); + let pick = LayoutPick { cmd: "smartArt.fromText", extra: json!({}), current: "", style: "", colors: "", nodes: None }; + smartart_gallery(app, ui, cx, pick); }); Button::command("format.paragraphDialog").label(Word::plain("Paragraph…")).show(ui); }); diff --git a/crates/ui-egui/src/ribbon/smartart.rs b/crates/ui-egui/src/ribbon/smartart.rs index 6316137f7..052ca1b65 100644 --- a/crates/ui-egui/src/ribbon/smartart.rs +++ b/crates/ui-egui/src/ribbon/smartart.rs @@ -1,5 +1,5 @@ use super::arrange::arrange_group; -use super::galleries::smartart_gallery; +use super::galleries::{LayoutPick, smartart_gallery}; use super::{Icon, SlideApp, Value, json}; use craft::menu::ribbon::{RibbonGroup, RibbonRow}; use craft::ui::buttons::{Arrangement, Button}; @@ -75,7 +75,15 @@ pub(crate) fn smartart_design(app: &mut SlideApp, row: &mut RibbonRow<'_>) { .enabled(menu_enabled(ui, "smartArt.layout")) .show(ui); Menu::new("Layouts").opened_by(&opener.response, Trigger::Click).show(ui, |ui, cx| { - smartart_gallery(app, ui, cx, "smartArt.layout", json!({"id": gid}), &kind, (&style, &colors), outline.as_deref()); + let pick = LayoutPick { + cmd: "smartArt.layout", + extra: json!({"id": gid}), + current: &kind, + style: &style, + colors: &colors, + nodes: outline.as_deref(), + }; + smartart_gallery(app, ui, cx, pick); }); let opener = Button::new("Convert") .icon(Icon::Layout.id()) diff --git a/crates/ui-egui/src/tests.rs b/crates/ui-egui/src/tests.rs index 3eb981138..4e0d5a894 100644 --- a/crates/ui-egui/src/tests.rs +++ b/crates/ui-egui/src/tests.rs @@ -2,9 +2,11 @@ use super::*; use craft::host::{Picked, ScriptedFiles}; +use craft::platform::clipboard::Written; use craft::ui::runtime::commands::{ClipItem, ClipboardHandle}; use craft::ui::runtime::env::WindowKey; use craft::ui::runtime::windows::WindowHost; +use deckcraft_engine::Mods; use egui_kittest::kittest::Queryable; use std::sync::Arc; @@ -421,7 +423,7 @@ fn ctrl_v_pastes_the_picture_a_browser_copied_not_its_link() { image.as_raw(), )))); } - ClipboardHandle::of(&harness.ctx).offer(&offer).unwrap(); + assert_eq!(ClipboardHandle::of(&harness.ctx).offer(&offer).unwrap(), Written::Written); harness.run_steps(2); let shapes_before = harness.state().session.active().unwrap().doc.slides[0].shapes.len(); harness.event(egui::Event::Paste(text.clone())); @@ -447,7 +449,8 @@ fn ctrl_v_pastes_an_image_when_no_paste_event_arrives() { app.session.active().unwrap().doc.slides[0].shapes.iter().filter(|s| matches!(s.kind, deckcraft_model::ShapeKind::Picture { .. })).count() }; let before = pictures(h.state()); - ClipboardHandle::of(&h.ctx).offer(&[ClipItem::Image(Arc::new(egui::ColorImage::filled([2, 2], egui::Color32::RED)))]).unwrap(); + let image = ClipItem::Image(Arc::new(egui::ColorImage::filled([2, 2], egui::Color32::RED))); + assert_eq!(ClipboardHandle::of(&h.ctx).offer(&[image]).unwrap(), Written::Written); h.key_press_modifiers(egui::Modifiers::COMMAND, egui::Key::V); h.run_steps(2); assert_eq!(pictures(h.state()), before + 1); @@ -758,7 +761,7 @@ fn copy_and_cut_commands_reach_the_system_clipboard() { harness.get_by_role_and_label(egui::accesskit::Role::Button, "Copy").click(); harness.run_steps(1); assert_eq!(copied(&harness).as_deref(), Some("Aurora"), "Copy puts the text on the clipboard"); - clipboard.offer(&[ClipItem::Text("clipboard sentinel".into())]).unwrap(); + assert_eq!(clipboard.offer(&[ClipItem::Text("clipboard sentinel".into())]).unwrap(), Written::Written); harness.run_steps(1); assert_eq!(copied(&harness).as_deref(), Some("clipboard sentinel"), "copy is published once"); @@ -1038,7 +1041,8 @@ fn copy_offers_html_and_paste_keeps_bold() { assert!(html.contains(""), "{html}"); assert_eq!(plain, "Hi"); let mut h = step_app(Services::default()); - ClipboardHandle::of(&h.ctx).offer(&[ClipItem::Html(html.into()), ClipItem::Text(plain.clone().into())]).unwrap(); + let offer = [ClipItem::Html(html.into()), ClipItem::Text(plain.clone().into())]; + assert_eq!(ClipboardHandle::of(&h.ctx).offer(&offer).unwrap(), Written::Written); h.event(egui::Event::Paste(plain)); h.run_steps(1); let st = h.state().session.active().unwrap();