Open vadimbelyaev opened 2 years ago
Seeing similar behavior, have you come across a solution @vadimbelyaev ?
Seeing similar behavior, have you come across a solution @vadimbelyaev ?
Not yet, unfortunately.
We have just bumped into the same issue when snapshotting with Xcode 15, are there any known workarounds, instead of replacing .continuous
with .circular
?
Describe the bug I'm using SnapshotTesting in a SwiftUI iOS project. I wrap a SwiftUI view under test in a
UIHostingController
and then pass the hosting controller into theassertSnapshot
method. However, I managed to reproduce the issue even by passing the SwiftUI view directly into theassertSnaphot
.When the view contains a
RoundedRectangle
with thestyle
set to.continuous
, its snapshots get rendered with vertical lines on both sides on the rounded rectangle. The color of the lines matches the border color.These lines remain visible while the rectangle's height is relatively small. Once the rectangle's height grows beyond a certain value, the lines completely blend with the rectangle's side, and then result starts looking OK.
The view looks fine in previews and when running on a simulator, even when it's embedded in a
UIHostingController
, but its snaphots are produced with artifacts by some reason.To Reproduce Here's a demo project that illustrates the issue: RoundedRectangleExperiment.zip
It's also available on GitHub: https://github.com/vadimbelyaev/RoundedRectangleExperiment/
A minimal view that can reproduce the issue is as small as this:
And here's a test for it:
Expected behavior A
RoundedRectangle
with a.continuous
style should render on snapshots without vertical lines on both sides. It should look the same as in previews or on a simulator.Screenshots The sample project I provided contains a view with multiple rounded rectangles in it to demonstrate how the artifacts are rendered for the rectangles of different heights and that the rectangles with the
.circular
style don't have this issue:Environment
Additional context N/A