Skip to content

Commit 5fb61c5

Browse files
committed
Add StateTests case
1 parent bccf2b3 commit 5fb61c5

File tree

4 files changed

+42
-13
lines changed

4 files changed

+42
-13
lines changed

Sources/OpenSwiftUICore/Graph/GraphHost.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ extension GraphHost {
371371
style: _GraphMutation_Style = .deferred,
372372
mayDeferUpdate: Bool = true
373373
) where T: GraphMutation {
374-
preconditionFailure("TODO")
374+
// preconditionFailure("TODO")
375375
}
376376

377377
package final func asyncTransaction(

Tests/OpenSwiftUICompatibilityTests/SwiftUICore/Data/Environment/EnvironmentValuesTest.swift renamed to Tests/OpenSwiftUICompatibilityTests/SwiftUICore/Data/Environment/EnvironmentValuesTests.swift

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
//
2-
// EnvironmentValuesTest.swift
3-
//
4-
//
5-
// Created by Kyle on 2023/11/21.
6-
//
2+
// EnvironmentValuesTests.swift
3+
// OpenSwiftUICompatibilityTests
74

85
import Testing
96

10-
struct EnvironmentValuesTest {
7+
struct EnvironmentValuesTests {
118
struct BoolKey: EnvironmentKey {
129
fileprivate static var name: String { "EnvironmentPropertyKey<BoolKey>" }
1310

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
//
2+
// StateTests.swift
3+
// OpenSwiftUICompatibilityTests
4+
5+
import Testing
6+
7+
#if canImport(Darwin)
8+
struct StateTests {
9+
@Test
10+
func appear() async throws {
11+
struct ContentView: View {
12+
var confirmation: Confirmation
13+
14+
@State private var toggle = false
15+
16+
var body: some View {
17+
AnyView(EmptyView())
18+
.onAppear {
19+
toggle.toggle()
20+
if toggle {
21+
confirmation()
22+
}
23+
}
24+
}
25+
}
26+
27+
#if os(iOS)
28+
await confirmation { @MainActor confirmation in
29+
let vc = UIHostingController(rootView: ContentView(confirmation: confirmation))
30+
vc.triggerLayout()
31+
workaroundIssue87(vc)
32+
}
33+
#endif
34+
}
35+
36+
// TODO: Add disappear support and test case
37+
}
38+
#endif

Tests/OpenSwiftUICompatibilityTests/SwiftUICore/Modifier/ViewModifier/AppearanceActionModifierTests.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@ import Testing
88
struct AppearanceActionModifierTests {
99
@Test
1010
func appear() async throws {
11-
guard #unavailable(iOS 18) else {
12-
withKnownIssue {
13-
Issue.record("Known crash issue on iOS 18")
14-
}
15-
return
16-
}
1711
struct ContentView: View {
1812
var confirmation: Confirmation
1913

0 commit comments

Comments
 (0)