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