mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Optimize View drawing logic and update ClearViewport tests
Refactored the `View` class to include a `NeedsDraw` check in multiple drawing methods, improving rendering efficiency. Adjusted `OnDrewText` and `DrewText` event handling for consistency. Removed unused code and redundant tests. Rewrote and reorganized `ClearViewportTests` for clarity and compatibility with the new `NeedsDraw` logic. Added new tests to validate `ClearViewport` behavior under various conditions, including transparent viewports, event cancellations, and content-only clearing. Updated namespaces for better alignment, disabled a noisy `ComboBoxTests` test, and improved code formatting and maintainability across files.
This commit is contained in:
@@ -205,34 +205,6 @@ public class ViewDrawTextAndLineCanvasTests () : FakeDriverBase
|
||||
Assert.True (eventRaised);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DrewText_Event_Raised ()
|
||||
{
|
||||
IDriver driver = CreateFakeDriver (80, 25);
|
||||
driver.Clip = new Region (driver.Screen);
|
||||
|
||||
bool eventRaised = false;
|
||||
|
||||
var view = new View
|
||||
{
|
||||
X = 10,
|
||||
Y = 10,
|
||||
Width = 20,
|
||||
Height = 20,
|
||||
Driver = driver,
|
||||
Text = "Test"
|
||||
};
|
||||
view.BeginInit ();
|
||||
view.EndInit ();
|
||||
view.LayoutSubViews ();
|
||||
|
||||
view.DrewText += (s, e) => eventRaised = true;
|
||||
|
||||
view.Draw ();
|
||||
|
||||
Assert.True (eventRaised);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region LineCanvas Tests
|
||||
|
||||
Reference in New Issue
Block a user