From 047b08060d33f9b69e36d670096221fde1487901 Mon Sep 17 00:00:00 2001 From: Owen McGirr Date: Tue, 28 Jul 2026 12:31:42 +0100 Subject: [PATCH] fix: render friendly switch action labels --- src/SwitchifyPc.App/SwitchControlProfileWindow.xaml.cs | 10 ++++++++-- .../SwitchControlProfileWindowTests.cs | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/SwitchifyPc.App/SwitchControlProfileWindow.xaml.cs b/src/SwitchifyPc.App/SwitchControlProfileWindow.xaml.cs index fd508cf..56d3b02 100644 --- a/src/SwitchifyPc.App/SwitchControlProfileWindow.xaml.cs +++ b/src/SwitchifyPc.App/SwitchControlProfileWindow.xaml.cs @@ -472,11 +472,17 @@ private sealed record ProfileListItem( private sealed record BindingTypeOption( SwitchBindingType Value, - string Label); + string Label) + { + public override string ToString() => Label; + } private sealed record BindingValueOption( string Value, - string Label); + string Label) + { + public override string ToString() => Label; + } private sealed class BindingRowViewModel : INotifyPropertyChanged { diff --git a/src/SwitchifyPc.Tests/SwitchControlProfileWindowTests.cs b/src/SwitchifyPc.Tests/SwitchControlProfileWindowTests.cs index 7bd88fb..db0ee81 100644 --- a/src/SwitchifyPc.Tests/SwitchControlProfileWindowTests.cs +++ b/src/SwitchifyPc.Tests/SwitchControlProfileWindowTests.cs @@ -307,6 +307,8 @@ public void ProfileWindowUsesFriendlyLabelsAndSavesCanonicalValues() Assert.Contains("Mouse button", ItemLabels(action)); Assert.Contains("Media control", ItemLabels(action)); + Assert.Equal("Keyboard key", action.SelectionBoxItem.ToString()); + Assert.Contains("Up arrow", value.Items.Cast().Select(item => item.ToString())); action.SelectedValue = SwitchBindingType.MouseClick; Assert.Empty(value.Text); Assert.False(save.IsEnabled);