forked from flutter/flutter
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Init licenses for test bindings (flutter#81961)
- Loading branch information
Showing
4 changed files
with
65 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[0-9]+:[0-9]+ [+]1: All tests passed! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright 2014 The Flutter 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'; | ||
|
||
void main() { | ||
testWidgets('Can show the license page', (WidgetTester tester) async { | ||
await tester.pumpWidget(const TestApp()); | ||
await tester.pump(); | ||
|
||
final Finder button = find.byType(TextButton); | ||
|
||
await tester.tap(button); | ||
await tester.pumpAndSettle(); | ||
|
||
await tester.scrollUntilVisible( | ||
// Dart should very definitely be in the licenses list. | ||
find.text('dart'), | ||
100, | ||
maxScrolls: 200, | ||
); | ||
|
||
expect(find.text('dart'), findsOneWidget); | ||
}); | ||
} | ||
|
||
class TestApp extends StatelessWidget { | ||
const TestApp({Key? key}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return const MaterialApp( | ||
home: ShowLicenseButton(), | ||
); | ||
} | ||
} | ||
|
||
class ShowLicenseButton extends StatelessWidget { | ||
const ShowLicenseButton({Key? key}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return TextButton( | ||
onPressed: () => showLicensePage(context: context), | ||
child: const Text( | ||
'Show licenses', | ||
key: Key('show-licenses'), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters