Skip to content

Commit eff9b74

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

File tree

1 file changed

+33
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)