44
55import Testing
66
7- struct OGFGestureFunctionsCompatibilityTests {
7+ struct OGFGestureFailureTypeIsTerminatedTests {
8+ @Test
9+ func nodeDefaultValue( ) {
10+ let value = OGFGestureNodeDefaultValue ( )
11+ #expect( value is Void )
12+ }
13+
14+ @Suite ( . enabled( if: compatibilityTestEnabled) )
15+ struct GestureNodeCreateDefaultTests {
16+ @Test ( arguments: [ 1 , 2 ] )
17+ func properties( _ key: Int ) {
18+ let _ = OGFGestureNodeCreateDefault ( key)
19+ // WIP
20+ // #expect(node.identifier == key.description)
21+ }
22+
23+ @Test ( . enabled( if: compatibilityTestEnabled) )
24+ func description( ) throws {
25+ let node = OGFGestureNodeCreateDefault ( 1 )
26+ let description = String ( describing: node)
27+ let pattern = [
28+ #"GestureNodeShim<\(\)> <0x[0-9a-f]+> \{"# ,
29+ #" node: GestureNode<\(\)> <0x[0-9a-f]+ \d+> \{"# ,
30+ #" phase: idle"# ,
31+ #" pendingPhases: \[\]"# ,
32+ #" relations: \{"# ,
33+ #" can exclude \(dynamic\): \[any, position: any\]"# ,
34+ #" can be excluded by \(dynamic\): \[any, position: any\]"# ,
35+ #" can exclude active \(dynamic\): \[any, position: any\]"# ,
36+ #" can be excluded when active by \(dynamic\): \[any, position: any\]"# ,
37+ #" should require failure of \(dynamic\): \[any, position: any\]"# ,
38+ #" should required to fail by \(dynamic\): \[any, position: any\]"# ,
39+ #" \}"# ,
40+ #" delegate: nil"# ,
41+ #" container: nil"# ,
42+ #" trackedEvents: \[\]"# ,
43+ #" \}"# ,
44+ #" flags: none"# ,
45+ #"\}"# ,
46+ ] . joined ( separator: " * \n " )
47+ let regex = try Regex ( pattern)
48+ #expect( description. wholeMatch ( of: regex) != nil )
49+ }
50+ }
51+
52+ @Suite ( . enabled( if: compatibilityTestEnabled) )
53+ struct GestureNodeCoordinatorCreateTests {
54+ @Test
55+ func createCoordinatorWithNilHandlers( ) {
56+ let coordinator = OGFGestureNodeCoordinatorCreate ( nil , nil )
57+ #expect( coordinator. nodes. count == 0 )
58+ }
59+
60+ @Test
61+ func createCoordinatorWithHandlers( ) {
62+ var willUpdateCalled = false
63+ var didUpdateCalled = false
64+ let coordinator = OGFGestureNodeCoordinatorCreate (
65+ { willUpdateCalled = true } ,
66+ { didUpdateCalled = true }
67+ )
68+ // FIXME: The init set does not work
69+ coordinator. willUpdateHandler = {
70+ willUpdateCalled = true
71+ }
72+ coordinator. didUpdateHandler = {
73+ didUpdateCalled = true
74+ }
75+ coordinator. willUpdateHandler ? ( )
76+ coordinator. didUpdateHandler ? ( )
77+ #expect( willUpdateCalled)
78+ #expect( didUpdateCalled)
79+ }
80+ }
81+
82+ @Test ( . disabled( ) )
83+ func gestureComponentControllerSetNode( ) throws {
84+ // TODO
85+ }
86+
887 @Test ( arguments: [
988 ( . excluded, false ) ,
1089 ( . failureDependency, false ) ,
@@ -15,7 +94,7 @@ struct OGFGestureFunctionsCompatibilityTests {
1594 ( . aborted, true ) ,
1695 ( . coordinatorChanged, false ) ,
1796 ] as [ ( OGFGestureFailureType , Bool ) ] )
18- func failureTypeIsTerminated ( _ type: OGFGestureFailureType , _ expected: Bool ) {
19- #expect( type. isTerminated == expected)
97+ func isTerminated ( _ type: OGFGestureFailureType , _ expected: Bool ) {
98+ #expect( OGFGestureFailureTypeIsTerminated ( type) == expected)
2099 }
21100}
0 commit comments