Cleanup
This commit is contained in:
@@ -2611,4 +2611,38 @@ mod tests {
|
||||
"offscreen descendants must keep geometry for widget-ref scrolling"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn scroll_culling_keeps_visible_text_selectable_inside_viewport_clip() {
|
||||
let text_id = ElementId::new(77);
|
||||
let root = Element::new().child(
|
||||
Element::scroll_box(120.0).width(360.0).height(120.0).child(
|
||||
Element::paragraph(
|
||||
"line 01\nline 02\nline 03\nline 04\nline 05\nline 06\nline 07\nline 08\nline 09",
|
||||
text_style().with_line_height(20.0),
|
||||
)
|
||||
.id(text_id),
|
||||
),
|
||||
);
|
||||
|
||||
let snapshot = layout_snapshot(1, UiSize::new(360.0, 120.0), &root);
|
||||
let text = snapshot
|
||||
.interaction_tree
|
||||
.text_for_element(text_id)
|
||||
.expect("selectable text should remain in the interaction tree");
|
||||
let visible_hit = snapshot
|
||||
.interaction_tree
|
||||
.text_hit_test(Point::new(8.0, 8.0))
|
||||
.expect("visible scrolled text should be selectable");
|
||||
|
||||
assert_eq!(text.element_id, Some(text_id));
|
||||
assert_eq!(visible_hit.target.element_id, Some(text_id));
|
||||
assert!(
|
||||
snapshot
|
||||
.interaction_tree
|
||||
.text_hit_test(Point::new(8.0, 160.0))
|
||||
.is_none(),
|
||||
"text hit testing should still honor the scroll viewport clip"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user