feat: configure pickup status presentation
Rust CI fader_master passed its selected CI mode.
MadGobblins/fader_master/pipeline/head This commit looks good Details

Add persisted Detailed, Compact, Symbol, Color, and Hidden pickup-status modes to the Config page and both mixer layouts.

Tests: cargo fmt --all -- --check; cargo check --workspace --all-targets --all-features; cargo test --workspace --all-targets --all-features; cargo test --workspace --doc --all-features; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo build --workspace --release --all-features; cargo check --workspace; cargo check --workspace --no-default-features; cargo check -p midi --no-default-features --features midir; cargo check -p volume_lib --no-default-features --features pulse
This commit is contained in:
Dandaedre 2026-10-16 19:11:40 +02:00
parent c1f3377914
commit 4e0d3e99a7
Signed by: Dandaedre
GPG Key ID: 440C6592E8A26D99
15 changed files with 394 additions and 38 deletions

View File

@ -255,6 +255,7 @@ new_stream = "adopt"
[ui]
default_controller = "desk-left"
theme = "default"
status_display = "detailed"
[runtime]
poll_interval_ms = 10
@ -461,6 +462,13 @@ background, foreground, accent/selection, secondary meter, muted, warning,
error, and meter track colors so status meaning remains consistent across
themes.
`ui.status_display` controls pickup feedback without changing pickup behavior.
The persisted modes are `detailed` (`pickup: tracking`), `compact` (`LIVE`),
`symbol` (a state-specific Unicode glyph), `color` (one fixed glyph using the
semantic status color), and `hidden` (no pickup indicator). Detailed is the
backward-compatible default. Both mixer orientations use the same mapping;
horizontal mode reclaims the pickup footer row when the indicator is hidden.
The TUI is mixer-first rather than exposing the profile's normalized tables as
separate tabs. Its main list is an ordered presentation of logical faders and
named separators. A layout entry references a stable fader ID or defines a
@ -474,9 +482,9 @@ density. Omitted density defaults to `standard` for existing profiles. Vertical
mode keeps the stacked card layout: Slim is a single terminal row while the
other sizes retain progressively more detail. Horizontal mode uses side-by-side
console-style fader strips with bottom-up meters, state, percentage, pickup
status, and a label at the bottom; density controls strip width. Horizontal
separators are labeled inline divider columns so every layout entry stays in a
single row, with the selected entry kept inside the width-bounded viewport.
status when enabled, and a label at the bottom; density controls strip width.
Horizontal separators are labeled inline divider columns so every layout entry
stays in a single row, with the selected entry kept inside the width-bounded viewport.
Vertical separators remain full-width rows between stacked cards.
Arrow-key controls follow that spatial model: vertical mode selects entries
with Up/Down and changes volume with Left/Right, while horizontal mode selects

View File

@ -4,7 +4,7 @@ use toml_edit::{Array, ArrayOfTables, DocumentMut, InlineTable, Item, Table, Val
use crate::{
Action, ConfigError, FaderDensity, MessageKind, MixerOrientation, Profile, SelectorField,
TargetKind, UiTheme,
StatusDisplayMode, TargetKind, UiTheme,
};
/// Match expression used when creating an application selector.
@ -78,6 +78,27 @@ pickup_tolerance = 0.02
})
}
/// Changes how pickup state is represented on mixer faders.
pub fn set_status_display(&mut self, mode: StatusDisplayMode) -> Result<(), ConfigError> {
self.transaction(|document| {
if document.get("ui").is_none() {
document["ui"] = Item::Table(Table::new());
}
let ui = document
.get_mut("ui")
.and_then(Item::as_table_mut)
.ok_or_else(|| ConfigError::validation("ui", "must be a table"))?;
ui["status_display"] = value(match mode {
StatusDisplayMode::Detailed => "detailed",
StatusDisplayMode::Compact => "compact",
StatusDisplayMode::Symbol => "symbol",
StatusDisplayMode::Color => "color",
StatusDisplayMode::Hidden => "hidden",
});
Ok(())
})
}
/// Selects the configured surface inherited by new MIDI assignments.
pub fn set_default_controller(&mut self, surface: Option<&str>) -> Result<(), ConfigError> {
self.transaction(|document| {

View File

@ -29,7 +29,7 @@ pub use paths::{XdgEnvironment, XdgPaths};
pub use profile::{
Action, Adapter, Application, Audio, Binding, Fader, FaderDensity, Group, MessageKind,
MixerLayoutEntry, MixerOrientation, NewStreamPolicy, Profile, Selector, SelectorField,
StartupPolicy, Surface, TargetKind, UiTheme,
StartupPolicy, StatusDisplayMode, Surface, TargetKind, UiTheme,
};
pub use state::{
CachedObservation, DesiredWrite, PersistedState, ProfileState, StartupState, UiView,

View File

@ -39,6 +39,8 @@ const fn default_poll_interval_ms() -> u64 {
struct UiSettings {
#[serde(default)]
mixer_orientation: MixerOrientation,
#[serde(default)]
status_display: StatusDisplayMode,
#[serde(default, skip_serializing_if = "Option::is_none")]
default_controller: Option<String>,
#[serde(default)]
@ -67,6 +69,18 @@ pub enum MixerOrientation {
Horizontal,
}
/// Amount and encoding of pickup status shown on mixer faders.
#[derive(Clone, Copy, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum StatusDisplayMode {
#[default]
Detailed,
Compact,
Symbol,
Color,
Hidden,
}
/// Behavior when a profile becomes active.
#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "snake_case")]
@ -409,6 +423,11 @@ impl Profile {
self.raw.ui.mixer_orientation
}
/// Preferred pickup-status presentation in the terminal mixer.
pub const fn status_display(&self) -> StatusDisplayMode {
self.raw.ui.status_display
}
/// Surface selected automatically for new MIDI assignments in the TUI.
pub fn default_controller(&self) -> Option<&str> {
self.raw.ui.default_controller.as_deref()

View File

@ -187,6 +187,19 @@ fn draft_theme_edit_is_profile_backed() {
assert!(draft.source().contains("theme = \"nord\""));
}
#[test]
fn draft_status_display_edit_is_profile_backed() {
let mut draft = ProfileDocument::parse(PROFILE).unwrap();
draft
.set_status_display(fader_config::StatusDisplayMode::Color)
.unwrap();
assert_eq!(
draft.preview().unwrap().status_display(),
fader_config::StatusDisplayMode::Color
);
assert!(draft.source().contains("status_display = \"color\""));
}
#[test]
fn draft_adds_bindings_and_rejects_duplicate_physical_controls() {
let mut draft = ProfileDocument::parse(PROFILE).unwrap();

View File

@ -153,6 +153,30 @@ fn theme_is_profile_backed_and_rejects_unknown_values() {
);
}
#[test]
fn pickup_status_display_defaults_and_validates_named_modes() {
assert_eq!(
Profile::parse(&EXAMPLE.replace("status_display = \"detailed\"\n", ""))
.unwrap()
.status_display(),
fader_config::StatusDisplayMode::Detailed
);
let configured = EXAMPLE.replace(
"status_display = \"detailed\"",
"status_display = \"symbol\"",
);
assert_eq!(
Profile::parse(&configured).unwrap().status_display(),
fader_config::StatusDisplayMode::Symbol
);
assert!(
Profile::parse(
&configured.replace("status_display = \"symbol\"", "status_display = \"raw\"")
)
.is_err()
);
}
#[test]
fn runtime_poll_interval_defaults_and_validates_safe_overrides() {
let without_runtime = EXAMPLE.replace("[runtime]\npoll_interval_ms = 10\n\n", "");

View File

@ -90,7 +90,7 @@ A profile contains these sections:
| Root fields | Schema version, stable profile ID, startup policy, and new-stream policy |
| `[runtime]` | Poll interval from 1–100 ms; the default is 10 ms |
| `[audio]` | `auto`, `pulse`, or reserved `pipewire` adapter selection, probe preference, and maximum gain |
| `[ui]` | `vertical`/`horizontal` orientation, default controller, and theme |
| `[ui]` | Mixer orientation, pickup-status presentation, default controller, and theme |
| `[[applications]]` | A label and one or more metadata selectors |
| `[[groups]]` | Application IDs combined under one logical target |
| `[[surfaces]]` | Stable controller identity and MIDI input/output ports |
@ -142,6 +142,22 @@ runtime work.
### Mixer presentation
Global mixer presentation is stored in `[ui]`:
```toml
[ui]
mixer_orientation = "horizontal"
status_display = "compact"
theme = "nord"
```
`status_display` accepts `detailed`, `compact`, `symbol`, `color`, or `hidden`.
Detailed shows the full pickup state, compact uses short words such as `LIVE`
and `WAIT`, symbol uses a distinct Unicode glyph per state, color uses one dot
whose semantic color carries the state, and hidden removes pickup feedback.
This only changes presentation; pickup protection remains active. Existing
profiles default to `detailed`. The Config page cycles and saves this value.
The TUI normally manages layout entries. Their TOML representation is useful
for review and bulk editing:

View File

@ -6,6 +6,7 @@ new_stream = "adopt"
[ui]
default_controller = "desk-left"
theme = "default"
status_display = "detailed"
[runtime]
poll_interval_ms = 10

View File

@ -243,6 +243,23 @@ impl ConfigurationEditor {
}
})?
}
ConfigurationEdit::SetStatusDisplay { mode } => {
self.document.set_status_display(match mode {
crate::ipc::StatusDisplayMode::Detailed => {
fader_config::StatusDisplayMode::Detailed
}
crate::ipc::StatusDisplayMode::Compact => {
fader_config::StatusDisplayMode::Compact
}
crate::ipc::StatusDisplayMode::Symbol => {
fader_config::StatusDisplayMode::Symbol
}
crate::ipc::StatusDisplayMode::Color => fader_config::StatusDisplayMode::Color,
crate::ipc::StatusDisplayMode::Hidden => {
fader_config::StatusDisplayMode::Hidden
}
})?
}
ConfigurationEdit::SetDefaultController { surface } => {
self.document.set_default_controller(surface.as_deref())?
}

View File

@ -3,7 +3,7 @@ use std::io::{self, Read, Write};
use serde::{Deserialize, Serialize, de::DeserializeOwned};
use thiserror::Error;
pub const PROTOCOL_VERSION: u16 = 17;
pub const PROTOCOL_VERSION: u16 = 18;
pub const MAX_FRAME_BYTES: usize = 64 * 1024;
/// Kind of mixer object addressed by a client.
@ -172,6 +172,9 @@ pub enum ConfigurationEdit {
SetMixerOrientation {
orientation: MixerOrientation,
},
SetStatusDisplay {
mode: StatusDisplayMode,
},
SetDefaultController {
surface: Option<String>,
},
@ -230,6 +233,7 @@ pub struct ConfigurationSnapshot {
#[serde(default)]
pub available_profiles: Vec<String>,
pub mixer_orientation: MixerOrientation,
pub status_display: StatusDisplayMode,
pub default_controller: Option<String>,
pub theme: String,
pub applications: Vec<ConfiguredApplication>,
@ -247,6 +251,17 @@ pub enum MixerOrientation {
Horizontal,
}
#[derive(Clone, Copy, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum StatusDisplayMode {
#[default]
Detailed,
Compact,
Symbol,
Color,
Hidden,
}
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
#[serde(tag = "kind", rename_all = "snake_case")]
pub enum MixerLayoutEntry {

View File

@ -122,6 +122,13 @@ pub(crate) fn configuration_snapshot(
fader_config::MixerOrientation::Vertical => crate::ipc::MixerOrientation::Vertical,
fader_config::MixerOrientation::Horizontal => crate::ipc::MixerOrientation::Horizontal,
},
status_display: match profile.status_display() {
fader_config::StatusDisplayMode::Detailed => crate::ipc::StatusDisplayMode::Detailed,
fader_config::StatusDisplayMode::Compact => crate::ipc::StatusDisplayMode::Compact,
fader_config::StatusDisplayMode::Symbol => crate::ipc::StatusDisplayMode::Symbol,
fader_config::StatusDisplayMode::Color => crate::ipc::StatusDisplayMode::Color,
fader_config::StatusDisplayMode::Hidden => crate::ipc::StatusDisplayMode::Hidden,
},
default_controller: profile.default_controller().map(str::to_owned),
theme: match profile.theme() {
fader_config::UiTheme::Default => "default",
@ -1058,6 +1065,10 @@ mod reconfigure_tests {
crate::ipc::GroupVolumeMode::Absolute
);
assert_eq!(snapshot.faders[0].pickup_tolerance, 0.02);
assert_eq!(
snapshot.status_display,
crate::ipc::StatusDisplayMode::Detailed
);
}
fn desired() -> Vec<DesiredWrite> {

View File

@ -116,6 +116,13 @@ impl IpcMixerClient {
tui::MixerOrientation::Horizontal
}
},
status_display: match snapshot.configuration.status_display {
crate::ipc::StatusDisplayMode::Detailed => tui::StatusDisplayMode::Detailed,
crate::ipc::StatusDisplayMode::Compact => tui::StatusDisplayMode::Compact,
crate::ipc::StatusDisplayMode::Symbol => tui::StatusDisplayMode::Symbol,
crate::ipc::StatusDisplayMode::Color => tui::StatusDisplayMode::Color,
crate::ipc::StatusDisplayMode::Hidden => tui::StatusDisplayMode::Hidden,
},
default_controller: snapshot.configuration.default_controller,
theme: tui::ThemeName::from_config_name(&snapshot.configuration.theme)
.ok_or_else(|| {
@ -418,6 +425,15 @@ fn configuration_edit(edit: TuiConfigurationEdit) -> crate::ipc::ConfigurationEd
tui::MixerOrientation::Horizontal => crate::ipc::MixerOrientation::Horizontal,
},
},
TuiConfigurationEdit::SetStatusDisplay { mode } => IpcEdit::SetStatusDisplay {
mode: match mode {
tui::StatusDisplayMode::Detailed => crate::ipc::StatusDisplayMode::Detailed,
tui::StatusDisplayMode::Compact => crate::ipc::StatusDisplayMode::Compact,
tui::StatusDisplayMode::Symbol => crate::ipc::StatusDisplayMode::Symbol,
tui::StatusDisplayMode::Color => crate::ipc::StatusDisplayMode::Color,
tui::StatusDisplayMode::Hidden => crate::ipc::StatusDisplayMode::Hidden,
},
},
TuiConfigurationEdit::SetDefaultController { surface } => {
IpcEdit::SetDefaultController { surface }
}

View File

@ -397,6 +397,9 @@ Dependencies: M8, M2, M1.
divider columns in Horizontal mode so entries stay on one row, and span the
display width in Vertical mode. Arrow-key selection and reordering follow the
layout axis, while the perpendicular arrows adjust volume.
Config also persists pickup-status presentation as Detailed, Compact,
Symbol, Color, or Hidden. Both mixer orientations share the same state
mapping, and hiding the indicator does not disable pickup protection.
- [x] **M9.5 Guided fader editor:** replace pipe-delimited table commands with a
selected-fader form. Application faders edit capture field/mode/pattern;
groups select eligible application faders and show the absolute group mode;

View File

@ -144,6 +144,7 @@ fn snapshot(mixer_orientation: MixerOrientation) -> MixerSnapshot {
profile_id: "desktop".to_owned(),
available_profiles: vec!["desktop".to_owned()],
mixer_orientation,
status_display: tui::StatusDisplayMode::Detailed,
default_controller: Some("apc-mini".to_owned()),
theme: ThemeName::CatppuccinMocha,
applications: vec![

View File

@ -99,6 +99,7 @@ pub struct ConfigurationSnapshot {
pub profile_id: String,
pub available_profiles: Vec<String>,
pub mixer_orientation: MixerOrientation,
pub status_display: StatusDisplayMode,
pub default_controller: Option<String>,
pub theme: ThemeName,
pub applications: Vec<ConfiguredApplication>,
@ -131,6 +132,48 @@ impl MixerOrientation {
}
}
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
pub enum StatusDisplayMode {
#[default]
Detailed,
Compact,
Symbol,
Color,
Hidden,
}
impl StatusDisplayMode {
const fn label(self) -> &'static str {
match self {
Self::Detailed => "Detailed",
Self::Compact => "Compact",
Self::Symbol => "Symbol",
Self::Color => "Color",
Self::Hidden => "Hidden",
}
}
const fn next(self) -> Self {
match self {
Self::Detailed => Self::Compact,
Self::Compact => Self::Symbol,
Self::Symbol => Self::Color,
Self::Color => Self::Hidden,
Self::Hidden => Self::Detailed,
}
}
const fn previous(self) -> Self {
match self {
Self::Detailed => Self::Hidden,
Self::Compact => Self::Detailed,
Self::Symbol => Self::Compact,
Self::Color => Self::Symbol,
Self::Hidden => Self::Color,
}
}
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum MixerLayoutEntry {
Fader {
@ -282,6 +325,9 @@ pub enum ConfigurationEdit {
SetMixerOrientation {
orientation: MixerOrientation,
},
SetStatusDisplay {
mode: StatusDisplayMode,
},
SetDefaultController {
surface: Option<String>,
},
@ -928,6 +974,7 @@ struct EditorInput {
enum SettingsRow {
Theme,
MixerOrientation,
StatusDisplay,
DefaultController,
HiddenFaders { count: usize },
ActiveProfile,
@ -1480,6 +1527,7 @@ impl<C: MixerClient> LiveTui<C> {
let mut rows = vec![
SettingsRow::Theme,
SettingsRow::MixerOrientation,
SettingsRow::StatusDisplay,
SettingsRow::DefaultController,
SettingsRow::HiddenFaders {
count: self.hidden_faders().len(),
@ -1547,6 +1595,14 @@ impl<C: MixerClient> LiveTui<C> {
orientation: self.snapshot.configuration.mixer_orientation.toggled(),
});
}
SettingsRow::StatusDisplay => {
let mode = if forward {
self.snapshot.configuration.status_display.next()
} else {
self.snapshot.configuration.status_display.previous()
};
self.apply_layout_edit(ConfigurationEdit::SetStatusDisplay { mode });
}
SettingsRow::DefaultController => {
let devices = &self.snapshot.devices;
let current = self.snapshot.configuration.default_controller.as_deref();
@ -2646,6 +2702,62 @@ fn device_summary(devices: &[MidiDevice]) -> Option<String> {
})
}
struct PickupDisplay {
text: &'static str,
style: Style,
}
fn pickup_display(
status: Option<PickupStatus>,
mode: StatusDisplayMode,
theme: theme::ThemePalette,
) -> PickupDisplay {
let Some(status) = status else {
return PickupDisplay {
text: "",
style: Style::default(),
};
};
let text = match mode {
StatusDisplayMode::Detailed => match status {
PickupStatus::Unavailable => "pickup: unavailable",
PickupStatus::Waiting => "pickup: waiting",
PickupStatus::Tracking => "pickup: tracking",
PickupStatus::Mixed => "pickup: mixed",
},
StatusDisplayMode::Compact => match status {
PickupStatus::Unavailable => "OFFLINE",
PickupStatus::Waiting => "WAIT",
PickupStatus::Tracking => "LIVE",
PickupStatus::Mixed => "MIXED",
},
StatusDisplayMode::Symbol => match status {
PickupStatus::Unavailable => "×",
PickupStatus::Waiting => "○",
PickupStatus::Tracking => "●",
PickupStatus::Mixed => "◐",
},
StatusDisplayMode::Color => "●",
StatusDisplayMode::Hidden => "",
};
let color = if mode == StatusDisplayMode::Color {
match status {
PickupStatus::Unavailable => theme.error,
PickupStatus::Waiting => theme.warning,
PickupStatus::Tracking => theme.secondary,
PickupStatus::Mixed => theme.accent,
}
} else if mode == StatusDisplayMode::Symbol {
theme.foreground
} else {
theme.muted
};
PickupDisplay {
text,
style: Style::default().fg(color),
}
}
fn unique_separator_id(label: &str, layout: &[MixerLayoutEntry]) -> String {
let base = label
.chars()
@ -3371,6 +3483,9 @@ impl<C: MixerClient> LiveTui<C> {
SettingsRow::MixerOrientation => {
format!("Mixer layout {} [←→]", config.mixer_orientation.label())
}
SettingsRow::StatusDisplay => {
format!("Pickup status {} [←→]", config.status_display.label())
}
SettingsRow::DefaultController => {
let controller = config.default_controller.as_deref().map_or_else(
|| "None".to_owned(),
@ -3659,14 +3774,16 @@ impl<C: MixerClient> LiveTui<C> {
return;
}
let pickup = match item.pickup {
Some(PickupStatus::Unavailable) => "pickup: unavailable",
Some(PickupStatus::Waiting) => "pickup: waiting",
Some(PickupStatus::Tracking) => "pickup: tracking",
Some(PickupStatus::Mixed) => "pickup: mixed",
None => "",
let pickup = pickup_display(
item.pickup,
self.snapshot.configuration.status_display,
theme,
);
let footer_height = if area.height >= 9 && !pickup.text.is_empty() {
4
} else {
3
};
let footer_height = if area.height >= 9 { 4 } else { 3 };
let meter_height = area.height.saturating_sub(footer_height);
let meter_width = area.width.saturating_sub(4).clamp(3, 7);
let meter_area = Rect::new(
@ -3701,9 +3818,9 @@ impl<C: MixerClient> LiveTui<C> {
let footer_y = area.bottom().saturating_sub(footer_height);
if footer_height == 4 {
Paragraph::new(pickup)
Paragraph::new(pickup.text)
.alignment(Alignment::Center)
.style(Style::default().fg(theme.muted))
.style(pickup.style)
.render(Rect::new(area.x, footer_y, area.width, 1), buf);
}
Paragraph::new(state)
@ -3828,25 +3945,33 @@ impl<C: MixerClient> LiveTui<C> {
if row_area.height < 2 {
break;
}
let title = format!(
"{} {} [{} · {}]{}{}",
if selected { "▶" } else { " " },
item.label,
match item.id.kind {
MixerObjectKind::Application => "application",
MixerObjectKind::Group => "group",
MixerObjectKind::Output => "output",
},
item.detail,
if item.pending { " … pending" } else { "" },
match item.pickup {
Some(PickupStatus::Unavailable) => " pickup: unavailable",
Some(PickupStatus::Waiting) => " pickup: waiting",
Some(PickupStatus::Tracking) => " pickup: tracking",
Some(PickupStatus::Mixed) => " pickup: mixed",
None => "",
}
let pickup = pickup_display(
item.pickup,
self.snapshot.configuration.status_display,
theme,
);
let title = Line::from(vec![
Span::raw(format!(
"{} {} [{} · {}]{}",
if selected { "▶" } else { " " },
item.label,
match item.id.kind {
MixerObjectKind::Application => "application",
MixerObjectKind::Group => "group",
MixerObjectKind::Output => "output",
},
item.detail,
if item.pending { " … pending" } else { "" },
)),
Span::styled(
if pickup.text.is_empty() {
String::new()
} else {
format!(" {}", pickup.text)
},
pickup.style,
),
]);
let block = Block::bordered().title(title).border_style(if selected {
Style::default().fg(theme.accent)
} else {
@ -4027,6 +4152,9 @@ mod tests {
ConfigurationEdit::SetMixerOrientation { orientation } => {
self.snapshot.configuration.mixer_orientation = *orientation;
}
ConfigurationEdit::SetStatusDisplay { mode } => {
self.snapshot.configuration.status_display = *mode;
}
ConfigurationEdit::SetDefaultController { surface } => {
self.snapshot.configuration.default_controller.clone_from(surface);
}
@ -4479,6 +4607,57 @@ mod tests {
assert!(!rendered.contains("Q/Esc"));
}
#[test]
fn pickup_status_display_modes_use_distinct_feedback() {
let theme = ThemeName::Default.palette();
assert_eq!(
pickup_display(
Some(PickupStatus::Tracking),
StatusDisplayMode::Detailed,
theme
)
.text,
"pickup: tracking"
);
assert_eq!(
pickup_display(
Some(PickupStatus::Tracking),
StatusDisplayMode::Compact,
theme
)
.text,
"LIVE"
);
assert_eq!(
pickup_display(
Some(PickupStatus::Waiting),
StatusDisplayMode::Symbol,
theme
)
.text,
"○"
);
let tracking = pickup_display(
Some(PickupStatus::Tracking),
StatusDisplayMode::Color,
theme,
);
let unavailable = pickup_display(
Some(PickupStatus::Unavailable),
StatusDisplayMode::Color,
theme,
);
assert_eq!(tracking.text, "●");
assert_eq!(unavailable.text, "●");
assert_ne!(tracking.style, unavailable.style);
assert_eq!(
pickup_display(Some(PickupStatus::Mixed), StatusDisplayMode::Hidden, theme).text,
""
);
}
#[test]
fn mixer_layout_reorders_and_hides_while_settings_restores_faders() {
let mut snapshot = DemoClient::default().view();
@ -4555,6 +4734,7 @@ mod tests {
app.handle_key_event(press(KeyCode::Down));
app.handle_key_event(press(KeyCode::Down));
app.handle_key_event(press(KeyCode::Down));
app.handle_key_event(press(KeyCode::Down));
app.handle_key_event(press(KeyCode::Enter));
let mut popup_buffer = Buffer::empty(area);
(&app).render(area, &mut popup_buffer);
@ -5188,6 +5368,7 @@ mod tests {
profile_id: "desktop".into(),
available_profiles: vec!["desktop".into(), "streaming".into()],
mixer_orientation: MixerOrientation::Vertical,
status_display: StatusDisplayMode::Detailed,
default_controller: Some("desk-left".into()),
theme: ThemeName::Dracula,
applications: vec![ConfiguredApplication {
@ -5253,6 +5434,7 @@ mod tests {
assert!(rendered.contains("Profile: desktop"));
assert!(rendered.contains("unsaved draft"));
assert!(rendered.contains("Theme Default"));
assert!(rendered.contains("Pickup status Detailed"));
assert!(rendered.contains("Default controller Desk controller"));
assert!(rendered.contains("Show hidden faders none"));
assert!(!rendered.contains("Apply draft"));
@ -5270,7 +5452,7 @@ mod tests {
let mut app = LiveTui::new(LayoutClient { snapshot, edits }).unwrap();
app.handle_key_event(press(KeyCode::Char('2')));
for _ in 0..4 {
for _ in 0..5 {
app.handle_key_event(press(KeyCode::Down));
}
app.handle_key_event(press(KeyCode::Enter));
@ -5321,7 +5503,7 @@ mod tests {
})
.unwrap();
app.handle_key_event(press(KeyCode::Tab));
for _ in 0..7 {
for _ in 0..8 {
app.handle_key_event(press(KeyCode::Down));
}
app.handle_key_event(press(KeyCode::Enter));
@ -5392,7 +5574,7 @@ mod tests {
})
.unwrap();
app.handle_key_event(press(KeyCode::Tab));
for _ in 0..7 {
for _ in 0..8 {
app.handle_key_event(press(KeyCode::Down));
}
app.handle_key_event(press(KeyCode::Enter));
@ -5432,7 +5614,7 @@ mod tests {
})
.unwrap();
app.handle_key_event(press(KeyCode::Tab));
for _ in 0..5 {
for _ in 0..6 {
app.handle_key_event(press(KeyCode::Down));
}
app.handle_key_event(press(KeyCode::Enter));
@ -5479,6 +5661,12 @@ mod tests {
);
app.handle_key_event(press(KeyCode::Down));
app.handle_key_event(press(KeyCode::Right));
assert_eq!(
app.snapshot.configuration.status_display,
StatusDisplayMode::Compact
);
app.handle_key_event(press(KeyCode::Down));
app.handle_key_event(press(KeyCode::Right));
assert_eq!(
app.snapshot.configuration.default_controller.as_deref(),
Some("desk")
@ -5496,6 +5684,9 @@ mod tests {
ConfigurationEdit::SetMixerOrientation {
orientation: MixerOrientation::Horizontal
},
ConfigurationEdit::SetStatusDisplay {
mode: StatusDisplayMode::Compact
},
ConfigurationEdit::SetDefaultController {
surface: Some("desk".into())
}