mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-15 06:26:04 +00:00
* fix(ios): cancel queued push-to-talk invokes * fix(ios): make push-to-talk cancellation lifecycle-safe * style(ios): use switch expression for PTT result * fix(ios): bind audio capture to lifecycle owners Co-authored-by: NianJiuZst <180004567+NianJiuZst@users.noreply.github.com> * style(ios): format rebased lifecycle changes Co-authored-by: NianJiuZst <180004567+NianJiuZst@users.noreply.github.com> * fix(ios): preserve routing hydration across reconnects Co-authored-by: NianJiuZst <180004567+NianJiuZst@users.noreply.github.com> * fix(ios): cancel routing hydration on target switch Co-authored-by: NianJiuZst <180004567+NianJiuZst@users.noreply.github.com> * chore(ios): refresh native i18n inventory Co-authored-by: NianJiuZst <180004567+NianJiuZst@users.noreply.github.com> * fix(i18n): preserve native localization IDs * chore: leave changelog to release automation * refactor(apple): split lifecycle and gateway helpers Co-authored-by: NianJiuZst <180004567+NianJiuZst@users.noreply.github.com> * fix(ios): make lifecycle parsing nonisolated * fix(ios): consume canonical Talk events --------- Co-authored-by: NianJiuZst <180004567+NianJiuZst@users.noreply.github.com> Co-authored-by: Peter Steinberger <steipete@gmail.com>
60 lines
2.0 KiB
Swift
60 lines
2.0 KiB
Swift
import OpenClawKit
|
|
import SwiftUI
|
|
import Testing
|
|
@testable import OpenClaw
|
|
|
|
struct AppCoverageTests {
|
|
@Test @MainActor func `node app model updates backgrounded state`() {
|
|
let appModel = NodeAppModel()
|
|
|
|
appModel.setScenePhase(.background)
|
|
#expect(appModel.isBackgrounded == true)
|
|
|
|
appModel.setScenePhase(.inactive)
|
|
#expect(appModel.isBackgrounded == true)
|
|
|
|
appModel.setScenePhase(.active)
|
|
#expect(appModel.isBackgrounded == false)
|
|
}
|
|
|
|
@Test @MainActor func `initial scene admission stays closed until active`() async {
|
|
let talkMode = TalkModeManager(allowSimulatorCapture: true)
|
|
let appModel = NodeAppModel(
|
|
talkMode: talkMode,
|
|
audioAdmissionInitiallyAllowed: false)
|
|
talkMode.updateGatewayConnected(true)
|
|
|
|
#expect(appModel.isBackgrounded)
|
|
#expect(appModel.voiceWake._test_isSuppressedForBackground())
|
|
let blocked = await appModel._test_handleInvoke(BridgeInvokeRequest(
|
|
id: "initial-scene-blocked",
|
|
command: OpenClawTalkCommand.pttStart.rawValue))
|
|
#expect(!blocked.ok)
|
|
|
|
appModel.setScenePhase(.active)
|
|
|
|
#expect(!appModel.isBackgrounded)
|
|
#expect(!appModel.voiceWake._test_isSuppressedForBackground())
|
|
let admitted = await appModel._test_handleInvoke(BridgeInvokeRequest(
|
|
id: "initial-scene-active",
|
|
command: OpenClawTalkCommand.pttStart.rawValue))
|
|
#expect(admitted.ok)
|
|
_ = await appModel._test_handleInvoke(BridgeInvokeRequest(
|
|
id: "initial-scene-cleanup",
|
|
command: OpenClawTalkCommand.pttCancel.rawValue))
|
|
}
|
|
|
|
@Test @MainActor func `voice wake start reports unsupported on simulator`() async {
|
|
let voiceWake = VoiceWakeManager()
|
|
voiceWake.isEnabled = true
|
|
|
|
await voiceWake.start()
|
|
|
|
#expect(voiceWake.isListening == false)
|
|
#expect(voiceWake.statusText.contains("Simulator"))
|
|
|
|
voiceWake.stop()
|
|
#expect(voiceWake.statusText == "Off")
|
|
}
|
|
}
|