Files
openclaw/apps/macos/Tests/OpenClawIPCTests/TalkModeControllerPublishingTests.swift
Peter Steinberger 311f5bfbaa feat(macos): honor the selected microphone in Talk and show live voice activity in chat (#109995)
* feat(macos): honor the selected microphone in Talk and surface live level, transcript, and mic picker in chat

* chore(i18n): translate new talk activity strings and regenerate Apple/Android catalogs
2026-07-17 15:45:46 +01:00

37 lines
1.2 KiB
Swift

import Testing
@testable import OpenClaw
@Suite(.serialized)
@MainActor
struct TalkModeControllerPublishingTests {
@Test func `controller publishes smoothed clamped level`() {
let controller = TalkModeController()
controller.updateLevel(2)
let attackLevel = controller.level
controller.updateLevel(0.2)
let releaseLevel = controller.level
controller.updateLevel(-1)
#expect(attackLevel > 0 && attackLevel <= 1)
#expect(releaseLevel > 0.2 && releaseLevel < attackLevel)
#expect(controller.level == 0)
}
@Test func `controller publishes bounded finals and distinct partial`() {
let controller = TalkModeController()
controller.updatePartialTranscript(" speaking now ")
#expect(controller.partialTranscript == "speaking now")
for index in 0..<25 {
controller.commitTranscript("utterance \(index)")
}
#expect(controller.partialTranscript.isEmpty)
#expect(controller.recentTranscripts.count == 20)
#expect(controller.recentTranscripts.first == "utterance 5")
#expect(controller.recentTranscripts.last == "utterance 24")
}
}