[image_picker] Add native tests for image, metadata, photo-asset, and PHPicker save utilities (#12536) Adds native unit tests for previously untested paths in `FLTImagePickerImageUtil`, `FLTImagePickerMetaDataUtil`, `FLTImagePickerPhotoAssetUtil`, and `FLTPHPickerSaveImageToPathOperation` before the Objective-C → Swift migration. Production code is unchanged. This is a tests-only change, so it does not bump the package version or CHANGELOG. Native `RunnerTests` go from 72 tests to 88 tests (+16). ### New test cases **`ImageUtilTests`:** - `testScaledGIFImage_UsesClampedDelayWhenUnclampedDelayMissing` — GIF scaling uses the clamped delay when unclamped delay is missing **`MetaDataUtilTests`:** - `testGetImageMIMETypeFromImageDataUnknownReturnsOther` — unrecognized image bytes map to the Other MIME type - `testConvertImageIgnoresQualityForPNG` — PNG conversion ignores JPEG quality and stays PNG - `testConvertImageDefaultsNonJPEGNonPNGToJPEG` — GIF and other non-JPEG/PNG data convert to JPEG **`PhotoAssetUtilTests`:** - `testGetAssetFromImagePickerInfoShouldReturnNilIfNotAvailable` — picker info without a PHAsset returns `nil` - `testGetAssetFromImagePickerInfoShouldReturnAssetIfPresent` — picker info with a PHAsset returns that asset - `testSaveVideoFromURLReturnsNilWhenSourceIsUnreadable` — missing source file returns `nil` - `testSaveVideoFromURLCopiesReadableFile` — a readable video is copied to a new path - `testSaveVideoFromURLReturnsNilWhenCopyFails` — copy failure returns `nil` - `testSaveImageWithOriginalImageDataNilUsesDefaultJPEG` — `nil` original data saves as `.jpg` - `testCreateFileReturnsPathWhenWriteFails` — create-file still returns a path when the write fails **`PickerSaveImageToPathOperationTests`:** - `testInitWithNilResultReturnsNil` — `nil` PHPicker result does not create an operation - `testStartWhenCancelledFinishesWithoutSaving` — a cancelled operation finishes without calling the save callback - `testSaveVideoCopiesFile` — a video item is copied to the saved path - `testSaveVideoFailsWhenLoadReturnsError` — a load error is reported as `invalid_image` - `testSaveVideoFailsWhenCopyFails` — a copy error is reported as `flutter_image_picker_copy_video_error` First part of `image_picker_ios` coverage backfill before the Obj-C → Swift migration for https://github.com/flutter/flutter/issues/119107 ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^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.
This repo is a companion repo to the main flutter repo. It contains the source code for Flutter's first-party packages (i.e., packages developed by the core Flutter team). Check the packages directory to see all packages.
These packages are also available on pub.
Please file any issues, bugs, or feature requests in the main flutter repo. Issues pertaining to this repository are labeled “package”.
If you wish to contribute a new package to the Flutter ecosystem, please see the documentation for developing packages. You can store your package source code in any GitHub repository (the present repo is only intended for packages developed by the core Flutter team). Once your package is ready you can publish to the pub repository.
If you wish to contribute a change to any of the existing packages in this repo, please review our contribution guide, and send a pull request.
These are the packages hosted in this repository: