From ebc47de514a989428b0d4343c7dfe7df9f39c5c8 Mon Sep 17 00:00:00 2001 From: Tig Date: Thu, 14 Mar 2024 10:24:31 -0800 Subject: [PATCH] Reamed Bounds -> Viewport test rename --- UnitTests/Drawing/LineCanvasTests.cs | 8 ++++---- UnitTests/View/Adornment/AdornmentTests.cs | 10 +++++----- UnitTests/View/DrawTests.cs | 16 ++++++++-------- UnitTests/View/Layout/AbsoluteLayoutTests.cs | 4 ++-- UnitTests/View/Layout/ScreenToTests.cs | 8 ++++---- .../{BoundsTests.cs => ViewportTests.cs} | 10 +++++----- UnitTests/View/ViewTests.cs | 18 +++++++++--------- UnitTests/Views/GraphViewTests.cs | 4 ++-- UnitTests/Views/TextFieldTests.cs | 2 +- UnitTests/Views/ToplevelTests.cs | 2 +- 10 files changed, 41 insertions(+), 41 deletions(-) rename UnitTests/View/Layout/{BoundsTests.cs => ViewportTests.cs} (90%) diff --git a/UnitTests/Drawing/LineCanvasTests.cs b/UnitTests/Drawing/LineCanvasTests.cs index c386fdcc8..2fda83384 100644 --- a/UnitTests/Drawing/LineCanvasTests.cs +++ b/UnitTests/Drawing/LineCanvasTests.cs @@ -366,7 +366,7 @@ public class LineCanvasTests )] [Theory] [SetupFakeDriver] - public void Bounds_H_And_V_Lines_Both_Positive ( + public void Viewport_H_And_V_Lines_Both_Positive ( int x, int y, int length, @@ -448,7 +448,7 @@ public class LineCanvasTests )] [Theory] [SetupFakeDriver] - public void Bounds_H_Line ( + public void Viewport_H_Line ( int x, int y, int length, @@ -466,7 +466,7 @@ public class LineCanvasTests [Fact] [SetupFakeDriver] - public void Bounds_Specific () + public void Viewport_Specific () { // Draw at 1,1 within client area of View (i.e. leave a top and left margin of 1) // This proves we aren't drawing excess above @@ -516,7 +516,7 @@ public class LineCanvasTests [Fact] [SetupFakeDriver] - public void Bounds_Specific_With_Ustring () + public void Viewport_Specific_With_Ustring () { // Draw at 1,1 within client area of View (i.e. leave a top and left margin of 1) // This proves we aren't drawing excess above diff --git a/UnitTests/View/Adornment/AdornmentTests.cs b/UnitTests/View/Adornment/AdornmentTests.cs index 199636d71..7010a2bc4 100644 --- a/UnitTests/View/Adornment/AdornmentTests.cs +++ b/UnitTests/View/Adornment/AdornmentTests.cs @@ -7,7 +7,7 @@ public class AdornmentTests (ITestOutputHelper output) private readonly ITestOutputHelper _output = output; [Fact] - public void Bounds_Location_Always_Empty_Size_Correct () + public void Viewport_Location_Always_Empty_Size_Correct () { var view = new View { @@ -42,7 +42,7 @@ public class AdornmentTests (ITestOutputHelper output) Assert.Equal (new (0, 0, view.Padding.Frame.Width , view.Padding.Frame.Height), view.Padding.Viewport); } - // Test that Adornment.Bounds_get override returns Frame.Size minus Thickness + // Test that Adornment.Viewport_get override returns Frame.Size minus Thickness [Theory] [InlineData (0, 0, 0, 0, 0)] [InlineData (0, 0, 0, 1, 1)] @@ -79,7 +79,7 @@ public class AdornmentTests (ITestOutputHelper output) [InlineData (1, 1, 1, 4, 4)] [InlineData (1, 1, 1, 4, 0)] [InlineData (1, 1, 1, 0, 4)] - public void Bounds_Width_Is_Frame_Width (int thickness, int x, int y, int w, int h) + public void Viewport_Width_Is_Frame_Width (int thickness, int x, int y, int w, int h) { var adornment = new Adornment (null); adornment.Thickness = new Thickness (thickness); @@ -90,7 +90,7 @@ public class AdornmentTests (ITestOutputHelper output) Assert.Equal (expectedBounds, adornment.Viewport); } - // Test that Adornment.Bounds_get override uses Parent not SuperView + // Test that Adornment.Viewport_get override uses Parent not SuperView [Fact] public void BoundsToScreen_Uses_Parent_Not_SuperView () { @@ -281,7 +281,7 @@ public class AdornmentTests (ITestOutputHelper output) } [Fact] - public void Setting_Bounds_Throws () + public void Setting_Viewport_Throws () { var adornment = new Adornment (null); Assert.Throws (() => adornment.Viewport = new Rectangle (1, 2, 3, 4)); diff --git a/UnitTests/View/DrawTests.cs b/UnitTests/View/DrawTests.cs index ad8c9ac73..38cffae9a 100644 --- a/UnitTests/View/DrawTests.cs +++ b/UnitTests/View/DrawTests.cs @@ -15,7 +15,7 @@ public class DrawTests [InlineData (0, 0, 2, 2)] [InlineData (-1, -1, 2, 2)] [SetupFakeDriver] - public void Clear_Bounds_Clears_Only_Bounds (int x, int y, int width, int height) + public void Clear_Viewport_Clears_Only_Bounds (int x, int y, int width, int height) { var superView = new View { Width = Dim.Fill (), Height = Dim.Fill () }; @@ -251,7 +251,7 @@ public class DrawTests [Fact] [SetupFakeDriver] - public void Draw_Minimum_Full_Border_With_Empty_Bounds_Without_Bottom () + public void Draw_Minimum_Full_Border_With_Empty_Viewport_Without_Bottom () { var view = new View { Width = 2, Height = 1, BorderStyle = LineStyle.Single }; view.Border.Thickness = new Thickness (1, 1, 1, 0); @@ -269,7 +269,7 @@ public class DrawTests [Fact] [SetupFakeDriver] - public void Draw_Minimum_Full_Border_With_Empty_Bounds_Without_Left () + public void Draw_Minimum_Full_Border_With_Empty_Viewport_Without_Left () { var view = new View { Width = 1, Height = 2, BorderStyle = LineStyle.Single }; view.Border.Thickness = new Thickness (0, 1, 1, 1); @@ -294,7 +294,7 @@ public class DrawTests [Fact] [SetupFakeDriver] - public void Draw_Minimum_Full_Border_With_Empty_Bounds_Without_Right () + public void Draw_Minimum_Full_Border_With_Empty_Viewport_Without_Right () { var view = new View { Width = 1, Height = 2, BorderStyle = LineStyle.Single }; view.Border.Thickness = new Thickness (1, 1, 0, 1); @@ -319,7 +319,7 @@ public class DrawTests [Fact] [SetupFakeDriver] - public void Draw_Minimum_Full_Border_With_Empty_Bounds_Without_Top () + public void Draw_Minimum_Full_Border_With_Empty_Viewport_Without_Top () { var view = new View { Width = 2, Height = 1, BorderStyle = LineStyle.Single }; view.Border.Thickness = new Thickness (1, 0, 1, 1); @@ -345,7 +345,7 @@ public class DrawTests [Fact] [AutoInitShutdown] - public void Draw_Negative_Bounds_Horizontal_With_New_Lines () + public void Draw_Negative_Viewport_Horizontal_With_New_Lines () { var subView = new View { @@ -492,7 +492,7 @@ public class DrawTests [Fact] [AutoInitShutdown] - public void Draw_Negative_Bounds_Horizontal_Without_New_Lines () + public void Draw_Negative_Viewport_Horizontal_Without_New_Lines () { // BUGBUG: This previously assumed the default height of a View was 1. var subView = new View @@ -571,7 +571,7 @@ public class DrawTests [Fact] [AutoInitShutdown] - public void Draw_Negative_Bounds_Vertical () + public void Draw_Negative_Viewport_Vertical () { var subView = new View { diff --git a/UnitTests/View/Layout/AbsoluteLayoutTests.cs b/UnitTests/View/Layout/AbsoluteLayoutTests.cs index ef3cf21b9..9ef864757 100644 --- a/UnitTests/View/Layout/AbsoluteLayoutTests.cs +++ b/UnitTests/View/Layout/AbsoluteLayoutTests.cs @@ -346,7 +346,7 @@ public class AbsoluteLayoutTests } [Fact] - public void AbsoluteLayout_Setting_Bounds_Location_NotEmpty () + public void AbsoluteLayout_Setting_Viewport_Location_NotEmpty () { // TODO: Should we enforce Viewport.X/Y == 0? The code currently ignores value.X/Y which is // TODO: correct behavior, but is silent. Perhaps an exception? @@ -359,7 +359,7 @@ public class AbsoluteLayoutTests } [Fact] - public void AbsoluteLayout_Setting_Bounds_Sets_Frame () + public void AbsoluteLayout_Setting_Viewport_Sets_Frame () { var frame = new Rectangle (1, 2, 3, 4); var newBounds = new Rectangle (0, 0, 30, 40); diff --git a/UnitTests/View/Layout/ScreenToTests.cs b/UnitTests/View/Layout/ScreenToTests.cs index b7a54aa33..df45c9006 100644 --- a/UnitTests/View/Layout/ScreenToTests.cs +++ b/UnitTests/View/Layout/ScreenToTests.cs @@ -21,7 +21,7 @@ public class ScreenToTests [InlineData (1, 1, 1, 1, -1, -1)] [InlineData (1, 1, 9, 9, 7, 7)] [InlineData (1, 1, 11, 11, 9, 9)] - public void ScreenToBounds_NoSuper_HasAdornments (int viewX, int viewY, int x, int y, int expectedX, int expectedY) + public void ScreenToViewport_NoSuper_HasAdornments (int viewX, int viewY, int x, int y, int expectedX, int expectedY) { var view = new View { @@ -50,7 +50,7 @@ public class ScreenToTests [InlineData (1, 1, 1, 1, 0, 0)] [InlineData (1, 1, 9, 9, 8, 8)] [InlineData (1, 1, 11, 11, 10, 10)] // it's ok for the view to return coordinates outside of its bounds - public void ScreenToBounds_NoSuper_NoAdornments (int viewX, int viewY, int x, int y, int expectedX, int expectedY) + public void ScreenToViewport_NoSuper_NoAdornments (int viewX, int viewY, int x, int y, int expectedX, int expectedY) { var view = new View { X = viewX, Y = viewY, Width = 10, Height = 10 }; @@ -69,7 +69,7 @@ public class ScreenToTests [InlineData (1, 1, 1, 1, -1, -1)] [InlineData (1, 1, 9, 9, 7, 7)] [InlineData (1, 1, 11, 11, 9, 9)] // it's ok for the view to return coordinates outside of its bounds - public void ScreenToBounds_SuperHasAdornments (int viewX, int viewY, int x, int y, int expectedX, int expectedY) + public void ScreenToViewport_SuperHasAdornments (int viewX, int viewY, int x, int y, int expectedX, int expectedY) { var super = new View { @@ -97,7 +97,7 @@ public class ScreenToTests [InlineData (1, 1, 1, 1, 0, 0)] [InlineData (1, 1, 9, 9, 8, 8)] [InlineData (1, 1, 11, 11, 10, 10)] // it's ok for the view to return coordinates outside of its bounds - public void ScreenToBounds_SuperHasNoAdornments (int viewX, int viewY, int x, int y, int expectedX, int expectedY) + public void ScreenToViewport_SuperHasNoAdornments (int viewX, int viewY, int x, int y, int expectedX, int expectedY) { var super = new View { X = 0, Y = 0, Width = 10, Height = 10 }; var view = new View { X = viewX, Y = viewY, Width = 5, Height = 5 }; diff --git a/UnitTests/View/Layout/BoundsTests.cs b/UnitTests/View/Layout/ViewportTests.cs similarity index 90% rename from UnitTests/View/Layout/BoundsTests.cs rename to UnitTests/View/Layout/ViewportTests.cs index 7af892b6c..b95b1ffb6 100644 --- a/UnitTests/View/Layout/BoundsTests.cs +++ b/UnitTests/View/Layout/ViewportTests.cs @@ -4,10 +4,10 @@ namespace Terminal.Gui.ViewTests; /// /// Test the . -/// DOES NOT TEST Adornment.Viewport methods. Those are in ./Adornment/BoundsTests.cs +/// DOES NOT TEST Adornment.Viewport methods. Those are in ./Adornment/ViewportTests.cs /// /// -public class BoundsTests (ITestOutputHelper output) +public class ViewportTests (ITestOutputHelper output) { private readonly ITestOutputHelper _output = output; @@ -16,7 +16,7 @@ public class BoundsTests (ITestOutputHelper output) [InlineData (1, 10)] [InlineData (-1, 10)] [InlineData (11, 10)] - public void Get_Bounds_NoSuperView_WithoutAdornments (int x, int expectedW) + public void Get_Viewport_NoSuperView_WithoutAdornments (int x, int expectedW) { // We test with only X because Y is equivalent. Height/Width are irrelevant. // Arrange @@ -47,7 +47,7 @@ public class BoundsTests (ITestOutputHelper output) [InlineData (10, 1, 0)] [InlineData (11, 1, 0)] - public void Get_Bounds_NestedSuperView_WithAdornments (int frameX, int borderThickness, int expectedW) + public void Get_Viewport_NestedSuperView_WithAdornments (int frameX, int borderThickness, int expectedW) { // We test with only X because Y is equivalent. Height/Width are irrelevant. // Arrange @@ -105,7 +105,7 @@ public class BoundsTests (ITestOutputHelper output) [InlineData (-1, 1, 5)] [InlineData (10, 1, 0)] [InlineData (11, 1, 0)] - public void Get_Bounds_NestedSuperView_WithAdornments_WithBorder (int frameX, int borderThickness, int expectedW) + public void Get_Viewport_NestedSuperView_WithAdornments_WithBorder (int frameX, int borderThickness, int expectedW) { // We test with only X because Y is equivalent. Height/Width are irrelevant. // Arrange diff --git a/UnitTests/View/ViewTests.cs b/UnitTests/View/ViewTests.cs index 9a1cfd459..0f594a82b 100644 --- a/UnitTests/View/ViewTests.cs +++ b/UnitTests/View/ViewTests.cs @@ -11,7 +11,7 @@ public class ViewTests [Fact] [AutoInitShutdown] - public void Clear_Bounds_Can_Use_Driver_AddRune_Or_AddStr_Methods () + public void Clear_Viewport_Can_Use_Driver_AddRune_Or_AddStr_Methods () { var view = new FrameView { Width = Dim.Fill (), Height = Dim.Fill () }; @@ -220,7 +220,7 @@ cccccccccccccccccccc", [Fact] [AutoInitShutdown] - public void Correct_Redraw_Bounds_NeedDisplay_On_Shrink_And_Move_Down_Right_Using_Frame () + public void Correct_Redraw_Viewport_NeedDisplay_On_Shrink_And_Move_Down_Right_Using_Frame () { var label = new Label { Text = "At 0,0" }; @@ -265,7 +265,7 @@ At 0,0 [Fact] [AutoInitShutdown] - public void Correct_Redraw_Bounds_NeedDisplay_On_Shrink_And_Move_Down_Right_Using_Pos_Dim () + public void Correct_Redraw_Viewport_NeedDisplay_On_Shrink_And_Move_Down_Right_Using_Pos_Dim () { var label = new Label { Text = "At 0,0" }; @@ -314,7 +314,7 @@ At 0,0 [Fact] [AutoInitShutdown] - public void Correct_Redraw_Bounds_NeedDisplay_On_Shrink_And_Move_Up_Left_Using_Frame () + public void Correct_Redraw_Viewport_NeedDisplay_On_Shrink_And_Move_Up_Left_Using_Frame () { var label = new Label { Text = "At 0,0" }; @@ -359,7 +359,7 @@ At 0,0 [Fact] [AutoInitShutdown] - public void Correct_Redraw_Bounds_NeedDisplay_On_Shrink_And_Move_Up_Left_Using_Pos_Dim () + public void Correct_Redraw_Viewport_NeedDisplay_On_Shrink_And_Move_Up_Left_Using_Pos_Dim () { var label = new Label { Text = "At 0,0" }; @@ -527,7 +527,7 @@ At 0,0 [Fact] [AutoInitShutdown] - public void Incorrect_Redraw_Bounds_NeedDisplay_On_Shrink_And_Move_Down_Right_Using_Frame () + public void Incorrect_Redraw_Viewport_NeedDisplay_On_Shrink_And_Move_Down_Right_Using_Frame () { var label = new Label { Text = "At 0,0" }; @@ -572,7 +572,7 @@ At 0,0 [Fact] [AutoInitShutdown] - public void Incorrect_Redraw_Bounds_NeedDisplay_On_Shrink_And_Move_Down_Right_Using_Pos_Dim () + public void Incorrect_Redraw_Viewport_NeedDisplay_On_Shrink_And_Move_Down_Right_Using_Pos_Dim () { var label = new Label { Text = "At 0,0" }; @@ -621,7 +621,7 @@ At 0,0 [Fact] [AutoInitShutdown] - public void Incorrect_Redraw_Bounds_NeedDisplay_On_Shrink_And_Move_Up_Left_Using_Frame () + public void Incorrect_Redraw_Viewport_NeedDisplay_On_Shrink_And_Move_Up_Left_Using_Frame () { var label = new Label { Text = "At 0,0" }; @@ -668,7 +668,7 @@ At 0,0 [Fact] [AutoInitShutdown] - public void Incorrect_Redraw_Bounds_NeedDisplay_On_Shrink_And_Move_Up_Left_Using_Pos_Dim () + public void Incorrect_Redraw_Viewport_NeedDisplay_On_Shrink_And_Move_Up_Left_Using_Pos_Dim () { var label = new Label { Text = "At 0,0" }; diff --git a/UnitTests/Views/GraphViewTests.cs b/UnitTests/Views/GraphViewTests.cs index bd27070e9..a40238eb8 100644 --- a/UnitTests/Views/GraphViewTests.cs +++ b/UnitTests/Views/GraphViewTests.cs @@ -441,7 +441,7 @@ public class GraphViewTests public class SeriesTests { [Fact] - public void Series_GetsPassedCorrectBounds_AllAtOnce () + public void Series_GetsPassedCorrectViewport_AllAtOnce () { GraphViewTests.InitFakeDriver (); @@ -493,7 +493,7 @@ public class SeriesTests /// results in multiple units of graph space being condensed into each cell of console /// [Fact] - public void Series_GetsPassedCorrectBounds_AllAtOnce_LargeCellSize () + public void Series_GetsPassedCorrectViewport_AllAtOnce_LargeCellSize () { GraphViewTests.InitFakeDriver (); diff --git a/UnitTests/Views/TextFieldTests.cs b/UnitTests/Views/TextFieldTests.cs index 413973ac0..997597159 100644 --- a/UnitTests/Views/TextFieldTests.cs +++ b/UnitTests/Views/TextFieldTests.cs @@ -177,7 +177,7 @@ public class TextFieldTests [Fact] [AutoInitShutdown] - public void CaptionedTextField_DoesNotOverspillBounds_Unicode () + public void CaptionedTextField_DoesNotOverspillViewport_Unicode () { string caption = "Mise" + char.ConvertFromUtf32 (int.Parse ("0301", NumberStyles.HexNumber)) + "rables"; diff --git a/UnitTests/Views/ToplevelTests.cs b/UnitTests/Views/ToplevelTests.cs index f4e4cb9ee..1ce9a3210 100644 --- a/UnitTests/Views/ToplevelTests.cs +++ b/UnitTests/Views/ToplevelTests.cs @@ -1513,7 +1513,7 @@ public class ToplevelTests [Fact] [AutoInitShutdown] - public void Window_Bounds_Bigger_Than_Driver_Cols_And_Rows_Allow_Drag_Beyond_Left_Right_And_Bottom () + public void Window_Viewport_Bigger_Than_Driver_Cols_And_Rows_Allow_Drag_Beyond_Left_Right_And_Bottom () { Toplevel top = Application.Top; var window = new Window { Width = 20, Height = 3 };