Skip to content

Fastest and only macOS Dictation app with on-device STT and custom trained AI enhancement model. Windows, iOS testflight! Android, Linux waitlist open! A local Wispr Flow alternative. Follow https://x.com/fluidvoiceapp for more

fix(ci): exclude prototypes and resolve standalone test lint

altic-dev50e9a777f39b
diff --git a/.swiftlint.yml b/.swiftlint.yml
index 48371d09..ffb9a822 100644
--- a/.swiftlint.yml
+++ b/.swiftlint.yml
@@ -27,6 +27,7 @@ opt_in_rules:
- unavailable_function
excluded:
+ - Prototypes
- .build
- DerivedData
- Fluid.xcodeproj
diff --git a/Tests/DictationTargetPolicyTests.swift b/Tests/DictationTargetPolicyTests.swift
index 307b68b7..fc62c66b 100644
--- a/Tests/DictationTargetPolicyTests.swift
+++ b/Tests/DictationTargetPolicyTests.swift
@@ -2,25 +2,38 @@ import Foundation
@main
enum DictationTargetPolicyTests {
+ private struct Case {
+ let name: String
+ let enabled: Bool
+ let focused: Int32?
+ let original: Int32?
+ let stillFocused: Bool
+ let expectedPID: Int32?
+ let restores: Bool
+ }
+
static func main() {
- let cases: [(String, Bool, Int32?, Int32?, Bool, Int32?, Bool)] = [
- ("off follows app B", false, 200, 100, false, 200, false),
- ("on restores app A", true, 200, 100, false, 100, true),
- ("off follows another field in A", false, 100, 100, false, 100, false),
- ("on restores original field in A", true, 100, 100, false, 100, true),
- ("already focused needs no restore", true, 100, 100, true, 100, false),
- ("off works without recording context", false, 200, nil, false, 200, false),
- ("overlay recovers saved target", false, 999, 100, false, 100, true),
- ("unknown focus recovers saved target", false, nil, 100, false, 100, true),
- ("invalid focus is not a destination", false, 0, 100, false, 100, true),
- ("missing target does not invent a PID", true, nil, nil, false, nil, true),
+ let cases: [Case] = [
+ .init(name: "off follows app B", enabled: false, focused: 200, original: 100, stillFocused: false, expectedPID: 200, restores: false),
+ .init(name: "on restores app A", enabled: true, focused: 200, original: 100, stillFocused: false, expectedPID: 100, restores: true),
+ .init(name: "off follows another field in A", enabled: false, focused: 100, original: 100, stillFocused: false, expectedPID: 100, restores: false),
+ .init(name: "on restores original field in A", enabled: true, focused: 100, original: 100, stillFocused: false, expectedPID: 100, restores: true),
+ .init(name: "already focused needs no restore", enabled: true, focused: 100, original: 100, stillFocused: true, expectedPID: 100, restores: false),
+ .init(name: "off works without recording context", enabled: false, focused: 200, original: nil, stillFocused: false, expectedPID: 200, restores: false),
+ .init(name: "overlay recovers saved target", enabled: false, focused: 999, original: 100, stillFocused: false, expectedPID: 100, restores: true),
+ .init(name: "unknown focus recovers saved target", enabled: false, focused: nil, original: 100, stillFocused: false, expectedPID: 100, restores: true),
+ .init(name: "invalid focus is not a destination", enabled: false, focused: 0, original: 100, stillFocused: false, expectedPID: 100, restores: true),
+ .init(name: "missing target does not invent a PID", enabled: true, focused: nil, original: nil, stillFocused: false, expectedPID: nil, restores: true),
]
- for (name, enabled, focused, original, stillFocused, expectedPID, restores) in cases {
+ for test in cases {
let result = DictationTargetPolicy.resolve(
- returnToStartingField: enabled, focusedPID: focused, ownPID: 999,
- originalPID: original, originalFieldIsFocused: stillFocused
+ returnToStartingField: test.enabled,
+ focusedPID: test.focused,
+ ownPID: 999,
+ originalPID: test.original,
+ originalFieldIsFocused: test.stillFocused
)
- precondition(result.pid == expectedPID && result.shouldRestoreOriginalFocus == restores, name)
+ precondition(result.pid == test.expectedPID && result.shouldRestoreOriginalFocus == test.restores, test.name)
}
print("PASS: \(cases.count) dictation destination cases, including app switches, field switches, overlays and missing focus")
}
diff --git a/Tests/FluidTypographyTests.swift b/Tests/FluidTypographyTests.swift
index 985058c7..aca9a58d 100644
--- a/Tests/FluidTypographyTests.swift
+++ b/Tests/FluidTypographyTests.swift
@@ -24,13 +24,17 @@ struct FluidTypographyTests {
precondition(native.familyName == "Avenir Next" && mono.familyName == "Avenir Next")
} else {
if FluidTypography.systemDesign(for: .default) == .serif {
- let descriptor = NSFont.systemFont(ofSize: 18, weight: .semibold).fontDescriptor.withDesign(.serif)!
+ guard let descriptor = NSFont.systemFont(ofSize: 18, weight: .semibold).fontDescriptor.withDesign(.serif) else {
+ preconditionFailure("The system serif font must be available")
+ }
precondition(native == NSFont(descriptor: descriptor, size: 18))
} else {
precondition(native == NSFont.systemFont(ofSize: 18, weight: .semibold))
}
if FluidTypography.systemDesign(for: .monospaced) == .serif {
- let descriptor = NSFont.systemFont(ofSize: 13, weight: .regular).fontDescriptor.withDesign(.serif)!
+ guard let descriptor = NSFont.systemFont(ofSize: 13, weight: .regular).fontDescriptor.withDesign(.serif) else {
+ preconditionFailure("The system serif font must be available")
+ }
precondition(mono == NSFont(descriptor: descriptor, size: 13))
} else {
precondition(mono == NSFont.monospacedSystemFont(ofSize: 13, weight: .regular))