You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.7 KiB
46 lines
1.7 KiB
import Foundation
|
|
import Testing
|
|
@testable import MusubiCore
|
|
|
|
@Suite struct ModelTests {
|
|
@Test func sceneRoundTripsThroughJSON() throws {
|
|
let pgm = Source(ndiName: "ZOWIEBOX-PGM (PGM)")
|
|
let mv = Source(ndiName: "ZOWIEBOX-MV (MV)")
|
|
let scene = Scene(
|
|
name: "OP-Live",
|
|
control: MachineConfig(audio: [
|
|
AudioAssignment(source: .ndi(name: pgm.ndiName), deviceUID: "MOTU-UID", deviceName: "M2", channel: 1, gainDB: -6),
|
|
AudioAssignment(source: .input(uid: "POLY-UID", name: "Poly BT700"), deviceUID: "MOTU-UID", deviceName: "M2", channel: 0),
|
|
]),
|
|
nodes: ["Mac mini von Samuel": MachineConfig(video: [
|
|
VideoAssignment(screen: ScreenRef(name: "Field Monitor", index: 1), source: pgm),
|
|
VideoAssignment(screen: ScreenRef(name: "HDMI TO USB", index: 0), source: mv),
|
|
])]
|
|
)
|
|
|
|
let data = try JSONEncoder().encode(scene)
|
|
let decoded = try JSONDecoder().decode(Scene.self, from: data)
|
|
|
|
#expect(decoded == scene)
|
|
}
|
|
|
|
@Test func audioKeyIgnoresSettings() {
|
|
var a = AudioAssignment(source: .ndi(name: "X"), deviceUID: "D", deviceName: "M2", channel: 1)
|
|
let key = a.key
|
|
a.gainDB = -12
|
|
a.muted = true
|
|
#expect(a.key == key)
|
|
#expect(key == "ndi:X→D#1")
|
|
}
|
|
|
|
@Test(arguments: [
|
|
("ZOWIEBOX-PGM (PGM)", "PGM"),
|
|
("MACBOOK (Test Pattern)", "Test Pattern"),
|
|
("NoParens", "NoParens"),
|
|
("EMPTY ()", "EMPTY ()"),
|
|
])
|
|
func defaultLabelUsesStreamName(ndiName: String, expected: String) {
|
|
#expect(Source.defaultLabel(for: ndiName) == expected)
|
|
}
|
|
}
|