mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Fixed SetupText issue
This commit is contained in:
@@ -40,28 +40,6 @@ public class FakeDriver : ConsoleDriver
|
||||
public static Behaviors FakeBehaviors = new ();
|
||||
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 ()
|
||||
{
|
||||
Cols = FakeConsole.WindowWidth = FakeConsole.BufferWidth = FakeConsole.WIDTH;
|
||||
|
||||
@@ -9,10 +9,11 @@ public partial class View
|
||||
/// </summary>
|
||||
private void SetupText ()
|
||||
{
|
||||
Text = string.Empty;
|
||||
TextDirection = TextDirection.LeftRight_TopBottom;
|
||||
}
|
||||
|
||||
private string _text = string.Empty;
|
||||
private string _text;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether trailing spaces at the end of word-wrapped lines are preserved
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using UICatalog.Scenarios;
|
||||
using Xunit.Abstractions;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace Terminal.Gui.InputTests;
|
||||
|
||||
@@ -171,27 +170,26 @@ public class KeyBindingTests
|
||||
Command [] resultCommands = keyBindings.GetCommands (Key.A);
|
||||
Assert.DoesNotContain (Command.HotKey, resultCommands);
|
||||
|
||||
keyBindings = new KeyBindings ();
|
||||
keyBindings = new ();
|
||||
keyBindings.Add (Key.A, KeyBindingScope.Focused, Command.HotKey);
|
||||
keyBindings.Add (Key.A, KeyBindingScope.Focused, Command.Accept);
|
||||
|
||||
resultCommands = keyBindings.GetCommands (Key.A);
|
||||
Assert.DoesNotContain (Command.HotKey, resultCommands);
|
||||
|
||||
keyBindings = new KeyBindings ();
|
||||
|
||||
keyBindings = new ();
|
||||
keyBindings.Add (Key.A, KeyBindingScope.HotKey, Command.HotKey);
|
||||
keyBindings.Add (Key.A, KeyBindingScope.Focused, Command.Accept);
|
||||
|
||||
resultCommands = keyBindings.GetCommands (Key.A);
|
||||
Assert.DoesNotContain (Command.HotKey, resultCommands);
|
||||
|
||||
keyBindings = new KeyBindings ();
|
||||
keyBindings = new ();
|
||||
keyBindings.Add (Key.A, new KeyBinding (new [] { Command.HotKey }, KeyBindingScope.HotKey));
|
||||
keyBindings.Add (Key.A, new KeyBinding (new [] { Command.Accept }, KeyBindingScope.HotKey));
|
||||
|
||||
resultCommands = keyBindings.GetCommands (Key.A);
|
||||
Assert.DoesNotContain (Command.HotKey, resultCommands);
|
||||
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -265,7 +263,7 @@ public class KeyBindingTests
|
||||
Assert.Contains (Command.Left, binding.Commands);
|
||||
|
||||
// negative test
|
||||
binding = keyBindings.Get (key, (KeyBindingScope)0);
|
||||
binding = keyBindings.Get (key, 0);
|
||||
Assert.Null (binding);
|
||||
|
||||
Command [] resultCommands = keyBindings.GetCommands (key);
|
||||
@@ -293,7 +291,7 @@ public class KeyBindingTests
|
||||
Assert.Contains (Command.Left, binding.Commands);
|
||||
|
||||
// negative test
|
||||
success = keyBindings.TryGet (key, (KeyBindingScope)0, out binding);
|
||||
success = keyBindings.TryGet (key, 0, out binding);
|
||||
Assert.False (success);
|
||||
|
||||
Command [] resultCommands = keyBindings.GetCommands (key);
|
||||
|
||||
@@ -77,7 +77,7 @@ public class AutoInitShutdownAttribute : BeforeAfterTestAttribute
|
||||
if (AutoInit)
|
||||
{
|
||||
// TODO: This Dispose call is here until all unit tests that don't correctly dispose Toplevel's they create are fixed.
|
||||
//Application.Top?.Dispose ();
|
||||
Application.Top?.Dispose ();
|
||||
Application.Shutdown ();
|
||||
#if DEBUG_IDISPOSABLE
|
||||
if (Responder.Instances.Count == 0)
|
||||
@@ -171,8 +171,6 @@ public class SetupFakeDriverAttribute : BeforeAfterTestAttribute
|
||||
Debug.WriteLine ($"Before: {methodUnderTest.Name}");
|
||||
Assert.Null (Application.Driver);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user