From 685572eaba7a3af0ebeac86215189fdfbbca6bc2 Mon Sep 17 00:00:00 2001 From: aiongg Date: Thu, 12 Nov 2026 11:04:07 +0000 Subject: [PATCH] Suite: a row is pressed where no control lies over it, its own or one its collection draws over it (a grid's filter buttons in its header cells) --- crates/ui-contract/src/testing/suite/row_click.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/crates/ui-contract/src/testing/suite/row_click.rs b/crates/ui-contract/src/testing/suite/row_click.rs index 3490674d9..91eafaee3 100644 --- a/crates/ui-contract/src/testing/suite/row_click.rs +++ b/crates/ui-contract/src/testing/suite/row_click.rs @@ -1,20 +1,23 @@ //! The point at which the suite presses a collection row to give it the lead or pick it: a point of the row's own -//! area (17.5). A row that holds child components (a switch, a select) is pressed where none of them is, so the -//! press reaches the row and not a child. +//! area (17.5). A row that holds child components (a switch, a select), or that the collection draws controls over (a +//! grid's filter buttons in its header cells), is pressed where none of them is, so the press reaches the row. use super::nodes::subtree; use crate::runtime::egui::access::Declared; use crate::testing::fixture::{Fixture, Target}; use egui::{Pos2, Rect}; -/// The point of `row` to press: its centre when no focusable or clickable descendant covers it, else the middle of the widest -/// stretch of the row's centre line that none covers, and the centre when the descendants cover the whole line. +/// The point of `row` to press: its centre when no focusable or clickable node of its collection (the row's parent: +/// the row's own children and the controls the collection shows beside or over its rows) covers it, else the middle of +/// the widest stretch of the row's centre line that none covers, and the centre when they cover the whole line. Nodes +/// outside the collection, such as the field a popup list opens over, lie under it and are not counted. pub(super) fn point(fixture: &Fixture, row: &Target) -> Pos2 { let tree = fixture.tree(); let centre = row.rect.center(); - let mut covered: Vec = subtree(tree, row.node) + let collection = tree.parent_of_key(row.node).unwrap_or(row.node); + let mut covered: Vec = subtree(tree, collection) .into_iter() - .skip(1) + .filter(|node| *node != collection && *node != row.node) .filter(|node| tree.declares_key(*node, Declared::Focus) || tree.declares_key(*node, Declared::Click)) .filter_map(|node| tree.bounds_of(node)) .filter(|bounds| bounds.min.y <= centre.y && centre.y <= bounds.max.y)