Verify tooltip inspection through the installed renderer overlay
This commit is contained in:
@@ -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.preview.is_none());
|
||||||
assert!(f.app.allocation_drag.active.is_some());
|
assert!(f.app.allocation_drag.active.is_some());
|
||||||
let inspected = mounted.pixels_at(&f.app, mouse::Cursor::Available(hover));
|
let inspected = mounted.pixels_at(&f.app, mouse::Cursor::Available(hover));
|
||||||
let tooltip = mounted
|
// Iced's Tooltip overlay draws its child but exposes no Operation
|
||||||
.geometry(&f.app)
|
// traversal. Compare the real rendered overlay instead of inventing
|
||||||
.bounds("allocation-destination-tooltip");
|
// container geometry that the installed widget cannot report.
|
||||||
assert!(tooltip.width > 0. && tooltip.height > 26.);
|
let inspection = std::mem::take(
|
||||||
assert!(tooltip.y >= 0. && tooltip.x >= 0.);
|
&mut f
|
||||||
assert!(tooltip.x + tooltip.width <= f.app.window_size.width);
|
.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);
|
assert_eq!(canvas_bounds(&mut mounted, &f.app), canvas);
|
||||||
record_render_evidence(
|
record_render_evidence(
|
||||||
&format!("{layer:?}-name-inspection"),
|
&format!("{layer:?}-name-inspection"),
|
||||||
|
|||||||
@@ -531,7 +531,6 @@ fn diagram(app: &App) -> View<'_, Message> {
|
|||||||
.size(13)
|
.size(13)
|
||||||
.wrapping(widget::text::Wrapping::None),
|
.wrapping(widget::text::Wrapping::None),
|
||||||
container(text(inspection).size(13))
|
container(text(inspection).size(13))
|
||||||
.id("allocation-destination-tooltip")
|
|
||||||
.padding(10)
|
.padding(10)
|
||||||
.max_width(420)
|
.max_width(420)
|
||||||
.style(style::card),
|
.style(style::card),
|
||||||
|
|||||||
Reference in New Issue
Block a user