mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-18 16:41:45 -06:00
311f5bfbaa
* 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
37 lines
1.2 KiB
Swift
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")
|
|
}
|
|
}
|