Merge pull request #711 from zjs81/fix/bulk-selection-test-2x-text

Make bulk selection test find the long-press row at 2.0x text
This commit is contained in:
zjs81 authored and GitHub committed 2026-11-23 23:55:45 -07:00
commit 0d410b23e6
1 file changed
+10 -9
+10 -9
View File
@@ -448,17 +448,18 @@ Future<void> _tearDown(WidgetTester tester) async {
/// its long-press handler: a real long press on bubble text starts text
/// selection in tests) and picks "Select messages".
Future<void> _enterSelectionFrom(WidgetTester tester, Finder message) async {
final target = tester.getCenter(message);
// The row's long-press detector wraps the bubble, so it is an ancestor of
// the message text whatever the text scale.
final detector = find
.byWidgetPredicate((w) => w is GestureDetector && w.onLongPress != null)
.ancestor(
of: message.first,
matching: find.byWidgetPredicate(
(w) => w is GestureDetector && w.onLongPress != null,
),
)
.first
.evaluate()
.firstWhere((e) {
final box = e.renderObject! as RenderBox;
// Full-width detectors: match on the message's row, not its text.
return (box.localToGlobal(box.size.center(Offset.zero)).dy - target.dy)
.abs() <
20;
});
.single;
(detector.widget as GestureDetector).onLongPress!();
await _settle(tester);
await tester.ensureVisible(find.text('Select messages'));