Repository navigation
Commit 759473e
authored
[camera_avfoundation] Fix Swift analyzer issues in tests (flutter#13340)
I don't know why these analyzer issues are being reported one-at-a-time in CI on flutter/packages#13284 instead of all at once, but flutter/packages#13332 was only one of a few analyzer issues:
```
darwin/Tests/CameraSessionPresetsTests.swift:28:9: error: variable 'currentFormat' was never mutated; consider changing to 'let' constant
var currentFormat: CaptureDeviceFormat = captureFormatMock
~~~ ^
let
darwin/Tests/CameraInitRaceConditionsTests.swift:62:24: warning: immutable value '_captureSessionQueue' was never used; consider replacing with '_' or removing it [#NoUsage]
60 |
61 | func testFlutterChannelInitializedWhenStartingImageStream() {
62 | let (cameraPlugin, _captureSessionQueue) = createCameraPlugin()
darwin/Tests/AvailableCamerasTests.swift:49:11: warning: variable 'requiredTypes' was never mutated; consider changing to 'let' constant [#VariableNeverMutated]
47 | telephotoCamera.position = .back
48 |
49 | var requiredTypes: [AVCaptureDevice.DeviceType] = [
darwin/Tests/AvailableCamerasTests.swift:52:11: warning: variable 'cameras' was never mutated; consider changing to 'let' constant [#VariableNeverMutated]
50 | .builtInWideAngleCamera, .builtInTelephotoCamera, .builtInUltraWideCamera,
51 | ]
52 | var cameras = [wideAngleCamera, frontFacingCamera, telephotoCamera, ultraWideCamera]
darwin/Tests/AvailableCamerasTests.swift:86:11: warning: variable 'requiredTypes' was never mutated; consider changing to 'let' constant [#VariableNeverMutated]
84 | frontFacingCamera.position = .front
85 |
86 | var requiredTypes: [AVCaptureDevice.DeviceType] = [
darwin/Tests/AvailableCamerasTests.swift:118:11: warning: variable 'requiredTypes' was never mutated; consider changing to 'let' constant [#VariableNeverMutated]
116 | unspecifiedCamera.position = .unspecified
117 |
118 | var requiredTypes: [AVCaptureDevice.DeviceType] = [
darwin/Tests/CameraOrientationTests.swift:120:14: warning: weak variable 'weakDevice' was never mutated; consider changing to 'let' constant [#VariableNeverMutated::WeakMutability]
118 | let captureSessionQueue = DispatchQueue(label: "capture_session_queue")
119 | weak var weakPlugin: CameraPlugin?
120 | weak var weakDevice = mockDevice
darwin/Tests/CameraOrientationTests.swift:157:14: warning: weak variable 'weakEventAPI' was never mutated; consider changing to 'let' constant [#VariableNeverMutated::WeakMutability]
155 | }
156 |
157 | weak var weakEventAPI = mockEventAPI
```
This wasn't showing up in CI due to flutter#194517.
## 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.1 parent 8482163 commit 759473e
3 files changed
Lines changed: 7 additions & 9 deletions
File tree
- packages/camera/camera_avfoundation/darwin/Tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
| 118 | + | |
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
121 | 120 | | |
122 | 121 | | |
123 | 122 | | |
| |||
126 | 125 | | |
127 | 126 | | |
128 | 127 | | |
129 | | - | |
| 128 | + | |
130 | 129 | | |
131 | 130 | | |
132 | 131 | | |
| |||
154 | 153 | | |
155 | 154 | | |
156 | 155 | | |
157 | | - | |
158 | 156 | | |
159 | 157 | | |
160 | 158 | | |
161 | 159 | | |
162 | | - | |
| 160 | + | |
163 | 161 | | |
164 | 162 | | |
165 | 163 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
0 commit comments