mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
39 lines
1.2 KiB
Dart
39 lines
1.2 KiB
Dart
// Copyright 2019 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:flutter/rendering.dart';
|
|
|
|
void main() {
|
|
testWidgets('Default MaterialButton meets a11y contrast guidelines', (WidgetTester tester) async {
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
home: Scaffold(
|
|
body: Center(
|
|
child: MaterialButton(
|
|
child: const Text('MaterialButton'),
|
|
onPressed: () { },
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
|
|
// Default, not disabled.
|
|
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
|
|
|
// Highlighted (pressed).
|
|
final Offset center = tester.getCenter(find.byType(MaterialButton));
|
|
await tester.startGesture(center);
|
|
await tester.pump(); // Start the splash and highlight animations.
|
|
await tester.pump(const Duration(milliseconds: 800)); // Wait for splash and highlight to be well under way.
|
|
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
|
},
|
|
semanticsEnabled: true,
|
|
skip: isBrowser,
|
|
);
|
|
|
|
}
|