Skip to content
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

Permit a null response in TextureAndroidViewController #139151

Closed

Conversation

johnmccutchan
Copy link
Contributor

When running under a unit test environment the platform view create method will return null (because there is no implementation). Relax the type check to permit a null response.

When running under a unit test environment the platform view create method
will return null (because there is no implementation). Relax the type
check to permit a null response.
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie or stuartmorgan on the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@github-actions github-actions bot added the framework flutter/packages/flutter repository. See also f: labels. label Nov 28, 2023
@johnmccutchan
Copy link
Contributor Author

This is necessary to land flutter/packages#5408

if (response is int) {
_internals.textureId = response;
} else {
assert(response == null, 'response will be null when running under test');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relaxing production code requirements to satisfy tests is kind of worrying. Why can't we do a dummy channel response in the unit tests?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is a trivial example of that, if it helps. A more complex version could check the call details and return an appropriate fake response.

@stuartmorgan
Copy link
Contributor

This is necessary to land flutter/packages#5408

That would mean delaying that PR by months, which would be another argument for mocking things out in tests instead.

@johnmccutchan
Copy link
Contributor Author

This is necessary to land flutter/packages#5408

That would mean delaying that PR by months, which would be another argument for mocking things out in tests instead.

How so? flutter/packages is tested against stable releases of Flutter and not head?

@stuartmorgan
Copy link
Contributor

How so? flutter/packages is tested against stable releases of Flutter and not head?

It's tested against both, due to https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#supported-flutter-versions

@johnmccutchan
Copy link
Contributor Author

Given the testing policy, I am abandoning this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants