Unverified Commit 71acf242 authored by derdilla's avatar derdilla Committed by GitHub

leak track page_test.dart (#135352)

parent f610b9c3
...@@ -4,9 +4,10 @@ ...@@ -4,9 +4,10 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
void main() { void main() {
testWidgets('test iOS page transition (LTR)', (WidgetTester tester) async { testWidgetsWithLeakTracking('test iOS page transition (LTR)', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
CupertinoApp( CupertinoApp(
onGenerateRoute: (RouteSettings settings) { onGenerateRoute: (RouteSettings settings) {
...@@ -79,7 +80,7 @@ void main() { ...@@ -79,7 +80,7 @@ void main() {
expect(widget1InitialTopLeft, equals(widget1TransientTopLeft)); expect(widget1InitialTopLeft, equals(widget1TransientTopLeft));
}); });
testWidgets('test iOS page transition (RTL)', (WidgetTester tester) async { testWidgetsWithLeakTracking('test iOS page transition (RTL)', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
CupertinoApp( CupertinoApp(
localizationsDelegates: const <LocalizationsDelegate<dynamic>>[ localizationsDelegates: const <LocalizationsDelegate<dynamic>>[
...@@ -150,7 +151,7 @@ void main() { ...@@ -150,7 +151,7 @@ void main() {
expect(widget1InitialTopLeft, equals(widget1TransientTopLeft)); expect(widget1InitialTopLeft, equals(widget1TransientTopLeft));
}); });
testWidgets('test iOS fullscreen dialog transition', (WidgetTester tester) async { testWidgetsWithLeakTracking('test iOS fullscreen dialog transition', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
const CupertinoApp( const CupertinoApp(
home: Center(child: Text('Page 1')), home: Center(child: Text('Page 1')),
...@@ -210,7 +211,7 @@ void main() { ...@@ -210,7 +211,7 @@ void main() {
expect(widget1InitialTopLeft, equals(widget1TransientTopLeft)); expect(widget1InitialTopLeft, equals(widget1TransientTopLeft));
}); });
testWidgets('test only edge swipes work (LTR)', (WidgetTester tester) async { testWidgetsWithLeakTracking('test only edge swipes work (LTR)', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
CupertinoApp( CupertinoApp(
onGenerateRoute: (RouteSettings settings) { onGenerateRoute: (RouteSettings settings) {
...@@ -271,7 +272,7 @@ void main() { ...@@ -271,7 +272,7 @@ void main() {
expect(find.text('Page 2'), isOnstage); expect(find.text('Page 2'), isOnstage);
}); });
testWidgets('test edge swipes work with media query padding (LTR)', (WidgetTester tester) async { testWidgetsWithLeakTracking('test edge swipes work with media query padding (LTR)', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
CupertinoApp( CupertinoApp(
builder: (BuildContext context, Widget? navigator) { builder: (BuildContext context, Widget? navigator) {
...@@ -315,7 +316,7 @@ void main() { ...@@ -315,7 +316,7 @@ void main() {
expect(find.text('Page 2'), isOnstage); expect(find.text('Page 2'), isOnstage);
}); });
testWidgets('test edge swipes work with media query padding (RLT)', (WidgetTester tester) async { testWidgetsWithLeakTracking('test edge swipes work with media query padding (RLT)', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
CupertinoApp( CupertinoApp(
builder: (BuildContext context, Widget? navigator) { builder: (BuildContext context, Widget? navigator) {
...@@ -363,7 +364,7 @@ void main() { ...@@ -363,7 +364,7 @@ void main() {
expect(find.text('Page 2'), isOnstage); expect(find.text('Page 2'), isOnstage);
}); });
testWidgets('test only edge swipes work (RTL)', (WidgetTester tester) async { testWidgetsWithLeakTracking('test only edge swipes work (RTL)', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
CupertinoApp( CupertinoApp(
localizationsDelegates: const <LocalizationsDelegate<dynamic>>[ localizationsDelegates: const <LocalizationsDelegate<dynamic>>[
...@@ -428,7 +429,7 @@ void main() { ...@@ -428,7 +429,7 @@ void main() {
expect(find.text('Page 2'), isOnstage); expect(find.text('Page 2'), isOnstage);
}); });
testWidgets('test edge swipe then drop back at starting point works', (WidgetTester tester) async { testWidgetsWithLeakTracking('test edge swipe then drop back at starting point works', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
CupertinoApp( CupertinoApp(
onGenerateRoute: (RouteSettings settings) { onGenerateRoute: (RouteSettings settings) {
...@@ -463,7 +464,7 @@ void main() { ...@@ -463,7 +464,7 @@ void main() {
expect(find.text('Page 2'), isOnstage); expect(find.text('Page 2'), isOnstage);
}); });
testWidgets('CupertinoPage does not lose its state when transitioning out', (WidgetTester tester) async { testWidgetsWithLeakTracking('CupertinoPage does not lose its state when transitioning out', (WidgetTester tester) async {
final GlobalKey<NavigatorState> navigator = GlobalKey<NavigatorState>(); final GlobalKey<NavigatorState> navigator = GlobalKey<NavigatorState>();
await tester.pumpWidget(KeepsStateTestWidget(navigatorKey: navigator)); await tester.pumpWidget(KeepsStateTestWidget(navigatorKey: navigator));
expect(find.text('subpage'), findsOneWidget); expect(find.text('subpage'), findsOneWidget);
...@@ -476,7 +477,7 @@ void main() { ...@@ -476,7 +477,7 @@ void main() {
expect(find.text('home'), findsOneWidget); expect(find.text('home'), findsOneWidget);
}); });
testWidgets('CupertinoPage restores its state', (WidgetTester tester) async { testWidgetsWithLeakTracking('CupertinoPage restores its state', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
RootRestorationScope( RootRestorationScope(
restorationId: 'root', restorationId: 'root',
...@@ -610,6 +611,12 @@ class _TestRestorableWidgetState extends State<TestRestorableWidget> with Restor ...@@ -610,6 +611,12 @@ class _TestRestorableWidgetState extends State<TestRestorableWidget> with Restor
registerForRestoration(counter, 'counter'); registerForRestoration(counter, 'counter');
} }
@override
void dispose() {
super.dispose();
counter.dispose();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return Column(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment