Add test for page_storage.0.dart
(#157770)
Contributes to https://github.com/flutter/flutter/issues/130459 It adds a test for - `examples/api/lib/widgets/page_storage/page_storage.0.dart`
This commit is contained in:
parent
662bac8f37
commit
55fa5ae07f
@ -314,7 +314,6 @@ final Set<String> _knownMissingTests = <String>{
|
||||
'examples/api/test/widgets/media_query/media_query_data.system_gesture_insets.0_test.dart',
|
||||
'examples/api/test/widgets/image/image.frame_builder.0_test.dart',
|
||||
'examples/api/test/widgets/image/image.loading_builder.0_test.dart',
|
||||
'examples/api/test/widgets/page_storage/page_storage.0_test.dart',
|
||||
'examples/api/test/widgets/scrollbar/raw_scrollbar.1_test.dart',
|
||||
'examples/api/test/widgets/scrollbar/raw_scrollbar.2_test.dart',
|
||||
'examples/api/test/widgets/scrollbar/raw_scrollbar.desktop.0_test.dart',
|
||||
|
@ -0,0 +1,39 @@
|
||||
// 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_api_samples/widgets/page_storage/page_storage.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Can choose to stay on page', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.PageStorageExampleApp(),
|
||||
);
|
||||
|
||||
expect(find.widgetWithText(AppBar, 'Persistence Example'), findsOne);
|
||||
|
||||
expect(find.text('0'), findsOne);
|
||||
|
||||
await tester.scrollUntilVisible(find.text('10'), 100);
|
||||
|
||||
expect(find.text('0'), findsNothing);
|
||||
|
||||
await tester.tap(find.byIcon(Icons.settings));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('0'), findsOne);
|
||||
await tester.scrollUntilVisible(find.text('20'), 100);
|
||||
|
||||
await tester.tap(find.byIcon(Icons.home));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('10'), findsOne);
|
||||
|
||||
await tester.tap(find.byIcon(Icons.settings));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('20'), findsOne);
|
||||
});
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user