merge: bring pinyin habit ranking into English keyboard branch

Keep English QuickType/mmap and Chinese schema hygiene on one branch.
Secure fields skip Rime; English still loads its lexicon only while English is active.
This commit is contained in:
Rocky
2026-08-14 21:51:38 +08:00
15 changed files with 588 additions and 5 deletions
@@ -404,6 +404,19 @@ final class EnglishTypingTests: XCTestCase {
XCTAssertFalse(PeriodShortcut.shouldArm(afterSpaceFollowing: "hello "))
}
func testLearningStoreClearRemovesBoosts() {
let suiteName = "EnglishLearningStore.clear.\(UUID().uuidString)"
let defaults = UserDefaults(suiteName: suiteName)!
defer { defaults.removePersistentDomain(forName: suiteName) }
let store = EnglishLearningStore(defaults: defaults)
store.recordAcceptance(of: "hello")
XCTAssertGreaterThan(store.boost(for: "hello"), 0)
store.clear()
XCTAssertEqual(store.boost(for: "hello"), 0)
XCTAssertTrue(store.snapshot().isEmpty)
}
@MainActor
func testEnglishQuickTypePutsVerbatimFirstAndMarksCorrection() {
let typing = makeIsolatedEnglishSession(suite: "english.quicktype.bar.test")