Skip to content

Commit 355e83b

Browse files
committed
Add test case for UIKit and CA private API
1 parent 8c86e61 commit 355e83b

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//
2+
// CoreAnimationPrivateTests.swift
3+
// OpenSwiftUI_SPITests
4+
5+
import OpenSwiftUI_SPI
6+
import Testing
7+
8+
#if canImport(QuartzCore)
9+
@MainActor
10+
struct CoreAnimationPrivateTests {
11+
@Test
12+
func layer() {
13+
let layer = CALayer()
14+
#expect(layer.hasBeenCommitted == false)
15+
layer.setAllowsEdgeAntialiasing(true)
16+
layer.setAllowsGroupOpacity(true)
17+
layer.setAllowsGroupBlending(true)
18+
19+
layer.openSwiftUI_viewTestProperties = 42
20+
#expect(layer.openSwiftUI_viewTestProperties == 42)
21+
}
22+
}
23+
#endif
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//
2+
// UIKitPrivateTests.swift
3+
// OpenSwiftUI_SPITests
4+
5+
import OpenSwiftUI_SPI
6+
import Testing
7+
8+
#if canImport(UIKit)
9+
@MainActor
10+
struct UIKitPrivateTests {
11+
@Test
12+
func application() {
13+
let app = UIApplication.shared
14+
let name = "ATest"
15+
app.startedTest(name)
16+
app.finishedTest(name)
17+
app.failedTest(name, withFailure: nil)
18+
#expect(app._launchTestName() == nil)
19+
}
20+
21+
@Test
22+
func view() {
23+
let view = UIView()
24+
#expect(view._shouldAnimateProperty(withKey: "frame") == false)
25+
#expect(view._shouldAnimateProperty(withKey: "alpha") == false)
26+
27+
view._setFocusInteractionEnabled(true)
28+
}
29+
30+
@Test
31+
func viewController() {
32+
let controller = UIViewController()
33+
#expect(controller._canShowWhileLocked == true)
34+
}
35+
}
36+
#endif

0 commit comments

Comments
 (0)