Skip to content

Commit

Permalink
Prefire doesn't pick up the custom template, try setting the perceptu…
Browse files Browse the repository at this point in the history
…al precision on the previews directly.
  • Loading branch information
stefanceriu committed Mar 5, 2024
1 parent ed0414d commit 5b48882
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions Sources/Compound/BaseStyles/CompoundButtonStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ public struct CompoundButtonStyle_Previews: PreviewProvider, PrefireProvider {
Header(title: "Plain")
}
}
.snapshot(perceptualPrecision: 0.98)
}

public static func states(_ size: CompoundButtonStyle.Size) -> some View {
Expand Down
1 change: 1 addition & 0 deletions Sources/Compound/BaseStyles/CompoundToggleStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public struct CompoundToggleStyle_Previews: PreviewProvider, PrefireProvider {
states
}
.padding(32)
.snapshot(perceptualPrecision: 0.98)
}

@ViewBuilder
Expand Down
4 changes: 4 additions & 0 deletions Sources/Compound/Icons/CompoundIcon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,18 @@ struct CompoundIcon_Previews: PreviewProvider, PrefireProvider {
static var previews: some View {
form
.previewDisplayName("Form")
.snapshot(perceptualPrecision: 0.98)
buttons
.padding(8)
.previewLayout(.sizeThatFits)
.previewDisplayName("Buttons")
.snapshot(perceptualPrecision: 0.98)
accessibilityIcons
.previewDisplayName("Accessibility Icons Only")
.snapshot(perceptualPrecision: 0.98)
accessibilityLabels
.previewDisplayName("Accessibility Labels")
.snapshot(perceptualPrecision: 0.98)
}

static var accessibilityIcons: some View {
Expand Down
1 change: 1 addition & 0 deletions Sources/Compound/List/ListInlinePicker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ struct ListInlinePicker_Previews: PreviewProvider, PrefireProvider {
.labelsHidden()
}
}
.snapshot(perceptualPrecision: 0.98)
}
}
}
2 changes: 2 additions & 0 deletions Sources/Compound/List/ListRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ public struct ListRow_Previews: PreviewProvider, PrefireProvider {
othersSection
}
.compoundList()
.snapshot(perceptualPrecision: 0.98)
}

static var labels: some View {
Expand Down Expand Up @@ -433,5 +434,6 @@ struct ListRowLoadingSelection_Previews: PreviewProvider, PrefireProvider {
kind: .selection(isSelected: false) { })
}
.compoundList()
.snapshot(perceptualPrecision: 0.98)
}
}
2 changes: 2 additions & 0 deletions Sources/Compound/List/ListRowAccessory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ struct ListRowAccessory_Previews: PreviewProvider, PrefireProvider {
.disabled(true)
}
.previewDisplayName("Accessories")
.snapshot(perceptualPrecision: 0.98)
}

static func row(title: String, accessory: ListRowAccessory) -> some View {
Expand All @@ -133,5 +134,6 @@ struct MultiUnselectedAccessory_Previews: PreviewProvider, PrefireProvider {
}
}
.previewDisplayName("Fake circle icon")
.snapshot(perceptualPrecision: 0.98)
}
}
1 change: 1 addition & 0 deletions Sources/Compound/List/ListRowButtonStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,6 @@ public struct ListRowButtonStyle_Previews: PreviewProvider, PrefireProvider {
.listRowInsets(EdgeInsets())
}
.compoundList()
.snapshot(perceptualPrecision: 0.98)
}
}
1 change: 1 addition & 0 deletions Sources/Compound/List/ListRowLabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -356,5 +356,6 @@ struct ListRowLabel_Previews: PreviewProvider, PrefireProvider {
}
}
.compoundList()
.snapshot(perceptualPrecision: 0.98)
}
}
1 change: 1 addition & 0 deletions Sources/Compound/List/ListRowTrailingSection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ struct ListRowTrailingSection_Previews: PreviewProvider, PrefireProvider {
details
withAccessory
}
.snapshot(perceptualPrecision: 0.98)
}

static var details: some View {
Expand Down
2 changes: 2 additions & 0 deletions Sources/Compound/List/ListStyles.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ struct ListTextStyles_Previews: PreviewProvider, PrefireProvider {
}
.compoundList()
.previewDisplayName("Form")
.snapshot(perceptualPrecision: 0.98)

List {
Section {
Expand All @@ -95,5 +96,6 @@ struct ListTextStyles_Previews: PreviewProvider, PrefireProvider {
}
.compoundList()
.previewDisplayName("List")
.snapshot(perceptualPrecision: 0.98)
}
}
2 changes: 2 additions & 0 deletions Sources/Compound/Text Field Styles/SearchFieldStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ struct SearchStyle_Previews: PreviewProvider, PrefireProvider {
}
.tint(.compound.textActionPrimary)
.previewDisplayName("List")
.snapshot(perceptualPrecision: 0.98)

NavigationStack {
Form {
Expand All @@ -103,5 +104,6 @@ struct SearchStyle_Previews: PreviewProvider, PrefireProvider {
}
.tint(.compound.textActionPrimary)
.previewDisplayName("Form")
.snapshot(perceptualPrecision: 0.98)
}
}

0 comments on commit 5b48882

Please sign in to comment.