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

This renames the "module" template to the "application" template, and makes "application" the default. The existing "app" template is now deprecated. flutter create also now recognizes the type of project in an existing directory, and is able to recreate it without having the template type explicitly specified (although you can still do that). It does this now by first looking in the .metadata file for the new project_type field, and if it doesn't find that, then it looks at the directory structure. Also, the .metadata file is now overwritten even on an existing directory so that 1) the project_type can be added to legacy projects, and 2) the version of Flutter that updated the project last is updated. I also cleaned up a bunch of things in create_test.dart, added many more tests, and added an example test to the test/ directory in the generated output of the application template. Fixes #22530 Fixes #22344
49 lines
1.5 KiB
Cheetah
49 lines
1.5 KiB
Cheetah
// This is a basic Flutter widget test.
|
|
//
|
|
// To perform an interaction with a widget in your test, use the WidgetTester
|
|
// utility that Flutter provides. For example, you can send tap and scroll
|
|
// gestures. You can also use WidgetTester to find child widgets in the widget
|
|
// tree, read text, and verify that the values of widget properties are correct.
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
import 'package:{{projectName}}/main.dart';
|
|
|
|
{{^withPluginHook}}
|
|
void main() {
|
|
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
|
|
// Build our app and trigger a frame.
|
|
await tester.pumpWidget(new MyApp());
|
|
|
|
// Verify that our counter starts at 0.
|
|
expect(find.text('0'), findsOneWidget);
|
|
expect(find.text('1'), findsNothing);
|
|
|
|
// Tap the '+' icon and trigger a frame.
|
|
await tester.tap(find.byIcon(Icons.add));
|
|
await tester.pump();
|
|
|
|
// Verify that our counter has incremented.
|
|
expect(find.text('0'), findsNothing);
|
|
expect(find.text('1'), findsOneWidget);
|
|
});
|
|
}
|
|
{{/withPluginHook}}
|
|
{{#withPluginHook}}
|
|
void main() {
|
|
testWidgets('Verify Platform version', (WidgetTester tester) async {
|
|
// Build our app and trigger a frame.
|
|
await tester.pumpWidget(new MyApp());
|
|
|
|
// Verify that platform version is retrieved.
|
|
expect(
|
|
find.byWidgetPredicate(
|
|
(Widget widget) =>
|
|
widget is Text && widget.data.startsWith('Running on:'),
|
|
),
|
|
findsOneWidget);
|
|
});
|
|
}
|
|
{{/withPluginHook}}
|