Migrate more tests to null safety #67360
Conversation
| expect(imageCache.statusForKey(provider).untracked, true); | ||
| expect(imageCache.pendingImageCount, 0); | ||
| expect(imageCache!.statusForKey(provider).untracked, true); | ||
| expect(imageCache!.pendingImageCount, 0); |
goderbauer
Oct 5, 2020
Author
Member
This expect is failing:
package:test_api expect
package:flutter_test/src/widget_tester.dart 429:3 expect
test/painting/image_provider_and_image_cache_test.dart 80:5 main.<fn>
Expected: <0>
Actual: <1>
I doesn't make sense to me why migrating this to NNBD would cause that... /cc @dnfield any idea?
This expect is failing:
package:test_api expect
package:flutter_test/src/widget_tester.dart 429:3 expect
test/painting/image_provider_and_image_cache_test.dart 80:5 main.<fn>
Expected: <0>
Actual: <1>
I doesn't make sense to me why migrating this to NNBD would cause that... /cc @dnfield any idea?
dnfield
Oct 5, 2020
Member
Why are we changing the completer from Completer<StateError> to Completer<void>?I don't see how that would cause this problem but it seems strange to me.
Why are we changing the completer from Completer<StateError> to Completer<void>?I don't see how that would cause this problem but it seems strange to me.
goderbauer
Oct 6, 2020
Author
Member
I think I got it, this test case was supposed to test this error case here:
flutter/packages/flutter/lib/src/painting/image_provider.dart
Lines 676 to 682
in
c8466d0
However, as the comment there says, with null-safety enabled, that error cannot happen anymore. Therefore deleting this test case.
I think I got it, this test case was supposed to test this error case here:
flutter/packages/flutter/lib/src/painting/image_provider.dart
Lines 676 to 682 in c8466d0
However, as the comment there says, with null-safety enabled, that error cannot happen anymore. Therefore deleting this test case.
| }, skip: isBrowser); // https://github.com/flutter/flutter/issues/56314 | ||
|
|
||
| test('AssetImageProvider - evicts on null load', () async { |
| final RadialGradient actual = RadialGradient.lerp(testGradient1, testGradient2, 0.5); | ||
|
|
||
| expect(actual.focal, isNull); | ||
| final RadialGradient? actual = RadialGradient.lerp(testGradient1, testGradient2, 0.5); |
dnfield
Oct 6, 2020
Member
nit: why not use ! and leave the null check as is?
nit: why not use ! and leave the null check as is?
goderbauer
Oct 6, 2020
Author
Member
either works :)
either works :)
| expect(imageCache.statusForKey(testImage).live, true); | ||
| expect(imageCache.statusForKey(testImage).keepAlive, false); | ||
| expect(imageCache.currentSizeBytes, 0); | ||
| imageCache!.putIfAbsent(testImage, () => completer1); |
dnfield
Oct 6, 2020
Member
Not for this PR, but all of this is making me think we should just be making the imageCache late non-nullable somehow.
Not for this PR, but all of this is making me think we should just be making the imageCache late non-nullable somehow.
|
LGTM |
b3bd9e6
into
flutter:master
dart-lang/sdk#40146
#62886