Skip to content

Conversation

@stuartmorgan-g
Copy link
Collaborator

Updates image_picker_ios to use the same test structure that image_picker_android already uses:

  • Removes the use of Pigeon's Dart test generator in favor of DI'ing an implementation of the actual generated Dart API.
  • Removes the use of the old method channel logger (which was adapted in place during the Pigeon conversion to minimize test changes in the PR that changed the implementation; the fact that it was still being used was tech debt), in favor of structured storage of passed arguments that can be queried directly. This makes tests much shorter and easier to understand and maintain, because if we want to check one parameter in a targeted test, we don't have to assert the entire argument dictionary.
  • Adds some missing test functionality (e.g., we didn't have tests of any of the non-null return value handling), and removes some duplicate testing (e.g., every possible combination of null and non-null width, hight, and image quality in on giant test).

Also does minor cleanup of image_picker_android; this conversion had already been done there, but it was still generating an unused dartTestOut.

Part of flutter/flutter#159886

Pre-Review Checklist

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2 3

@stuartmorgan-g stuartmorgan-g added override: no versioning needed Override the check requiring version bumps for most changes override: no changelog needed Override the check requiring CHANGELOG updates for most changes labels Oct 29, 2025
@stuartmorgan-g
Copy link
Collaborator Author

CHANGELOG/version overrides: While technically there is a production code change here, it's just adding an optional, visibible-only-for-tests parameter, and moving one ivar initialization from the declaration to the constructor, so it's pretty clearly a no-op.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request is a significant improvement, refactoring the image_picker_ios tests to remove the dependency on Pigeon's Dart test generator and align with the image_picker_android implementation. The introduction of dependency injection with a fake API mock makes the tests much cleaner, more focused, and easier to maintain. The removal of the old method call logger and the addition of more granular tests are excellent changes. My review includes a few minor suggestions to make the new tests even more precise by removing or adjusting assertions that check for parameters not relevant to the specific method being tested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

override: no changelog needed Override the check requiring CHANGELOG updates for most changes override: no versioning needed Override the check requiring version bumps for most changes p: image_picker platform-android platform-ios

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant