hex/ios/HEXShared/FullKeyboard/View/FullKeyboardView+Debug.swift
Kit Langton 9e352ea9d4
iOS: group shared sources and split the full keyboard tests (#2448)
- Move the full keyboard's engine, view and autocorrect families into
  HEXShared/FullKeyboard/Engine, View and Autocorrect.
- Move dictation formatting, spelling and romanizer sources into
  HEXShared/Formatting, Spelling and Romanizers.
- Split the 4,181-line FullKeyboardEngineTests file into per-capability
  extension files, and KeyboardClipboardTests into its own file.

Pure moves: no behavior changes and the same 160 tests.
2026-11-22 18:18:35 -08:00

24 lines
1 KiB
Swift

import UIKit
/// Simulator fixtures (`FullKeyboardSnapshotStage`): a key held down, or its accent callout
/// open with an option picked.
extension FullKeyboardView {
func debugPress(_ character: String) {
guard let key = engine.layout.key(.character(character)) else { return }
engine.touchBegan(id: -1, at: CGPoint(x: key.frame.midX, y: key.frame.midY))
}
func debugHoldAccent(_ character: String, selecting option: String) {
debugHoldAccent(character)
guard let index = engine.activeAccentMenu?.options.firstIndex(of: option) else { return }
engine.debugSelectAccent(index)
}
func debugHoldAccent(_ character: String, selectIndex: Int? = nil) {
guard let key = engine.layout.key(.character(character)) else { return }
let center = CGPoint(x: key.frame.midX, y: key.frame.midY)
engine.touchBegan(id: -2, at: center)
_ = engine.openAccentMenuIfEligible(forTouch: -2)
if let selectIndex { engine.debugSelectAccent(selectIndex) }
}
}