From 8a5b278062c4ae8088f1252d0d73cbcaf5ef40d0 Mon Sep 17 00:00:00 2001 From: zjs81 <30362347+zjs81@users.noreply.github.com> Date: Mon, 23 Nov 2026 23:48:29 -0700 Subject: [PATCH] Make bulk selection test find the long-press row at 2.0x text Follow-up to #706. The helper matched the row's long-press detector by vertical distance to the message text, which finds nothing when the bubble is tall at 2.0x text. Look up the detector as an ancestor of the text. --- test/screens/bulk_message_selection_test.dart | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/test/screens/bulk_message_selection_test.dart b/test/screens/bulk_message_selection_test.dart index 9cd919bf..fddaba5b 100644 --- a/test/screens/bulk_message_selection_test.dart +++ b/test/screens/bulk_message_selection_test.dart @@ -448,17 +448,18 @@ Future _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 _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'));