Skip to content

Commit

Permalink
Add OS version to snapshot name
Browse files Browse the repository at this point in the history
  • Loading branch information
lunij committed Jun 14, 2024
1 parent b4b161c commit 6bd1fbc
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Tests/SnapshotTestingTests/SnapshotTestingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ final class SnapshotTestingTests: XCTestCase {
button.bezelStyle = .rounded
button.title = "Push Me"
button.sizeToFit()
assertSnapshot(of: button, as: .image)
assertSnapshot(of: button, as: .recursiveDescription)
assertSnapshot(of: button, as: .image, named: "\(platform)\(osVersion.majorVersion)")
assertSnapshot(of: button, as: .recursiveDescription, named: "\(platform)\(osVersion.majorVersion)")
}

func testNSViewWithLayer() {
Expand All @@ -207,8 +207,8 @@ final class SnapshotTestingTests: XCTestCase {
view.wantsLayer = true
view.layer?.backgroundColor = NSColor.green.cgColor
view.layer?.cornerRadius = 5
assertSnapshot(of: view, as: .image)
assertSnapshot(of: view, as: .recursiveDescription)
assertSnapshot(of: view, as: .image, named: "\(platform)\(osVersion.majorVersion)")
assertSnapshot(of: view, as: .recursiveDescription, named: "\(platform)\(osVersion.majorVersion)")
}
#endif

Expand Down
2 changes: 2 additions & 0 deletions Tests/SnapshotTestingTests/TestHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import XCTest

@testable import SnapshotTesting

let osVersion = ProcessInfo.processInfo.operatingSystemVersion

#if os(iOS)
let platform = "ios"
#elseif os(tvOS)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[ AF ! wLU ] h=--- v=--- NSButton "Push Me" f=(0,0,84,32) b=(-) => <_NSViewBackingLayer>
[ A ! wLU ] h=--- v=--- NSButtonBezelView f=(0,0,84,32) b=(-) => <_NSViewBackingLayer>
[ AF ! wLU ] h=--- v=--- NSButtonTextField "Push Me" f=(11,7,62,15) b=(-) => <NSTextLayer>
A=autoresizesSubviews, C=canDrawConcurrently, D=needsDisplay, F=flipped, G=gstate, H=hidden (h=by ancestor), L=needsLayout (l=child needsLayout), U=needsUpdateConstraints (u=child needsUpdateConstraints), O=opaque, P=preservesContentDuringLiveResize, S=scaled/rotated, W=wantsLayer (w=ancestor wantsLayer), V=needsVibrancy (v=allowsVibrancy), #=has surface
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[ A ! W U ] h=--- v=--- NSView f=(0,0,10,10) b=(-) => <_NSViewBackingLayer>
A=autoresizesSubviews, C=canDrawConcurrently, D=needsDisplay, F=flipped, G=gstate, H=hidden (h=by ancestor), L=needsLayout (l=child needsLayout), U=needsUpdateConstraints (u=child needsUpdateConstraints), O=opaque, P=preservesContentDuringLiveResize, S=scaled/rotated, W=wantsLayer (w=ancestor wantsLayer), V=needsVibrancy (v=allowsVibrancy), #=has surface

0 comments on commit 6bd1fbc

Please sign in to comment.