mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Added unit tests
This commit is contained in:
@@ -508,6 +508,7 @@ public static partial class Application // Run (Begin, Run, End, Stop)
|
||||
if (ClearScreenNextIteration)
|
||||
{
|
||||
forceDraw = true;
|
||||
ClearScreenNextIteration = false;
|
||||
}
|
||||
if (forceDraw)
|
||||
{
|
||||
|
||||
67
UnitTests/Application/ApplicationScreenTests.cs
Normal file
67
UnitTests/Application/ApplicationScreenTests.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace Terminal.Gui.ApplicationTests.NavigationTests;
|
||||
|
||||
public class ApplicationScreenTests (ITestOutputHelper output)
|
||||
{
|
||||
[Fact]
|
||||
public void ClearScreenNextIteration_Resets_To_False_After_LayoutAndDraw ()
|
||||
{
|
||||
// Arrange
|
||||
Application.Init ();
|
||||
|
||||
// Act
|
||||
Application.ClearScreenNextIteration = true;
|
||||
Application.LayoutAndDraw ();
|
||||
|
||||
// Assert
|
||||
Assert.False (Application.ClearScreenNextIteration);
|
||||
|
||||
// Cleanup
|
||||
Application.ResetState (true);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[SetupFakeDriver]
|
||||
public void ClearContents_Called_When_Top_Frame_Changes ()
|
||||
{
|
||||
// Arrange
|
||||
Application.Init ();
|
||||
Application.Top = new Toplevel ();
|
||||
Application.TopLevels.Push (Application.Top);
|
||||
|
||||
int clearedContentsRaised = 0;
|
||||
|
||||
Application.Driver!.ClearedContents += (e, a) => clearedContentsRaised++;
|
||||
|
||||
// Act
|
||||
Application.LayoutAndDraw ();
|
||||
|
||||
// Assert
|
||||
Assert.Equal (0, clearedContentsRaised);
|
||||
|
||||
// Act
|
||||
Application.Top.SetNeedsLayout ();
|
||||
Application.LayoutAndDraw ();
|
||||
|
||||
// Assert
|
||||
Assert.Equal (0, clearedContentsRaised);
|
||||
|
||||
// Act
|
||||
Application.Top.X = 1;
|
||||
Application.LayoutAndDraw ();
|
||||
|
||||
// Assert
|
||||
Assert.Equal (1, clearedContentsRaised);
|
||||
|
||||
// Act
|
||||
Application.Top.Width = 10;
|
||||
Application.LayoutAndDraw ();
|
||||
|
||||
// Assert
|
||||
Assert.Equal (2, clearedContentsRaised);
|
||||
|
||||
// Cleanup
|
||||
Application.ResetState (true);
|
||||
}
|
||||
}
|
||||
52
bench.json
52
bench.json
@@ -1,52 +0,0 @@
|
||||
[
|
||||
{
|
||||
"Scenario": "Adornments Demo",
|
||||
"Duration": "00:00:00.1805368",
|
||||
"IterationCount": 501,
|
||||
"ClearedContentCount": 0,
|
||||
"RefreshedCount": 503,
|
||||
"UpdatedCount": 1,
|
||||
"DrawCompleteCount": 82,
|
||||
"LaidOutCount": 82
|
||||
},
|
||||
{
|
||||
"Scenario": "All Views Tester",
|
||||
"Duration": "00:00:00.1070009",
|
||||
"IterationCount": 501,
|
||||
"ClearedContentCount": 0,
|
||||
"RefreshedCount": 503,
|
||||
"UpdatedCount": 1,
|
||||
"DrawCompleteCount": 103,
|
||||
"LaidOutCount": 182
|
||||
},
|
||||
{
|
||||
"Scenario": "Animation",
|
||||
"Duration": "00:00:00.0675802",
|
||||
"IterationCount": 501,
|
||||
"ClearedContentCount": 0,
|
||||
"RefreshedCount": 503,
|
||||
"UpdatedCount": 1,
|
||||
"DrawCompleteCount": 4,
|
||||
"LaidOutCount": 4
|
||||
},
|
||||
{
|
||||
"Scenario": "Arrangement",
|
||||
"Duration": "00:00:00.1284709",
|
||||
"IterationCount": 501,
|
||||
"ClearedContentCount": 0,
|
||||
"RefreshedCount": 503,
|
||||
"UpdatedCount": 1,
|
||||
"DrawCompleteCount": 123,
|
||||
"LaidOutCount": 123
|
||||
},
|
||||
{
|
||||
"Scenario": "ASCIICustomButtonTest",
|
||||
"Duration": "00:00:01.0613372",
|
||||
"IterationCount": 30,
|
||||
"ClearedContentCount": 0,
|
||||
"RefreshedCount": 32,
|
||||
"UpdatedCount": 31,
|
||||
"DrawCompleteCount": 4185,
|
||||
"LaidOutCount": 2852
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user