知了 Cicada · 任何会议和直播的实时字幕、同声传译、AI 会议纪要,Mac、Windows、Linux、Android 免费开源。Live subtitles, interpreting and meeting notes for any call or stream, on Mac, Windows, Linux and Android.
Swift androidlinuxlive-captionsmacosmeeting-notesmenubar-appsimultaneous-interpretationspeech-recognitionsubtitlesswiftswiftuitranslationwindows
import Foundation
import Testing
@testable import Cicada
@Suite struct HybridRecordTests {
private func line(_ id: String, _ speaker: String = "them", via: String? = nil) -> TranscriptLine {
TranscriptLine(id: id, t: 0, speaker: speaker, src: "x", srcLang: "en", dstLang: "zh", via: via)
}
@Test func onlyAMeetingThatHeardBothShowsPlaces() {
#expect(!RecordList.heardBoth([line("a"), line("b")]))
#expect(!RecordList.heardBoth([line("a", via: "room"), line("b", via: "room")]))
#expect(!RecordList.heardBoth([line("a", via: "room"), line("b", "me")]))
#expect(RecordList.heardBoth([line("a", via: "room"), line("b")]))
}
@Test func aChangeOfPlaceStartsANewRun() {
let ls = [line("a"), line("b"), line("c", via: "room"), line("d", "me"), line("e", via: "room"), line("f")]
#expect(RecordList.placeStarts(ls) == ["a", "c", "e", "f"])
}
@Test func anUnpluggedMicSaysWhatTookOver() {
#expect(RoomMicLoss.detail(next: "MacBook Pro Microphone", builtIn: true, both: true) == L("已改用 Mac 自带的麦克风"))
#expect(RoomMicLoss.detail(next: "Jabra Speak 510", builtIn: false, both: false) == L("已改用 Jabra Speak 510"))
#expect(RoomMicLoss.detail(next: nil, builtIn: false, both: true) == L("只听电脑了"))
#expect(RoomMicLoss.detail(next: nil, builtIn: false, both: false) == L("没有别的麦克风,已暂停"))
}
}