fix: update CropInfo initializer calls to use named argument labels#506
fix: update CropInfo initializer calls to use named argument labels#506guoyingtao merged 2 commits intomasterfrom
Conversation
CropInfo's init signature was updated with named parameters but FakeCropView.swift still used positional arguments, preventing the test target from compiling. Co-Authored-By: Claude <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a helper Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
Tests/MantisTests/Mock/FakeCropView.swift (1)
175-178: Consider centralizing the zero-valueCropInfomock builder.You now have the same initializer payload in three places; extracting a helper will reduce future signature-drift risk in tests.
♻️ Optional refactor
+ private func makeZeroCropInfo() -> CropInfo { + CropInfo( + translation: .zero, + rotation: .zero, + scaleX: .zero, + scaleY: .zero, + cropSize: .zero, + imageViewSize: .zero, + cropRegion: CropRegion(topLeft: .zero, topRight: .zero, bottomLeft: .zero, bottomRight: .zero) + ) + } + func crop() -> CropOutput { CropOutput(nil, Transformation(offset: .zero, rotation: .zero, scale: .zero, isManuallyZoomed: false, initialMaskFrame: .zero, maskFrame: .zero, cropWorkbenchViewBounds: .zero, horizontallyFlipped: false, verticallyFlipped: false), - CropInfo(translation: .zero, rotation: .zero, scaleX: .zero, scaleY: .zero, cropSize: .zero, imageViewSize: .zero, - cropRegion: CropRegion(topLeft: .zero, - topRight: .zero, - bottomLeft: .zero, - bottomRight: .zero))) + makeZeroCropInfo()) } func crop(_ image: UIImage) -> CropOutput { CropOutput(nil, Transformation(offset: .zero, rotation: .zero, scale: .zero, isManuallyZoomed: false, initialMaskFrame: .zero, maskFrame: .zero, cropWorkbenchViewBounds: .zero, horizontallyFlipped: false, verticallyFlipped: false), - CropInfo(translation: .zero, rotation: .zero, scaleX: .zero, scaleY: .zero, cropSize: .zero, imageViewSize: .zero, - cropRegion: CropRegion(topLeft: .zero, - topRight: .zero, - bottomLeft: .zero, - bottomRight: .zero))) + makeZeroCropInfo()) } func getCropInfo() -> CropInfo { - CropInfo(translation: .zero, rotation: .zero, scaleX: .zero, scaleY: .zero, - cropSize: .zero, imageViewSize: .zero, - cropRegion: CropRegion(topLeft: .zero, topRight: .zero, - bottomLeft: .zero, bottomRight: .zero)) + makeZeroCropInfo() }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Tests/MantisTests/Mock/FakeCropView.swift` around lines 175 - 178, Extract a single test helper that returns the zero-valued CropInfo used by tests (e.g., makeZeroCropInfo() or zeroCropInfo()) and replace the repeated inline initializer occurrences with calls to that helper; ensure the helper constructs CropInfo(translation: .zero, rotation: .zero, scaleX: .zero, scaleY: .zero, cropSize: .zero, imageViewSize: .zero, cropRegion: CropRegion(topLeft: .zero, topRight: .zero, bottomLeft: .zero, bottomRight: .zero)) so all three usages of CropInfo are consolidated and future signature changes only need one update.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@Tests/MantisTests/Mock/FakeCropView.swift`:
- Around line 175-178: Extract a single test helper that returns the zero-valued
CropInfo used by tests (e.g., makeZeroCropInfo() or zeroCropInfo()) and replace
the repeated inline initializer occurrences with calls to that helper; ensure
the helper constructs CropInfo(translation: .zero, rotation: .zero, scaleX:
.zero, scaleY: .zero, cropSize: .zero, imageViewSize: .zero, cropRegion:
CropRegion(topLeft: .zero, topRight: .zero, bottomLeft: .zero, bottomRight:
.zero)) so all three usages of CropInfo are consolidated and future signature
changes only need one update.
…nfo construction Co-Authored-By: Claude <noreply@anthropic.com>
CropInfo's init signature was updated with named parameters but FakeCropView.swift still used positional arguments, preventing the test target from compiling.
Summary by CodeRabbit