mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00

* Fix tests to use Ahem, and helpful changes around that - Fix fonts that had metric-specific behaviours. - LiveTestWidgetsFlutterBinding.allowAllFrames has been renamed to LiveTestWidgetsFlutterBinding.framePolicy. - LiveTestWidgetsFlutterBinding now defaults to using a frame policy that pumps slightly more frames, to animate the pointer crosshairs. - Added "flutter run --use-test-fonts" to enable Ahem on devices. - Changed how idle() works to be more effective in live mode. - Display the test name in live mode (unless ahem fonts are enabled). - Added a toString to TextSelectionPoint. - Style nit fixes. * Roll engine to get Ahem changes. * Update tests for dartdoc changes. * Fix flutter_tools tests
35 lines
1.3 KiB
Dart
35 lines
1.3 KiB
Dart
// Copyright 2016 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_gallery/demo/calculator_demo.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
void main() {
|
|
final TestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.ensureInitialized();
|
|
if (binding is LiveTestWidgetsFlutterBinding)
|
|
binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fullyLive;
|
|
|
|
// We press the "1" and the "2" buttons and check that the display
|
|
// reads "12".
|
|
testWidgets('Flutter calculator app smoke test', (WidgetTester tester) async {
|
|
await tester.pumpWidget(new CalculatorDemo());
|
|
|
|
final Finder oneButton = find.widgetWithText(InkResponse, '1');
|
|
expect(oneButton, findsOneWidget);
|
|
|
|
final Finder twoButton = find.widgetWithText(InkResponse, '2');
|
|
expect(twoButton, findsOneWidget);
|
|
|
|
await tester.tap(oneButton);
|
|
await tester.pump();
|
|
await tester.tap(twoButton);
|
|
await tester.pump();
|
|
await tester.pump(const Duration(seconds: 1)); // Wait until it has finished.
|
|
|
|
final Finder display = find.widgetWithText(Expanded, '12');
|
|
expect(display, findsOneWidget);
|
|
});
|
|
}
|