Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS 17 Snapshots have weird edges and radius #790

Open
davidalhambra opened this issue Oct 11, 2023 · 3 comments
Open

iOS 17 Snapshots have weird edges and radius #790

davidalhambra opened this issue Oct 11, 2023 · 3 comments

Comments

@davidalhambra
Copy link

Describe the bug
When I run my tests on iOS17 I get different version than the previous versions. It's weir because the components itself doesn't change visually on my app, only in the snapshots. It happens with some components that have radius or curved edges.
This is happening for UIKit and SwiftUI components. They also have different approaches. In the screenshot we see an screenshot of one Capsule SwiftUI item, but is happening the same with an UIKit item built with a background color and shaped.

To Reproduce
This is the body of the Capsule item of the screenshot bellow.

        public var body: some View {
            /// We do not use Apples formatted API because we want a small badge
            /// without a space between number and % - also this code looks simpler.
            Text(String(format: "%.0f%%", progress))
                .padding(.horizontal, Style.horizontalPadding)
                .frame(height: Style.height)
                .background(
                    Capsule()
                        .fill(Style.background(for: progress).color,
                              strokeBorder: Style.border.color,
                              lineWidth: Style.borderWidth)
                )
        }

Expected behavior
On previous iOS versions we had a clear Snapshot with the Capsule or Circle shape. Right now we get the good shape on the app (nothing changed) but not at the Snapshot.

Screenshots
test_SwiftUI_ProgressBadge_ColorSchemes light

Captura de pantalla 2023-10-11 a las 14 27 08

Environment

  • swift-snapshot-testing version [e.g. 1.9.0]
  • Xcode 15.0
  • Swift 5
  • OS: iOS 17
@davidaberg
Copy link

We are also getting jagged and blurry border edges when recording snapshots in Xcode 15 / iOS 17. Only in the snapshots, not in our app.

@davidalhambra davidalhambra changed the title iOS 17 Snapshots have weird edges iOS 17 Snapshots have weird edges and radius Oct 16, 2023
@renate-wuenschl
Copy link

From what I can see the issue seems to be related to any kind of RoundedRectangle in SwiftUI with a border (also SwiftUI.Toggle).

Side note: Recently SnapshotTesting was crashing for me when changing my own uneven rectangle implementation to apples UnevenRoundedRectangle() - maybe this is related 🤷🏻‍♀️

@lukeredpath
Copy link

I fixed this issue by explicitly using a circular corner style - on iOS 17 I think it now defaults to continuous.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants