forked from firka/flutter
@@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
void main() {
|
||||
testWidgets('WidgetsApp test', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.MyApp(),
|
||||
const example.WidgetsAppExampleApp(),
|
||||
);
|
||||
|
||||
expect(find.text('Hello World'), findsOneWidget);
|
||||
|
||||
@@ -18,7 +18,7 @@ void main() {
|
||||
}
|
||||
|
||||
await tester.pumpWidget(
|
||||
const example.MyApp(),
|
||||
const example.WidgetBindingObserverExampleApp(),
|
||||
);
|
||||
|
||||
expect(find.text('There are no AppLifecycleStates to show.'), findsOneWidget);
|
||||
|
||||
@@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
void main() {
|
||||
testWidgets('has two containers when wide', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.MyApp(),
|
||||
const example.LayoutBuilderExampleApp(),
|
||||
);
|
||||
|
||||
final Finder containerFinder = find.byType(Container);
|
||||
@@ -19,7 +19,7 @@ void main() {
|
||||
await tester.pumpWidget(
|
||||
ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 400),
|
||||
child: const example.MyApp(),
|
||||
child: const example.LayoutBuilderExampleApp(),
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('should update magnifier position on drag', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(const example.MyApp());
|
||||
await tester.pumpWidget(const example.MagnifierExampleApp());
|
||||
|
||||
Matcher isPositionedAt(Offset at) {
|
||||
return isA<Positioned>().having(
|
||||
@@ -40,7 +40,7 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets('should match golden', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(const example.MyApp());
|
||||
await tester.pumpWidget(const example.MagnifierExampleApp());
|
||||
|
||||
final Offset centerOfFlutterLogo = tester.getCenter(find.byType(Positioned));
|
||||
const Offset dragDistance = Offset(10, 10);
|
||||
|
||||
@@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
void main() {
|
||||
const String tooltipText = 'tooltip';
|
||||
testWidgets('Tooltip is shown on press', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(const example.MyApp());
|
||||
await tester.pumpWidget(const example.OverlayPortalExampleApp());
|
||||
expect(find.text(tooltipText), findsNothing);
|
||||
|
||||
await tester.tap(find.byType(example.ClickableTooltipWidget));
|
||||
@@ -22,11 +22,11 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets('Tooltip is shown at the right location', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(const example.MyApp());
|
||||
await tester.pumpWidget(const example.OverlayPortalExampleApp());
|
||||
await tester.tap(find.byType(example.ClickableTooltipWidget));
|
||||
await tester.pump();
|
||||
|
||||
final Size canvasSize = tester.getSize(find.byType(example.MyApp));
|
||||
final Size canvasSize = tester.getSize(find.byType(example.OverlayPortalExampleApp));
|
||||
expect(
|
||||
tester.getBottomRight(find.text(tooltipText)),
|
||||
canvasSize - const Size(50, 50),
|
||||
@@ -34,7 +34,7 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets('Tooltip is shown with the right font size', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(const example.MyApp());
|
||||
await tester.pumpWidget(const example.OverlayPortalExampleApp());
|
||||
await tester.tap(find.byType(example.ClickableTooltipWidget));
|
||||
await tester.pump();
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_api_samples/widgets/scroll_view/listview_select.1.dart'
|
||||
import 'package:flutter_api_samples/widgets/scroll_view/list_view.0.dart'
|
||||
as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
@@ -11,7 +11,7 @@ void main() {
|
||||
testWidgets('long press ListTile should enable edit mode',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.MyApp(),
|
||||
const example.ListViewExampleApp(),
|
||||
);
|
||||
|
||||
final Finder listView = find.byType(ListView);
|
||||
@@ -29,7 +29,7 @@ void main() {
|
||||
testWidgets('Pressing cross button should disable edit mode',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.MyApp(),
|
||||
const example.ListViewExampleApp(),
|
||||
);
|
||||
|
||||
final Finder listView = find.byType(ListView);
|
||||
@@ -52,7 +52,7 @@ void main() {
|
||||
testWidgets('tapping ListTile or checkBox should toggle ListTile state',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.MyApp(),
|
||||
const example.ListViewExampleApp(),
|
||||
);
|
||||
|
||||
final Finder listView = find.byType(ListView);
|
||||
@@ -10,7 +10,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
void main() {
|
||||
testWidgets('SliverOpacity example', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.MyApp(),
|
||||
const example.SliverOpacityExampleApp(),
|
||||
);
|
||||
|
||||
final Finder button = find.byType(FloatingActionButton);
|
||||
|
||||
@@ -84,13 +84,13 @@ void main() {
|
||||
}
|
||||
|
||||
testWidgets('should show custom magnifier on drag', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(const example.MyApp(text: defaultText));
|
||||
await tester.pumpWidget(const example.TextMagnifierExampleApp(text: defaultText));
|
||||
|
||||
await showMagnifier(tester, 'e');
|
||||
expect(find.byType(example.CustomMagnifier), findsOneWidget);
|
||||
|
||||
await expectLater(
|
||||
find.byType(example.MyApp),
|
||||
find.byType(example.TextMagnifierExampleApp),
|
||||
matchesGoldenFile('text_magnifier.0_test.png'),
|
||||
);
|
||||
}, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.android }));
|
||||
@@ -101,7 +101,7 @@ void main() {
|
||||
final String text = textDirection == TextDirection.rtl ? 'أثارت زر' : defaultText;
|
||||
final String textToTapOn = textDirection == TextDirection.rtl ? 'ت' : 'e';
|
||||
|
||||
await tester.pumpWidget(example.MyApp(textDirection: textDirection, text: text));
|
||||
await tester.pumpWidget(example.TextMagnifierExampleApp(textDirection: textDirection, text: text));
|
||||
|
||||
await showMagnifier(tester, textToTapOn);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
void main() {
|
||||
testWidgets('pressing shouldPop button changes shouldPop', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.MyApp(),
|
||||
const example.WillPopScopeExampleApp(),
|
||||
);
|
||||
|
||||
final Finder buttonFinder = find.text('shouldPop: true');
|
||||
@@ -19,14 +19,14 @@ void main() {
|
||||
});
|
||||
testWidgets('pressing Push button pushes route', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.MyApp(),
|
||||
const example.WillPopScopeExampleApp(),
|
||||
);
|
||||
|
||||
final Finder buttonFinder = find.text('Push');
|
||||
expect(buttonFinder, findsOneWidget);
|
||||
expect(find.byType(example.MyStatefulWidget), findsOneWidget);
|
||||
expect(find.byType(example.WillPopScopeExample), findsOneWidget);
|
||||
await tester.tap(buttonFinder);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byType(example.MyStatefulWidget, skipOffstage: false), findsNWidgets(2));
|
||||
expect(find.byType(example.WillPopScopeExample, skipOffstage: false), findsNWidgets(2));
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user