diff --git a/Tests/SnapshotTestingHEICTests/SnapshotTestingHEICTests.swift b/Tests/SnapshotTestingHEICTests/SnapshotTestingHEICTests.swift index e00295a..a88664c 100644 --- a/Tests/SnapshotTestingHEICTests/SnapshotTestingHEICTests.swift +++ b/Tests/SnapshotTestingHEICTests/SnapshotTestingHEICTests.swift @@ -1,19 +1,20 @@ -#if os(iOS) || os(tvOS) import XCTest import SnapshotTesting @testable import SnapshotTestingHEIC final class SnapshotTestingHEICTests: XCTestCase { +#if os(iOS) || os(tvOS) var sut: TestViewController! override func setUp() { super.setUp() sut = TestViewController() -// isRecording = true + // isRecording = true } override func tearDown() { + sut = nil super.tearDown() } @@ -40,6 +41,29 @@ final class SnapshotTestingHEICTests: XCTestCase { assertSnapshot(matching: sut, as: .imageHEIC(on: .iPadPro12_9, compressionQuality: 0.75)) } +#endif -} + +#if os(macOS) + func test_HEIC_NSView() { + // given + let view = NSView() + let button = NSButton() + // when + view.frame = CGRect(origin: .zero, size: CGSize(width: 400, height: 400)) + view.wantsLayer = true + view.layer?.backgroundColor = NSColor.blue.cgColor + view.addSubview(button) + button.frame.origin = CGPoint(x: view.frame.origin.x + view.frame.size.width / 2.0, + y: view.frame.origin.y + view.frame.size.height / 2.0) + button.bezelStyle = .rounded + button.title = "Push Me" + button.wantsLayer = true + button.layer?.backgroundColor = NSColor.red.cgColor + button.sizeToFit() + // then + assertSnapshot(matching: view, as: .imageHEIC) + } #endif + +} diff --git a/Tests/SnapshotTestingHEICTests/__Snapshots__/SnapshotTestingHEICTests/test_HEIC_NSView.1.heic b/Tests/SnapshotTestingHEICTests/__Snapshots__/SnapshotTestingHEICTests/test_HEIC_NSView.1.heic new file mode 100644 index 0000000..e6682f8 Binary files /dev/null and b/Tests/SnapshotTestingHEICTests/__Snapshots__/SnapshotTestingHEICTests/test_HEIC_NSView.1.heic differ