Skip to content

Commit a8ca3ac

Browse files
committed
[WIP] test(nsview): add more ci-compatible nsview-tests
1 parent 02643ce commit a8ca3ac

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

Tests/SnapshotTestingTests/SnapshotTestingTests.swift

+17-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ final class SnapshotTestingTests: XCTestCase {
249249
button.frame.size = .init(width: 84, height: 32)
250250
assertSnapshot(
251251
matching: button,
252-
as: .image(windowForDrawing: .init(backingScaleFactor: 1, colorSpace: .genericRGB))
252+
as: .image(windowForDrawing: .ci)
253253
)
254254
assertSnapshot(matching: button, as: .recursiveDescription)
255255
#endif
@@ -269,6 +269,22 @@ final class SnapshotTestingTests: XCTestCase {
269269
#endif
270270
}
271271

272+
func testNSViewWithLayerCICompatible() {
273+
#if os(macOS)
274+
let view = NSView()
275+
view.frame = CGRect(x: 0.0, y: 0.0, width: 10.0, height: 10.0)
276+
view.wantsLayer = true
277+
view.layer?.backgroundColor = NSColor.green.cgColor
278+
view.layer?.cornerRadius = 5
279+
view.appearance = NSAppearance(named: .aqua)
280+
assertSnapshot(
281+
matching: view,
282+
as: .image(windowForDrawing: .ci)
283+
)
284+
assertSnapshot(matching: view, as: .recursiveDescription)
285+
#endif
286+
}
287+
272288
func testPrecision() {
273289
#if os(iOS) || os(macOS) || os(tvOS)
274290
#if os(iOS) || os(tvOS)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[ A ! WLU ] h=--- v=--- NSView f=(0,0,10,10) b=(-) => <_NSViewBackingLayer>
2+
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 commit comments

Comments
 (0)