From 7918a33ec976654a6249b4ebd6f1706fcb7a2eb4 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sat, 23 May 2026 09:43:16 +0200 Subject: [PATCH] Make MEF-menu separators visible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The InitMainMenu build path already inserts Separators between MenuCategory groups (Open / Save / Remove / Exit in File, View / Navigation / Options in View, etc.). The Simple-theme default style renders them as a 1px line at very low contrast — barely visible against the menu background, which is why "no groups in the menus" was a reasonable read. Assisted-by: Claude:claude-opus-4-7:Claude Code --- .../Docking/PreviewTabPromotionTests.cs | 30 +++++++++++++++++++ ILSpy/App.axaml | 12 ++++++++ 2 files changed, 42 insertions(+) diff --git a/ILSpy.Tests/Docking/PreviewTabPromotionTests.cs b/ILSpy.Tests/Docking/PreviewTabPromotionTests.cs index a285ebf3d..92e0e522c 100644 --- a/ILSpy.Tests/Docking/PreviewTabPromotionTests.cs +++ b/ILSpy.Tests/Docking/PreviewTabPromotionTests.cs @@ -490,6 +490,36 @@ public class PreviewTabPromotionTests "the already-pinned tab stays pinned"); } + [AvaloniaTest] + public async Task File_Menu_Separators_Have_A_Visible_Background() + { + // Regression for the "no groups in the menus" report: separators were inserted at + // MenuCategory boundaries (Open / Save / Remove / Exit in File menu, etc.) but the + // Simple-theme default rendered them nearly invisible against the menu chrome. + // App.axaml applies a Style for MenuItem Separator that gives them a visible + // brush + height. This test pins that style at the rendered-Separator level. + var window = AppComposition.Current.GetExport(); + window.Show(); + var vm = (MainWindowViewModel)window.DataContext!; + await vm.AssemblyTreeModel.WaitForAssembliesAsync(minimumCount: 1); + + var fileMenu = window.GetVisualDescendants().OfType() + .Single(m => (m.Tag as string) == "_File"); + fileMenu.Open(); + global::Avalonia.Threading.Dispatcher.UIThread.RunJobs(); + await Waiters.WaitForAsync(() => fileMenu.Items.Count > 0, System.TimeSpan.FromSeconds(5)); + + var separators = fileMenu.Items.OfType().ToList(); + separators.Should().HaveCountGreaterThanOrEqualTo(2, + "File menu's MenuCategory groups (Open / Save / Remove / Exit) must produce at least two separators"); + + foreach (var sep in separators) + { + sep.Background.Should().NotBeNull( + "the App.axaml MenuItem Separator style must set a visible Background brush"); + } + } + [AvaloniaTest] public async Task Pin_Button_Inherits_The_Close_Button_Theme() { diff --git a/ILSpy/App.axaml b/ILSpy/App.axaml index 3ff069ef2..41a20a06a 100644 --- a/ILSpy/App.axaml +++ b/ILSpy/App.axaml @@ -118,6 +118,18 @@ + + +