@@ -154,35 +154,27 @@ private final class AXFixtureSnapshot: NSObject {
154154 @ objc let enabled : NSNumber = true
155155 @ objc let selected : NSNumber = false
156156 @ objc let hasFocus : NSNumber = false
157- @ objc let hasKeyboardFocus : NSNumber
158157 @ objc let children : [ AXFixtureSnapshot ]
159158 @ objc let accessibilityElement : AXFixtureElement ?
160159
161- init ( node : AXFixtureNode , children : [ AXFixtureSnapshot ] , element : AXFixtureElement ? , keyboardFocus : Bool = false ) {
160+ init ( node : AXFixtureNode , children : [ AXFixtureSnapshot ] , element : AXFixtureElement ? ) {
162161 identifier = node . identity
163162 label = node . identity
164- hasKeyboardFocus = NSNumber ( value : keyboardFocus )
165163 self . children = children
166164 accessibilityElement = element
167165 }
168166
169167 /// `levels` node levels rooted at `node`; the deepest returned level loses its live element
170- /// when the fixture says the frontier vanished. The node named by `keyboardFocusIdentity` holds
171- /// the software keyboard's focus, the way a text field being typed into does.
172- static func fragment (
173- _ node : AXFixtureNode , levels : Int , vanishAtFrontier : Bool , keyboardFocusIdentity : String ? = nil
174- ) -> AXFixtureSnapshot {
168+ /// when the fixture says the frontier vanished.
169+ static func fragment ( _ node : AXFixtureNode , levels : Int , vanishAtFrontier : Bool ) -> AXFixtureSnapshot {
175170 let boundary = levels <= 1
176171 let children = boundary
177172 ? [ ]
178- : node . children . map {
179- fragment ( $0 , levels : levels - 1 , vanishAtFrontier : vanishAtFrontier , keyboardFocusIdentity : keyboardFocusIdentity )
180- }
173+ : node . children . map { fragment ( $0 , levels : levels - 1 , vanishAtFrontier : vanishAtFrontier ) }
181174 return AXFixtureSnapshot (
182175 node : node ,
183176 children : children ,
184- element : boundary && vanishAtFrontier ? nil : AXFixtureElement ( node : node ) ,
185- keyboardFocus : node . identity == keyboardFocusIdentity )
177+ element : boundary && vanishAtFrontier ? nil : AXFixtureElement ( node : node ) )
186178 }
187179}
188180
@@ -191,24 +183,19 @@ private final class AXFixtureSnapshot: NSObject {
191183private final class AXFixtureClient : NSObject {
192184 private let rejectLevelsAbove : Int ?
193185 private let vanishAtFrontier : Bool
194- private let keyboardFocusIdentity : String ?
195186 private( set) var requests = 0
196187 private( set) var rejected = 0
197- /// Every attribute the bridge asked for, across requests: the request contract under test.
198- private( set) var requestedAttributes : [ String ] = [ ]
199188
200- init ( rejectLevelsAbove : Int ? , vanishAtFrontier : Bool , keyboardFocusIdentity : String ? = nil ) {
189+ init ( rejectLevelsAbove : Int ? , vanishAtFrontier : Bool ) {
201190 self . rejectLevelsAbove = rejectLevelsAbove
202191 self . vanishAtFrontier = vanishAtFrontier
203- self . keyboardFocusIdentity = keyboardFocusIdentity
204192 }
205193
206194 @ objc ( requestSnapshotForElement : attributes : parameters : error : )
207195 func requestSnapshot (
208196 forElement element : Any , attributes : Any , parameters : [ String : Any ] , error : NSErrorPointer
209197 ) -> Any ? {
210198 requests += 1
211- requestedAttributes . append ( contentsOf : ( attributes as? [ Any ] ?? [ ] ) . compactMap { $0 as? String } )
212199 let levels = ( parameters [ " maxDepth " ] as? NSNumber ) ? . intValue ?? 0
213200 if let limit = rejectLevelsAbove , levels > limit {
214201 rejected += 1
@@ -218,8 +205,7 @@ private final class AXFixtureClient: NSObject {
218205 return nil
219206 }
220207 guard let element = element as? AXFixtureElement else { return nil }
221- return AXFixtureSnapshot . fragment (
222- element . node , levels : levels , vanishAtFrontier : vanishAtFrontier , keyboardFocusIdentity : keyboardFocusIdentity )
208+ return AXFixtureSnapshot . fragment ( element . node , levels : levels , vanishAtFrontier : vanishAtFrontier )
223209 }
224210}
225211
@@ -378,34 +364,6 @@ extension RunnerTests {
378364 return observation
379365 }
380366
381- /// The bridge reports keyboard focus as `focused` when the snapshot carries it, beside the focus
382- /// engine's focus it asks the AX server for. The server exposes no keyboard-focus attribute, so
383- /// the request names the native focus only; a snapshot that arrives with keyboard focus set (the
384- /// XCTest producers' case) still reads as focused through the shared OR.
385- func testPrivateAXBridgeReportsKeyboardFocusAsFocused ( ) throws {
386- let rootNode = AXFixtureNode . build ( AXRecoveryFixture . Tree ( chain : 2 , fan : nil ) )
387- let client = AXFixtureClient ( rejectLevelsAbove : nil , vanishAtFrontier : false , keyboardFocusIdentity : " 1 " )
388- let response = RunnerAXSnapshotBridge . snapshotTree (
389- withClient : client ,
390- target : AXFixtureElement ( node : rootNode ) ,
391- maxDepth : 2 ,
392- maxNodes : 10 ,
393- deepExtensionCallLimit : 0 ,
394- customActionLimit : 0 ,
395- deadline : . distantFuture )
396- let root = try XCTUnwrap ( response [ " root " ] as? [ String : Any ] )
397- let field = try XCTUnwrap ( ( root [ " children " ] as? [ [ String : Any ] ] ) ? . first )
398- XCTAssertEqual ( root [ " label " ] as? String , " 0 " )
399- XCTAssertEqual ( root [ " focused " ] as? Bool , false , " no focus of either kind is not focused " )
400- XCTAssertEqual ( field [ " label " ] as? String , " 1 " )
401- XCTAssertEqual ( field [ " focused " ] as? Bool , true , " keyboard focus alone is focused " )
402- // The AX server answers only what it was asked for, so the request must still name the focus
403- // engine's focus: the raw keypath when the mapper is absent, `HasNativeFocus` when it maps.
404- XCTAssertTrue (
405- client . requestedAttributes . contains { $0 . range ( of : " focus " , options : . caseInsensitive ) != nil } ,
406- " requested attributes name the focus engine's focus: \( client . requestedAttributes ) " )
407- }
408-
409367 /// Every recovery case of the shared fixture, replayed through the real ladder, bridge
410368 /// capture, frontier extension, and completeness verdict, down to the delivered tree.
411369 func testPrivateAXRecoveryMatchesSharedFixture ( ) throws {
0 commit comments