-
Notifications
You must be signed in to change notification settings - Fork 628
Open
Description
Describe the bug
Hello, I am trying to create a snapshot test for a view that has a Date Picker in wheel style. It seems no matter what I've tried that the ui is not being snapshotted as expected. The selected value seems fine, but the rest of the values in the wheel are pushed and overlap with each other.
I created a simple snapshot to check if the issue is reproducible by just snapshotting the component, and it is reproducible.
To Reproduce
Try running the following test
func test_date_picker_bug_empty_light() {
let calendar = Calendar.current
let dateComponents = DateComponents(hour: 9, minute: 41)
let date = calendar.date(from: dateComponents)!
let screen = NavigationStack {
DatePicker(
"",
selection: .constant(date),
displayedComponents: .hourAndMinute
)
.datePickerStyle(.wheel)
}
let vc = UIHostingController(rootView: screen)
vc.overrideUserInterfaceStyle = .light
assertSnapshot(
of: vc,
as: .image(on: .iPhone13Mini),
named: "date_picker_bug",
record: true
)
}
Expected behavior
The expected behaviour is that I get a screenshot of the DatePicker.
Screenshots
This is the result that I get
Environment
- swift-snapshot-testing version 1.18.4
- Xcode 16.2
- Swift 6
- OS: 15.5 (24F74)
Additional context
The issue is reproducible only in DatePicker when the selection is wheel.
Metadata
Metadata
Assignees
Labels
No labels