@@ -1424,4 +1424,90 @@ void main() {
1424
1424
textDirection: TextDirection .ltr,
1425
1425
));
1426
1426
});
1427
+
1428
+ testWidgets ('InkWell highlight should not survive after [onTapDown, onDoubleTap] sequence' , (WidgetTester tester) async {
1429
+ final List <String > log = < String > [];
1430
+
1431
+ await tester.pumpWidget (Directionality (
1432
+ textDirection: TextDirection .ltr,
1433
+ child: Material (
1434
+ child: Center (
1435
+ child: InkWell (
1436
+ onTap: () {
1437
+ log.add ('tap' );
1438
+ },
1439
+ onDoubleTap: () {
1440
+ log.add ('double-tap' );
1441
+ },
1442
+ onTapDown: (TapDownDetails details) {
1443
+ log.add ('tap-down' );
1444
+ },
1445
+ onTapCancel: () {
1446
+ log.add ('tap-cancel' );
1447
+ },
1448
+ ),
1449
+ ),
1450
+ ),
1451
+ ));
1452
+
1453
+ final Offset taplocation = tester.getRect (find.byType (InkWell )).center;
1454
+
1455
+ final TestGesture gesture = await tester.startGesture (taplocation);
1456
+ await tester.pump (const Duration (milliseconds: 100 ));
1457
+ expect (log, equals (< String > ['tap-down' ]));
1458
+ await gesture.up ();
1459
+ await tester.pump (const Duration (milliseconds: 100 ));
1460
+ await tester.tap (find.byType (InkWell ));
1461
+ await tester.pump (const Duration (milliseconds: 100 ));
1462
+ expect (log, equals (< String > ['tap-down' , 'double-tap' ]));
1463
+
1464
+ await tester.pumpAndSettle ();
1465
+ final RenderObject inkFeatures = tester.allRenderObjects.firstWhere ((RenderObject object) => object.runtimeType.toString () == '_RenderInkFeatures' );
1466
+ expect (inkFeatures, paintsExactlyCountTimes (#drawRect, 0 ));
1467
+ });
1468
+
1469
+ testWidgets ('InkWell splash should not survive after [onTapDown, onTapDown, onTapCancel, onDoubleTap] sequence' , (WidgetTester tester) async {
1470
+ final List <String > log = < String > [];
1471
+
1472
+ await tester.pumpWidget (Directionality (
1473
+ textDirection: TextDirection .ltr,
1474
+ child: Material (
1475
+ child: Center (
1476
+ child: InkWell (
1477
+ onTap: () {
1478
+ log.add ('tap' );
1479
+ },
1480
+ onDoubleTap: () {
1481
+ log.add ('double-tap' );
1482
+ },
1483
+ onTapDown: (TapDownDetails details) {
1484
+ log.add ('tap-down' );
1485
+ },
1486
+ onTapCancel: () {
1487
+ log.add ('tap-cancel' );
1488
+ },
1489
+ ),
1490
+ ),
1491
+ ),
1492
+ ));
1493
+
1494
+ final Offset tapLocation = tester.getRect (find.byType (InkWell )).center;
1495
+
1496
+ final TestGesture gesture1 = await tester.startGesture (tapLocation);
1497
+ await tester.pump (const Duration (milliseconds: 100 ));
1498
+ expect (log, equals (< String > ['tap-down' ]));
1499
+ await gesture1.up ();
1500
+ await tester.pump (const Duration (milliseconds: 100 ));
1501
+
1502
+ final TestGesture gesture2 = await tester.startGesture (tapLocation);
1503
+ await tester.pump (const Duration (milliseconds: 100 ));
1504
+ expect (log, equals (< String > ['tap-down' , 'tap-down' ]));
1505
+ await gesture2.up ();
1506
+ await tester.pump (const Duration (milliseconds: 100 ));
1507
+ expect (log, equals (< String > ['tap-down' , 'tap-down' , 'tap-cancel' , 'double-tap' ]));
1508
+
1509
+ await tester.pumpAndSettle ();
1510
+ final RenderObject inkFeatures = tester.allRenderObjects.firstWhere ((RenderObject object) => object.runtimeType.toString () == '_RenderInkFeatures' );
1511
+ expect (inkFeatures, paintsExactlyCountTimes (#drawCircle, 0 ));
1512
+ });
1427
1513
}
0 commit comments