-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Add smoke tests for all the examples, fix 17 broken examples. #89021
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
778ba40 to
d8d07fd
Compare
854382c to
24e48fc
Compare
cb0f5df to
56c6ae4
Compare
149dfaf to
ea09a18
Compare
4644b71 to
aa9b7e5
Compare
179d984 to
a2b3a97
Compare
dev/tools/examples_smoke_test.dart
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL about exitCode. Is this equivalent to exit(4);?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, except that it allows for a clean shutdown. If you call exit(4), then if the main is wrapped (e.g. in an integration test) then the test shutdown doesn't occur cleanly (it just exits the app immediately), and not all results are reported.
dev/tools/examples_smoke_test.dart
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does the glob and path separator work on windows?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, in git it does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh, so the glob is expanded by git?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice.
christopherfujino
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Piinks
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after confirming test coverage, but I think since the sample code tests exposed those issues, I am guessing they provide test coverage
dev/ci/docker_linux/Dockerfile
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: this can be updated further
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, good point. Done.
dev/tools/examples_smoke_test.dart
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a test for this? Or does the sample code test cover it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There wasn't a test. This failed because List<int> wasn't castable to Null, and if there isn't anything to drain, it tries to do that (the docs say "The [futureValue] must not be omitted if null is not assignable to [E].", and it was omitting the return value). The example smoke test doesn't cover this, I just found it when I was playing with one of the examples.
I modified the Fake implementation in image_provider_network_image_test.dart to mirror the implementation in Stream (since the fake "implements" it, not derives from it) to make sure that NetworkImage always passes something to drain. It fails before, and passes now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, does this need a test? Or does the sample code test ensure this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a test for this, which needed to be done, since there wasn't any test at all for RelativePositionedTransition. The test uses a RectTween, which is an Animation<Rect?>, so it exercises this issue.
This was just a null-saftey conversion error: it's silly to not be able to use a RectTween with this. Probably happened because there was no test at all.
a2b3a97 to
3b6d43e
Compare
93e9b9b to
4529372
Compare
…r#89021) This adds a smoke test for every single API example. It also fixes 17 tests that had bugs in them, or were otherwise broken, and even fixes one actual bug in the framework, and one limitation in the framework. The bug in the framework is that NetworkImage's _loadAsync method had await response.drain<List<int>>();, but if the response is null, it will throw a cryptic exception saying that Null can't be assigned to List<int>. The fix was just to use await response.drain<void>(); instead. The limitation is that RelativePositionedTransition takes an Animation<Rect> rect parameter, and if you want to use a RectTween with it, the value emitted there is Rect?, and one of the examples was just casting from Animation<Rect> to Animation<Rect?>, which is invalid, so I modified RelativePositionedTransition to take a Rect? and just use Rect.zero if the rect is null.
Description
This adds a smoke test for every single API example. It also fixes 17 tests that had bugs in them, or were otherwise broken, and even fixes one actual bug in the framework, and one limitation in the framework.
The bug in the framework is that
NetworkImage's_loadAsyncmethod hadawait response.drain<List<int>>();, but if the response is null, it will throw a cryptic exception saying thatNullcan't be assigned toList<int>. The fix was just to useawait response.drain<void>();instead.The limitation is that
RelativePositionedTransitiontakes anAnimation<Rect> rectparameter, and if you want to use aRectTweenwith it, the value emitted there isRect?, and one of the examples was just casting fromAnimation<Rect>toAnimation<Rect?>, which is invalid, so I modifiedRelativePositionedTransitionto take aRect?and just useRect.zeroif therectis null.Epilepsy warning: the following image flickers a lot.
example_smoke.mp4
Related Issues
Tests