diff --git a/crates/ui-egui/src/panels/glyphs.rs b/crates/ui-egui/src/panels/glyphs.rs index ea26dfec76..1de977dd36 100644 --- a/crates/ui-egui/src/panels/glyphs.rs +++ b/crates/ui-egui/src/panels/glyphs.rs @@ -974,9 +974,10 @@ fn alternates_popup(ui: &mut Ui, face: &vectorcraft_text::FontFace, c: Option t.plain_text(), + _ => panic!("text"), + }; + assert_eq!((plain(&app, a), plain(&app, b)), ("a".to_string(), "中中中".to_string())); + app.run("select.set", json!({"ids": [a]})).unwrap(); + app.session.select_tool("type", Default::default()).unwrap(); + app.session.set_tool_option("textSelection", &json!({"editing": a, "anchor": 0, "caret": 0})); + app.run("select.all", json!({})).unwrap(); + assert_eq!(super::super::character::text_editing(&app), Some((NodeId(a), 0, 1)), "the selection is the one character"); + assert_eq!(super::super::character::text_story(&app).map(|s| s.len()), Some(2), "the whole story is selected"); + let ctx = egui::Context::default(); + set_pstate(&ctx, "gl-subset", 1usize); + let undo = app.session.active().unwrap().history.undo.len(); + let popup = open_corner_popup(&ctx, &mut app); + click(&ctx, &mut app, popup[3].center()); + let texts: String = [a, b].iter().map(|id| plain(&app, *id)).collect(); + assert_eq!(texts, "a", "status: {}", app.ui.status); + assert_eq!(glyph_ids(&app, &json!(a)), [u2]); + assert_eq!(app.session.active().unwrap().history.undo.len(), undo + 1, "one undo step"); + } + /// In Entire Font, a glyph no character maps whose substitutions give other glyphs has the /// corner triangle too: its pop-up lists it and those glyphs, and a pick goes on the selected /// character as a double-click on that glyph's cell would put it.