Browse Source

Make MEF-menu separators visible

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
pull/3755/head
Siegfried Pammer 2 months ago
parent
commit
7918a33ec9
  1. 30
      ILSpy.Tests/Docking/PreviewTabPromotionTests.cs
  2. 12
      ILSpy/App.axaml

30
ILSpy.Tests/Docking/PreviewTabPromotionTests.cs

@ -490,6 +490,36 @@ public class PreviewTabPromotionTests @@ -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<MainWindow>();
window.Show();
var vm = (MainWindowViewModel)window.DataContext!;
await vm.AssemblyTreeModel.WaitForAssembliesAsync(minimumCount: 1);
var fileMenu = window.GetVisualDescendants().OfType<global::Avalonia.Controls.MenuItem>()
.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<global::Avalonia.Controls.Separator>().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()
{

12
ILSpy/App.axaml

@ -118,6 +118,18 @@ @@ -118,6 +118,18 @@
<Setter Property="Foreground" Value="White" />
</Style>
<!-- Menu separators between MenuCategory groups. Simple theme's default is a thin
line at very low contrast against the menu background — barely visible. Boost
height and use a more contrasting brush so the MEF-injected groups (Save vs
Remove vs Exit in File menu, View vs Navigation vs Options in View menu, etc.)
read as distinct sections. Scoped to MenuItem-descendant separators so it
doesn't catch toolbar separators or the docking-chrome ones. -->
<Style Selector="MenuItem Separator">
<Setter Property="Height" Value="1" />
<Setter Property="Margin" Value="0,4" />
<Setter Property="Background" Value="Gray" />
</Style>
<!-- VS-style preview tab: italicise the title of any DocumentTabStripItem whose
dockable is a ContentTabPage with IsPreview=true. Tool-pane tabs and pinned
document tabs fall through to Normal via the converter's null/false branch.

Loading…
Cancel
Save