Simplify the Screen property in ApplicationImpl by removing the _screen field and its locking mechanism. The getter now directly retrieves the screen size from the Driver or defaults to 2048x2048. The setter now calls Driver?.SetScreenSize to update the screen size, eliminating the need for the ResetScreen method.

Update `RaiseScreenChangedEvent` to no longer explicitly set the `Screen` property. Remove unnecessary `.ToArray()` conversion in `View.Draw`.

Clarify `Screen` property documentation in `IApplication` to specify constraints on location and size. Update tests to reflect the new behavior where setting the `Screen` property raises the `ScreenChanged` event. Rename and adjust test cases accordingly.
This commit is contained in:
Tig
2025-12-04 16:42:51 -07:00
parent 4738e8535a
commit b061aacf18
4 changed files with 11 additions and 44 deletions

View File

@@ -383,7 +383,7 @@ public class IApplicationScreenChangedTests (ITestOutputHelper output)
}
[Fact]
public void Screen_Property_Setting_Does_Not_Fire_ScreenChanged_Event ()
public void Screen_Property_Setting_Raises_ScreenChanged_Event ()
{
// Arrange
using IApplication app = Application.Create ();
@@ -397,11 +397,10 @@ public class IApplicationScreenChangedTests (ITestOutputHelper output)
try
{
// Act - Manually set Screen property (not via driver resize)
// Act - Manually set Screen property
app.Screen = new (0, 0, 100, 50);
// Assert - Event should not fire for manual property setting
Assert.False (eventFired);
Assert.True (eventFired);
Assert.Equal (new (0, 0, 100, 50), app.Screen);
}
finally