소스 검색

Merge branch 'v2_develop' into v2_3368_unit_tests_dispose

Tig 1 년 전
부모
커밋
704691401d
2개의 변경된 파일24개의 추가작업 그리고 0개의 파일을 삭제
  1. 22 0
      Terminal.Gui/ConsoleDrivers/FakeDriver/FakeDriver.cs
  2. 2 0
      UnitTests/TestHelpers.cs

+ 22 - 0
Terminal.Gui/ConsoleDrivers/FakeDriver/FakeDriver.cs

@@ -40,6 +40,28 @@ public class FakeDriver : ConsoleDriver
     public static Behaviors FakeBehaviors = new ();
     public static Behaviors FakeBehaviors = new ();
     public override bool SupportsTrueColor => false;
     public override bool SupportsTrueColor => false;
 
 
+    /// <inheritdoc />
+    public override int Cols
+    {
+        get => base.Cols;
+        internal set
+        {
+            base.Cols = value;
+            FakeConsole.SetBufferSize (Cols, Rows);
+        }
+    }
+
+    /// <inheritdoc />
+    public override int Rows
+    {
+        get => base.Rows;
+        internal set
+        {
+            base.Rows = value;
+            FakeConsole.SetBufferSize (Cols, Rows);
+        }
+    }
+
     public FakeDriver ()
     public FakeDriver ()
     {
     {
         Cols = FakeConsole.WindowWidth = FakeConsole.BufferWidth = FakeConsole.WIDTH;
         Cols = FakeConsole.WindowWidth = FakeConsole.BufferWidth = FakeConsole.WIDTH;

+ 2 - 0
UnitTests/TestHelpers.cs

@@ -171,6 +171,8 @@ public class SetupFakeDriverAttribute : BeforeAfterTestAttribute
         Debug.WriteLine ($"Before: {methodUnderTest.Name}");
         Debug.WriteLine ($"Before: {methodUnderTest.Name}");
         Assert.Null (Application.Driver);
         Assert.Null (Application.Driver);
         Application.Driver = new FakeDriver { Rows = 25, Cols = 25 };
         Application.Driver = new FakeDriver { Rows = 25, Cols = 25 };
+        Assert.Equal (FakeConsole.BufferWidth, Application.Driver.Cols);
+        Assert.Equal (FakeConsole.BufferHeight, Application.Driver.Rows);
         base.Before (methodUnderTest);
         base.Before (methodUnderTest);
     }
     }
 }
 }