diff --git a/ILSpy.Tests/Options/OptionsPageScrollReachTests.cs b/ILSpy.Tests/Options/OptionsPageScrollReachTests.cs index e94261724..dcc4def44 100644 --- a/ILSpy.Tests/Options/OptionsPageScrollReachTests.cs +++ b/ILSpy.Tests/Options/OptionsPageScrollReachTests.cs @@ -107,4 +107,46 @@ public class OptionsPageScrollReachTests + "obscures it. Indicates either ScrollViewer.Extent under-measures the StackPanel " + "content or the ContentPresenter under-allocates the TabControl's vertical room."); } + + [AvaloniaTest] + public void Each_Decompiler_Settings_Group_Has_A_Header_Checkbox() + { + // Every Decompiler-settings category (the C# language-version groups) carries a tri-state + // header checkbox bound to AreAllItemsChecked that bulk-toggles the group. The group + // viewmodel has the whole plumbing, but the panel's Expander header had been reduced to + // plain category text, so each group rendered WITHOUT its checkbox. Realize the panel and + // assert each group's header checkbox is present (its Content is the Category string, + // distinct from the per-item checkboxes whose Content is a setting Description). + var window = AppComposition.Current.GetExport(); + window.Width = 900; + window.Height = 600; + window.Show(); + Dispatcher.UIThread.RunJobs(); + + var command = AppComposition.Current.GetExport() + .GetCommand(nameof(Resources._Options)); + command.Execute(null); + Dispatcher.UIThread.RunJobs(); + + var view = window.GetVisualDescendants().OfType().Single(); + var model = (OptionsPageModel)((ContentTabPage)((MainWindowViewModel)window.DataContext!) + .DockWorkspace.Documents!.VisibleDockables! + .OfType().Single(t => t.Content is OptionsPageModel)).Content!; + var decompilerPage = model.Pages.OfType().Single(); + model.SelectedPage = decompilerPage; + Dispatcher.UIThread.RunJobs(); + + var renderedCheckboxContents = view.GetVisualDescendants().OfType() + .Select(cb => cb.Content?.ToString()) + .Where(s => !string.IsNullOrEmpty(s)) + .ToHashSet(); + + decompilerPage.Settings.Should().NotBeEmpty("baseline: the Decompiler panel must have groups"); + foreach (var group in decompilerPage.Settings) + { + renderedCheckboxContents.Should().Contain(group.Category, + $"the '{group.Category}' group must render a header checkbox (the bulk-toggle), " + + "not just the category text"); + } + } } diff --git a/ILSpy/Options/DecompilerSettingsPanel.axaml b/ILSpy/Options/DecompilerSettingsPanel.axaml index 704c6f640..3bc05ce13 100644 --- a/ILSpy/Options/DecompilerSettingsPanel.axaml +++ b/ILSpy/Options/DecompilerSettingsPanel.axaml @@ -16,7 +16,16 @@ - + + + + +