Add moonmix: pavucontrol-style PipeWire mixer in MoonBit (WirePlumber + GTK4) (#1)
CI / check (push) Successful in 9s
CI / native (push) Successful in 1m1s

This commit was merged in pull request #1.
This commit is contained in:
nandi committed 2026-11-22 23:52:37 +00:00
1 parent 13a1de9b2c
commit 92ae5cdbfe
36 files changed
+3789 -1

No files matched your search

+77
View File
@@ -0,0 +1,77 @@
///|
test "playback rows" {
let s = sample_state()
let rows = @model.rows(s, Playback)
assert_eq(rows.length(), 1)
let r = rows[0]
assert_eq(r.title, "Firefox")
assert_eq(r.subtitle, "Big Buck Bunny")
assert_eq(r.volume_text, "100% (0.00 dB)")
assert_eq(r.choices.map(fn(c) { c.id }), [40, 41])
assert_eq(r.current_choice, 1)
assert_eq(r.choices[1].name, "bluez_output.headphones")
}
///|
test "recording rows route to sources" {
let s = sample_state()
let r = @model.rows(s, Recording)[0]
assert_eq(r.title, "OBS")
assert_eq(r.choices.map(fn(c) { c.id }), [50])
assert_eq(r.current_choice, 0)
}
///|
test "device rows" {
let s = sample_state()
let outs = @model.rows(s, OutputDevices)
assert_eq(outs.map(fn(r) { r.is_default }), [true, false])
assert_eq(outs[1].volume_text, "50% (-18.06 dB)")
assert_eq(outs[0].subtitle, "alsa_output.pci.analog-stereo")
assert_eq(outs[0].choices, [])
let ins = @model.rows(s, InputDevices)
assert_eq(ins.length(), 1)
assert_true(ins[0].mute)
assert_true(ins[0].is_default)
assert_eq(ins[0].icon_name, "audio-input-microphone-symbolic")
}
///|
test "stream without app name falls back" {
let s = @model.State::new()
let _ = s.apply(Upsert(@model.Node::new(7, "Stream/Output/Audio")))
let r = @model.rows(s, Playback)[0]
assert_eq(r.title, "Stream 7")
assert_eq(r.current_choice, -1)
assert_false(r.has_volume)
assert_eq(r.volume_text, "")
}
///|
test "diff rows" {
let s = sample_state()
let before = @model.rows(s, OutputDevices)
let _ = s.apply(Remove(41))
let _ = s.apply(
Upsert(@model.Node::new(42, "Audio/Sink", description="HDMI")),
)
let _ = s.apply(Upsert({ ..s.nodes.get(40).unwrap(), mute: true, }))
let after = @model.rows(s, OutputDevices)
assert_eq(@model.diff_rows(before, after), {
removed: [41],
added: [42],
updated: [40],
})
assert_eq(@model.diff_rows(after, after), {
removed: [],
added: [],
updated: [],
})
}
///|
test "tab labels" {
assert_eq(@model.Tab::all().map(fn(t) { t.label() }), [
"Playback", "Recording", "Output Devices", "Input Devices",
])
}