Automated tests protect deterministic behavior, but only real applications can verify InputMethodKit delivery, physical Caps Lock timing, host composition behavior, and candidate positioning.
Run the full suite with isolated build output:
DERIVED_DATA="$(mktemp -d /tmp/SwiftTypeTests.XXXXXX)"
RESULT_BUNDLE="$(mktemp -d /tmp/SwiftTypeResults.XXXXXX)/Tests.xcresult"
xcodebuild \
-project SwiftType.xcodeproj \
-scheme SwiftType \
-configuration Debug \
-destination 'platform=macOS' \
-derivedDataPath "$DERIVED_DATA" \
-resultBundlePath "$RESULT_BUNDLE" \
testXcode may register generated input-method bundles with LaunchServices even when build output is temporary. Tests do not copy a bundle into ~/Library/Input Methods/.
Run shell verification from the repository root:
bash scripts/release/tests/test_diagnose.sh
bash scripts/release/tests/test_diagnose_input_sources.sh
bash scripts/release/tests/test_pkg_install.sh
bash -n scripts/install.sh scripts/diagnose.sh \
scripts/release/pkg-scripts/install-common.sh
git diff --checkThe installer harness uses isolated temporary directories and deliberately produces expected error messages while testing rollback and rejection paths. It must never fault-test against the active daily-use installation.
On 2026-09-18, the optimization and documentation working tree based on b757996 passed:
- 613 XCTest cases, zero failures or skips;
- the input-source diagnostic harness;
- the general diagnostic harness;
- 11 installer safety cases;
- changed-file LSP and repository error diagnostics;
- Markdown link, anchor, whitespace, privacy-pattern, and secret-pattern checks;
- signature, universal
x86_64 arm64architecture, and installed/Release bundle equality for build20260918065419(executable SHA-256b3da96742f81308138a4d91c0d408c0e4143b9c7b4add7389cb1db3106272b4f).
This is a dated result, not a permanent test count or a guarantee for every application. Update it only after a fresh complete run.
| Test area | Main coverage |
|---|---|
Tests/App/ |
Required metadata, privacy logging, uninstall behavior |
Tests/Input/InputClientPolicyTests.swift |
Routing precedence, hard exceptions, runtime overrides |
Tests/Input/InputControllerEventRoutingTests.swift |
Flags changes, Caps Lock passthrough, lifecycle, inline/direct/passthrough behavior |
Tests/Input/InputControllerTransparentPredictionTests.swift |
Mirror safety, commit verification, stale state, debounce, no duplicate insertion |
Tests/Input/LatinKeyHandlerTests.swift |
Space, Return, punctuation, literal and candidate semantics |
Tests/Prediction/ |
Injected policy evidence and live spell-check edge contracts |
Tests/UI/ |
Candidate layouts, selection, accessibility, positioning, themes, settings |
scripts/release/tests/ |
Read-only diagnostics and transactional installer failures/rollback |
System spell-check results can vary. Policy tests must use injected fixed evidence rather than depending on a particular live candidate ranking.
- Record the installed build number from Settings → About or
CFBundleVersion. - Finish active compositions and quit/reopen apps that were running during installation.
- Confirm the selected source and running executable path.
- Do not run Debug test bundles concurrently with acceptance testing.
- If the installed source is selectable but receives no events, log out and back in before changing production code.
For every applicable client, test letters, contractions, punctuation, Backspace, Space, Return, a numbered candidate, command/navigation keys, focus changes, and source switching before typing and during a partial word.
| Application / surface | Expected mode | Essential checks |
|---|---|---|
| TextEdit | Inline | Literal and candidate commits, Return, punctuation, Caps Lock during hel |
| Spotlight | Inline | Empty and active-composition switching; text remains exactly once |
| Safari | Inline | Page fields and address/search fields; candidate positioning |
| Microsoft Edge | Inline | No dropped letters; address bar and web fields; switching during composition |
| Chrome/Brave/Vivaldi | Transparent | Immediate text, Backspace once, suffix/correction safety, host-owned arrows/Tab/Return |
| WeCom and DingTalk | Transparent + compatibility commit | No dropped/duplicated text, Smart Space, no persistent marked range |
| Terminal/iTerm2/Ghostty | Passthrough | Shell/editor shortcuts unchanged, no candidates, normal switching |
| VS Code editor | Direct input | Printable text exactly once, no candidates, commands host-owned |
| VS Code integrated terminal | Direct input | Printable text and Space once; raw controls remain terminal-owned |
| ChatGPT/Claude/other Electron editors | Current configured policy | Composer behavior, Return/submission, switching, no drops or duplication |
| Termius | Passthrough | Terminal and settings/search fields; shortcuts remain unchanged |
| Word/System Settings | Inline default | Composition, replacement, search/input fields, switching |
Bundle-ID routing cannot distinguish all surfaces within one app. Record the exact app version, effective policy, field type, key sequence, visible candidates, and actual source selection when reporting a failure.
Candidate order varies by machine. Verify that the visible Space target equals the committed text rather than requiring one universal ranking.
Representative cases:
- Exact evidence such as
the,but, orappremains literal plus one space. - A visible strict completion for
appl,appli, orcoordis accepted by Space. - A visible correction for
convinientis accepted when no prefix wins. - Explicit candidate selection overrides the automatic target.
- Return without explicit selection preserves original letters.
- Fast Space before transparent debounce remains literal; delayed candidates do not reappear.
- Unsafe transparent replacement falls back without duplication or destructive editing.
Check both Vertical List and Grid:
- shortcuts match the displayed rows;
- the Space indicator follows default or explicit selection correctly;
- literal reasons do not create a hidden selection;
- hidden/preallocated cells are absent from the accessibility tree;
- VoiceOver announces the container, candidate labels, Space action, and explicit selection;
- press actions commit the expected candidate;
- Increase Contrast, Reduce Transparency, light/dark appearance, and custom themes remain legible;
- positioning works near screen edges, after scrolling, and across displays;
- moving fields during pending transparent prediction never shows stale candidates.
Use Instruments with the Points of Interest template and attach to the installed SmartType process (the technical executable remains named SwiftType). Available operations include:
Key handlingPrediction updateSpell correctionSpell completionsSpell guessesCandidate presentationCandidate geometryCandidate rendering
Measure cold-first-word and warm p50/p95/p99 separately in representative inline and transparent clients. Never add words, prefixes, candidates, surrounding text, or paths to signpost metadata.
Before distributing a PKG, use a disposable macOS account or machine to verify:
- Fresh installation.
- Upgrade over an existing working version.
- Missing or corrupt payload rejection.
- No-GUI-user failure.
- Previous-installation recovery after an injected post-swap failure.
- Destination collision with a normal file and a symlink.
- Installed signature, architectures, bundle identifier, version, and source/installed equality.
- Reconnection after affected applications are reopened.
Package generation is not installation. Installation or service restart requires explicit authorization and must not be hidden inside a test workflow.
A passing suite cannot prove:
- physical Caps Lock press/release timing;
- which Latin source macOS will choose;
- delivery by every Electron/CEF/native host version;
- live VoiceOver quality or multi-display geometry;
- sleep/wake and long-session behavior;
- notarized/disposable-machine package acceptance.
Report these as manual acceptance results, not unit-test guarantees.