From 172409f17a7ac3631dda727edc55ede594183a19 Mon Sep 17 00:00:00 2001 From: Tig Date: Thu, 17 Oct 2024 21:32:25 -0600 Subject: [PATCH] Fixed more unit tests ... --- UnitTests/View/Layout/Dim.Tests.cs | 141 +------------------------ UnitTests/View/Layout/Dim.ViewTests.cs | 28 +---- 2 files changed, 2 insertions(+), 167 deletions(-) diff --git a/UnitTests/View/Layout/Dim.Tests.cs b/UnitTests/View/Layout/Dim.Tests.cs index 1adf57aa0..78fc31062 100644 --- a/UnitTests/View/Layout/Dim.Tests.cs +++ b/UnitTests/View/Layout/Dim.Tests.cs @@ -28,121 +28,6 @@ public class DimTests Assert.Equal (10, result); } - // TODO: This actually a SetRelativeLayout/LayoutSubViews test and should be moved - // A new test that does not depend on Application is needed. - [Fact] - [AutoInitShutdown] - public void Dim_Add_Operator () - { - Toplevel top = new (); - - var view = new View { X = 0, Y = 0, Width = 20, Height = 0 }; - var field = new TextField { X = 0, Y = Pos.Bottom (view), Width = 20 }; - var count = 0; - - field.KeyDown += (s, k) => - { - if (k.KeyCode == KeyCode.Enter) - { - field.Text = $"Label {count}"; - var label = new Label { X = 0, Y = view.Viewport.Height, /*Width = 20,*/ Text = field.Text }; - view.Add (label); - Assert.Equal ($"Label {count}", label.Text); - Assert.Equal ($"Absolute({count})", label.Y.ToString ()); - - Assert.Equal ($"Absolute({count})", view.Height.ToString ()); - view.Height += 1; - count++; - Assert.Equal ($"Absolute({count})", view.Height.ToString ()); - } - }; - - Application.Iteration += (s, a) => - { - while (count < 20) - { - field.NewKeyDownEvent (Key.Enter); - } - - Application.RequestStop (); - }; - - var win = new Window (); - win.Add (view); - win.Add (field); - - top.Add (win); - - Application.Run (top); - top.Dispose (); - - Assert.Equal (20, count); - } - - // TODO: This actually a SetRelativeLayout/LayoutSubViews test and should be moved - // TODO: A new test that calls SetRelativeLayout directly is needed. - [Fact] - [AutoInitShutdown] - public void Dim_Subtract_Operator () - { - Toplevel top = new (); - - var view = new View { X = 0, Y = 0, Width = 20, Height = 0 }; - var field = new TextField { X = 0, Y = Pos.Bottom (view), Width = 20 }; - var count = 20; - List