mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-01 16:59:35 +01:00
WIP: Almost there!
Refactored tests and code to align with the modern instance-based application model. Key changes include: - Disabled Sixel rendering in `OutputBase.cs` due to dependency on legacy static `Application` object. - Hardcoded `force16Colors` to `false` in `WindowsOutput.cs` with a `BUGBUG` note. - Updated `ApplicationImplTests` to use `ApplicationImpl.SetInstance` and return `ApplicationImpl.Instance`. - Refactored `ApplicationModelFencingTests` to use `Application.Create()` and added `ResetModelUsageTracking()` for model switching. - Removed legacy `DriverTests` and reintroduced updated versions with cross-platform driver tests. - Reverted `ArrangementTests` and `ShortcutTests` to use legacy static `ApplicationImpl.Instance`. - Reintroduced driver tests in `DriverTests.cs` with modern `Application.Create()` and added `TestTop` for driver content verification. - General cleanup, including removal of outdated code and addition of `BUGBUG` notes for temporary workarounds.
This commit is contained in:
@@ -17,7 +17,7 @@ public class ApplicationModelFencingTests
|
||||
public void Create_ThenInstanceAccess_ThrowsInvalidOperationException ()
|
||||
{
|
||||
// Create a modern instance-based application
|
||||
IApplication app = ApplicationImpl.Instance; // Force legacy
|
||||
IApplication app = Application.Create ();
|
||||
app.Init ("fake");
|
||||
|
||||
// Attempting to initialize using the legacy static model should throw
|
||||
@@ -31,6 +31,8 @@ public class ApplicationModelFencingTests
|
||||
|
||||
// Clean up
|
||||
app.Shutdown ();
|
||||
ApplicationImpl.ResetModelUsageTracking ();
|
||||
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -43,7 +45,7 @@ public class ApplicationModelFencingTests
|
||||
// Attempting to create and initialize with modern instance-based model should throw
|
||||
InvalidOperationException ex = Assert.Throws<InvalidOperationException> (() =>
|
||||
{
|
||||
IApplication app = ApplicationImpl.Instance; // Force legacy
|
||||
IApplication app = Application.Create ();
|
||||
app.Init ("fake");
|
||||
});
|
||||
|
||||
@@ -52,6 +54,7 @@ public class ApplicationModelFencingTests
|
||||
|
||||
// Clean up
|
||||
staticInstance.Shutdown ();
|
||||
ApplicationImpl.ResetModelUsageTracking ();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -72,13 +75,14 @@ public class ApplicationModelFencingTests
|
||||
|
||||
// Clean up
|
||||
staticInstance.Shutdown ();
|
||||
ApplicationImpl.ResetModelUsageTracking ();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Create_ThenInit_ThrowsInvalidOperationException ()
|
||||
{
|
||||
// Create a modern instance-based application
|
||||
IApplication app = ApplicationImpl.Instance; // Force legacy
|
||||
IApplication app = Application.Create ();
|
||||
app.Init ("fake");
|
||||
|
||||
// Attempting to initialize using the legacy static model should throw
|
||||
@@ -92,6 +96,7 @@ public class ApplicationModelFencingTests
|
||||
|
||||
// Clean up
|
||||
app.Shutdown ();
|
||||
ApplicationImpl.ResetModelUsageTracking ();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -110,6 +115,7 @@ public class ApplicationModelFencingTests
|
||||
app1.Shutdown ();
|
||||
app2.Shutdown ();
|
||||
app3.Shutdown ();
|
||||
ApplicationImpl.ResetModelUsageTracking ();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -126,6 +132,7 @@ public class ApplicationModelFencingTests
|
||||
|
||||
// Clean up
|
||||
instance1.Shutdown ();
|
||||
ApplicationImpl.ResetModelUsageTracking ();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -150,5 +157,6 @@ public class ApplicationModelFencingTests
|
||||
IApplication app2 = Application.Create ();
|
||||
Assert.NotNull (app2);
|
||||
app2.Shutdown ();
|
||||
ApplicationImpl.ResetModelUsageTracking ();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user