From 8a829dc6f3146c08753360ff06d23927f90c4c71 Mon Sep 17 00:00:00 2001 From: Tig Date: Mon, 22 Dec 2025 15:50:19 -0700 Subject: [PATCH] Tweaks. Refactor Dialog tests to use fake driver; cleanup config - Migrated Dialog alignment/layout tests to ViewsTests using FakeDriverBase and a fake driver for improved isolation and parallelization. - Removed old DialogTests from UnitTests; new tests use explicit disposal and resource management. - Refactored Dialog static default properties to use auto-properties with [ConfigurationProperty] attributes, removing old backing fields and simplifying code. - Made DriverAssert public for cross-project test use. - Removed obsolete test migration and performance analysis markdown docs. - Improved test infrastructure for future migrations. --- Terminal.Gui/Views/Dialog.cs | 202 +++------ Tests/CATEGORY_A_MIGRATION_SUMMARY.md | 151 ------- Tests/IntegrationTests/DialogTests.cs | 9 + Tests/PERFORMANCE_ANALYSIS.md | 363 ---------------- Tests/TEST_MIGRATION_REPORT.md | 285 ------------- Tests/TEXT_TESTS_ANALYSIS.md | 255 ------------ Tests/U | 0 Tests/UnitTests/DriverAssert.cs | 2 +- .../UnitTests.Parallelizable.csproj | 1 - .../Views}/DialogTests.cs | 391 +++++++++--------- 10 files changed, 276 insertions(+), 1383 deletions(-) delete mode 100644 Tests/CATEGORY_A_MIGRATION_SUMMARY.md create mode 100644 Tests/IntegrationTests/DialogTests.cs delete mode 100644 Tests/PERFORMANCE_ANALYSIS.md delete mode 100644 Tests/TEST_MIGRATION_REPORT.md delete mode 100644 Tests/TEXT_TESTS_ANALYSIS.md delete mode 100644 Tests/U rename Tests/{UnitTests/Dialogs => UnitTestsParallelizable/Views}/DialogTests.cs (87%) diff --git a/Terminal.Gui/Views/Dialog.cs b/Terminal.Gui/Views/Dialog.cs index 7644e1ec5..1d0aa8cd4 100644 --- a/Terminal.Gui/Views/Dialog.cs +++ b/Terminal.Gui/Views/Dialog.cs @@ -14,21 +14,49 @@ namespace Terminal.Gui.Views; /// public class Dialog : Window { - private static LineStyle _defaultBorderStyle = LineStyle.Heavy; // Resources/config.json overrides - private static Alignment _defaultButtonAlignment = Alignment.End; // Resources/config.json overrides - private static AlignmentModes _defaultButtonAlignmentModes = AlignmentModes.StartToEnd | AlignmentModes.AddSpaceBetweenItems; // Resources/config.json overrides - private static int _defaultMinimumHeight = 80; // Resources/config.json overrides - private static int _defaultMinimumWidth = 80; // Resources/config.json overrides - private static ShadowStyle _defaultShadow = ShadowStyle.Transparent; // Resources/config.json overrides + /// + /// Defines the default border styling for . Can be configured via + /// . + /// + [ConfigurationProperty (Scope = typeof (ThemeScope))] + public new static LineStyle DefaultBorderStyle { get; set; } = LineStyle.Heavy; + + /// The default for . + /// This property can be set in a Theme. + [ConfigurationProperty (Scope = typeof (ThemeScope))] + public static Alignment DefaultButtonAlignment { get; set; } = Alignment.End; + + /// The default for . + /// This property can be set in a Theme. + [ConfigurationProperty (Scope = typeof (ThemeScope))] + public static AlignmentModes DefaultButtonAlignmentModes { get; set; } = AlignmentModes.StartToEnd | AlignmentModes.AddSpaceBetweenItems; + + /// + /// Defines the default minimum Dialog height, as a percentage of the container width. Can be configured via + /// . + /// + [ConfigurationProperty (Scope = typeof (ThemeScope))] + public static int DefaultMinimumHeight { get; set; } = 80; + + /// + /// Defines the default minimum Dialog width, as a percentage of the container width. Can be configured via + /// . + /// + [ConfigurationProperty (Scope = typeof (ThemeScope))] + public static int DefaultMinimumWidth { get; set; } = 80; + + /// + /// Gets or sets whether all s are shown with a shadow effect by default. + /// + [ConfigurationProperty (Scope = typeof (ThemeScope))] + public new static ShadowStyle DefaultShadow { get; set; } = ShadowStyle.Transparent; /// /// Initializes a new instance of the class with no s. /// /// - /// By default, , , , and are - /// set - /// such that the will be centered in, and no larger than 90% of , if - /// there is one. Otherwise, + /// By default, the will be centered in, and no larger than 90% of + /// , if there is one. Otherwise, /// it will be bound by the screen dimensions. /// public Dialog () @@ -49,7 +77,6 @@ public class Dialog : Window } private readonly List