Skip to content

Commit

Permalink
Add tests for os(macOS)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey1312 committed Apr 3, 2022
1 parent 95f5512 commit 1d56cb7
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions Tests/SnapshotTestingHEICTests/SnapshotTestingHEICTests.swift
Original file line number Diff line number Diff line change
@@ -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()
}

Expand All @@ -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

}
Binary file not shown.

0 comments on commit 1d56cb7

Please sign in to comment.