Add golden test for clipping (#20750)

For #20483
This commit is contained in:
liyuqian
2018-08-20 14:33:27 -07:00
committed by GitHub
parent 09fec4c51b
commit 980c8a737b
2 changed files with 31 additions and 1 deletions

View File

@@ -1 +1 @@
6c45fafdf5e3231406e1921285767f6ca8c05d6e
d0800cf4170e77682173c19703f605c6795e0ff8

View File

@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:io';
import 'dart:ui';
import 'package:flutter/material.dart';
@@ -408,4 +409,33 @@ void main() {
expect(shortFAB, findsNothing);
expect(helloWorld, findsOneWidget);
});
// This test prevents https://github.com/flutter/flutter/issues/20483
testWidgets('Floating Action Button clips ink splash and highlight', (WidgetTester tester) async {
final GlobalKey key = new GlobalKey();
await tester.pumpWidget(
new MaterialApp(
home: new Scaffold(
body: new Center(
child: new RepaintBoundary(
key: key,
child: new FloatingActionButton(
onPressed: () {},
child: const Icon(Icons.add),
),
),
),
),
),
);
await tester.press(find.byKey(key));
await tester.pump();
await tester.pump(const Duration(milliseconds: 1000));
await expectLater(
find.byKey(key),
matchesGoldenFile('floating_action_button_test.clip.1.png'),
skip: !Platform.isLinux,
);
});
}