From c1212644b0c6db962b9e25c14b70e04968ae319b Mon Sep 17 00:00:00 2001 From: gramps Date: Fri, 30 Oct 2026 08:57:09 -0700 Subject: [PATCH] fix(socials): live preview of the bar appearance + the crash on dragging a slider MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two bugs from the creator's first look at the new controls. 1. CRASH — '{DependencyProperty.UnsetValue}' is not a valid value for property 'Fill'. The token conversion deleted `YtSliderKnobHoverBrush` while two slider triggers still referenced it. WPF does not fail that at build time: it substitutes UnsetValue and throws at the next layout, inside `Ellipse.OnRender` — so the first slider touched (the new opacity one) killed the app. The brush is back, as a glossier version of the rest state. Guard: `ThemeResourceTests` scans every app XAML and proves each {StaticResource} key is defined (theme/App resources or the same file). Proven by removing the key again — the test names it. 2. PREVIEW DID NOTHING — the preview bar is its own XAML rendering (not the rasterized strip the compositor overlays), and it was hard-wired white-on-transparent, so the drawer's controls had nothing to move. Now: - `SocialBarTextBrush` / `SocialBarBackgroundBrush` come from the same `SocialBarStyle` the renderer bakes, so preview and output cannot disagree. - the preview draws the plate (same colour + opacity) and the drop shadow. - the drawer applies changes to the live config as you edit (`ApplyAppearancePreview`), and Cancel restores the pre-edit snapshot — so the preview tracks the controls without persisting anything until Save. 46 tests green (theme, socials, design tokens, layout store, real-MainWindow meter test). --- Controls/PreviewPane.xaml | 46 +++++++++++++++++++--- Themes/Controls.xaml | 10 +++++ ViewModels/MainViewModel.Socials.cs | 48 ++++++++++++++++++++++- ytLive.Tests/ThemeResourceTests.cs | 61 +++++++++++++++++++++++++++++ 4 files changed, 158 insertions(+), 7 deletions(-) create mode 100644 ytLive.Tests/ThemeResourceTests.cs diff --git a/Controls/PreviewPane.xaml b/Controls/PreviewPane.xaml index 51f7934..fc61496 100644 --- a/Controls/PreviewPane.xaml +++ b/Controls/PreviewPane.xaml @@ -351,8 +351,12 @@ + @@ -362,15 +366,45 @@ - - + + + + + + + + + + + diff --git a/Themes/Controls.xaml b/Themes/Controls.xaml index 3f63732..b409b7d 100644 --- a/Themes/Controls.xaml +++ b/Themes/Controls.xaml @@ -359,6 +359,16 @@ + + + + + + +