@@ -18,7 +18,7 @@ func assertMatch(
18
18
_ line: Int = #line,
19
19
_ function: StaticString = #function,
20
20
@ViewBuilder _ view: ( ) -> some View ,
21
- environment: ( inout EnvironmentValues ) -> ( ) = { _ in }
21
+ environment: @escaping ( inout EnvironmentValues ) -> ( ) = { _ in }
22
22
) throws {
23
23
try assertMatch ( name: " \( URL ( filePath: file) . lastPathComponent) - \( line) - \( function) " , markup, view, environment: environment)
24
24
}
@@ -28,16 +28,16 @@ func assertMatch(
28
28
name: String ,
29
29
_ markup: String ,
30
30
@ViewBuilder _ view: ( ) -> some View ,
31
- environment: ( inout EnvironmentValues ) -> ( ) = { _ in }
31
+ environment: @escaping ( inout EnvironmentValues ) -> ( ) = { _ in }
32
32
) throws {
33
33
let coordinator = LiveViewCoordinator ( URL ( string: " http://localhost " ) !)
34
34
let document = try LiveViewNativeCore . Document. parse ( markup)
35
35
let viewTree = coordinator. builder. fromNodes (
36
36
document [ document. root ( ) ] . children ( ) ,
37
37
context: LiveContext ( coordinator: coordinator, url: coordinator. currentURL)
38
38
) . environment ( \. coordinatorEnvironment, CoordinatorEnvironment ( coordinator, document: document) )
39
- let markupImage = ImageRenderer ( content: viewTree) . uiImage? . pngData ( )
40
- let viewImage = ImageRenderer ( content: view ( ) ) . uiImage? . pngData ( )
39
+ let markupImage = ImageRenderer ( content: viewTree. transformEnvironment ( \ . self , transform : environment ) ) . uiImage? . pngData ( )
40
+ let viewImage = ImageRenderer ( content: view ( ) . transformEnvironment ( \ . self , transform : environment ) ) . uiImage? . pngData ( )
41
41
42
42
if markupImage == viewImage {
43
43
XCTAssert ( true )
0 commit comments