File tree 1 file changed +5
-3
lines changed
Sources/SnapshotTesting/Snapshotting
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,6 @@ extension Snapshotting where Value == NSView, Format == NSImage {
31
31
32
32
let initialFrame = view. frame
33
33
if let size = size { view. frame. size = size }
34
- view. layoutSubtreeIfNeeded ( )
35
34
guard view. frame. width > 0 , view. frame. height > 0 else {
36
35
fatalError ( " View not renderable to image at size \( view. frame. size) " )
37
36
}
@@ -73,8 +72,11 @@ extension Snapshotting where Value == NSView, Format == NSImage {
73
72
74
73
}
75
74
76
- // This is to maintain compatibility with `recursiveDescription`
77
- view. layoutSubtreeIfNeeded ( )
75
+ // This is to maintain compatibility with `recursiveDescription` because the current
76
+ // test snapshots expect `.needsLayout = false` and for some apple magic reason
77
+ // `view.needsLayout = false` does not do anything, but this does.
78
+ let bitmapRep2 = view. bitmapImageRepForCachingDisplay ( in: view. bounds) !
79
+ view. cacheDisplay ( in: view. bounds, to: bitmapRep2)
78
80
}
79
81
80
82
}
You can’t perform that action at this time.
0 commit comments