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

Fix building on Xcode 15 by specifying Nimble.Predicate #268

Merged
merged 1 commit into from Jun 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions Nimble_Snapshots/DynamicSize/DynamicSizeSnapshot.swift
Expand Up @@ -153,7 +153,7 @@ public func haveValidDynamicSizeSnapshot<T: Snapshotable>(named name: String? =
pixelTolerance: CGFloat? = nil,
tolerance: CGFloat? = nil,
resizeMode: ResizeMode = .frame,
shouldIgnoreScale: Bool = false) -> Predicate<T> {
shouldIgnoreScale: Bool = false) -> Nimble.Predicate<T> {
return Predicate { actualExpression in
return performDynamicSizeSnapshotTest(name,
identifier: identifier,
Expand Down Expand Up @@ -250,7 +250,7 @@ public func recordDynamicSizeSnapshot<T: Snapshotable>(named name: String? = nil
isDeviceAgnostic: Bool = false,
usesDrawRect: Bool = false,
resizeMode: ResizeMode = .frame,
shouldIgnoreScale: Bool = false) -> Predicate<T> {
shouldIgnoreScale: Bool = false) -> Nimble.Predicate<T> {
return Predicate { actualExpression in
return performDynamicSizeSnapshotTest(name,
identifier: identifier,
Expand Down
20 changes: 10 additions & 10 deletions Nimble_Snapshots/DynamicType/HaveValidDynamicTypeSnapshot.swift
Expand Up @@ -15,8 +15,8 @@ func shortCategoryName(_ category: UIContentSizeCategory) -> String {
return category.rawValue.replacingOccurrences(of: "UICTContentSizeCategory", with: "")
}

func combinePredicates<T>(_ predicates: [Predicate<T>],
deferred: (() -> Void)? = nil) -> Predicate<T> {
func combinePredicates<T>(_ predicates: [Nimble.Predicate<T>],
deferred: (() -> Void)? = nil) -> Nimble.Predicate<T> {
return Predicate { actualExpression in
defer {
deferred?()
Expand All @@ -37,18 +37,18 @@ public func haveValidDynamicTypeSnapshot<T: Snapshotable>(named name: String? =
pixelTolerance: CGFloat? = nil,
tolerance: CGFloat? = nil,
sizes: [UIContentSizeCategory] = allContentSizeCategories(),
isDeviceAgnostic: Bool = false) -> Predicate<T> {
isDeviceAgnostic: Bool = false) -> Nimble.Predicate<T> {
let mock = NBSMockedApplication()

let predicates: [Predicate<T>] = sizes.map { category in
let predicates: [Nimble.Predicate<T>] = sizes.map { category in
let sanitizedName = sanitizedTestName(name)
let nameWithCategory = "\(sanitizedName)_\(shortCategoryName(category))"

return Predicate { actualExpression in
return Nimble.Predicate { actualExpression in
mock.mockPreferredContentSizeCategory(category)
updateTraitCollection(on: actualExpression)

let predicate: Predicate<T>
let predicate: Nimble.Predicate<T>
if isDeviceAgnostic {
predicate = haveValidDeviceAgnosticSnapshot(named: nameWithCategory, identifier: identifier,
usesDrawRect: usesDrawRect, pixelTolerance: pixelTolerance,
Expand All @@ -74,18 +74,18 @@ public func recordDynamicTypeSnapshot<T: Snapshotable>(named name: String? = nil
identifier: String? = nil,
usesDrawRect: Bool = false,
sizes: [UIContentSizeCategory] = allContentSizeCategories(),
isDeviceAgnostic: Bool = false) -> Predicate<T> {
isDeviceAgnostic: Bool = false) -> Nimble.Predicate<T> {
let mock = NBSMockedApplication()

let predicates: [Predicate<T>] = sizes.map { category in
let predicates: [Nimble.Predicate<T>] = sizes.map { category in
let sanitizedName = sanitizedTestName(name)
let nameWithCategory = "\(sanitizedName)_\(shortCategoryName(category))"

return Predicate { actualExpression in
return Nimble.Predicate { actualExpression in
mock.mockPreferredContentSizeCategory(category)
updateTraitCollection(on: actualExpression)

let predicate: Predicate<T>
let predicate: Nimble.Predicate<T>
if isDeviceAgnostic {
predicate = recordDeviceAgnosticSnapshot(named: nameWithCategory,
identifier: identifier,
Expand Down
8 changes: 4 additions & 4 deletions Nimble_Snapshots/HaveValidSnapshot.swift
Expand Up @@ -280,7 +280,7 @@ public func haveValidSnapshot<T: Snapshotable>(named name: String? = nil,
usesDrawRect: Bool = false,
pixelTolerance: CGFloat? = nil,
tolerance: CGFloat? = nil,
shouldIgnoreScale: Bool = false) -> Predicate<T> {
shouldIgnoreScale: Bool = false) -> Nimble.Predicate<T> {

return Predicate { actualExpression in
if switchChecksWithRecords {
Expand All @@ -306,7 +306,7 @@ public func haveValidDeviceAgnosticSnapshot<T: Snapshotable>(named name: String?
usesDrawRect: Bool = false,
pixelTolerance: CGFloat? = nil,
tolerance: CGFloat? = nil,
shouldIgnoreScale: Bool = false) -> Predicate<T> {
shouldIgnoreScale: Bool = false) -> Nimble.Predicate<T> {

return Predicate { actualExpression in
if switchChecksWithRecords {
Expand All @@ -332,7 +332,7 @@ public func haveValidDeviceAgnosticSnapshot<T: Snapshotable>(named name: String?
public func recordSnapshot<T: Snapshotable>(named name: String? = nil,
identifier: String? = nil,
usesDrawRect: Bool = false,
shouldIgnoreScale: Bool = false) -> Predicate<T> {
shouldIgnoreScale: Bool = false) -> Nimble.Predicate<T> {

return Predicate { actualExpression in
return recordSnapshot(name, identifier: identifier, usesDrawRect: usesDrawRect,
Expand All @@ -344,7 +344,7 @@ public func recordSnapshot<T: Snapshotable>(named name: String? = nil,
public func recordDeviceAgnosticSnapshot<T: Snapshotable>(named name: String? = nil,
identifier: String? = nil,
usesDrawRect: Bool = false,
shouldIgnoreScale: Bool = false) -> Predicate<T> {
shouldIgnoreScale: Bool = false) -> Nimble.Predicate<T> {

return Predicate { actualExpression in
return recordSnapshot(name, identifier: identifier, isDeviceAgnostic: true, usesDrawRect: usesDrawRect,
Expand Down