Skip to content

Commit d3c93cf

Browse files
committed
Add test case to cover ViewInputs change
1 parent 2857dd4 commit d3c93cf

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//
2+
// ViewInputsTest.swift
3+
// OpenSwiftUICoreTests
4+
5+
import OpenGraphShims
6+
@_spi(ForOpenSwiftUIOnly)
7+
import OpenSwiftUICore
8+
import Testing
9+
10+
@MainActor
11+
@Suite(.enabled(if: attributeGraphEnabled))
12+
struct ViewInputsTest {
13+
@Test
14+
func debugProperties() {
15+
let graph = ViewGraph(rootViewType: EmptyView.self)
16+
graph.globalSubgraph.apply {
17+
var inputs = _ViewInputs(withoutGeometry: graph.graphInputs)
18+
19+
#expect(inputs.changedDebugProperties == .all)
20+
inputs.changedDebugProperties = []
21+
22+
inputs.transform = .init(value: .init())
23+
#expect(inputs.changedDebugProperties.contains(.transform))
24+
25+
inputs.size = .init(value: .zero)
26+
#expect(inputs.changedDebugProperties.contains(.size))
27+
28+
inputs.environment = .init(value: .init())
29+
#expect(inputs.changedDebugProperties.contains(.environment))
30+
31+
inputs.viewPhase = .init(value: .invalid)
32+
#expect(inputs.changedDebugProperties.contains(.phase))
33+
}
34+
}
35+
}

0 commit comments

Comments
 (0)