Verify tooltip inspection through the installed renderer overlay

This commit is contained in:
2026-09-12 04:46:09 -07:00
parent 5ce798b713
commit 3840ca2965
2 changed files with 32 additions and 7 deletions
@@ -625,12 +625,38 @@ async fn actual_toolbar_hover_inspects_last_full_name_without_authorizing_an_out
assert!(f.app.allocation_drag.preview.is_none());
assert!(f.app.allocation_drag.active.is_some());
let inspected = mounted.pixels_at(&f.app, mouse::Cursor::Available(hover));
let tooltip = mounted
.geometry(&f.app)
.bounds("allocation-destination-tooltip");
assert!(tooltip.width > 0. && tooltip.height > 26.);
assert!(tooltip.y >= 0. && tooltip.x >= 0.);
assert!(tooltip.x + tooltip.width <= f.app.window_size.width);
// Iced's Tooltip overlay draws its child but exposes no Operation
// traversal. Compare the real rendered overlay instead of inventing
// container geometry that the installed widget cannot report.
let inspection = std::mem::take(
&mut f
.app
.allocation_drag
.feedback
.as_mut()
.unwrap()
.inspection_targets,
);
let without_name = mounted.pixels_at(&f.app, mouse::Cursor::Available(hover));
let width = f.app.window_size.width as usize;
assert_ne!(
inspected, without_name,
"full captured name changes the actual hovered tooltip"
);
assert_eq!(
canvas_pixels(&inspected, width, canvas),
canvas_pixels(&without_name, width, canvas)
);
assert_eq!(
canvas_pixels(&inspected, width, slot),
canvas_pixels(&without_name, width, slot)
);
f.app
.allocation_drag
.feedback
.as_mut()
.unwrap()
.inspection_targets = inspection;
assert_eq!(canvas_bounds(&mut mounted, &f.app), canvas);
record_render_evidence(
&format!("{layer:?}-name-inspection"),
-1
View File
@@ -531,7 +531,6 @@ fn diagram(app: &App) -> View<'_, Message> {
.size(13)
.wrapping(widget::text::Wrapping::None),
container(text(inspection).size(13))
.id("allocation-destination-tooltip")
.padding(10)
.max_width(420)
.style(style::card),