mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-16 23:52:40 -06:00
43d9ba493d
* refactor(ios): remove redundant node test seams * fix(ios): keep approval route context private * fix(ios): preserve routing task assertion * fix(ios): retain private talk permission test seam * fix(ios): retain operator options boundary
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.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.handleInvoke(BridgeInvokeRequest(
|
|
id: "initial-scene-active",
|
|
command: OpenClawTalkCommand.pttStart.rawValue))
|
|
#expect(admitted.ok)
|
|
_ = await appModel.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")
|
|
}
|
|
}
|