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
@testable import FluidVoice_Debug
import XCTest
final class DeliveryTargetAssessmentTests: XCTestCase {
func testTextRolesAreEditable() {
for role in ["AXTextField", "AXTextArea", "AXComboBox", "AXSecureTextField"] {
XCTAssertEqual(DeliveryTargetAssessment.classify(role: role, valueSettable: false), .editable(role: role))
}
}
func testSettableValueWinsOverRole() {
XCTAssertEqual(DeliveryTargetAssessment.classify(role: "AXStaticText", valueSettable: true), .editable(role: "AXStaticText"))
}
func testControlsAndStaticContentAreRefused() {
for role in ["AXButton", "AXStaticText", "AXImage", "AXMenuItem", "AXSlider"] {
XCTAssertTrue(DeliveryTargetAssessment.classify(role: role, valueSettable: false).isCertainlyNotEditable, role)
}
}
func testContainersStayUnknownSoPasteProceeds() {
// Apps that draw their own UI report the window or application as the
// focused element and still accept Cmd+V.
for role in ["AXWindow", "AXSheet", "AXDrawer", "AXApplication", "AXGroup", "AXWebArea", "AXCell", "AXUnknown"] {
XCTAssertEqual(DeliveryTargetAssessment.classify(role: role, valueSettable: false), .unknown(reason: "role_\(role)"), role)
}
}
func testMuseComposerExceptionIsLimitedToItsComposer() {
let label = "Message Attach file\nSend"
XCTAssertTrue(DeliveryTargetAssessment.isMuseComposer(bundleID: "com.meta.endo", role: "AXButton", title: label, description: nil))
XCTAssertTrue(DeliveryTargetAssessment.isMuseComposer(bundleID: "com.meta.endo", role: "AXButton", title: nil, description: label))
XCTAssertFalse(DeliveryTargetAssessment.isMuseComposer(bundleID: "com.meta.endo", role: "AXButton", title: "Send", description: nil))
XCTAssertFalse(DeliveryTargetAssessment.isMuseComposer(bundleID: "another.app", role: "AXButton", title: label, description: nil))
XCTAssertFalse(DeliveryTargetAssessment.isMuseComposer(bundleID: "com.meta.endo", role: "AXMenuButton", title: label, description: nil))
XCTAssertFalse(DeliveryTargetAssessment.isMuseComposer(bundleID: "com.meta.endo", role: "AXButton", title: nil, description: nil))
}
}