From 29e0f5f990622634dcce3ec60dfd4c6434095266 Mon Sep 17 00:00:00 2001 From: LongCatIsLooong <31859944+LongCatIsLooong@users.noreply.github.com> Date: Tue, 27 Sep 2022 16:27:05 -0700 Subject: [PATCH] Add regression test for TextPainter.getWordBoundary (#112229) --- .../flutter/test/painting/text_painter_test.dart | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/flutter/test/painting/text_painter_test.dart b/packages/flutter/test/painting/text_painter_test.dart index 4c76745e6e..41a6115766 100644 --- a/packages/flutter/test/painting/text_painter_test.dart +++ b/packages/flutter/test/painting/text_painter_test.dart @@ -1208,6 +1208,21 @@ void main() { painter.dispose(); }); + + test('TextPainter.getWordBoundary works', (){ + // Regression test for https://github.com/flutter/flutter/issues/93493 . + const String testCluster = '👨‍👩‍👦👨‍👩‍👦👨‍👩‍👦'; // 8 * 3 + final TextPainter textPainter = TextPainter( + text: const TextSpan(text: testCluster), + textDirection: TextDirection.ltr, + ); + + textPainter.layout(); + expect( + textPainter.getWordBoundary(const TextPosition(offset: 8)), + const TextRange(start: 8, end: 16), + ); + }, skip: isBrowser); // https://github.com/flutter/flutter/issues/61017 } class MockCanvas extends Fake implements Canvas {