mirror of
https://github.com/anomalyco/hex.git
synced 2026-11-27 07:58:01 +01:00
- 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.
24 lines
1 KiB
Swift
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) }
|
|
}
|
|
}
|