mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 07:47:54 +01:00
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:
@@ -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
|
||||
{
|
||||
|
||||
@@ -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"/>.
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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> ();
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user