@@ -1299,6 +1299,54 @@ void main() {
1299
1299
expect (selection.end, 31 );
1300
1300
});
1301
1301
});
1302
+
1303
+ test ('can just update the gesture recognizer' , () async {
1304
+ final TapGestureRecognizer recognizerBefore = TapGestureRecognizer ()..onTap = () {};
1305
+ final RenderParagraph paragraph = RenderParagraph (
1306
+ TextSpan (text: 'How are you \n ' , recognizer: recognizerBefore),
1307
+ textDirection: TextDirection .ltr,
1308
+ );
1309
+
1310
+ int semanticsUpdateCount = 0 ;
1311
+ TestRenderingFlutterBinding .instance.pipelineOwner.ensureSemantics (
1312
+ listener: () {
1313
+ ++ semanticsUpdateCount;
1314
+ },
1315
+ );
1316
+
1317
+ layout (paragraph);
1318
+
1319
+ expect ((paragraph.text as TextSpan ).recognizer, same (recognizerBefore));
1320
+ final SemanticsNode nodeBefore = SemanticsNode ();
1321
+ paragraph.assembleSemanticsNode (nodeBefore, SemanticsConfiguration (), < SemanticsNode > []);
1322
+ expect (semanticsUpdateCount, 0 );
1323
+ List <SemanticsNode > children = < SemanticsNode > [];
1324
+ nodeBefore.visitChildren ((SemanticsNode child) {
1325
+ children.add (child);
1326
+ return true ;
1327
+ });
1328
+ SemanticsData data = children.single.getSemanticsData ();
1329
+ expect (data.hasAction (SemanticsAction .longPress), false );
1330
+ expect (data.hasAction (SemanticsAction .tap), true );
1331
+
1332
+ final LongPressGestureRecognizer recognizerAfter = LongPressGestureRecognizer ()..onLongPress = () {};
1333
+ paragraph.text = TextSpan (text: 'How are you \n ' , recognizer: recognizerAfter);
1334
+
1335
+ pumpFrame (phase: EnginePhase .flushSemantics);
1336
+
1337
+ expect ((paragraph.text as TextSpan ).recognizer, same (recognizerAfter));
1338
+ final SemanticsNode nodeAfter = SemanticsNode ();
1339
+ paragraph.assembleSemanticsNode (nodeAfter, SemanticsConfiguration (), < SemanticsNode > []);
1340
+ expect (semanticsUpdateCount, 1 );
1341
+ children = < SemanticsNode > [];
1342
+ nodeAfter.visitChildren ((SemanticsNode child) {
1343
+ children.add (child);
1344
+ return true ;
1345
+ });
1346
+ data = children.single.getSemanticsData ();
1347
+ expect (data.hasAction (SemanticsAction .longPress), true );
1348
+ expect (data.hasAction (SemanticsAction .tap), false );
1349
+ });
1302
1350
}
1303
1351
1304
1352
class MockCanvas extends Fake implements Canvas {
0 commit comments