File tree Expand file tree Collapse file tree 2 files changed +46
-8
lines changed
Example/OpenSwiftUIUITests/Layout/Stack
Tests/OpenSwiftUICoreTests/Layout Expand file tree Collapse file tree 2 files changed +46
-8
lines changed Original file line number Diff line number Diff line change 1+ //
2+ // ZIndexCompatibilityTests.swift
3+ // OpenSwiftUICompatibilityTests
4+
5+ import Foundation
6+ import Testing
7+ import SnapshotTesting
8+
9+ @MainActor
10+ @Suite ( . snapshots( record: . never, diffTool: diffTool) )
11+ struct ZStackIndexUITests {
12+ @Test
13+ func zIndexExample( ) {
14+ struct ContentView : View {
15+ var body : some View {
16+ VStack {
17+ // TODO: Path & Shape is not implemented yet.
18+ Color . yellow
19+ // Rectangle()
20+ // .fill(Color.yellow)
21+ . frame ( width: 100 , height: 100 , alignment: . center)
22+ . zIndex ( 1 ) // Top layer.
23+ Color . red
24+ // Rectangle()
25+ // .fill(Color.red)
26+ . frame ( width: 100 , height: 100 , alignment: . center)
27+ . rotationEffect ( . degrees( 45 ) )
28+ // Here a zIndex of 0 is the default making
29+ // this the bottom layer.
30+ }
31+ }
32+ }
33+ withKnownIssue {
34+ openSwiftUIAssertSnapshot (
35+ of: ContentView ( ) ,
36+ size: CGSize ( width: 200 , height: 200 )
37+ )
38+ }
39+ }
40+ }
Original file line number Diff line number Diff line change 33// OpenSwiftUICoreTests
44
55import OpenAttributeGraphShims
6+ @_spi ( ForOpenSwiftUIOnly)
67import OpenSwiftUICore
78import Testing
89
910@MainActor
1011struct ZIndexTests {
1112 @Test
12- func indexOrder( ) {
13- struct ContentView : View {
14- var body : some View {
15- Color . red
16- . zIndex ( 0.5 )
17- }
18- }
19- // TODO: Add a test helper to hook into makeViewList and retrieve the zIndex value to verify it
13+ func traitCollectionZIndex( ) {
14+ var collection = ViewTraitCollection ( )
15+ #expect( collection. zIndex. isApproximatelyEqual ( to: 0.0 ) )
16+ collection. zIndex = 1.5
17+ #expect( collection. zIndex. isApproximatelyEqual ( to: 1.5 ) )
2018 }
2119}
You can’t perform that action at this time.
0 commit comments