Refactor Application constants and remove unused field

Removed the internal `_forceFakeConsole` field and its
associated `ClearForceFakeConsole` method from
`Application.Driver.cs` to simplify internal state management.

Renamed `DefaultMaximumIterationsPerSecond` to
`DEFAULT_MAXIMUM_ITERATIONS_PER_SECOND` in `Application.cs`
to align with updated naming conventions. Updated all
references and XML documentation accordingly.

Adjusted test logic in `ApplicationTests.cs` and
`TestSetup.cs` to remove references to `_forceFakeConsole`
and ensure alignment with the updated codebase.
This commit is contained in:
Tig
2025-10-26 15:35:52 -06:00
parent c653dc37c3
commit 93ec92e6a0
6 changed files with 4 additions and 13 deletions

View File

@@ -6,12 +6,6 @@ public static partial class Application // Driver abstractions
{
internal static bool _forceFakeConsole;
// Internal helper method for ApplicationImpl.ResetState to clear this field
internal static void ClearForceFakeConsole ()
{
_forceFakeConsole = false;
}
/// <summary>Gets the <see cref="IConsoleDriver"/> that has been selected. See also <see cref="ForceDriver"/>.</summary>
public static IConsoleDriver? Driver
{

View File

@@ -53,7 +53,7 @@ public static partial class Application
/// <summary>
/// Maximum number of iterations of the main loop (and hence draws)
/// to allow to occur per second. Defaults to <see cref="DefaultMaximumIterationsPerSecond"/>> which is a 40ms sleep
/// to allow to occur per second. Defaults to <see cref="DEFAULT_MAXIMUM_ITERATIONS_PER_SECOND"/>> which is a 40ms sleep
/// after iteration (factoring in how long iteration took to run).
/// <remarks>Note that not every iteration draws (see <see cref="View.NeedsDraw"/>).
/// Only affects v2 drivers.</remarks>
@@ -67,7 +67,7 @@ public static partial class Application
/// <summary>
/// Default value for <see cref="MaximumIterationsPerSecond"/>
/// </summary>
public const ushort DefaultMaximumIterationsPerSecond = 25;
public const ushort DEFAULT_MAXIMUM_ITERATIONS_PER_SECOND = 25;
/// <summary>
/// Gets a string representation of the Application as rendered by <see cref="Driver"/>.

View File

@@ -261,7 +261,7 @@ public interface IApplication
/// <summary>
/// Maximum number of iterations of the main loop (and hence draws)
/// to allow to occur per second. Defaults to <see cref="Application.DefaultMaximumIterationsPerSecond"/> which is a 40ms sleep
/// to allow to occur per second. Defaults to <see cref="Application.DEFAULT_MAXIMUM_ITERATIONS_PER_SECOND"/> which is a 40ms sleep
/// after iteration (factoring in how long iteration took to run).
/// <remarks>Note that not every iteration draws (see <see cref="View.NeedsDraw"/>).
/// Only affects v2 drivers.</remarks>

View File

@@ -101,7 +101,7 @@ public class GuiTestContext : IDisposable
Logging.Logger = origLogger;
_finished = true;
Application.MaximumIterationsPerSecond = Application.DefaultMaximumIterationsPerSecond;
Application.MaximumIterationsPerSecond = Application.DEFAULT_MAXIMUM_ITERATIONS_PER_SECOND;
}
},
_cts.Token);

View File

@@ -329,7 +329,6 @@ public class ApplicationTests
Assert.False (Application.Initialized);
Assert.Equal (Application.GetSupportedCultures (), Application.SupportedCultures);
Assert.Equal (Application.GetAvailableCulturesFromEmbeddedResources (), Application.SupportedCultures);
Assert.False (Application._forceFakeConsole);
Assert.Equal (-1, Application.MainThreadId);
Assert.Empty (Application.TopLevels);
Assert.Empty (Application.CachedViewsUnderMouse);
@@ -362,7 +361,6 @@ public class ApplicationTests
// Set the values that can be set
Application.Initialized = true;
Application._forceFakeConsole = true;
Application.MainThreadId = 1;
//Application._topLevels = new List<Toplevel> ();

View File

@@ -58,7 +58,6 @@ public class GlobalTestSetup : IDisposable
Assert.False (Application.Initialized);
Assert.Equal (Application.GetSupportedCultures (), Application.SupportedCultures);
Assert.Equal (Application.GetAvailableCulturesFromEmbeddedResources (), Application.SupportedCultures);
Assert.False (Application._forceFakeConsole);
Assert.Equal (-1, Application.MainThreadId);
Assert.Empty (Application.TopLevels);
Assert.Empty (Application.CachedViewsUnderMouse);