mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-30 17:57:57 +01:00
Change ClearScreenNextIteration to internal and trying to fix unit test failure
This commit is contained in:
@@ -13,7 +13,7 @@ public class CombiningMarks : Scenario
|
||||
top.DrawComplete += (s, e) =>
|
||||
{
|
||||
// Forces reset _lineColsOffset because we're dealing with direct draw
|
||||
Application.ClearScreenNextIteration = true;
|
||||
Application.Top!.SetNeedsDraw ();
|
||||
|
||||
var i = -1;
|
||||
top.AddStr ("Terminal.Gui only supports combining marks that normalize. See Issue #2616.");
|
||||
|
||||
@@ -82,8 +82,8 @@ public static partial class Application // Screen related stuff
|
||||
/// Gets or sets whether the screen will be cleared, and all Views redrawn, during the next Application iteration.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is typicall set to true when a View's <see cref="View.Frame"/> changes and that view has no
|
||||
/// This is typical set to true when a View's <see cref="View.Frame"/> changes and that view has no
|
||||
/// SuperView (e.g. when <see cref="Application.Top"/> is moved or resized.
|
||||
/// </remarks>
|
||||
public static bool ClearScreenNextIteration { get; set; }
|
||||
internal static bool ClearScreenNextIteration { get; set; }
|
||||
}
|
||||
|
||||
@@ -239,6 +239,8 @@ public partial class View // Layout APIs
|
||||
_x = value ?? throw new ArgumentNullException (nameof (value), @$"{nameof (X)} cannot be null");
|
||||
|
||||
PosDimSet ();
|
||||
|
||||
NeedsClearScreenNextIteration ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,6 +283,8 @@ public partial class View // Layout APIs
|
||||
|
||||
_y = value ?? throw new ArgumentNullException (nameof (value), @$"{nameof (Y)} cannot be null");
|
||||
PosDimSet ();
|
||||
|
||||
NeedsClearScreenNextIteration ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -339,6 +343,8 @@ public partial class View // Layout APIs
|
||||
OnHeightChanged,
|
||||
HeightChanged,
|
||||
out Dim _);
|
||||
|
||||
NeedsClearScreenNextIteration ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -425,6 +431,16 @@ public partial class View // Layout APIs
|
||||
OnWidthChanged,
|
||||
WidthChanged,
|
||||
out Dim _);
|
||||
|
||||
NeedsClearScreenNextIteration ();
|
||||
}
|
||||
}
|
||||
|
||||
private void NeedsClearScreenNextIteration ()
|
||||
{
|
||||
if (Application.Top is { } && Application.Top == this && Application.TopLevels.Count == 1)
|
||||
{
|
||||
Application.ClearScreenNextIteration = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -656,7 +672,7 @@ public partial class View // Layout APIs
|
||||
else if (Application.TopLevels.Count == 1)
|
||||
{
|
||||
// If this is the only TopLevel, we need to redraw the screen
|
||||
Application.ClearScreenNextIteration = true;
|
||||
Application.Top!.SetNeedsDraw ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -376,9 +376,9 @@ public partial class View : IDisposable, ISupportInitializeNotification
|
||||
{
|
||||
SuperView?.SetNeedsDraw ();
|
||||
}
|
||||
else
|
||||
else if (Application.Top is { })
|
||||
{
|
||||
Application.ClearScreenNextIteration = true;
|
||||
Application.Top!.SetNeedsDraw ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public class ApplicationScreenTests
|
||||
Assert.Equal (0, clearedContentsRaised);
|
||||
|
||||
// Act
|
||||
Application.Top.SetNeedsLayout ();
|
||||
Application.Top!.SetNeedsLayout ();
|
||||
Application.LayoutAndDraw ();
|
||||
|
||||
// Assert
|
||||
@@ -67,6 +67,20 @@ public class ApplicationScreenTests
|
||||
// Assert
|
||||
Assert.Equal (2, clearedContentsRaised);
|
||||
|
||||
// Act
|
||||
Application.Top.Y = 1;
|
||||
Application.LayoutAndDraw ();
|
||||
|
||||
// Assert
|
||||
Assert.Equal (3, clearedContentsRaised);
|
||||
|
||||
// Act
|
||||
Application.Top.Height = 10;
|
||||
Application.LayoutAndDraw ();
|
||||
|
||||
// Assert
|
||||
Assert.Equal (4, clearedContentsRaised);
|
||||
|
||||
Application.End (rs);
|
||||
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user