Skip to content

Conversation

@stuartmorgan-g
Copy link
Collaborator

Updates file_selector_ios, _macos, and _windows tests to use the same structure as file_selector_linux 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 mockito in favor of a fake, since the fake is extremely simple to maintain and it makes the tests simpler.

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 28, 2025
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 refactors the tests for file_selector_ios, file_selector_macos, and file_selector_windows to remove the dependency on Pigeon's Dart test generator and the mockito package. This is achieved by introducing dependency injection for the platform-specific FileSelectorApi and using a simple fake implementation in tests. This change simplifies the test setup, reduces dependencies, and removes generated test files, improving the overall maintainability of the codebase. The changes are consistent across all affected packages and I've noted one opportunity for improvement.

@stuartmorgan-g
Copy link
Collaborator Author

CHANGELOG/version overrides: While technically there is 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.

final bool? selectMultiple;
}

@HostApi(dartHostTestHandler: 'TestFileSelectorApi')
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This wasn't being used, it was just copypasta from some other platform, which is why there are no other changes to file_selector_linux.

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: file_selector platform-ios platform-linux platform-macos platform-windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant