diff --git a/.gitignore b/.gitignore index 8045370e..228e74e3 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ build .swiftpm .DS_Store +.build/ diff --git a/Bootstrap/Bootstrap.xcodeproj/project.pbxproj b/Bootstrap/Bootstrap.xcodeproj/project.pbxproj index 65b0d54a..de716174 100644 --- a/Bootstrap/Bootstrap.xcodeproj/project.pbxproj +++ b/Bootstrap/Bootstrap.xcodeproj/project.pbxproj @@ -19,6 +19,7 @@ 5EFDC7711F8699AA001453EC /* DynamicSizeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5EFDC76E1F8699AA001453EC /* DynamicSizeTests.swift */; }; 5EFDC7721F8699AA001453EC /* DynamicTypeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5EFDC76F1F8699AA001453EC /* DynamicTypeTests.swift */; }; 69BE287EA35A14E2787AC4AF /* Pods_Bootstrap_BootstrapTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CF2E7C50C1B84B73173ED6F7 /* Pods_Bootstrap_BootstrapTests.framework */; }; + C31D2DD929D73AFE002BD84C /* BootstrapCustomFolderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5EFDC7761F8699F9001453EC /* BootstrapCustomFolderTests.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -358,6 +359,7 @@ files = ( 5EFDC7701F8699AA001453EC /* WithoutQuickTests.swift in Sources */, 5EFDC7711F8699AA001453EC /* DynamicSizeTests.swift in Sources */, + C31D2DD929D73AFE002BD84C /* BootstrapCustomFolderTests.swift in Sources */, 5EFDC7611F8698B4001453EC /* BootstrapTests.swift in Sources */, 5EFDC7721F8699AA001453EC /* DynamicTypeTests.swift in Sources */, ); diff --git a/Bootstrap/Bootstrap/DynamicTypeView.swift b/Bootstrap/Bootstrap/DynamicTypeView.swift index c9af57ef..544a63ca 100644 --- a/Bootstrap/Bootstrap/DynamicTypeView.swift +++ b/Bootstrap/Bootstrap/DynamicTypeView.swift @@ -8,7 +8,13 @@ public final class DynamicTypeView: UIView { label = UILabel() super.init(frame: frame) - backgroundColor = .white + backgroundColor = UIColor { traits -> UIColor in + if traits.userInterfaceStyle == .dark { + return .lightGray + } else { + return .white + } + } translatesAutoresizingMaskIntoConstraints = false label.font = .preferredFont(forTextStyle: .body) diff --git a/Bootstrap/BootstrapTests/ACustomFolder/BootstrapCustomFolderTests.swift b/Bootstrap/BootstrapTests/ACustomFolder/BootstrapCustomFolderTests.swift index 2c9a0cce..000a7023 100644 --- a/Bootstrap/BootstrapTests/ACustomFolder/BootstrapCustomFolderTests.swift +++ b/Bootstrap/BootstrapTests/ACustomFolder/BootstrapCustomFolderTests.swift @@ -12,19 +12,31 @@ final class BootstrapCustomFormatTests: QuickSpec { beforeEach { setNimbleTestFolder("CustomFolder") view = UIView(frame: CGRect(origin: .zero, size: CGSize(width: 44, height: 44))) - view.backgroundColor = .blue + view.backgroundColor = UIColor { traits -> UIColor in + if traits.userInterfaceStyle == .dark { + return .brown + } else { + return .blue + } + } } it("fails to find the snapshots due to the custom folder") { expect(view).notTo(haveValidSnapshot(named: "something custom")) + expect(view).notTo(haveValidSnapshot(named: "something custom")) } it("finds the snapshots using a custom images directory") { - expect(view).to(haveValidSnapshot()) + expect(view).to(recordSnapshot()) } it("finds device agnostic snapshots with custom images directory") { - expect(view).to(haveValidDeviceAgnosticSnapshot()) + expect(view).to(recordDeviceAgnosticSnapshot()) + } + + it("find the snapshot using a custom image directory for light and dark mode") { + expect(view).to(recordSnapshot(userInterfaceStyle: .light)) + expect(view).to(recordSnapshot(userInterfaceStyle: .dark)) } } } diff --git a/Bootstrap/BootstrapTests/BootstrapTests.swift b/Bootstrap/BootstrapTests/BootstrapTests.swift index c6b46140..57cc58b5 100644 --- a/Bootstrap/BootstrapTests/BootstrapTests.swift +++ b/Bootstrap/BootstrapTests/BootstrapTests.swift @@ -16,11 +16,18 @@ final class BootstrapTests: QuickSpec { setNimbleTolerance(0.1) setNimbleTestFolder("tests") view = UIView(frame: CGRect(origin: .zero, size: CGSize(width: 44, height: 44))) - view.backgroundColor = .blue + view.backgroundColor = UIColor { traits -> UIColor in + if traits.userInterfaceStyle == .dark { + return .brown + } else { + return .blue + } + } } it("has a valid snapshot") { - expect(view).to(haveValidSnapshot()) + expect(view).to(haveValidSnapshot(userInterfaceStyle: .light)) + expect(view).to(haveValidSnapshot(userInterfaceStyle: .dark)) expect(view).to(haveValidSnapshot(named: "something custom")) } diff --git a/Bootstrap/BootstrapTests/DynamicSizeTests.swift b/Bootstrap/BootstrapTests/DynamicSizeTests.swift index 50283e72..5141f294 100644 --- a/Bootstrap/BootstrapTests/DynamicSizeTests.swift +++ b/Bootstrap/BootstrapTests/DynamicSizeTests.swift @@ -27,7 +27,13 @@ final class DynamicSizeTests: QuickSpec { beforeEach { view = UIView(frame: CGRect(x: 0, y: 0, width: 500, height: 500)) - view.backgroundColor = .blue + view.backgroundColor = UIColor { traits -> UIColor in + if traits.userInterfaceStyle == .dark { + return .brown + } else { + return .blue + } + } } it("has a valid snapshot to all sizes") { @@ -35,6 +41,14 @@ final class DynamicSizeTests: QuickSpec { // expect(view).to(recordDynamicSizeSnapshot(sizes: sizes)) } + it("has a valid snapshot to all sizes in light and dark mode") { + expect(view).to(haveValidDynamicSizeSnapshot(sizes: sizes, userInterfaceStyle: .light)) + expect(view).to(haveValidDynamicSizeSnapshot(sizes: sizes, userInterfaceStyle: .dark)) +// expect(view).to(recordDynamicSizeSnapshot(sizes: sizes, userInterfaceStyle: .light)) +// expect(view).to(recordDynamicSizeSnapshot(sizes: sizes, userInterfaceStyle: .dark)) + } + + it("has a valid snapshot to all sizes with identifier") { // expect(view).to(recordDynamicSizeSnapshot(identifier: "bootstrap", sizes: sizes)) expect(view).to(haveValidDynamicSizeSnapshot(identifier: "bootstrap", sizes: sizes)) diff --git a/Bootstrap/BootstrapTests/DynamicTypeTests.swift b/Bootstrap/BootstrapTests/DynamicTypeTests.swift index 7d8e5280..b0010572 100644 --- a/Bootstrap/BootstrapTests/DynamicTypeTests.swift +++ b/Bootstrap/BootstrapTests/DynamicTypeTests.swift @@ -81,6 +81,26 @@ final class DynamicTypeTests: QuickSpec { identifier: "bootstrap")) } + it("has a valid snapshot with identifier in light and dark mode") { + // expect(view).to(recordDynamicTypeSnapshot(identifier: "bootstrap", userInterfaceStyle: .light)) + // expect(view).to(recordDynamicTypeSnapshot(identifier: "bootstrap", userInterfaceStyle: .dark)) + expect(view).to(haveValidDynamicTypeSnapshot(identifier: "bootstrap", userInterfaceStyle: .light)) + expect(view).to(haveValidDynamicTypeSnapshot(identifier: "bootstrap", userInterfaceStyle: .dark)) + +// expect(view).to(recordDynamicTypeSnapshot(named: "something custom with model and OS", +// identifier: "bootstrap", +// userInterfaceStyle: .light)) +// expect(view).to(recordDynamicTypeSnapshot(named: "something custom with model and OS", +// identifier: "bootstrap", +// userInterfaceStyle: .dark)) + expect(view).to(haveValidDynamicTypeSnapshot(named: "something custom with model and OS", + identifier: "bootstrap", + userInterfaceStyle: .light)) + expect(view).to(haveValidDynamicTypeSnapshot(named: "something custom with model and OS", + identifier: "bootstrap", + userInterfaceStyle: .dark)) + } + it("works with adjustsFontForContentSizeCategory") { let label = UILabel(frame: CGRect(x: 0, y: 0, width: 300, height: 100)) label.text = "Example" diff --git a/Bootstrap/BootstrapTests/ReferenceImages/BootstrapTests/in_some_context__has_a_valid_snapshot__dark@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/BootstrapTests/in_some_context__has_a_valid_snapshot__dark@2x.png new file mode 100644 index 00000000..c8488890 Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/BootstrapTests/in_some_context__has_a_valid_snapshot__dark@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/BootstrapTests/in_some_context__has_a_valid_snapshot__light@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/BootstrapTests/in_some_context__has_a_valid_snapshot__light@2x.png new file mode 100644 index 00000000..850a72f2 Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/BootstrapTests/in_some_context__has_a_valid_snapshot__light@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/CustomFolder/.gitkeep b/Bootstrap/BootstrapTests/ReferenceImages/CustomFolder/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicSizeTests/in_some_context__using_only_frame__has_a_valid_snapshot_to_all_sizes_in_light_and_dark_mode__LargeSize_dark@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicSizeTests/in_some_context__using_only_frame__has_a_valid_snapshot_to_all_sizes_in_light_and_dark_mode__LargeSize_dark@2x.png new file mode 100644 index 00000000..3352e882 Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicSizeTests/in_some_context__using_only_frame__has_a_valid_snapshot_to_all_sizes_in_light_and_dark_mode__LargeSize_dark@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicSizeTests/in_some_context__using_only_frame__has_a_valid_snapshot_to_all_sizes_in_light_and_dark_mode__LargeSize_light@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicSizeTests/in_some_context__using_only_frame__has_a_valid_snapshot_to_all_sizes_in_light_and_dark_mode__LargeSize_light@2x.png new file mode 100644 index 00000000..e7405fc5 Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicSizeTests/in_some_context__using_only_frame__has_a_valid_snapshot_to_all_sizes_in_light_and_dark_mode__LargeSize_light@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicSizeTests/in_some_context__using_only_frame__has_a_valid_snapshot_to_all_sizes_in_light_and_dark_mode__MediumSize_dark@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicSizeTests/in_some_context__using_only_frame__has_a_valid_snapshot_to_all_sizes_in_light_and_dark_mode__MediumSize_dark@2x.png new file mode 100644 index 00000000..6ebcb1c0 Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicSizeTests/in_some_context__using_only_frame__has_a_valid_snapshot_to_all_sizes_in_light_and_dark_mode__MediumSize_dark@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicSizeTests/in_some_context__using_only_frame__has_a_valid_snapshot_to_all_sizes_in_light_and_dark_mode__MediumSize_light@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicSizeTests/in_some_context__using_only_frame__has_a_valid_snapshot_to_all_sizes_in_light_and_dark_mode__MediumSize_light@2x.png new file mode 100644 index 00000000..90229fdb Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicSizeTests/in_some_context__using_only_frame__has_a_valid_snapshot_to_all_sizes_in_light_and_dark_mode__MediumSize_light@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicSizeTests/in_some_context__using_only_frame__has_a_valid_snapshot_to_all_sizes_in_light_and_dark_mode__SmallSize_dark@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicSizeTests/in_some_context__using_only_frame__has_a_valid_snapshot_to_all_sizes_in_light_and_dark_mode__SmallSize_dark@2x.png new file mode 100644 index 00000000..c8488890 Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicSizeTests/in_some_context__using_only_frame__has_a_valid_snapshot_to_all_sizes_in_light_and_dark_mode__SmallSize_dark@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicSizeTests/in_some_context__using_only_frame__has_a_valid_snapshot_to_all_sizes_in_light_and_dark_mode__SmallSize_light@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicSizeTests/in_some_context__using_only_frame__has_a_valid_snapshot_to_all_sizes_in_light_and_dark_mode__SmallSize_light@2x.png new file mode 100644 index 00000000..850a72f2 Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicSizeTests/in_some_context__using_only_frame__has_a_valid_snapshot_to_all_sizes_in_light_and_dark_mode__SmallSize_light@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__AccessibilityL_dark_dark_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__AccessibilityL_dark_dark_bootstrap@2x.png new file mode 100644 index 00000000..21c0f51a Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__AccessibilityL_dark_dark_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__AccessibilityL_light_light_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__AccessibilityL_light_light_bootstrap@2x.png new file mode 100644 index 00000000..da93f81e Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__AccessibilityL_light_light_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__AccessibilityM_dark_dark_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__AccessibilityM_dark_dark_bootstrap@2x.png new file mode 100644 index 00000000..21c0f51a Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__AccessibilityM_dark_dark_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__AccessibilityM_light_light_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__AccessibilityM_light_light_bootstrap@2x.png new file mode 100644 index 00000000..da93f81e Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__AccessibilityM_light_light_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__AccessibilityXL_dark_dark_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__AccessibilityXL_dark_dark_bootstrap@2x.png new file mode 100644 index 00000000..21c0f51a Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__AccessibilityXL_dark_dark_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__AccessibilityXL_light_light_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__AccessibilityXL_light_light_bootstrap@2x.png new file mode 100644 index 00000000..da93f81e Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__AccessibilityXL_light_light_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__AccessibilityXXL_dark_dark_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__AccessibilityXXL_dark_dark_bootstrap@2x.png new file mode 100644 index 00000000..21c0f51a Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__AccessibilityXXL_dark_dark_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__AccessibilityXXL_light_light_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__AccessibilityXXL_light_light_bootstrap@2x.png new file mode 100644 index 00000000..da93f81e Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__AccessibilityXXL_light_light_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__AccessibilityXXXL_dark_dark_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__AccessibilityXXXL_dark_dark_bootstrap@2x.png new file mode 100644 index 00000000..21c0f51a Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__AccessibilityXXXL_dark_dark_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__AccessibilityXXXL_light_light_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__AccessibilityXXXL_light_light_bootstrap@2x.png new file mode 100644 index 00000000..da93f81e Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__AccessibilityXXXL_light_light_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__L_dark_dark_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__L_dark_dark_bootstrap@2x.png new file mode 100644 index 00000000..21c0f51a Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__L_dark_dark_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__L_light_light_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__L_light_light_bootstrap@2x.png new file mode 100644 index 00000000..da93f81e Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__L_light_light_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__M_dark_dark_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__M_dark_dark_bootstrap@2x.png new file mode 100644 index 00000000..21c0f51a Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__M_dark_dark_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__M_light_light_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__M_light_light_bootstrap@2x.png new file mode 100644 index 00000000..da93f81e Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__M_light_light_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__S_dark_dark_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__S_dark_dark_bootstrap@2x.png new file mode 100644 index 00000000..21c0f51a Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__S_dark_dark_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__S_light_light_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__S_light_light_bootstrap@2x.png new file mode 100644 index 00000000..da93f81e Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__S_light_light_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__XL_dark_dark_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__XL_dark_dark_bootstrap@2x.png new file mode 100644 index 00000000..21c0f51a Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__XL_dark_dark_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__XL_light_light_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__XL_light_light_bootstrap@2x.png new file mode 100644 index 00000000..da93f81e Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__XL_light_light_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__XS_dark_dark_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__XS_dark_dark_bootstrap@2x.png new file mode 100644 index 00000000..21c0f51a Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__XS_dark_dark_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__XS_light_light_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__XS_light_light_bootstrap@2x.png new file mode 100644 index 00000000..da93f81e Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__XS_light_light_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__XXL_dark_dark_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__XXL_dark_dark_bootstrap@2x.png new file mode 100644 index 00000000..21c0f51a Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__XXL_dark_dark_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__XXL_light_light_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__XXL_light_light_bootstrap@2x.png new file mode 100644 index 00000000..da93f81e Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__XXL_light_light_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__XXXL_dark_dark_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__XXXL_dark_dark_bootstrap@2x.png new file mode 100644 index 00000000..21c0f51a Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__XXXL_dark_dark_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__XXXL_light_light_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__XXXL_light_light_bootstrap@2x.png new file mode 100644 index 00000000..da93f81e Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/in_some_context__has_a_valid_snapshot_with_identifier_in_light_and_dark_mode__XXXL_light_light_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_AccessibilityL_dark_dark_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_AccessibilityL_dark_dark_bootstrap@2x.png new file mode 100644 index 00000000..21c0f51a Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_AccessibilityL_dark_dark_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_AccessibilityL_light_light_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_AccessibilityL_light_light_bootstrap@2x.png new file mode 100644 index 00000000..da93f81e Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_AccessibilityL_light_light_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_AccessibilityM_dark_dark_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_AccessibilityM_dark_dark_bootstrap@2x.png new file mode 100644 index 00000000..21c0f51a Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_AccessibilityM_dark_dark_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_AccessibilityM_light_light_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_AccessibilityM_light_light_bootstrap@2x.png new file mode 100644 index 00000000..da93f81e Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_AccessibilityM_light_light_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_AccessibilityXL_dark_dark_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_AccessibilityXL_dark_dark_bootstrap@2x.png new file mode 100644 index 00000000..21c0f51a Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_AccessibilityXL_dark_dark_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_AccessibilityXL_light_light_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_AccessibilityXL_light_light_bootstrap@2x.png new file mode 100644 index 00000000..da93f81e Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_AccessibilityXL_light_light_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_AccessibilityXXL_dark_dark_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_AccessibilityXXL_dark_dark_bootstrap@2x.png new file mode 100644 index 00000000..21c0f51a Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_AccessibilityXXL_dark_dark_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_AccessibilityXXL_light_light_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_AccessibilityXXL_light_light_bootstrap@2x.png new file mode 100644 index 00000000..da93f81e Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_AccessibilityXXL_light_light_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_AccessibilityXXXL_dark_dark_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_AccessibilityXXXL_dark_dark_bootstrap@2x.png new file mode 100644 index 00000000..21c0f51a Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_AccessibilityXXXL_dark_dark_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_AccessibilityXXXL_light_light_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_AccessibilityXXXL_light_light_bootstrap@2x.png new file mode 100644 index 00000000..da93f81e Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_AccessibilityXXXL_light_light_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_L_dark_dark_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_L_dark_dark_bootstrap@2x.png new file mode 100644 index 00000000..21c0f51a Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_L_dark_dark_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_L_light_light_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_L_light_light_bootstrap@2x.png new file mode 100644 index 00000000..da93f81e Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_L_light_light_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_M_dark_dark_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_M_dark_dark_bootstrap@2x.png new file mode 100644 index 00000000..21c0f51a Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_M_dark_dark_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_M_light_light_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_M_light_light_bootstrap@2x.png new file mode 100644 index 00000000..da93f81e Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_M_light_light_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_S_dark_dark_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_S_dark_dark_bootstrap@2x.png new file mode 100644 index 00000000..21c0f51a Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_S_dark_dark_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_S_light_light_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_S_light_light_bootstrap@2x.png new file mode 100644 index 00000000..da93f81e Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_S_light_light_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_XL_dark_dark_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_XL_dark_dark_bootstrap@2x.png new file mode 100644 index 00000000..21c0f51a Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_XL_dark_dark_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_XL_light_light_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_XL_light_light_bootstrap@2x.png new file mode 100644 index 00000000..da93f81e Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_XL_light_light_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_XS_dark_dark_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_XS_dark_dark_bootstrap@2x.png new file mode 100644 index 00000000..21c0f51a Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_XS_dark_dark_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_XS_light_light_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_XS_light_light_bootstrap@2x.png new file mode 100644 index 00000000..da93f81e Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_XS_light_light_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_XXL_dark_dark_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_XXL_dark_dark_bootstrap@2x.png new file mode 100644 index 00000000..21c0f51a Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_XXL_dark_dark_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_XXL_light_light_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_XXL_light_light_bootstrap@2x.png new file mode 100644 index 00000000..da93f81e Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_XXL_light_light_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_XXXL_dark_dark_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_XXXL_dark_dark_bootstrap@2x.png new file mode 100644 index 00000000..21c0f51a Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_XXXL_dark_dark_bootstrap@2x.png differ diff --git a/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_XXXL_light_light_bootstrap@2x.png b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_XXXL_light_light_bootstrap@2x.png new file mode 100644 index 00000000..da93f81e Binary files /dev/null and b/Bootstrap/BootstrapTests/ReferenceImages/DynamicTypeTests/something_custom_with_model_and_OS_XXXL_light_light_bootstrap@2x.png differ diff --git a/Bootstrap/Podfile.lock b/Bootstrap/Podfile.lock index 7e416e0f..0ec40ac9 100644 --- a/Bootstrap/Podfile.lock +++ b/Bootstrap/Podfile.lock @@ -8,9 +8,9 @@ PODS: - iOSSnapshotTestCase/SwiftSupport (8.0.0): - iOSSnapshotTestCase/Core - Nimble (11.0.0) - - Nimble-Snapshots (9.4.0): - - Nimble-Snapshots/Core (= 9.4.0) - - Nimble-Snapshots/Core (9.4.0): + - Nimble-Snapshots (9.6.0): + - Nimble-Snapshots/Core (= 9.6.0) + - Nimble-Snapshots/Core (9.6.0): - iOSSnapshotTestCase (~> 8.0) - Nimble (~> 11.0) - Quick (6.0.0) @@ -35,7 +35,7 @@ SPEC CHECKSUMS: Forgeries: 64ced144ea8341d89a7eec9d1d7986f0f1366250 iOSSnapshotTestCase: a670511f9ee3829c2b9c23e6e68f315fd7b6790f Nimble: a854c12888a21d9e25a0413bb743ad76c37ef50c - Nimble-Snapshots: 9f29ff080d7aeceedd1c9b929cdb690e0a86439a + Nimble-Snapshots: 685ec7707c6055bce156341aa9d398a9d3e02f6f Quick: 4d5ab9e81f0a632cbf9bc4f3069b55e5eeb175df PODFILE CHECKSUM: cd5b709b72116303d001ccd6a46fecaf6ce2c21b diff --git a/Bootstrap/Pods/Local Podspecs/Nimble-Snapshots.podspec.json b/Bootstrap/Pods/Local Podspecs/Nimble-Snapshots.podspec.json index d0c8c7dc..e0e01bc8 100644 --- a/Bootstrap/Pods/Local Podspecs/Nimble-Snapshots.podspec.json +++ b/Bootstrap/Pods/Local Podspecs/Nimble-Snapshots.podspec.json @@ -1,6 +1,6 @@ { "name": "Nimble-Snapshots", - "version": "9.4.0", + "version": "9.6.0", "summary": "Nimble matchers for iOSSnapshotTestCase", "description": "Nimble matchers for iOSSnapshotTestCase. Highly derivative of [Expecta Matchers for iOSSnapshotTestCase](https://github.com/dblock/ios-snapshot-test-case-expecta).", "homepage": "https://github.com/ashfurrow/Nimble-Snapshots", @@ -22,7 +22,7 @@ }, "source": { "git": "https://github.com/ashfurrow/Nimble-Snapshots.git", - "tag": "9.4.0" + "tag": "9.6.0" }, "default_subspecs": "Core", "frameworks": [ diff --git a/Bootstrap/Pods/Manifest.lock b/Bootstrap/Pods/Manifest.lock index 7e416e0f..0ec40ac9 100644 --- a/Bootstrap/Pods/Manifest.lock +++ b/Bootstrap/Pods/Manifest.lock @@ -8,9 +8,9 @@ PODS: - iOSSnapshotTestCase/SwiftSupport (8.0.0): - iOSSnapshotTestCase/Core - Nimble (11.0.0) - - Nimble-Snapshots (9.4.0): - - Nimble-Snapshots/Core (= 9.4.0) - - Nimble-Snapshots/Core (9.4.0): + - Nimble-Snapshots (9.6.0): + - Nimble-Snapshots/Core (= 9.6.0) + - Nimble-Snapshots/Core (9.6.0): - iOSSnapshotTestCase (~> 8.0) - Nimble (~> 11.0) - Quick (6.0.0) @@ -35,7 +35,7 @@ SPEC CHECKSUMS: Forgeries: 64ced144ea8341d89a7eec9d1d7986f0f1366250 iOSSnapshotTestCase: a670511f9ee3829c2b9c23e6e68f315fd7b6790f Nimble: a854c12888a21d9e25a0413bb743ad76c37ef50c - Nimble-Snapshots: 9f29ff080d7aeceedd1c9b929cdb690e0a86439a + Nimble-Snapshots: 685ec7707c6055bce156341aa9d398a9d3e02f6f Quick: 4d5ab9e81f0a632cbf9bc4f3069b55e5eeb175df PODFILE CHECKSUM: cd5b709b72116303d001ccd6a46fecaf6ce2c21b diff --git a/Bootstrap/Pods/Pods.xcodeproj/project.pbxproj b/Bootstrap/Pods/Pods.xcodeproj/project.pbxproj index 8410e8a4..dd03bf06 100644 --- a/Bootstrap/Pods/Pods.xcodeproj/project.pbxproj +++ b/Bootstrap/Pods/Pods.xcodeproj/project.pbxproj @@ -1186,8 +1186,8 @@ BFDFE7DC352907FC980B868725387E98 /* Project object */ = { isa = PBXProject; attributes = { - LastSwiftUpdateCheck = 1300; - LastUpgradeCheck = 1300; + LastSwiftUpdateCheck = 1240; + LastUpgradeCheck = 1240; }; buildConfigurationList = 4821239608C13582E20E6DA73FD5F1F9 /* Build configuration list for PBXProject "Pods" */; compatibilityVersion = "Xcode 8.0"; diff --git a/Bootstrap/Pods/Target Support Files/Nimble-Snapshots/Nimble-Snapshots-Info.plist b/Bootstrap/Pods/Target Support Files/Nimble-Snapshots/Nimble-Snapshots-Info.plist index f9eb4b5f..1485403d 100644 --- a/Bootstrap/Pods/Target Support Files/Nimble-Snapshots/Nimble-Snapshots-Info.plist +++ b/Bootstrap/Pods/Target Support Files/Nimble-Snapshots/Nimble-Snapshots-Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 9.4.0 + 9.6.0 CFBundleSignature ???? CFBundleVersion diff --git a/CHANGELOG.md b/CHANGELOG.md index 60af3a6c..16e70ebf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ - Nothing yet! +## 9.6.0 + +- Add abitlity to test in light and dark mode + ## 9.5.1 - Fixes SPM definition. See #255 - @diogot diff --git a/Gemfile.lock b/Gemfile.lock index 2e26972b..37848dec 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,16 +1,15 @@ GEM remote: https://rubygems.org/ specs: - CFPropertyList (3.0.5) + CFPropertyList (3.0.6) rexml - activesupport (6.1.7.2) + activesupport (7.0.4.3) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) - zeitwerk (~> 2.3) - addressable (2.8.0) - public_suffix (>= 2.0.2, < 5.0) + addressable (2.8.1) + public_suffix (>= 2.0.2, < 6.0) algoliasearch (1.27.5) httpclient (~> 2.8, >= 2.8.3) json (>= 1.5.1) @@ -20,15 +19,15 @@ GEM cork nap open4 (~> 1.3) - cocoapods (1.11.3) + cocoapods (1.12.0) addressable (~> 2.8) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.11.3) + cocoapods-core (= 1.12.0) cocoapods-deintegrate (>= 1.0.3, < 2.0) - cocoapods-downloader (>= 1.4.0, < 2.0) + cocoapods-downloader (>= 1.6.0, < 2.0) cocoapods-plugins (>= 1.0.0, < 2.0) cocoapods-search (>= 1.0.0, < 2.0) - cocoapods-trunk (>= 1.4.0, < 2.0) + cocoapods-trunk (>= 1.6.0, < 2.0) cocoapods-try (>= 1.1.0, < 2.0) colored2 (~> 3.1) escape (~> 0.0.4) @@ -36,10 +35,10 @@ GEM gh_inspector (~> 1.0) molinillo (~> 0.8.0) nap (~> 1.0) - ruby-macho (>= 1.0, < 3.0) + ruby-macho (>= 2.3.0, < 3.0) xcodeproj (>= 1.21.0, < 2.0) - cocoapods-core (1.11.3) - activesupport (>= 5.0, < 7) + cocoapods-core (1.12.0) + activesupport (>= 5.0, < 8) addressable (~> 2.8) algoliasearch (~> 1.0) concurrent-ruby (~> 1.1) @@ -58,78 +57,59 @@ GEM netrc (~> 0.11) cocoapods-try (1.2.0) colored2 (3.1.2) - concurrent-ruby (1.2.0) + concurrent-ruby (1.2.2) cork (0.3.0) colored2 (~> 3.1) - danger (8.6.1) + danger (9.2.0) claide (~> 1.0) claide-plugins (>= 0.9.2) colored2 (~> 3.1) cork (~> 0.1) - faraday (>= 0.9.0, < 2.0) + faraday (>= 0.9.0, < 3.0) faraday-http-cache (~> 2.0) git (~> 1.7) kramdown (~> 2.3) kramdown-parser-gfm (~> 1.0) no_proxy_fix - octokit (~> 4.7) + octokit (~> 5.0) terminal-table (>= 1, < 4) - danger-swiftlint (0.30.2) + danger-swiftlint (0.32.0) danger rake (> 10) thor (~> 0.19) escape (0.0.4) - ethon (0.15.0) + ethon (0.16.0) ffi (>= 1.15.0) - faraday (1.10.0) - faraday-em_http (~> 1.0) - faraday-em_synchrony (~> 1.0) - faraday-excon (~> 1.1) - faraday-httpclient (~> 1.0) - faraday-multipart (~> 1.0) - faraday-net_http (~> 1.0) - faraday-net_http_persistent (~> 1.0) - faraday-patron (~> 1.0) - faraday-rack (~> 1.0) - faraday-retry (~> 1.0) + faraday (2.7.4) + faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) - faraday-em_http (1.0.0) - faraday-em_synchrony (1.0.0) - faraday-excon (1.1.0) - faraday-http-cache (2.2.0) + faraday-http-cache (2.4.1) faraday (>= 0.8) - faraday-httpclient (1.0.1) - faraday-multipart (1.0.3) - multipart-post (>= 1.2, < 3) - faraday-net_http (1.0.1) - faraday-net_http_persistent (1.2.0) - faraday-patron (1.0.0) - faraday-rack (1.0.0) - faraday-retry (1.0.3) + faraday-net_http (3.0.2) ffi (1.15.5) fourflusher (2.3.1) fuzzy_match (2.0.4) gh_inspector (1.1.3) - git (1.11.0) + git (1.18.0) + addressable (~> 2.8) rchardet (~> 1.8) httpclient (2.8.3) i18n (1.12.0) concurrent-ruby (~> 1.0) - json (2.6.1) + json (2.6.3) kramdown (2.4.0) rexml kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) - minitest (5.17.0) + minitest (5.18.0) molinillo (0.8.0) - multipart-post (2.1.1) nanaimo (0.3.0) nap (1.1.0) netrc (0.11.0) no_proxy_fix (0.1.2) - octokit (4.22.0) - faraday (>= 0.9) - sawyer (~> 0.8.0, >= 0.5.3) + octokit (5.6.1) + faraday (>= 1, < 3) + sawyer (~> 0.9) open4 (1.3.4) public_suffix (4.0.7) rake (13.0.6) @@ -138,9 +118,9 @@ GEM rouge (2.0.7) ruby-macho (2.5.1) ruby2_keywords (0.0.5) - sawyer (0.8.2) + sawyer (0.9.2) addressable (>= 2.3.5) - faraday (> 0.8, < 2.0) + faraday (>= 0.17.3, < 3) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) thor (0.20.3) @@ -148,8 +128,8 @@ GEM ethon (>= 0.9.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.1.0) - xcodeproj (1.21.0) + unicode-display_width (2.4.2) + xcodeproj (1.22.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) @@ -158,7 +138,6 @@ GEM rexml (~> 3.2.4) xcpretty (0.3.0) rouge (~> 2.0.7) - zeitwerk (2.6.6) PLATFORMS ruby @@ -171,4 +150,4 @@ DEPENDENCIES xcpretty BUNDLED WITH - 2.2.16 + 2.4.6 diff --git a/Nimble-Snapshots.podspec b/Nimble-Snapshots.podspec index d686e42e..21185f5a 100644 --- a/Nimble-Snapshots.podspec +++ b/Nimble-Snapshots.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Nimble-Snapshots" - s.version = "9.5.1" + s.version = "9.6.0" s.summary = "Nimble matchers for iOSSnapshotTestCase" s.description = <<-DESC Nimble matchers for iOSSnapshotTestCase. Highly derivative of [Expecta Matchers for iOSSnapshotTestCase](https://github.com/dblock/ios-snapshot-test-case-expecta). diff --git a/Nimble_Snapshots/DynamicSize/DynamicSizeSnapshot.swift b/Nimble_Snapshots/DynamicSize/DynamicSizeSnapshot.swift index bc4bcf70..6fa33e2f 100644 --- a/Nimble_Snapshots/DynamicSize/DynamicSizeSnapshot.swift +++ b/Nimble_Snapshots/DynamicSize/DynamicSizeSnapshot.swift @@ -128,21 +128,34 @@ public struct DynamicSizeSnapshot { let record: Bool let sizes: [String: CGSize] let resizeMode: ResizeMode - - init(name: String?, identifier: String?, record: Bool, sizes: [String: CGSize], resizeMode: ResizeMode) { + let userInterfaceStyle: UIUserInterfaceStyle? + + init(name: String?, + identifier: String?, + record: Bool, + sizes: [String: CGSize], + resizeMode: ResizeMode, + userInterfaceStyle: UIUserInterfaceStyle?) { self.name = name self.identifier = identifier self.record = record self.sizes = sizes self.resizeMode = resizeMode + self.userInterfaceStyle = userInterfaceStyle } } public func snapshot(_ name: String? = nil, identifier: String? = nil, sizes: [String: CGSize], - resizeMode: ResizeMode = .frame) -> DynamicSizeSnapshot { - return DynamicSizeSnapshot(name: name, identifier: identifier, record: false, sizes: sizes, resizeMode: resizeMode) + resizeMode: ResizeMode = .frame, + userInterfaceStyle: UIUserInterfaceStyle? = nil) -> DynamicSizeSnapshot { + return DynamicSizeSnapshot(name: name, + identifier: identifier, + record: false, + sizes: sizes, + resizeMode: resizeMode, + userInterfaceStyle: userInterfaceStyle) } public func haveValidDynamicSizeSnapshot(named name: String? = nil, @@ -153,7 +166,8 @@ public func haveValidDynamicSizeSnapshot(named name: String? = pixelTolerance: CGFloat? = nil, tolerance: CGFloat? = nil, resizeMode: ResizeMode = .frame, - shouldIgnoreScale: Bool = false) -> Predicate { + shouldIgnoreScale: Bool = false, + userInterfaceStyle: UIUserInterfaceStyle? = nil) -> Predicate { return Predicate { actualExpression in return performDynamicSizeSnapshotTest(name, identifier: identifier, @@ -165,7 +179,23 @@ public func haveValidDynamicSizeSnapshot(named name: String? = pixelTolerance: pixelTolerance, isRecord: false, resizeMode: resizeMode, - shouldIgnoreScale: shouldIgnoreScale) + shouldIgnoreScale: shouldIgnoreScale, + userInterfaceStyle: userInterfaceStyle) + } +} + +extension UIUserInterfaceStyle { + var identifier: String? { + switch self { + case .dark: + return "dark" + case .light: + return "light" + case .unspecified: + return nil + @unknown default: + return nil + } } } @@ -179,7 +209,8 @@ func performDynamicSizeSnapshotTest(_ name: String?, pixelTolerance: CGFloat? = nil, isRecord: Bool, resizeMode: ResizeMode, - shouldIgnoreScale: Bool = false) -> PredicateResult { + shouldIgnoreScale: Bool = false, + userInterfaceStyle: UIUserInterfaceStyle? = nil) -> PredicateResult { // swiftlint:disable:next force_try force_unwrapping let instance = try! actualExpression.evaluate()! let testFileLocation = actualExpression.location.file @@ -193,13 +224,9 @@ func performDynamicSizeSnapshotTest(_ name: String?, let result = sizes.map { sizeName, size -> Bool in // swiftlint:disable:next force_unwrapping let view = instance.snapshotObject! - let finalSnapshotName: String - - if let identifier = identifier { - finalSnapshotName = "\(snapshotName)_\(identifier)_\(sizeName)" - } else { - finalSnapshotName = "\(snapshotName)_\(sizeName)" - } + let finalSnapshotName = [snapshotName, identifier, "\(sizeName)", userInterfaceStyle?.identifier] + .compactMap { $0 } + .joined(separator: "_") resizer.resize(view: view, for: size) @@ -210,7 +237,7 @@ func performDynamicSizeSnapshotTest(_ name: String?, referenceDirectory: referenceImageDirectory, tolerance: tolerance, perPixelTolerance: pixelTolerance, filename: filename, identifier: nil, - shouldIgnoreScale: shouldIgnoreScale) + shouldIgnoreScale: shouldIgnoreScale, userInterfaceStyle: userInterfaceStyle) } if isRecord { @@ -240,8 +267,14 @@ func performDynamicSizeSnapshotTest(_ name: String?, public func recordSnapshot(_ name: String? = nil, identifier: String? = nil, sizes: [String: CGSize], - resizeMode: ResizeMode = .frame) -> DynamicSizeSnapshot { - return DynamicSizeSnapshot(name: name, identifier: identifier, record: true, sizes: sizes, resizeMode: resizeMode) + resizeMode: ResizeMode = .frame, + userInterfaceStyle: UIUserInterfaceStyle? = nil) -> DynamicSizeSnapshot { + return DynamicSizeSnapshot(name: name, + identifier: identifier, + record: true, + sizes: sizes, + resizeMode: resizeMode, + userInterfaceStyle: userInterfaceStyle) } public func recordDynamicSizeSnapshot(named name: String? = nil, @@ -250,7 +283,8 @@ public func recordDynamicSizeSnapshot(named name: String? = nil isDeviceAgnostic: Bool = false, usesDrawRect: Bool = false, resizeMode: ResizeMode = .frame, - shouldIgnoreScale: Bool = false) -> Predicate { + shouldIgnoreScale: Bool = false, + userInterfaceStyle: UIUserInterfaceStyle? = nil) -> Predicate { return Predicate { actualExpression in return performDynamicSizeSnapshotTest(name, identifier: identifier, @@ -260,7 +294,8 @@ public func recordDynamicSizeSnapshot(named name: String? = nil actualExpression: actualExpression, isRecord: true, resizeMode: resizeMode, - shouldIgnoreScale: shouldIgnoreScale) + shouldIgnoreScale: shouldIgnoreScale, + userInterfaceStyle: userInterfaceStyle) } } @@ -269,11 +304,13 @@ public func ==(lhs: Expectation, rhs: DynamicSi lhs.to(recordDynamicSizeSnapshot(named: rhs.name, identifier: rhs.identifier, sizes: rhs.sizes, - resizeMode: rhs.resizeMode)) + resizeMode: rhs.resizeMode, + userInterfaceStyle: rhs.userInterfaceStyle)) } else { lhs.to(haveValidDynamicSizeSnapshot(named: rhs.name, identifier: rhs.identifier, sizes: rhs.sizes, - resizeMode: rhs.resizeMode)) + resizeMode: rhs.resizeMode, + userInterfaceStyle: rhs.userInterfaceStyle)) } } diff --git a/Nimble_Snapshots/DynamicType/HaveValidDynamicTypeSnapshot.swift b/Nimble_Snapshots/DynamicType/HaveValidDynamicTypeSnapshot.swift index 2826688c..6f2ac118 100644 --- a/Nimble_Snapshots/DynamicType/HaveValidDynamicTypeSnapshot.swift +++ b/Nimble_Snapshots/DynamicType/HaveValidDynamicTypeSnapshot.swift @@ -37,12 +37,16 @@ public func haveValidDynamicTypeSnapshot(named name: String? = pixelTolerance: CGFloat? = nil, tolerance: CGFloat? = nil, sizes: [UIContentSizeCategory] = allContentSizeCategories(), - isDeviceAgnostic: Bool = false) -> Predicate { + isDeviceAgnostic: Bool = false, + userInterfaceStyle: UIUserInterfaceStyle? = nil) -> Predicate { let mock = NBSMockedApplication() let predicates: [Predicate] = sizes.map { category in let sanitizedName = sanitizedTestName(name) - let nameWithCategory = "\(sanitizedName)_\(shortCategoryName(category))" + var nameWithCategory = "\(sanitizedName)_\(shortCategoryName(category))" + if let userInterfaceStyle = userInterfaceStyle, let userInterfaceStyleIdentifier = userInterfaceStyle.identifier { + nameWithCategory += "_\(userInterfaceStyleIdentifier)" + } return Predicate { actualExpression in mock.mockPreferredContentSizeCategory(category) @@ -52,13 +56,15 @@ public func haveValidDynamicTypeSnapshot(named name: String? = if isDeviceAgnostic { predicate = haveValidDeviceAgnosticSnapshot(named: nameWithCategory, identifier: identifier, usesDrawRect: usesDrawRect, pixelTolerance: pixelTolerance, - tolerance: tolerance) + tolerance: tolerance, + userInterfaceStyle: userInterfaceStyle) } else { predicate = haveValidSnapshot(named: nameWithCategory, identifier: identifier, usesDrawRect: usesDrawRect, pixelTolerance: pixelTolerance, - tolerance: tolerance) + tolerance: tolerance, + userInterfaceStyle: userInterfaceStyle) } return try predicate.satisfies(actualExpression) @@ -74,12 +80,16 @@ public func recordDynamicTypeSnapshot(named name: String? = nil identifier: String? = nil, usesDrawRect: Bool = false, sizes: [UIContentSizeCategory] = allContentSizeCategories(), - isDeviceAgnostic: Bool = false) -> Predicate { + isDeviceAgnostic: Bool = false, + userInterfaceStyle: UIUserInterfaceStyle? = nil) -> Predicate { let mock = NBSMockedApplication() let predicates: [Predicate] = sizes.map { category in let sanitizedName = sanitizedTestName(name) - let nameWithCategory = "\(sanitizedName)_\(shortCategoryName(category))" + var nameWithCategory = "\(sanitizedName)_\(shortCategoryName(category))" + if let userInterfaceStyle = userInterfaceStyle, let userInterfaceStyleIdentifier = userInterfaceStyle.identifier { + nameWithCategory += "_\(userInterfaceStyleIdentifier)" + } return Predicate { actualExpression in mock.mockPreferredContentSizeCategory(category) @@ -89,9 +99,13 @@ public func recordDynamicTypeSnapshot(named name: String? = nil if isDeviceAgnostic { predicate = recordDeviceAgnosticSnapshot(named: nameWithCategory, identifier: identifier, - usesDrawRect: usesDrawRect) + usesDrawRect: usesDrawRect, + userInterfaceStyle: userInterfaceStyle) } else { - predicate = recordSnapshot(named: nameWithCategory, identifier: identifier, usesDrawRect: usesDrawRect) + predicate = recordSnapshot(named: nameWithCategory, + identifier: identifier, + usesDrawRect: usesDrawRect, + userInterfaceStyle: userInterfaceStyle) } return try predicate.satisfies(actualExpression) diff --git a/Nimble_Snapshots/DynamicType/PrettyDynamicTypeSyntax.swift b/Nimble_Snapshots/DynamicType/PrettyDynamicTypeSyntax.swift index 560cbc5d..011bf9cf 100644 --- a/Nimble_Snapshots/DynamicType/PrettyDynamicTypeSyntax.swift +++ b/Nimble_Snapshots/DynamicType/PrettyDynamicTypeSyntax.swift @@ -9,51 +9,72 @@ public struct DynamicTypeSnapshot { let record: Bool let sizes: [UIContentSizeCategory] let deviceAgnostic: Bool + let userInterfaceStyle: UIUserInterfaceStyle? - init(name: String?, identifier: String?, record: Bool, sizes: [UIContentSizeCategory], deviceAgnostic: Bool) { + init(name: String?, + identifier: String?, + record: Bool, + sizes: [UIContentSizeCategory], + deviceAgnostic: Bool, + userInterfaceStyle: UIUserInterfaceStyle?) { self.name = name self.identifier = identifier self.record = record self.sizes = sizes self.deviceAgnostic = deviceAgnostic + self.userInterfaceStyle = userInterfaceStyle } } public func dynamicTypeSnapshot(_ name: String? = nil, identifier: String? = nil, sizes: [UIContentSizeCategory] = allContentSizeCategories(), - deviceAgnostic: Bool = false) -> DynamicTypeSnapshot { + deviceAgnostic: Bool = false, + userInterfaceStyle: UIUserInterfaceStyle? = nil) -> DynamicTypeSnapshot { return DynamicTypeSnapshot(name: name, identifier: identifier, record: false, sizes: sizes, - deviceAgnostic: deviceAgnostic) + deviceAgnostic: deviceAgnostic, + userInterfaceStyle: userInterfaceStyle) } public func recordDynamicTypeSnapshot(_ name: String? = nil, identifier: String? = nil, sizes: [UIContentSizeCategory] = allContentSizeCategories(), - deviceAgnostic: Bool = false) -> DynamicTypeSnapshot { + deviceAgnostic: Bool = false, + userInterfaceStyle: UIUserInterfaceStyle? = nil) -> DynamicTypeSnapshot { return DynamicTypeSnapshot(name: name, identifier: identifier, record: true, sizes: sizes, - deviceAgnostic: deviceAgnostic) + deviceAgnostic: deviceAgnostic, + userInterfaceStyle: userInterfaceStyle) } public func ==(lhs: Expectation, rhs: DynamicTypeSnapshot) where Expectation.Value: Snapshotable { if let name = rhs.name { if rhs.record { - lhs.to(recordDynamicTypeSnapshot(named: name, sizes: rhs.sizes, isDeviceAgnostic: rhs.deviceAgnostic)) + lhs.to(recordDynamicTypeSnapshot(named: name, + sizes: rhs.sizes, + isDeviceAgnostic: rhs.deviceAgnostic, + userInterfaceStyle: rhs.userInterfaceStyle)) } else { - lhs.to(haveValidDynamicTypeSnapshot(named: name, sizes: rhs.sizes, isDeviceAgnostic: rhs.deviceAgnostic)) + lhs.to(haveValidDynamicTypeSnapshot(named: name, + sizes: rhs.sizes, + isDeviceAgnostic: rhs.deviceAgnostic, + userInterfaceStyle: rhs.userInterfaceStyle)) } } else { if rhs.record { - lhs.to(recordDynamicTypeSnapshot(sizes: rhs.sizes, isDeviceAgnostic: rhs.deviceAgnostic)) + lhs.to(recordDynamicTypeSnapshot(sizes: rhs.sizes, + isDeviceAgnostic: rhs.deviceAgnostic, + userInterfaceStyle: rhs.userInterfaceStyle)) } else { - lhs.to(haveValidDynamicTypeSnapshot(sizes: rhs.sizes, isDeviceAgnostic: rhs.deviceAgnostic)) + lhs.to(haveValidDynamicTypeSnapshot(sizes: rhs.sizes, + isDeviceAgnostic: rhs.deviceAgnostic, + userInterfaceStyle: rhs.userInterfaceStyle)) } } } diff --git a/Nimble_Snapshots/HaveValidSnapshot.swift b/Nimble_Snapshots/HaveValidSnapshot.swift index eb650d41..0fe93096 100644 --- a/Nimble_Snapshots/HaveValidSnapshot.swift +++ b/Nimble_Snapshots/HaveValidSnapshot.swift @@ -51,7 +51,8 @@ public class FBSnapshotTest: NSObject { perPixelTolerance: CGFloat, filename: String, identifier: String? = nil, - shouldIgnoreScale: Bool = false) -> Bool { + shouldIgnoreScale: Bool = false, + userInterfaceStyle: UIUserInterfaceStyle? = nil) -> Bool { let testName = parseFilename(filename: filename) let snapshotController: FBSnapshotTestController = FBSnapshotTestController(test: self) @@ -66,7 +67,8 @@ public class FBSnapshotTest: NSObject { snapshotController.recordMode = record snapshotController.referenceImagesDirectory = referenceDirectory snapshotController.imageDiffDirectory = defaultImageDiffDirectory - snapshotController.usesDrawViewHierarchyInRect = usesDrawRect + // if an userInterfaceStyle is sent, we need to force usesDrawViewHierarchyInRect + snapshotController.usesDrawViewHierarchyInRect = userInterfaceStyle == nil ? usesDrawRect : true let reason = "Missing value for referenceImagesDirectory - " + "Call FBSnapshotTest.setReferenceImagesDirectory(FB_REFERENCE_IMAGE_DIR)" @@ -76,6 +78,10 @@ public class FBSnapshotTest: NSObject { fatalError("Failed unwrapping Snapshot Object") } + if let userInterfaceStyle = userInterfaceStyle { + snapshotObject.overrideUserInterfaceStyle = userInterfaceStyle + } + do { try snapshotController.compareSnapshot(ofViewOrLayer: snapshotObject, selector: Selector(snapshot), @@ -209,12 +215,20 @@ private func performSnapshotTest(_ name: String?, actualExpression: Expression, pixelTolerance: CGFloat? = nil, tolerance: CGFloat?, - shouldIgnoreScale: Bool) -> PredicateResult { + shouldIgnoreScale: Bool, + userInterfaceStyle: UIUserInterfaceStyle? = nil) -> PredicateResult { // swiftlint:disable:next force_try force_unwrapping let instance = try! actualExpression.evaluate()! let testFileLocation = actualExpression.location.file let referenceImageDirectory = getDefaultReferenceDirectory(testFileLocation) - let snapshotName = sanitizedTestName(name) + + let snapshotName: String + if let userInterfaceStyle = userInterfaceStyle, let userInterfaceStyleIdentifier = userInterfaceStyle.identifier { + snapshotName = sanitizedTestName(name) + "_\(userInterfaceStyleIdentifier)" + } else { + snapshotName = sanitizedTestName(name) + } + let tolerance = tolerance ?? getTolerance() let pixelTolerance = pixelTolerance ?? getPixelTolerance() let filename = "\(actualExpression.location.file)" @@ -224,7 +238,8 @@ private func performSnapshotTest(_ name: String?, referenceDirectory: referenceImageDirectory, tolerance: tolerance, perPixelTolerance: pixelTolerance, filename: filename, identifier: identifier, - shouldIgnoreScale: shouldIgnoreScale) + shouldIgnoreScale: shouldIgnoreScale, + userInterfaceStyle: userInterfaceStyle) return PredicateResult(status: PredicateStatus(bool: result), message: .fail("expected a matching snapshot in \(snapshotName)")) @@ -235,12 +250,20 @@ private func recordSnapshot(_ name: String?, isDeviceAgnostic: Bool = false, usesDrawRect: Bool = false, actualExpression: Expression, - shouldIgnoreScale: Bool) -> PredicateResult { + shouldIgnoreScale: Bool, + userInterfaceStyle: UIUserInterfaceStyle? = nil) -> PredicateResult { // swiftlint:disable:next force_try force_unwrapping let instance = try! actualExpression.evaluate()! let testFileLocation = actualExpression.location.file let referenceImageDirectory = getDefaultReferenceDirectory(testFileLocation) - let snapshotName = sanitizedTestName(name) + + let snapshotName: String + if let userInterfaceStyle = userInterfaceStyle, let userInterfaceStyleIdentifier = userInterfaceStyle.identifier { + snapshotName = sanitizedTestName(name) + "_\(userInterfaceStyleIdentifier)" + } else { + snapshotName = sanitizedTestName(name) + } + let tolerance = getTolerance() let pixelTolerance = getPixelTolerance() let filename = "\(actualExpression.location.file)" @@ -256,7 +279,8 @@ private func recordSnapshot(_ name: String?, perPixelTolerance: pixelTolerance, filename: filename, identifier: identifier, - shouldIgnoreScale: shouldIgnoreScale) { + shouldIgnoreScale: shouldIgnoreScale, + userInterfaceStyle: userInterfaceStyle) { let name = name ?? snapshotName message = "snapshot \(name) successfully recorded, replace recordSnapshot with a check" } else if let name = name { @@ -280,7 +304,8 @@ public func haveValidSnapshot(named name: String? = nil, usesDrawRect: Bool = false, pixelTolerance: CGFloat? = nil, tolerance: CGFloat? = nil, - shouldIgnoreScale: Bool = false) -> Predicate { + shouldIgnoreScale: Bool = false, + userInterfaceStyle: UIUserInterfaceStyle? = nil) -> Predicate { return Predicate { actualExpression in if switchChecksWithRecords { @@ -288,7 +313,8 @@ public func haveValidSnapshot(named name: String? = nil, identifier: identifier, usesDrawRect: usesDrawRect, actualExpression: actualExpression, - shouldIgnoreScale: shouldIgnoreScale) + shouldIgnoreScale: shouldIgnoreScale, + userInterfaceStyle: userInterfaceStyle) } return performSnapshotTest(name, @@ -297,7 +323,8 @@ public func haveValidSnapshot(named name: String? = nil, actualExpression: actualExpression, pixelTolerance: pixelTolerance, tolerance: tolerance, - shouldIgnoreScale: shouldIgnoreScale) + shouldIgnoreScale: shouldIgnoreScale, + userInterfaceStyle: userInterfaceStyle) } } @@ -306,7 +333,8 @@ public func haveValidDeviceAgnosticSnapshot(named name: String? usesDrawRect: Bool = false, pixelTolerance: CGFloat? = nil, tolerance: CGFloat? = nil, - shouldIgnoreScale: Bool = false) -> Predicate { + shouldIgnoreScale: Bool = false, + userInterfaceStyle: UIUserInterfaceStyle? = nil) -> Predicate { return Predicate { actualExpression in if switchChecksWithRecords { @@ -315,7 +343,8 @@ public func haveValidDeviceAgnosticSnapshot(named name: String? isDeviceAgnostic: true, usesDrawRect: usesDrawRect, actualExpression: actualExpression, - shouldIgnoreScale: shouldIgnoreScale) + shouldIgnoreScale: shouldIgnoreScale, + userInterfaceStyle: userInterfaceStyle) } return performSnapshotTest(name, @@ -325,30 +354,35 @@ public func haveValidDeviceAgnosticSnapshot(named name: String? actualExpression: actualExpression, pixelTolerance: pixelTolerance, tolerance: tolerance, - shouldIgnoreScale: shouldIgnoreScale) + shouldIgnoreScale: shouldIgnoreScale, + userInterfaceStyle: userInterfaceStyle) } } public func recordSnapshot(named name: String? = nil, identifier: String? = nil, usesDrawRect: Bool = false, - shouldIgnoreScale: Bool = false) -> Predicate { + shouldIgnoreScale: Bool = false, + userInterfaceStyle: UIUserInterfaceStyle? = nil) -> Predicate { return Predicate { actualExpression in return recordSnapshot(name, identifier: identifier, usesDrawRect: usesDrawRect, actualExpression: actualExpression, - shouldIgnoreScale: shouldIgnoreScale) + shouldIgnoreScale: shouldIgnoreScale, + userInterfaceStyle: userInterfaceStyle) } } public func recordDeviceAgnosticSnapshot(named name: String? = nil, identifier: String? = nil, usesDrawRect: Bool = false, - shouldIgnoreScale: Bool = false) -> Predicate { + shouldIgnoreScale: Bool = false, + userInterfaceStyle: UIUserInterfaceStyle? = nil) -> Predicate { return Predicate { actualExpression in return recordSnapshot(name, identifier: identifier, isDeviceAgnostic: true, usesDrawRect: usesDrawRect, actualExpression: actualExpression, - shouldIgnoreScale: shouldIgnoreScale) + shouldIgnoreScale: shouldIgnoreScale, + userInterfaceStyle: userInterfaceStyle) } } diff --git a/Nimble_Snapshots/PrettySyntax.swift b/Nimble_Snapshots/PrettySyntax.swift index 80de03aa..7559bf1b 100644 --- a/Nimble_Snapshots/PrettySyntax.swift +++ b/Nimble_Snapshots/PrettySyntax.swift @@ -1,4 +1,5 @@ import Nimble +import UIKit // MARK: - Nicer syntax using == operator @@ -7,32 +8,42 @@ public struct Snapshot { let identifier: String? let record: Bool let usesDrawRect: Bool + let userInterfaceStyle: UIUserInterfaceStyle? - init(name: String?, identifier: String?, record: Bool, usesDrawRect: Bool) { + init(name: String?, identifier: String?, record: Bool, usesDrawRect: Bool, userInterfaceStyle: UIUserInterfaceStyle?) { self.name = name self.identifier = identifier self.record = record self.usesDrawRect = usesDrawRect + self.userInterfaceStyle = userInterfaceStyle } } public func snapshot(_ name: String? = nil, identifier: String? = nil, - usesDrawRect: Bool = false) -> Snapshot { - return Snapshot(name: name, identifier: identifier, record: false, usesDrawRect: usesDrawRect) + usesDrawRect: Bool = false, + userInterfaceStyle: UIUserInterfaceStyle? = nil) -> Snapshot { + return Snapshot(name: name, identifier: identifier, record: false, usesDrawRect: usesDrawRect, userInterfaceStyle: userInterfaceStyle) } public func recordSnapshot(_ name: String? = nil, identifier: String? = nil, - usesDrawRect: Bool = false) -> Snapshot { - return Snapshot(name: name, identifier: identifier, record: true, usesDrawRect: usesDrawRect) + usesDrawRect: Bool = false, + userInterfaceStyle: UIUserInterfaceStyle? = nil) -> Snapshot { + return Snapshot(name: name, identifier: identifier, record: true, usesDrawRect: usesDrawRect, userInterfaceStyle: userInterfaceStyle) } public func ==(lhs: Expectation, rhs: Snapshot) where Expectation.Value: Snapshotable { if rhs.record { - lhs.to(recordSnapshot(named: rhs.name, identifier: rhs.identifier, usesDrawRect: rhs.usesDrawRect)) + lhs.to(recordSnapshot(named: rhs.name, + identifier: rhs.identifier, + usesDrawRect: rhs.usesDrawRect, + userInterfaceStyle: rhs.userInterfaceStyle)) } else { - lhs.to(haveValidSnapshot(named: rhs.name, identifier: rhs.identifier, usesDrawRect: rhs.usesDrawRect)) + lhs.to(haveValidSnapshot(named: rhs.name, + identifier: rhs.identifier, + usesDrawRect: rhs.usesDrawRect, + userInterfaceStyle: rhs.userInterfaceStyle)) } } diff --git a/README.md b/README.md index dc6ef671..08b7fef4 100644 --- a/README.md +++ b/README.md @@ -201,3 +201,32 @@ implement the `ViewResizer` protocol and resize yourself. The custom behavior can be used to record the views too. For more info on usage, check the [dynamic sizes tests](Bootstrap/BootstrapTests/DynamicSizeTests.swift). + + + +## Light and Dark mode + +Testing in light and dark mode is as easy as sending an extra argument, it also supports dynamic size +and dynamic type, having the convetion to append `light` or `dark` on the file name when looking for it +or saving the screenshot. + +```swift +expect(view) == snapshot("some custom name", userInterfaceStyle: .light) +expect(view) == snapshot("some custom name", userInterfaceStyle: .dark) + +// expect(view).to(recordDynamicTypeSnapshot(userInterfaceStyle: .light) +expect(view).to(haveValidDynamicTypeSnapshot(userInterfaceStyle: .light)) +// expect(view).to(recordDynamicTypeSnapshot(userInterfaceStyle: .dark) +expect(view).to(haveValidDynamicTypeSnapshot(userInterfaceStyle: .dark)) + + +let sizes = ["SmallSize": CGSize(width: 44, height: 44), +"MediumSize": CGSize(width: 88, height: 88), +"LargeSize": CGSize(width: 132, height: 132)] + +// expect(view).to(recordDynamicSizeSnapshot(sizes: sizes, userInterfaceStyle: .light)) +expect(view).to(haveValidDynamicSizeSnapshot(sizes: sizes, userInterfaceStyle: .light)) + +// expect(view).to(recordDynamicSizeSnapshot(sizes: sizes, userInterfaceStyle: .dark)) +expect(view).to(haveValidDynamicSizeSnapshot(sizes: sizes, userInterfaceStyle: .dark)) +``` \ No newline at end of file