From 51d9dd09c7cfd2e3be8648960d8ebe3b2f1c26c1 Mon Sep 17 00:00:00 2001 From: gramps Date: Fri, 30 Oct 2026 09:06:53 -0700 Subject: [PATCH] fix(socials): the bar disappeared from the preview when the plate was off MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit My own regression from the previous commit: the plate Border WRAPPED the bar's content and its Visibility was bound to BarBackgroundEnabled — so with the plate off (the default) the preview collapsed the entire social bar. Nothing was wrong with the data; the element was there and invisible. Fix: the wrapper is always laid out. "Plate off" now means a TRANSPARENT background (`SocialBarBackgroundBrush` returns Transparent when disabled) and zero padding, "on" means the colour/opacity plate with 18,6 padding — which also matches what the renderer bakes for the output, so preview and broadcast agree. Guard (new fact in SocialBarAppearanceTests): the preview must never visibility-gate the bar on BarBackgroundEnabled, the wrapper must bind SocialBarBackgroundBrush, and the plate's switching must be Padding. --- Controls/PreviewPane.xaml | 16 ++++++++++++---- ViewModels/MainViewModel.Socials.cs | 7 +++++-- ytLive.Tests/SocialBarAppearanceTests.cs | 14 ++++++++++++++ 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/Controls/PreviewPane.xaml b/Controls/PreviewPane.xaml index fc61496..17a4d08 100644 --- a/Controls/PreviewPane.xaml +++ b/Controls/PreviewPane.xaml @@ -351,10 +351,18 @@ - + + + + diff --git a/ViewModels/MainViewModel.Socials.cs b/ViewModels/MainViewModel.Socials.cs index 2a3da84..b713db3 100644 --- a/ViewModels/MainViewModel.Socials.cs +++ b/ViewModels/MainViewModel.Socials.cs @@ -35,8 +35,11 @@ public partial class MainViewModel /// so the two cannot drift apart (creator request 2026-10-30). public SolidColorBrush SocialBarTextBrush => SocialBarStyle.From(_socials).TextBrush; - /// The preview's plate: same colour AND same opacity the renderer bakes in. - public SolidColorBrush SocialBarBackgroundBrush => SocialBarStyle.From(_socials).BackgroundBrush; + /// The preview's plate: same colour AND same opacity the renderer bakes in. + /// Transparent when the plate is off — "off" means no plate, never no bar. + public SolidColorBrush SocialBarBackgroundBrush => _socials?.BarBackgroundEnabled == true + ? SocialBarStyle.From(_socials).BackgroundBrush + : Brushes.Transparent; /// The global socials config (entries + bar settings), or null. public SocialsConfig? Socials => _socials; diff --git a/ytLive.Tests/SocialBarAppearanceTests.cs b/ytLive.Tests/SocialBarAppearanceTests.cs index 350c58f..b85db0e 100644 --- a/ytLive.Tests/SocialBarAppearanceTests.cs +++ b/ytLive.Tests/SocialBarAppearanceTests.cs @@ -65,6 +65,20 @@ public class SocialBarAppearanceTests Assert.Null(failure); } + [Fact] + public void The_preview_bar_is_never_hidden_by_the_plate_switch() + { + // Regression, 2026-10-30: the plate Border wrapped the whole bar and its Visibility was + // bound to BarBackgroundEnabled, so turning the plate off (the default) removed the bar + // from the preview entirely. "Plate off" must mean a transparent plate. + var preview = SourceAssert.Text("Controls", "PreviewPane.xaml"); + Assert.DoesNotContain("Socials.BarBackgroundEnabled, Converter={StaticResource BoolToVis}", preview); + Assert.Contains("{Binding SocialBarBackgroundBrush}", preview); + + // The plate's PADDING is what switches with the toggle, not the element's presence. + Assert.Contains("", preview); + } + private static VideoFrame? Render(SocialBarStyle style) => SocialBarRenderer.Render(Entries, style); private static int Count(VideoFrame frame, Func predicate)