mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-30 02:07:10 +01:00
Tests: read retained paint chunks in every ui-egui shape walk
The pinned egui replays a region that did not change as one Shape::PaintChunk of clipped shapes. Test helpers that walked out.shapes by hand stopped at the chunk, so text, meshes, rects and lines painted inside it were missed. - Add painted_shapes and flat_painted_shapes next to text_shapes in tests/labels.rs. They open Shape::Vec and Shape::PaintChunk in paint order and compose each shape's transform and clip the same way. - Route every remaining hand-written text and shape walk in the ui-egui tests through text_shapes or these helpers, keeping each test's assertions and its first-painted or last-painted order. - panel_readout_copy: the Link Info Name check called the removed text_shape helper and did not compile; it now reads visible_paint. Format the file.
This commit is contained in:
1 parent
98a8cda027
commit
fa1c0a8dc4
31 files changed
+147
-290
No files matched your search
@@ -38,20 +38,12 @@ fn frame(app: &mut VectorcraftApp, ctx: &egui::Context, events: Vec<egui::Event>
|
||||
|
||||
/// [`frame`] on a window `size` points large.
|
||||
fn frame_in(app: &mut VectorcraftApp, ctx: &egui::Context, events: Vec<egui::Event>, size: egui::Vec2) -> Vec<Shape> {
|
||||
fn flat(s: Shape, out: &mut Vec<Shape>) {
|
||||
match s {
|
||||
Shape::Vec(v) => v.into_iter().for_each(|s| flat(s, out)),
|
||||
s => out.push(s),
|
||||
}
|
||||
}
|
||||
let raw =
|
||||
egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(Pos2::ZERO, size)), max_texture_side: Some(8192), events, ..Default::default() };
|
||||
let mut out = ctx.run_ui(raw, |ui| app.canvas_area(ui));
|
||||
// A pane's picture is uploaded once, maybe in this frame: [`wait_ready`] finds it later.
|
||||
note_uploads(&mut out.textures_delta);
|
||||
let mut shapes = vec![];
|
||||
out.shapes.into_iter().for_each(|c| flat(c.shape, &mut shapes));
|
||||
shapes
|
||||
crate::tests_labels::flat_painted_shapes(&out.shapes)
|
||||
}
|
||||
|
||||
/// A texture's picture: its pixels and size.
|
||||
@@ -627,15 +619,10 @@ fn art_carried_through_a_tab_drops_into_a_third_documents_pane() {
|
||||
// A tab's title starts with its document's name (an inactive tab shows the name alone).
|
||||
let names: Vec<String> = app.session.documents().iter().map(|d| d.title()).collect();
|
||||
let titles = |out: egui::FullOutput| -> Vec<egui::Rect> {
|
||||
let mut t: Vec<_> = out
|
||||
.shapes
|
||||
.iter()
|
||||
.filter_map(|s| match &s.shape {
|
||||
Shape::Text(t) if names.iter().any(|n| t.galley.text().starts_with(n.as_str())) => {
|
||||
Some(egui::Rect::from_min_size(t.pos, t.galley.size()))
|
||||
}
|
||||
_ => None,
|
||||
})
|
||||
let mut t: Vec<_> = crate::tests_labels::text_shapes(&out)
|
||||
.into_iter()
|
||||
.filter(|(t, _)| names.iter().any(|n| t.galley.text().starts_with(n.as_str())))
|
||||
.map(|(t, transform)| transform * egui::Rect::from_min_size(t.pos, t.galley.size()))
|
||||
.collect();
|
||||
t.sort_by(|a, b| a.left().total_cmp(&b.left()));
|
||||
t
|
||||
@@ -1002,14 +989,15 @@ fn other_panes_draw_through_their_documents_profiles() {
|
||||
let fills = |out: &egui::FullOutput, rgb: [u8; 3]| {
|
||||
fn any(s: &Shape, f: &dyn Fn(Color32) -> bool) -> bool {
|
||||
match s {
|
||||
Shape::Vec(v) => v.iter().any(|s| any(s, f)),
|
||||
Shape::Path(p) => f(p.fill),
|
||||
Shape::Rect(r) => f(r.fill),
|
||||
Shape::Mesh(m) if m.texture_id == egui::TextureId::default() => m.vertices.iter().any(|v| f(v.color)),
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
out.shapes.iter().any(|c| any(&c.shape, &|c: Color32| c.a() == 255 && near([c.r(), c.g(), c.b()], rgb)))
|
||||
crate::tests_labels::painted_shapes(&out.shapes)
|
||||
.into_iter()
|
||||
.any(|(s, ..)| any(s, &|c: Color32| c.a() == 255 && near([c.r(), c.g(), c.b()], rgb)))
|
||||
};
|
||||
let ctx = crate::testing::ui_context();
|
||||
let raw = || egui::RawInput {
|
||||
|
||||
@@ -956,17 +956,10 @@ fn shapes(app: &mut VectorcraftApp, ctx: &egui::Context) -> Vec<Shape> {
|
||||
shapes
|
||||
}
|
||||
|
||||
/// The shapes of a frame's output, `Shape::Vec`s flattened: the canvas's picture slot holds the art's.
|
||||
/// The shapes of a frame's output, `Shape::Vec`s and retained paint chunks flattened: the canvas's
|
||||
/// picture slot holds the art's.
|
||||
fn flat_shapes(clipped: Vec<egui::epaint::ClippedShape>) -> Vec<Shape> {
|
||||
fn flat(s: Shape, out: &mut Vec<Shape>) {
|
||||
match s {
|
||||
Shape::Vec(v) => v.into_iter().for_each(|s| flat(s, out)),
|
||||
s => out.push(s),
|
||||
}
|
||||
}
|
||||
let mut v = vec![];
|
||||
clipped.into_iter().for_each(|c| flat(c.shape, &mut v));
|
||||
v
|
||||
crate::tests_labels::flat_painted_shapes(&clipped)
|
||||
}
|
||||
|
||||
/// One headless canvas frame → the shapes drawn ([`flat_shapes`]) and the textures uploaded by it
|
||||
|
||||
@@ -3292,13 +3292,6 @@ struct StyleFace {
|
||||
/// The Style field of the settled bar. `textures` holds the textures the frames uploaded since the fixture began
|
||||
/// recording; the uploads of these frames are applied to it.
|
||||
fn style_face(bar: &mut Shown, textures: &mut std::collections::HashMap<egui::TextureId, egui::ColorImage>) -> StyleFace {
|
||||
fn flat(shape: egui::Shape, out: &mut Vec<egui::Shape>) {
|
||||
if let egui::Shape::Vec(shapes) = shape {
|
||||
shapes.into_iter().for_each(|s| flat(s, out));
|
||||
} else {
|
||||
out.push(shape);
|
||||
}
|
||||
}
|
||||
let field = bar.settle().named("Graphic Styles").rect;
|
||||
let mut paint = bar.fixture.take_paint().expect("the fixture records what it paints");
|
||||
for (id, delta) in paint.textures_delta.set.iter().flat_map(|(id, deltas)| deltas.iter().map(move |delta| (id, delta))) {
|
||||
@@ -3320,10 +3313,7 @@ fn style_face(bar: &mut Shown, textures: &mut std::collections::HashMap<egui::Te
|
||||
}
|
||||
// The uploads are applied to `textures`, not to a renderer.
|
||||
paint.textures_delta.clear();
|
||||
let mut shapes = Vec::new();
|
||||
for clipped in std::mem::take(&mut paint.shapes) {
|
||||
flat(clipped.shape, &mut shapes);
|
||||
}
|
||||
let shapes = crate::tests_labels::flat_painted_shapes(&paint.shapes);
|
||||
let mut face = StyleFace { field, pictures: Vec::new(), fills: Vec::new() };
|
||||
for shape in shapes {
|
||||
match shape {
|
||||
|
||||
@@ -1084,16 +1084,13 @@ mod tests {
|
||||
/// did; before, it showed the words, and Landscape, cut short, ran into Artboards.
|
||||
#[test]
|
||||
fn orientation_shows_two_page_icons_beside_artboards() {
|
||||
fn texts(s: &egui::Shape, out: &mut Vec<(String, egui::Pos2)>) {
|
||||
match s {
|
||||
egui::Shape::Text(t) => out.push((t.galley.text().to_string(), t.visual_bounding_rect().center())),
|
||||
egui::Shape::Vec(v) => v.iter().for_each(|s| texts(s, out)),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
let mut app = app();
|
||||
open(&mut app);
|
||||
let out = laid_out(&mut app);
|
||||
let drawn: Vec<(String, egui::Pos2)> = crate::tests_labels::text_shapes(&out)
|
||||
.into_iter()
|
||||
.map(|(t, transform)| (t.galley.text().to_string(), (transform * t.visual_bounding_rect()).center()))
|
||||
.collect();
|
||||
let nodes = out.platform_output.accesskit_update.map(|u| u.nodes).unwrap_or_default();
|
||||
let bounds = |label: &str, role: egui::accesskit::Role| {
|
||||
let (_, n) = nodes.iter().find(|(_, n)| n.label() == Some(label) && n.role() == role).unwrap_or_else(|| panic!("no {role:?} {label}"));
|
||||
@@ -1104,8 +1101,6 @@ mod tests {
|
||||
// Artboards follows Landscape on its line, or wraps below it when the column has no room for it.
|
||||
assert!(landscape.x1 <= artboards.x0 || landscape.y1 <= artboards.y0, "Landscape {landscape:?} stays clear of Artboards {artboards:?}");
|
||||
let group = bounds("Orientation", egui::accesskit::Role::RadioGroup);
|
||||
let mut drawn = Vec::new();
|
||||
out.shapes.iter().for_each(|s| texts(&s.shape, &mut drawn));
|
||||
let inside: Vec<_> = drawn
|
||||
.iter()
|
||||
.filter(|(_, at)| (group.x0..=group.x1).contains(&f64::from(at.x)) && (group.y0..=group.y1).contains(&f64::from(at.y)))
|
||||
|
||||
@@ -295,18 +295,15 @@ fn checked_artboards_read_as_a_range() {
|
||||
|
||||
/// The rect the frame `shapes` paint `texture` over; `None` when none paints it.
|
||||
fn painted(shapes: &[egui::epaint::ClippedShape], texture: egui::TextureId) -> Option<egui::Rect> {
|
||||
fn walk(shape: &egui::Shape, texture: egui::TextureId, out: &mut Option<egui::Rect>) {
|
||||
match shape {
|
||||
egui::Shape::Vec(all) => all.iter().for_each(|s| walk(s, texture, out)),
|
||||
egui::Shape::Mesh(mesh) if mesh.texture_id == texture => {
|
||||
let at = mesh.calc_bounds();
|
||||
*out = Some(out.map_or(at, |r| r.union(at)));
|
||||
}
|
||||
_ => {}
|
||||
let mut out: Option<egui::Rect> = None;
|
||||
for (shape, transform, _) in crate::tests_labels::painted_shapes(shapes) {
|
||||
if let egui::Shape::Mesh(mesh) = shape
|
||||
&& mesh.texture_id == texture
|
||||
{
|
||||
let at = transform * mesh.calc_bounds();
|
||||
out = Some(out.map_or(at, |r| r.union(at)));
|
||||
}
|
||||
}
|
||||
let mut out = None;
|
||||
shapes.iter().for_each(|clipped| walk(&clipped.shape, texture, &mut out));
|
||||
out
|
||||
}
|
||||
|
||||
@@ -943,14 +940,11 @@ fn a_preset_export_reopens_on_its_rows() {
|
||||
}
|
||||
|
||||
fn screen_text_at(out: &egui::FullOutput, label: &str) -> egui::Pos2 {
|
||||
fn find(shape: &egui::Shape, label: &str) -> Option<egui::Pos2> {
|
||||
match shape {
|
||||
egui::Shape::Text(t) if t.galley.text().trim() == label => Some(t.visual_bounding_rect().center()),
|
||||
egui::Shape::Vec(v) => v.iter().find_map(|s| find(s, label)),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
out.shapes.iter().find_map(|s| find(&s.shape, label)).unwrap_or_else(|| panic!("missing {label}: {}", crate::tests_labels::shapes_text(out)))
|
||||
crate::tests_labels::text_shapes(out)
|
||||
.into_iter()
|
||||
.find(|(t, _)| t.galley.text().trim() == label)
|
||||
.map(|(t, transform)| (transform * t.visual_bounding_rect()).center())
|
||||
.unwrap_or_else(|| panic!("missing {label}: {}", crate::tests_labels::shapes_text(out)))
|
||||
}
|
||||
|
||||
/// First-directory entries of the big-endian TIFF chosen below: tag, type, count, inline value.
|
||||
|
||||
@@ -72,16 +72,6 @@ fn frame_texts(app: &VectorcraftApp, ctx: &egui::Context) -> Vec<String> {
|
||||
|
||||
/// The texts the dialogs paint with where each is drawn and its font, once they have faded in.
|
||||
fn frame_runs(app: &VectorcraftApp, ctx: &egui::Context) -> Vec<(String, egui::Rect, Option<egui::FontId>)> {
|
||||
fn walk(s: &egui::Shape, out: &mut Vec<(String, egui::Rect, Option<egui::FontId>)>) {
|
||||
match s {
|
||||
egui::Shape::Text(t) => {
|
||||
let font = t.galley.job.sections.first().map(|section| section.format.font_id.clone());
|
||||
out.push((t.galley.text().to_string(), t.galley.rect.translate(t.pos.to_vec2()), font));
|
||||
}
|
||||
egui::Shape::Vec(v) => v.iter().for_each(|s| walk(s, out)),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
let dialogs = app.dialogs().expect("a window");
|
||||
let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1200.0, 1200.0));
|
||||
let mut texts = vec![];
|
||||
@@ -89,8 +79,13 @@ fn frame_runs(app: &VectorcraftApp, ctx: &egui::Context) -> Vec<(String, egui::R
|
||||
let raw = egui::RawInput { screen_rect: Some(screen), time: Some(f64::from(k) * 0.25), ..Default::default() };
|
||||
let mut out = ctx.run_ui(raw, |ui| dialogs.with(|host| host.run(ui)));
|
||||
out.textures_delta.clear();
|
||||
texts.clear();
|
||||
out.shapes.iter().for_each(|c| walk(&c.shape, &mut texts));
|
||||
texts = crate::tests_labels::text_shapes(&out)
|
||||
.into_iter()
|
||||
.map(|(t, transform)| {
|
||||
let font = t.galley.job.sections.first().map(|section| section.format.font_id.clone());
|
||||
(t.galley.text().to_string(), transform * t.galley.rect.translate(t.pos.to_vec2()), font)
|
||||
})
|
||||
.collect();
|
||||
}
|
||||
texts
|
||||
}
|
||||
|
||||
@@ -15,18 +15,10 @@ fn app_with(n: usize) -> VectorcraftApp {
|
||||
|
||||
/// One headless frame of the canvas panel's body (the tabs and the canvas or panes) on a
|
||||
/// 1200 × 800 window, then the floating document windows, which egui draws inside the window, run
|
||||
/// as the hosts run a frame → the shapes it drew, `Shape::Vec`s flattened.
|
||||
/// as the hosts run a frame → the shapes it drew, `Shape::Vec`s and retained paint chunks flattened.
|
||||
fn frame(app: &mut VectorcraftApp, ctx: &egui::Context, events: Vec<egui::Event>) -> Vec<Shape> {
|
||||
fn flat(s: Shape, out: &mut Vec<Shape>) {
|
||||
match s {
|
||||
Shape::Vec(v) => v.into_iter().for_each(|s| flat(s, out)),
|
||||
s => out.push(s),
|
||||
}
|
||||
}
|
||||
let out = run_frame(app, ctx, events);
|
||||
let mut shapes = vec![];
|
||||
out.shapes.into_iter().for_each(|c| flat(c.shape, &mut shapes));
|
||||
shapes
|
||||
crate::tests_labels::flat_painted_shapes(&out.shapes)
|
||||
}
|
||||
|
||||
/// One headless frame of the canvas panel's body and the floating document windows on a 1200 ×
|
||||
|
||||
@@ -132,11 +132,9 @@ mod tests {
|
||||
let mut out = ctx.run_ui(egui::RawInput::default(), |ui| super::show(app, ui));
|
||||
out.textures_delta.clear();
|
||||
let mut texts = String::new();
|
||||
for shape in out.shapes {
|
||||
if let egui::epaint::Shape::Text(t) = shape.shape {
|
||||
texts.push_str(t.galley.text());
|
||||
texts.push('\n');
|
||||
}
|
||||
for (t, _) in crate::tests_labels::text_shapes(&out) {
|
||||
texts.push_str(t.galley.text());
|
||||
texts.push('\n');
|
||||
}
|
||||
texts
|
||||
}
|
||||
|
||||
@@ -288,18 +288,10 @@ fn discover_says_why_a_tool_cannot_be_marked() {
|
||||
}
|
||||
fn texts(ctx: &egui::Context, app: &mut VectorcraftApp, events: Vec<egui::Event>) -> Vec<(String, egui::Rect)> {
|
||||
let out = pass(ctx, app, events);
|
||||
fn collect(s: &egui::Shape, out: &mut Vec<(String, egui::Rect)>) {
|
||||
match s {
|
||||
egui::Shape::Text(t) => out.push((t.galley.text().to_string(), t.visual_bounding_rect())),
|
||||
egui::Shape::Vec(v) => v.iter().for_each(|s| collect(s, out)),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
let mut texts = vec![];
|
||||
for c in &out.shapes {
|
||||
collect(&c.shape, &mut texts);
|
||||
}
|
||||
texts
|
||||
crate::tests_labels::text_shapes(&out)
|
||||
.into_iter()
|
||||
.map(|(t, transform)| (t.galley.text().to_string(), transform * t.visual_bounding_rect()))
|
||||
.collect()
|
||||
}
|
||||
fn click(ctx: &egui::Context, app: &mut VectorcraftApp, label: &str) {
|
||||
texts(ctx, app, vec![]);
|
||||
|
||||
@@ -522,11 +522,9 @@ fn progress(app: &mut VectorcraftApp, ctx: &egui::Context) -> String {
|
||||
let mut out = ctx.run_ui(egui::RawInput::default(), |ui| crate::export_progress::show(app, ui));
|
||||
out.textures_delta.clear();
|
||||
let mut texts = String::new();
|
||||
for shape in out.shapes {
|
||||
if let egui::epaint::Shape::Text(t) = shape.shape {
|
||||
texts.push_str(t.galley.text());
|
||||
texts.push('\n');
|
||||
}
|
||||
for (t, _) in crate::tests_labels::text_shapes(&out) {
|
||||
texts.push_str(t.galley.text());
|
||||
texts.push('\n');
|
||||
}
|
||||
texts
|
||||
}
|
||||
|
||||
@@ -113,15 +113,10 @@ impl Host {
|
||||
};
|
||||
let mut full = ctx.run_ui(input, |ui| (viewport.viewport_ui_cb)(ui));
|
||||
full.textures_delta.clear();
|
||||
fn texts(s: &egui::Shape, out: &mut Vec<(String, Rect)>) {
|
||||
match s {
|
||||
egui::Shape::Text(t) => out.push((t.galley.text().to_string(), t.visual_bounding_rect())),
|
||||
egui::Shape::Vec(v) => v.iter().for_each(|s| texts(s, out)),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
let mut shown = Vec::new();
|
||||
full.shapes.iter().for_each(|c| texts(&c.shape, &mut shown));
|
||||
let shown: Vec<(String, Rect)> = crate::tests_labels::text_shapes(&full)
|
||||
.into_iter()
|
||||
.map(|(t, transform)| (t.galley.text().to_string(), transform * t.visual_bounding_rect()))
|
||||
.collect();
|
||||
let nodes = full.platform_output.accesskit_update.as_ref().map_or_else(Vec::new, |update| {
|
||||
let rect = |b: egui::accesskit::Rect| Rect::from_min_max(pos2(b.x0 as f32, b.y0 as f32), pos2(b.x1 as f32, b.y1 as f32));
|
||||
update.nodes.iter().filter_map(|(_, node)| Some((node.label()?.to_string(), rect(node.bounds()?)))).collect()
|
||||
|
||||
@@ -1080,11 +1080,10 @@ fn footer_strip_shows_no_rows(h: &mut Harness, case: &str) {
|
||||
egui::Shape::Mesh(m) => m.vertices.iter().all(|v| v.color.a() == 0),
|
||||
_ => false,
|
||||
};
|
||||
let showing: Vec<Rect> = h
|
||||
.shapes
|
||||
.iter()
|
||||
.filter(|c| !transparent(&c.shape))
|
||||
.map(|c| (c.shape.visual_bounding_rect(), c.clip_rect))
|
||||
let showing: Vec<Rect> = crate::tests_labels::painted_shapes(&h.shapes)
|
||||
.into_iter()
|
||||
.filter(|(shape, ..)| !transparent(shape))
|
||||
.map(|(shape, transform, clip)| (transform * shape.visual_bounding_rect(), clip))
|
||||
.filter(|(bounds, clip)| {
|
||||
let seen = clip.intersect(*bounds).intersect(strip);
|
||||
bounds.height() < 60.0 && bounds.top() < footer.top() && seen.is_positive() && seen.height() > 0.5
|
||||
|
||||
@@ -43,18 +43,10 @@ pub(super) fn frame_raw(
|
||||
) -> Vec<(String, egui::Rect)> {
|
||||
let mut out = ctx.run_ui(raw, |ui| f(app, ui));
|
||||
out.textures_delta.clear();
|
||||
fn collect(s: &egui::Shape, out: &mut Vec<(String, egui::Rect)>) {
|
||||
match s {
|
||||
egui::Shape::Text(t) => out.push((t.galley.text().to_string(), t.visual_bounding_rect())),
|
||||
egui::Shape::Vec(v) => v.iter().for_each(|s| collect(s, out)),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
let mut texts = vec![];
|
||||
for c in &out.shapes {
|
||||
collect(&c.shape, &mut texts);
|
||||
}
|
||||
texts
|
||||
crate::tests_labels::text_shapes(&out)
|
||||
.into_iter()
|
||||
.map(|(t, transform)| (t.galley.text().to_string(), transform * t.visual_bounding_rect()))
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Click at `pos` over three frames of `f` (hover, press, release).
|
||||
|
||||
@@ -20,20 +20,11 @@ fn app() -> VectorcraftApp {
|
||||
|
||||
/// One frame of `draw` with `events`; the texts it painted.
|
||||
fn frame(ctx: &egui::Context, events: Vec<Event>, time: f64, mut draw: impl FnMut(&mut egui::Ui)) -> Vec<String> {
|
||||
fn texts(s: &egui::Shape, out: &mut Vec<String>) {
|
||||
match s {
|
||||
egui::Shape::Text(t) => out.push(t.galley.text().to_string()),
|
||||
egui::Shape::Vec(v) => v.iter().for_each(|s| texts(s, out)),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
let screen_rect = Some(Rect::from_min_size(Pos2::ZERO, vec2(1200.0, 800.0)));
|
||||
let input = egui::RawInput { events, time: Some(time), screen_rect, ..Default::default() };
|
||||
let mut out = ctx.run_ui(input, &mut draw);
|
||||
out.textures_delta.clear();
|
||||
let mut v = vec![];
|
||||
out.shapes.iter().for_each(|c| texts(&c.shape, &mut v));
|
||||
v
|
||||
crate::tests_labels::text_shapes(&out).into_iter().map(|(t, _)| t.galley.text().to_string()).collect()
|
||||
}
|
||||
|
||||
fn undo_len(app: &VectorcraftApp) -> usize {
|
||||
|
||||
@@ -25,21 +25,12 @@ fn app() -> VectorcraftApp {
|
||||
|
||||
/// One frame of `draw` with `events` and `modifiers` held; the texts it painted.
|
||||
fn frame(ctx: &egui::Context, events: Vec<Event>, modifiers: Modifiers, time: f64, mut draw: impl FnMut(&mut egui::Ui)) -> Vec<String> {
|
||||
fn texts(s: &egui::Shape, out: &mut Vec<String>) {
|
||||
match s {
|
||||
egui::Shape::Text(t) => out.push(t.galley.text().to_string()),
|
||||
egui::Shape::Vec(v) => v.iter().for_each(|s| texts(s, out)),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
let screen_rect = Some(Rect::from_min_size(Pos2::ZERO, vec2(1200.0, 800.0)));
|
||||
let events = std::iter::once(Event::ModifiersChanged(modifiers)).chain(events).collect();
|
||||
let input = egui::RawInput { events, time: Some(time), screen_rect, ..Default::default() };
|
||||
let mut out = ctx.run_ui(input, &mut draw);
|
||||
out.textures_delta.clear();
|
||||
let mut v = vec![];
|
||||
out.shapes.iter().for_each(|c| texts(&c.shape, &mut v));
|
||||
v
|
||||
crate::tests_labels::text_shapes(&out).into_iter().map(|(t, _)| t.galley.text().to_string()).collect()
|
||||
}
|
||||
|
||||
fn undo_len(app: &VectorcraftApp) -> usize {
|
||||
|
||||
@@ -21,20 +21,11 @@ fn app() -> VectorcraftApp {
|
||||
|
||||
/// One frame of `draw` with `events`; the texts it painted.
|
||||
fn frame(ctx: &egui::Context, events: Vec<Event>, time: f64, mut draw: impl FnMut(&mut egui::Ui)) -> Vec<String> {
|
||||
fn texts(s: &egui::Shape, out: &mut Vec<String>) {
|
||||
match s {
|
||||
egui::Shape::Text(t) => out.push(t.galley.text().to_string()),
|
||||
egui::Shape::Vec(v) => v.iter().for_each(|s| texts(s, out)),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
let screen_rect = Some(Rect::from_min_size(Pos2::ZERO, vec2(1200.0, 800.0)));
|
||||
let input = egui::RawInput { events, time: Some(time), screen_rect, ..Default::default() };
|
||||
let mut out = ctx.run_ui(input, &mut draw);
|
||||
out.textures_delta.clear();
|
||||
let mut v = vec![];
|
||||
out.shapes.iter().for_each(|c| texts(&c.shape, &mut v));
|
||||
v
|
||||
crate::tests_labels::text_shapes(&out).into_iter().map(|(t, _)| t.galley.text().to_string()).collect()
|
||||
}
|
||||
|
||||
fn undo_len(app: &VectorcraftApp) -> usize {
|
||||
|
||||
@@ -1951,11 +1951,9 @@ fn progress(app: &mut VectorcraftApp, ctx: &egui::Context) -> String {
|
||||
let mut out = ctx.run_ui(egui::RawInput::default(), |ui| crate::export_progress::show(app, ui));
|
||||
out.textures_delta.clear();
|
||||
let mut texts = String::new();
|
||||
for shape in out.shapes {
|
||||
if let egui::epaint::Shape::Text(t) = shape.shape {
|
||||
texts.push_str(t.galley.text());
|
||||
texts.push('\n');
|
||||
}
|
||||
for (t, _) in crate::tests_labels::text_shapes(&out) {
|
||||
texts.push_str(t.galley.text());
|
||||
texts.push('\n');
|
||||
}
|
||||
texts
|
||||
}
|
||||
|
||||
@@ -1265,7 +1265,7 @@ fn access_frame(a: &mut VectorcraftApp, events: Vec<egui::Event>) -> (Vec<(Strin
|
||||
script_access::show(a, &mut w.script_access, ui);
|
||||
a.prefs = Some(w);
|
||||
});
|
||||
(crate::tests_removeanchors::shapes_text(&out.shapes.iter().map(|c| c.shape.clone()).collect::<Vec<_>>()), out)
|
||||
(crate::tests_removeanchors::shapes_text(&crate::tests_labels::flat_painted_shapes(&out.shapes)), out)
|
||||
}
|
||||
|
||||
/// The texts of General › Script File Access after the frames it lays itself out in.
|
||||
|
||||
@@ -362,19 +362,10 @@ fn quitting_waits_for_background_saves() {
|
||||
|
||||
/// The status bar's texts in one headless frame.
|
||||
pub(super) fn status_bar_texts(app: &mut VectorcraftApp) -> Vec<String> {
|
||||
fn texts(s: &egui::Shape, out: &mut Vec<String>) {
|
||||
match s {
|
||||
egui::Shape::Text(t) => out.push(t.galley.text().to_string()),
|
||||
egui::Shape::Vec(v) => v.iter().for_each(|s| texts(s, out)),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
let ctx = crate::testing::ui_context();
|
||||
let mut out = ctx.run_ui(egui::RawInput::default(), |ui| crate::chrome::status_bar(app, ui));
|
||||
out.textures_delta.clear();
|
||||
let mut v = vec![];
|
||||
out.shapes.iter().for_each(|c| texts(&c.shape, &mut v));
|
||||
v
|
||||
crate::tests_labels::text_shapes(&out).into_iter().map(|(t, _)| t.galley.text().to_string()).collect()
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -48,21 +48,15 @@ fn step(h: &mut Window) {
|
||||
|
||||
/// The texts the window paints with `command` run, each with where it was drawn, a field label's colon left off.
|
||||
fn texts(command: &str, params: Value) -> Vec<(String, Rect)> {
|
||||
fn collect(s: &egui::Shape, out: &mut Vec<(String, Rect)>) {
|
||||
match s {
|
||||
egui::Shape::Text(t) => out.push((t.galley.text().trim().trim_end_matches(':').to_owned(), t.visual_bounding_rect())),
|
||||
egui::Shape::Vec(v) => v.iter().for_each(|s| collect(s, out)),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
let mut h = window();
|
||||
crate::menus::invoke(h.state_mut(), command, params);
|
||||
for _ in 0..6 {
|
||||
step(&mut h);
|
||||
}
|
||||
let mut out = vec![];
|
||||
h.output().shapes.iter().for_each(|c| collect(&c.shape, &mut out));
|
||||
out
|
||||
crate::tests_labels::text_shapes(h.output())
|
||||
.into_iter()
|
||||
.map(|(t, transform)| (t.galley.text().trim().trim_end_matches(':').to_owned(), transform * t.visual_bounding_rect()))
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Where each painted `label` was drawn, top to bottom.
|
||||
|
||||
@@ -37,15 +37,10 @@ fn frame(app: &mut VectorcraftApp, ctx: &egui::Context, time: f64, events: Vec<E
|
||||
out.textures_delta.clear();
|
||||
// A tab's title starts with its document's name (an inactive tab shows the name alone).
|
||||
let names: Vec<String> = app.session.documents().iter().map(|d| d.title()).collect();
|
||||
let mut titles: Vec<_> = out
|
||||
.shapes
|
||||
.iter()
|
||||
.filter_map(|s| match &s.shape {
|
||||
egui::Shape::Text(t) if names.iter().any(|n| t.galley.text().starts_with(n.as_str())) => {
|
||||
Some(egui::Rect::from_min_size(t.pos, t.galley.size()))
|
||||
}
|
||||
_ => None,
|
||||
})
|
||||
let mut titles: Vec<_> = crate::tests_labels::text_shapes(&out)
|
||||
.into_iter()
|
||||
.filter(|(t, _)| names.iter().any(|n| t.galley.text().starts_with(n.as_str())))
|
||||
.map(|(t, transform)| transform * egui::Rect::from_min_size(t.pos, t.galley.size()))
|
||||
.collect();
|
||||
titles.sort_by(|a, b| a.left().total_cmp(&b.left()));
|
||||
titles
|
||||
|
||||
@@ -46,6 +46,39 @@ pub(crate) fn text_shapes(out: &egui::FullOutput) -> Vec<(&egui::epaint::TextSha
|
||||
text
|
||||
}
|
||||
|
||||
/// Every painted shape other than `Shape::Vec` and `Shape::PaintChunk` (whose members it lists
|
||||
/// instead), in paint order, with its composed window transform and the clip rectangle it is drawn in.
|
||||
pub(crate) fn painted_shapes(clipped: &[egui::epaint::ClippedShape]) -> Vec<(&Shape, egui::emath::TSTransform, egui::Rect)> {
|
||||
use egui::emath::TSTransform;
|
||||
|
||||
fn collect<'a>(shape: &'a Shape, transform: TSTransform, clip: egui::Rect, out: &mut Vec<(&'a Shape, TSTransform, egui::Rect)>) {
|
||||
match shape {
|
||||
Shape::Vec(shapes) => shapes.iter().for_each(|shape| collect(shape, transform, clip, out)),
|
||||
Shape::PaintChunk(shapes) => shapes.iter().for_each(|clipped| {
|
||||
collect(&clipped.shape, transform * clipped.transform_after_tessellation, clip.intersect(transform * clipped.clip_rect), out);
|
||||
}),
|
||||
shape => out.push((shape, transform, clip)),
|
||||
}
|
||||
}
|
||||
let mut shapes = Vec::new();
|
||||
for clipped in clipped {
|
||||
collect(&clipped.shape, clipped.transform_after_tessellation, clipped.clip_rect, &mut shapes);
|
||||
}
|
||||
shapes
|
||||
}
|
||||
|
||||
/// [`painted_shapes`] as owned shapes, each moved by its transform.
|
||||
pub(crate) fn flat_painted_shapes(clipped: &[egui::epaint::ClippedShape]) -> Vec<Shape> {
|
||||
painted_shapes(clipped)
|
||||
.into_iter()
|
||||
.map(|(shape, transform, _)| {
|
||||
let mut shape = shape.clone();
|
||||
shape.transform(transform);
|
||||
shape
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Every string a frame painted, one per line.
|
||||
pub(crate) fn shapes_text(out: &egui::FullOutput) -> String {
|
||||
let mut text = String::new();
|
||||
|
||||
@@ -397,14 +397,8 @@ impl Panel {
|
||||
let images = paint.textures_delta.set.iter().flat_map(|(id, deltas)| deltas.iter().map(move |delta| (*id, delta.image.clone()))).collect();
|
||||
// The test reads the images; no renderer applies them.
|
||||
paint.textures_delta.clear();
|
||||
let mut shapes = Vec::new();
|
||||
let mut open: Vec<egui::Shape> = paint.shapes.into_iter().map(|clipped| clipped.shape).collect();
|
||||
while let Some(shape) = open.pop() {
|
||||
match shape {
|
||||
egui::Shape::Vec(nested) => open.extend(nested),
|
||||
shape => shapes.push(shape),
|
||||
}
|
||||
}
|
||||
// Last painted first.
|
||||
let shapes = crate::tests_labels::flat_painted_shapes(&paint.shapes).into_iter().rev().collect();
|
||||
(shapes, images)
|
||||
}
|
||||
|
||||
|
||||
@@ -261,19 +261,13 @@ fn frame(
|
||||
events: Vec<egui::Event>,
|
||||
draw: &impl Fn(&mut VectorcraftApp, &mut egui::Ui),
|
||||
) -> Vec<(String, Rect)> {
|
||||
fn texts(s: &egui::Shape, out: &mut Vec<(String, Rect)>) {
|
||||
match s {
|
||||
egui::Shape::Text(t) => out.push((t.galley.text().to_string(), t.visual_bounding_rect())),
|
||||
egui::Shape::Vec(v) => v.iter().for_each(|s| texts(s, out)),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
let raw = egui::RawInput { screen_rect: Some(Rect::from_min_size(Pos2::ZERO, vec2(SCREEN.0, SCREEN.1))), events, ..Default::default() };
|
||||
// With the app's frame input, as the window's frames have it: its host carries the file service a dialog picks with.
|
||||
let out = crate::testing::part_frame(app, ctx, raw, |app, ui| draw(app, ui));
|
||||
let mut v = vec![];
|
||||
out.shapes.iter().for_each(|c| texts(&c.shape, &mut v));
|
||||
v
|
||||
crate::tests_labels::text_shapes(&out)
|
||||
.into_iter()
|
||||
.map(|(t, transform)| (t.galley.text().to_string(), transform * t.visual_bounding_rect()))
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Where text `label` was drawn (menu items pad theirs).
|
||||
|
||||
@@ -59,7 +59,7 @@ pub(crate) const CONTROL_ROOM: egui::Vec2 = vec2(2200.0, 900.0);
|
||||
pub(crate) fn control_frame(app: &mut VectorcraftApp, ctx: &egui::Context, events: Vec<Event>) -> Vec<(String, Rect)> {
|
||||
let raw = egui::RawInput { screen_rect: Some(Rect::from_min_size(Pos2::ZERO, CONTROL_ROOM)), events, ..Default::default() };
|
||||
let out = crate::testing::part_frame(app, ctx, raw, chrome::control_bar);
|
||||
shapes_text(&out.shapes.iter().map(|c| c.shape.clone()).collect::<Vec<_>>())
|
||||
shapes_text(&crate::tests_labels::flat_painted_shapes(&out.shapes))
|
||||
}
|
||||
|
||||
pub(crate) fn click_control(app: &mut VectorcraftApp, ctx: &egui::Context, at: Pos2) {
|
||||
@@ -74,7 +74,7 @@ fn canvas_frame(app: &mut VectorcraftApp, ctx: &egui::Context, events: Vec<Event
|
||||
let screen = Rect::from_min_size(Pos2::ZERO, vec2(800.0, 600.0));
|
||||
let raw = egui::RawInput { screen_rect: Some(screen), events, ..Default::default() };
|
||||
let out = crate::testing::part_frame(app, ctx, raw, canvas::show);
|
||||
shapes_text(&out.shapes.iter().map(|c| c.shape.clone()).collect::<Vec<_>>())
|
||||
shapes_text(&crate::tests_labels::flat_painted_shapes(&out.shapes))
|
||||
}
|
||||
|
||||
fn click_canvas(app: &mut VectorcraftApp, ctx: &egui::Context, at: Pos2, button: PointerButton) -> Vec<(String, Rect)> {
|
||||
@@ -92,7 +92,7 @@ pub(crate) fn properties_frame(app: &mut VectorcraftApp, width: f32) -> Vec<(Str
|
||||
crate::panels::properties::show(app, ui);
|
||||
});
|
||||
out.textures_delta.clear();
|
||||
shapes_text(&out.shapes.iter().map(|c| c.shape.clone()).collect::<Vec<_>>())
|
||||
shapes_text(&crate::tests_labels::flat_painted_shapes(&out.shapes))
|
||||
}
|
||||
|
||||
pub(crate) fn has(texts: &[(String, Rect)], label: &str) -> bool {
|
||||
|
||||
@@ -39,11 +39,9 @@ fn has_type(app: &VectorcraftApp) -> bool {
|
||||
fn progress(app: &mut VectorcraftApp, ctx: &egui::Context, time: f64) -> String {
|
||||
let out = crate::testing::part_frame(app, ctx, egui::RawInput { time: Some(time), ..Default::default() }, export_progress::show);
|
||||
let mut texts = String::new();
|
||||
for shape in out.shapes {
|
||||
if let egui::epaint::Shape::Text(t) = shape.shape {
|
||||
texts.push_str(t.galley.text());
|
||||
texts.push('\n');
|
||||
}
|
||||
for (t, _) in crate::tests_labels::text_shapes(&out) {
|
||||
texts.push_str(t.galley.text());
|
||||
texts.push('\n');
|
||||
}
|
||||
texts
|
||||
}
|
||||
|
||||
@@ -30,16 +30,10 @@ fn frame(app: &mut VectorcraftApp, ctx: &egui::Context, events: Vec<Event>, draw
|
||||
..Default::default()
|
||||
};
|
||||
let out = crate::testing::part_frame(app, ctx, raw, draw);
|
||||
fn walk(s: &egui::Shape, v: &mut Vec<(String, Rect)>) {
|
||||
match s {
|
||||
egui::Shape::Text(t) => v.push((t.galley.text().to_string(), Rect::from_min_size(t.pos, t.galley.size()))),
|
||||
egui::Shape::Vec(s) => s.iter().for_each(|s| walk(s, v)),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
let mut texts = vec![];
|
||||
out.shapes.iter().for_each(|c| walk(&c.shape, &mut texts));
|
||||
texts
|
||||
crate::tests_labels::text_shapes(&out)
|
||||
.into_iter()
|
||||
.map(|(t, transform)| (t.galley.text().to_string(), transform * Rect::from_min_size(t.pos, t.galley.size())))
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// How many fields show `v` points: painted as one run, or as its number with the unit as the next run on its row.
|
||||
|
||||
@@ -626,13 +626,6 @@ fn a_scripts_file_dialog_keeps_at_most_2048_picked_files() {
|
||||
|
||||
/// The texts the open warning draws, after a few frames of the whole app.
|
||||
fn dialog_texts(app: &mut VectorcraftApp) -> Vec<String> {
|
||||
fn texts(s: &egui::Shape, out: &mut Vec<String>) {
|
||||
match s {
|
||||
egui::Shape::Text(t) => out.push(t.galley.text().to_string()),
|
||||
egui::Shape::Vec(v) => v.iter().for_each(|s| texts(s, out)),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
let ctx = app.ui_ctx.clone().unwrap();
|
||||
let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1600.0, 4000.0));
|
||||
let mut out = None;
|
||||
@@ -640,9 +633,8 @@ fn dialog_texts(app: &mut VectorcraftApp) -> Vec<String> {
|
||||
let raw = egui::RawInput { time: Some(0.1 * f64::from(i)), screen_rect: Some(screen), ..Default::default() };
|
||||
out = Some(crate::testing::app_frame(app, &ctx, raw));
|
||||
}
|
||||
let mut v = vec![];
|
||||
out.unwrap().shapes.iter().for_each(|c| texts(&c.shape, &mut v));
|
||||
v
|
||||
let out = out.unwrap();
|
||||
crate::tests_labels::text_shapes(&out).into_iter().map(|(t, _)| t.galley.text().to_string()).collect()
|
||||
}
|
||||
|
||||
/// The warning before a run lists the files the script writes, read without running it.
|
||||
|
||||
@@ -18,14 +18,10 @@ pub(super) fn window(app: &mut VectorcraftApp, ui: &mut egui::Ui) {
|
||||
fn app_frame(app: &mut VectorcraftApp, ctx: &egui::Context, events: Vec<Event>, text: &str) -> Option<Rect> {
|
||||
let screen_rect = Some(Rect::from_min_size(Pos2::ZERO, vec2(1600.0, 900.0)));
|
||||
let out = crate::testing::app_frame(app, ctx, egui::RawInput { events, screen_rect, ..Default::default() });
|
||||
fn find(shape: &egui::Shape, text: &str) -> Option<Rect> {
|
||||
match shape {
|
||||
egui::Shape::Text(t) if t.galley.text() == text => Some(t.galley.rect.translate(t.pos.to_vec2())),
|
||||
egui::Shape::Vec(v) => v.iter().find_map(|s| find(s, text)),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
out.shapes.iter().find_map(|s| find(&s.shape, text))
|
||||
crate::tests_labels::text_shapes(&out)
|
||||
.into_iter()
|
||||
.find(|(t, _)| t.galley.text() == text)
|
||||
.map(|(t, transform)| transform * t.galley.rect.translate(t.pos.to_vec2()))
|
||||
}
|
||||
|
||||
fn app_with_rect() -> (VectorcraftApp, egui::Context) {
|
||||
|
||||
@@ -321,14 +321,7 @@ fn the_controls_under_the_tools_share_a_line_under_a_rule() {
|
||||
let proxy = named_rect(&nodes, "Fill and Stroke");
|
||||
let screen_rect = Some(egui::Rect::from_min_size(Pos2::ZERO, egui::vec2(1200.0, 2000.0)));
|
||||
let out = crate::testing::app_frame(&mut app, &ctx, egui::RawInput { time: Some(1.0), screen_rect, ..Default::default() });
|
||||
let mut flat = Vec::new();
|
||||
let mut stack: Vec<egui::Shape> = out.shapes.into_iter().map(|clipped| clipped.shape).collect();
|
||||
while let Some(shape) = stack.pop() {
|
||||
match shape {
|
||||
egui::Shape::Vec(inner) => stack.extend(inner),
|
||||
shape => flat.push(shape),
|
||||
}
|
||||
}
|
||||
let flat = crate::tests_labels::flat_painted_shapes(&out.shapes);
|
||||
// A rule is a thin horizontal line or bar across most of the rail's width, between the tools and the controls.
|
||||
let between = |y: f32| y > last.bottom() && y < proxy.top();
|
||||
let across = |left: f32, right: f32| right - left >= last.width() * 0.75 && left < last.right() && right > last.left();
|
||||
@@ -595,20 +588,15 @@ fn a_short_tools_rail_shows_its_scroll_bar_at_rest() {
|
||||
let rail = nodes.iter().find(|n| n.role() == Role::Toolbar && n.label() == Some("Tools")).and_then(bounds).expect("the rail is drawn");
|
||||
let screen_rect = Some(egui::Rect::from_min_size(Pos2::ZERO, egui::vec2(1200.0, height)));
|
||||
let out = crate::testing::app_frame(app, &ctx, egui::RawInput { time: Some(t0 + 0.2), screen_rect, ..Default::default() });
|
||||
let mut stack: Vec<egui::Shape> = out.shapes.into_iter().map(|clipped| clipped.shape).collect();
|
||||
let mut found = 0;
|
||||
while let Some(shape) = stack.pop() {
|
||||
match shape {
|
||||
egui::Shape::Vec(inner) => stack.extend(inner),
|
||||
egui::Shape::Rect(r) => {
|
||||
let b = r.rect;
|
||||
let narrow = b.width() > 0.0 && b.width() <= rail.width() * 0.25 && b.height() >= b.width() * 3.0;
|
||||
let at_end = rail.expand(0.5).contains_rect(b) && b.center().x > rail.center().x;
|
||||
if narrow && at_end {
|
||||
found += 1;
|
||||
}
|
||||
for shape in crate::tests_labels::flat_painted_shapes(&out.shapes) {
|
||||
if let egui::Shape::Rect(r) = shape {
|
||||
let b = r.rect;
|
||||
let narrow = b.width() > 0.0 && b.width() <= rail.width() * 0.25 && b.height() >= b.width() * 3.0;
|
||||
let at_end = rail.expand(0.5).contains_rect(b) && b.center().x > rail.center().x;
|
||||
if narrow && at_end {
|
||||
found += 1;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
found
|
||||
|
||||
@@ -353,12 +353,11 @@ fn copy_long_link_value(a: &mut App) {
|
||||
assert_eq!(names.len(), 1, "one actual full-name copy readout");
|
||||
assert_eq!(names[0].1.description(), Some("Copy"));
|
||||
let area = location_node_rect(&names[0].1);
|
||||
let (value, clipped) = out
|
||||
.shapes
|
||||
.iter()
|
||||
.find_map(|s| {
|
||||
let t = text_shape(&s.shape, &name)?;
|
||||
let r = t.galley.rect.translate(t.pos.to_vec2()).intersect(s.clip_rect).intersect(area);
|
||||
let (value, clipped) = visible_paint(&out)
|
||||
.into_iter()
|
||||
.filter(|(t, ..)| t.galley.text() == name)
|
||||
.find_map(|(t, bounds, _)| {
|
||||
let r = bounds.intersect(area);
|
||||
r.is_positive().then_some((r, t.galley.elided || r.width() < t.galley.rect.width()))
|
||||
})
|
||||
.expect("the actual selected image's Link Info Name value");
|
||||
@@ -636,9 +635,9 @@ fn location_node_rect(node: &egui::accesskit::Node) -> Rect {
|
||||
}
|
||||
|
||||
fn shortened_location(out: &egui::FullOutput, rect: Rect, full: &str) -> bool {
|
||||
visible_paint(out)
|
||||
.into_iter()
|
||||
.any(|(shape, bounds, center)| rect.contains(center) && bounds.contains(center) && shape.galley.text().contains('…') && shape.galley.text() != full)
|
||||
visible_paint(out).into_iter().any(|(shape, bounds, center)| {
|
||||
rect.contains(center) && bounds.contains(center) && shape.galley.text().contains('…') && shape.galley.text() != full
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -725,10 +724,7 @@ fn panel_readout_long_location_fits_and_copies_by_pointer_accessibility_and_keyb
|
||||
let (location_id, node) = locations[0];
|
||||
let location_rect = location_node_rect(node);
|
||||
assert!(body.contains_rect(location_rect), "{locale}: the fitted Location remains inside the panel");
|
||||
assert!(
|
||||
shortened_location(&out, location_rect, location),
|
||||
"{locale}: the long path must actually be shortened on screen"
|
||||
);
|
||||
assert!(shortened_location(&out, location_rect, location), "{locale}: the long path must actually be shortened on screen");
|
||||
let buttons: Vec<_> =
|
||||
nodes.iter().filter(|(_, n)| n.role() == Role::Button && n.label() == Some(vectorcraft_ui_egui::i18n::t("Copy Location"))).collect();
|
||||
assert_eq!(buttons.len(), 1, "{locale}: one named native Copy Location button");
|
||||
|
||||
Reference in new issue
Block a user