Skip to content

[camera]fix resolution test failure due to hardware restriction - #13356

Merged
auto-submit[bot] merged 1 commit into
flutter:mainfrom
hellohuanlin:camera_fix_resolution
Oct 20, 2026
Merged

auto-submit[bot] merged 1 commit into
flutter:mainfrom
hellohuanlin:camera_fix_resolution

Conversation

@hellohuanlin

@hellohuanlin hellohuanlin commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

This fixes a failure when running on iPhone 17.

The reason is:

case .low:
  if videoCaptureSession.canSetSessionPreset(.cif352x288) { ... break }
  fallthrough
default:
  if videoCaptureSession.canSetSessionPreset(.low) {
    videoCaptureSession.sessionPreset = .low   // size is up to the device

On iPhone 17, .cif352x288 is not supported, so it falls back to .low, which is 480p (480x640). This actually fails even before iOS 27, but we didn't catch it because it requires hardware device.

To prevent similar failures in the future, we shouldn't assume hardware capabilities (e.g. photo resolution). So I updated the test to verify photos in higher settings have relatively higher resolutions.

Note that I did not change Android - I think it was as fragile as iOS and could break in the future. However, unlike iOS, the Android tests do run on real devices in our CI, so we should be able to catch any failure if that happens, so I wouldn't be concerned about it.

List which issues are fixed by this PR. You must list at least one issue.
Fixes flutter/flutter#191202

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. 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.

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

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Oct 20, 2026

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

Copy link
Copy Markdown
Contributor

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 integration tests in camera_test.dart to verify that captured image and video sizes do not decrease as the requested resolution preset increases, replacing hardcoded expected sizes with a more flexible validation helper. Feedback from the review suggests wrapping the initialization and disposal of both CameraController and VideoPlayerController in try-finally blocks to prevent resource leaks in the event of an exception or assertion failure.

@hellohuanlin hellohuanlin added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 20, 2026
@auto-submit
auto-submit Bot merged commit 5b1f975 into flutter:main Oct 20, 2026
12 checks passed
ValentinVignal pushed a commit to ValentinVignal/flutter that referenced this pull request Oct 21, 2026
flutter/packages@618afba...1383427

2026-10-21 [email protected] [shared_preferences] Keep Kotlin
classes used through JNI in Android release builds
(flutter/packages#13311)
2026-10-20 [email protected] [webview_flutter_wkwebview] Roll back iOS
and macOS versions (flutter/packages#13354)
2026-10-20 [email protected] [camera]fix
resolution test failure due to hardware restriction
(flutter/packages#13356)
2026-10-20 [email protected] [google_maps_flutter_web] Fail fast and
deduplicate map setup in integration tests (flutter/packages#13092)
2026-10-20 [email protected] [camera_avfoundation] Fix Swift analyzer
issues in tests (flutter/packages#13340)
2026-10-20 [email protected] Sync release-material_ui-1.8.0 to
main (flutter/packages#13346)
2026-10-20 [email protected] [material_ui] add a `barFocusNode` to
`SearchAnchor.bar` (ref: flutter#186073)
(flutter/packages#12863)
2026-10-20 [email protected] [in_app_purchase_storekit] Expose
sk2Transaction on SK2PurchaseDetails (flutter/packages#13341)
2026-10-20 [email protected] Sync release-cupertino_ui-1.1.4 to
main (flutter/packages#13350)
2026-10-20 [email protected] [google_maps_flutter_web] Don't hang
`onMapCreated` when tiles fail to load (flutter/packages#13059)
2026-10-20 [email protected] [material_ui]
Unskip web tests that pass on CanvasKit and Skwasm:
adaptive_text_selection_toolbar_test, material_button_test,
outlined_button_test, text_button_test (flutter/packages#13335)
2026-10-20 [email protected] Sync release-go_router-18.1.1 to
main (flutter/packages#13347)
2026-10-20 [email protected] [camera] Add zero-shutter-lag support
to camera_android_camerax and camera_avfoundation
(flutter/packages#13199)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
LongCatIsLooong pushed a commit to LongCatIsLooong/flutter that referenced this pull request Oct 22, 2026
flutter/packages@618afba...1383427

2026-10-21 [email protected] [shared_preferences] Keep Kotlin
classes used through JNI in Android release builds
(flutter/packages#13311)
2026-10-20 [email protected] [webview_flutter_wkwebview] Roll back iOS
and macOS versions (flutter/packages#13354)
2026-10-20 [email protected] [camera]fix
resolution test failure due to hardware restriction
(flutter/packages#13356)
2026-10-20 [email protected] [google_maps_flutter_web] Fail fast and
deduplicate map setup in integration tests (flutter/packages#13092)
2026-10-20 [email protected] [camera_avfoundation] Fix Swift analyzer
issues in tests (flutter/packages#13340)
2026-10-20 [email protected] Sync release-material_ui-1.8.0 to
main (flutter/packages#13346)
2026-10-20 [email protected] [material_ui] add a `barFocusNode` to
`SearchAnchor.bar` (ref: flutter#186073)
(flutter/packages#12863)
2026-10-20 [email protected] [in_app_purchase_storekit] Expose
sk2Transaction on SK2PurchaseDetails (flutter/packages#13341)
2026-10-20 [email protected] Sync release-cupertino_ui-1.1.4 to
main (flutter/packages#13350)
2026-10-20 [email protected] [google_maps_flutter_web] Don't hang
`onMapCreated` when tiles fail to load (flutter/packages#13059)
2026-10-20 [email protected] [material_ui]
Unskip web tests that pass on CanvasKit and Skwasm:
adaptive_text_selection_toolbar_test, material_button_test,
outlined_button_test, text_button_test (flutter/packages#13335)
2026-10-20 [email protected] Sync release-go_router-18.1.1 to
main (flutter/packages#13347)
2026-10-20 [email protected] [camera] Add zero-shutter-lag support
to camera_android_camerax and camera_avfoundation
(flutter/packages#13199)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
suryaKommana2662 pushed a commit to suryaKommana2662/flutter that referenced this pull request Oct 29, 2026
flutter/packages@618afba...1383427

2026-10-21 [email protected] [shared_preferences] Keep Kotlin
classes used through JNI in Android release builds
(flutter/packages#13311)
2026-10-20 [email protected] [webview_flutter_wkwebview] Roll back iOS
and macOS versions (flutter/packages#13354)
2026-10-20 [email protected] [camera]fix
resolution test failure due to hardware restriction
(flutter/packages#13356)
2026-10-20 [email protected] [google_maps_flutter_web] Fail fast and
deduplicate map setup in integration tests (flutter/packages#13092)
2026-10-20 [email protected] [camera_avfoundation] Fix Swift analyzer
issues in tests (flutter/packages#13340)
2026-10-20 [email protected] Sync release-material_ui-1.8.0 to
main (flutter/packages#13346)
2026-10-20 [email protected] [material_ui] add a `barFocusNode` to
`SearchAnchor.bar` (ref: flutter#186073)
(flutter/packages#12863)
2026-10-20 [email protected] [in_app_purchase_storekit] Expose
sk2Transaction on SK2PurchaseDetails (flutter/packages#13341)
2026-10-20 [email protected] Sync release-cupertino_ui-1.1.4 to
main (flutter/packages#13350)
2026-10-20 [email protected] [google_maps_flutter_web] Don't hang
`onMapCreated` when tiles fail to load (flutter/packages#13059)
2026-10-20 [email protected] [material_ui]
Unskip web tests that pass on CanvasKit and Skwasm:
adaptive_text_selection_toolbar_test, material_button_test,
outlined_button_test, text_button_test (flutter/packages#13335)
2026-10-20 [email protected] Sync release-go_router-18.1.1 to
main (flutter/packages#13347)
2026-10-20 [email protected] [camera] Add zero-shutter-lag support
to camera_android_camerax and camera_avfoundation
(flutter/packages#13199)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App CICD Run CI/CD p: camera platform-ios platform-macos

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[iOS 27] camera_avfoundation integration tests fail for image/video resolution and image output format

2 participants