Unverified Commit 1bcaf940 authored by Greg Spencer's avatar Greg Spencer Committed by GitHub

Fix nullability warnings in routes_test (#67694)

parent f92ba2d2
...@@ -57,7 +57,7 @@ class TestRoute extends Route<String?> with LocalHistoryRoute<String?> { ...@@ -57,7 +57,7 @@ class TestRoute extends Route<String?> with LocalHistoryRoute<String?> {
@override @override
void didReplace(Route<dynamic>? oldRoute) { void didReplace(Route<dynamic>? oldRoute) {
expect(oldRoute, isA<TestRoute>()); expect(oldRoute, isA<TestRoute>());
final TestRoute castRoute = oldRoute as TestRoute; final TestRoute castRoute = oldRoute! as TestRoute;
log('didReplace ${castRoute.name}'); log('didReplace ${castRoute.name}');
super.didReplace(castRoute); super.didReplace(castRoute);
} }
...@@ -667,7 +667,7 @@ void main() { ...@@ -667,7 +667,7 @@ void main() {
); );
await tester.pump(); await tester.pump();
await tester.pumpAndSettle(); await tester.pumpAndSettle();
final ProxyAnimation secondaryAnimationPageOne = secondaryAnimationProxyPageOne.parent as ProxyAnimation; final ProxyAnimation secondaryAnimationPageOne = secondaryAnimationProxyPageOne.parent! as ProxyAnimation;
expect(animationPageOne.value, 1.0); expect(animationPageOne.value, 1.0);
expect(secondaryAnimationPageOne.parent, kAlwaysDismissedAnimation); expect(secondaryAnimationPageOne.parent, kAlwaysDismissedAnimation);
...@@ -686,7 +686,7 @@ void main() { ...@@ -686,7 +686,7 @@ void main() {
); );
await tester.pump(); await tester.pump();
await tester.pumpAndSettle(); await tester.pumpAndSettle();
final ProxyAnimation secondaryAnimationPageTwo = secondaryAnimationProxyPageTwo.parent as ProxyAnimation; final ProxyAnimation secondaryAnimationPageTwo = secondaryAnimationProxyPageTwo.parent! as ProxyAnimation;
expect(animationPageTwo.value, 1.0); expect(animationPageTwo.value, 1.0);
expect(secondaryAnimationPageTwo.parent, kAlwaysDismissedAnimation); expect(secondaryAnimationPageTwo.parent, kAlwaysDismissedAnimation);
expect(secondaryAnimationPageOne.parent, animationPageTwo.parent); expect(secondaryAnimationPageOne.parent, animationPageTwo.parent);
...@@ -725,7 +725,7 @@ void main() { ...@@ -725,7 +725,7 @@ void main() {
); );
await tester.pump(); await tester.pump();
await tester.pumpAndSettle(); await tester.pumpAndSettle();
final ProxyAnimation secondaryAnimationPageOne = secondaryAnimationProxyPageOne.parent as ProxyAnimation; final ProxyAnimation secondaryAnimationPageOne = secondaryAnimationProxyPageOne.parent! as ProxyAnimation;
expect(animationPageOne.value, 1.0); expect(animationPageOne.value, 1.0);
expect(secondaryAnimationPageOne.parent, kAlwaysDismissedAnimation); expect(secondaryAnimationPageOne.parent, kAlwaysDismissedAnimation);
...@@ -745,7 +745,7 @@ void main() { ...@@ -745,7 +745,7 @@ void main() {
); );
await tester.pump(); await tester.pump();
await tester.pumpAndSettle(); await tester.pumpAndSettle();
final ProxyAnimation secondaryAnimationPageTwo = secondaryAnimationProxyPageTwo.parent as ProxyAnimation; final ProxyAnimation secondaryAnimationPageTwo = secondaryAnimationProxyPageTwo.parent! as ProxyAnimation;
expect(animationPageTwo.value, 1.0); expect(animationPageTwo.value, 1.0);
expect(secondaryAnimationPageTwo.parent, kAlwaysDismissedAnimation); expect(secondaryAnimationPageTwo.parent, kAlwaysDismissedAnimation);
expect(secondaryAnimationPageOne.parent, animationPageTwo.parent); expect(secondaryAnimationPageOne.parent, animationPageTwo.parent);
...@@ -780,7 +780,7 @@ void main() { ...@@ -780,7 +780,7 @@ void main() {
); );
await tester.pump(); await tester.pump();
await tester.pumpAndSettle(); await tester.pumpAndSettle();
final ProxyAnimation secondaryAnimationPageOne = secondaryAnimationProxyPageOne.parent as ProxyAnimation; final ProxyAnimation secondaryAnimationPageOne = secondaryAnimationProxyPageOne.parent! as ProxyAnimation;
expect(animationPageOne.value, 1.0); expect(animationPageOne.value, 1.0);
expect(secondaryAnimationPageOne.parent, kAlwaysDismissedAnimation); expect(secondaryAnimationPageOne.parent, kAlwaysDismissedAnimation);
...@@ -813,7 +813,7 @@ void main() { ...@@ -813,7 +813,7 @@ void main() {
await tester.pump(); await tester.pump();
await tester.pump(const Duration(milliseconds: 1)); await tester.pump(const Duration(milliseconds: 1));
expect(secondaryAnimationPageOne.parent, isA<TrainHoppingAnimation>()); expect(secondaryAnimationPageOne.parent, isA<TrainHoppingAnimation>());
final TrainHoppingAnimation trainHopper = secondaryAnimationPageOne.parent as TrainHoppingAnimation; final TrainHoppingAnimation trainHopper = secondaryAnimationPageOne.parent! as TrainHoppingAnimation;
expect(trainHopper.currentTrain, animationPageTwo.parent); expect(trainHopper.currentTrain, animationPageTwo.parent);
await tester.pump(const Duration(milliseconds: 100)); await tester.pump(const Duration(milliseconds: 100));
expect(secondaryAnimationPageOne.parent, isNot(isA<TrainHoppingAnimation>())); expect(secondaryAnimationPageOne.parent, isNot(isA<TrainHoppingAnimation>()));
...@@ -852,7 +852,7 @@ void main() { ...@@ -852,7 +852,7 @@ void main() {
); );
await tester.pump(); await tester.pump();
await tester.pumpAndSettle(); await tester.pumpAndSettle();
final ProxyAnimation secondaryAnimationPageOne = secondaryAnimationProxyPageOne.parent as ProxyAnimation; final ProxyAnimation secondaryAnimationPageOne = secondaryAnimationProxyPageOne.parent! as ProxyAnimation;
expect(animationPageOne.value, 1.0); expect(animationPageOne.value, 1.0);
expect(secondaryAnimationPageOne.parent, kAlwaysDismissedAnimation); expect(secondaryAnimationPageOne.parent, kAlwaysDismissedAnimation);
...@@ -883,14 +883,14 @@ void main() { ...@@ -883,14 +883,14 @@ void main() {
await tester.pump(); await tester.pump();
await tester.pump(const Duration(milliseconds: 10)); await tester.pump(const Duration(milliseconds: 10));
expect(secondaryAnimationPageOne.parent, isA<TrainHoppingAnimation>()); expect(secondaryAnimationPageOne.parent, isA<TrainHoppingAnimation>());
final TrainHoppingAnimation trainHopper = secondaryAnimationPageOne.parent as TrainHoppingAnimation; final TrainHoppingAnimation trainHopper = secondaryAnimationPageOne.parent! as TrainHoppingAnimation;
expect(trainHopper.currentTrain, animationPageTwo.parent); expect(trainHopper.currentTrain, animationPageTwo.parent);
// Pop page three while replacement push is ongoing. // Pop page three while replacement push is ongoing.
navigator.currentState!.pop(); navigator.currentState!.pop();
await tester.pump(); await tester.pump();
expect(secondaryAnimationPageOne.parent, isA<TrainHoppingAnimation>()); expect(secondaryAnimationPageOne.parent, isA<TrainHoppingAnimation>());
final TrainHoppingAnimation trainHopper2 = secondaryAnimationPageOne.parent as TrainHoppingAnimation; final TrainHoppingAnimation trainHopper2 = secondaryAnimationPageOne.parent! as TrainHoppingAnimation;
expect(trainHopper2.currentTrain, animationPageTwo.parent); expect(trainHopper2.currentTrain, animationPageTwo.parent);
expect(trainHopper.currentTrain, isNull); // Has been disposed. expect(trainHopper.currentTrain, isNull); // Has been disposed.
await tester.pumpAndSettle(); await tester.pumpAndSettle();
......
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