mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-30 17:57:57 +01:00
Fixing broken unit tests.
This commit is contained in:
@@ -83,6 +83,7 @@ namespace Terminal.Gui {
|
||||
public override void GenerateSuggestions (AutocompleteContext context)
|
||||
{
|
||||
if (_suspendSuggestions) {
|
||||
_suspendSuggestions = false;
|
||||
return;
|
||||
}
|
||||
base.GenerateSuggestions (context);
|
||||
|
||||
@@ -902,44 +902,71 @@ namespace Terminal.Gui.DialogTests {
|
||||
Application.Run (win);
|
||||
}
|
||||
|
||||
// [Theory, AutoInitShutdown]
|
||||
// [InlineData (5)]
|
||||
// //[InlineData (6)]
|
||||
// //[InlineData (7)]
|
||||
// //[InlineData (8)]
|
||||
// //[InlineData (9)]
|
||||
// public void Dialog_In_Window_Without_Size_One_Button_Aligns (int height)
|
||||
// {
|
||||
// ((FakeDriver)Application.Driver).SetBufferSize (20, height);
|
||||
// var win = new Window ();
|
||||
[Theory, AutoInitShutdown]
|
||||
[InlineData (5, @"
|
||||
┌┌───────────────┐─┐
|
||||
││ │ │
|
||||
││ ⟦ Ok ⟧ │ │
|
||||
│└───────────────┘ │
|
||||
└──────────────────┘")]
|
||||
[InlineData (6, @"
|
||||
┌┌───────────────┐─┐
|
||||
││ │ │
|
||||
││ │ │
|
||||
││ ⟦ Ok ⟧ │ │
|
||||
│└───────────────┘ │
|
||||
└──────────────────┘")]
|
||||
[InlineData (7, @"
|
||||
┌──────────────────┐
|
||||
│┌───────────────┐ │
|
||||
││ │ │
|
||||
││ │ │
|
||||
││ ⟦ Ok ⟧ │ │
|
||||
│└───────────────┘ │
|
||||
└──────────────────┘")]
|
||||
[InlineData (8, @"
|
||||
┌──────────────────┐
|
||||
│┌───────────────┐ │
|
||||
││ │ │
|
||||
││ │ │
|
||||
││ │ │
|
||||
││ ⟦ Ok ⟧ │ │
|
||||
│└───────────────┘ │
|
||||
└──────────────────┘")]
|
||||
[InlineData (9, @"
|
||||
┌──────────────────┐
|
||||
│┌───────────────┐ │
|
||||
││ │ │
|
||||
││ │ │
|
||||
││ │ │
|
||||
││ │ │
|
||||
││ ⟦ Ok ⟧ │ │
|
||||
│└───────────────┘ │
|
||||
└──────────────────┘")]
|
||||
public void Dialog_In_Window_Without_Size_One_Button_Aligns (int height, string expected)
|
||||
{
|
||||
((FakeDriver)Application.Driver).SetBufferSize (20, height);
|
||||
var win = new Window ();
|
||||
|
||||
// Application.Iteration += (s, a) => {
|
||||
// var dlg = new Dialog ("Test", new Button ("Ok"));
|
||||
var iterations = -1;
|
||||
Application.Iteration += (s, a) => {
|
||||
iterations++;
|
||||
if (iterations == 0) {
|
||||
var dlg = new Dialog (new Button ("Ok"));
|
||||
Application.Run (dlg);
|
||||
} else if (iterations == 1) {
|
||||
// BUGBUG: This seems wrong; is it a bug in Dim.Percent(85)?? No
|
||||
_ = TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
|
||||
} else {
|
||||
Application.RequestStop ();
|
||||
}
|
||||
};
|
||||
|
||||
// dlg.LayoutComplete += (s, a) => {
|
||||
// Application.Refresh ();
|
||||
// // BUGBUG: This seems wrong; is it a bug in Dim.Percent(85)??
|
||||
// var expected = @"
|
||||
//┌┌┤Test├─────────┐─┐
|
||||
//││ │ │
|
||||
//││ [ Ok ] │ │
|
||||
//│└───────────────┘ │
|
||||
//└──────────────────┘";
|
||||
// _ = TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
|
||||
|
||||
// dlg.RequestStop ();
|
||||
// win.RequestStop ();
|
||||
// };
|
||||
|
||||
// Application.Run (dlg);
|
||||
// };
|
||||
|
||||
// Application.Run (win);
|
||||
// Application.Shutdown ();
|
||||
// }
|
||||
Application.Run (win);
|
||||
}
|
||||
|
||||
[Fact, AutoInitShutdown]
|
||||
public void Dialog_In_Window_With_TexxtField_And_Button_AnchorEnd ()
|
||||
public void Dialog_In_Window_With_TextField_And_Button_AnchorEnd ()
|
||||
{
|
||||
((FakeDriver)Application.Driver).SetBufferSize (20, 5);
|
||||
|
||||
|
||||
@@ -594,6 +594,7 @@ namespace Terminal.Gui.ViewTests {
|
||||
Assert.Equal (78, w.Frame.Width);
|
||||
Assert.Equal (23, w.Frame.Height);
|
||||
// BUGBUG: v2 - this no longer works - see above
|
||||
// The reason was that wrong coded before and that why t.LayoutSubviews throws
|
||||
//Assert.Equal (6, f.Frame.Width);
|
||||
//Assert.Equal (6, f.Frame.Height);
|
||||
//Assert.Equal (76, v1.Frame.Width);
|
||||
@@ -1115,13 +1116,13 @@ namespace Terminal.Gui.ViewTests {
|
||||
view.Add (label);
|
||||
Assert.Equal ($"Label {i}", label.Text);
|
||||
// BUGBUG: Bogus test; views have not been initialized yet
|
||||
//Assert.Equal ($"Absolute({i})", label.Y.ToString ());
|
||||
Assert.Equal ($"Absolute({i})", label.Y.ToString ());
|
||||
listLabels.Add (label);
|
||||
|
||||
// BUGBUG: Bogus test; views have not been initialized yet
|
||||
//Assert.Equal ($"Absolute({i})", view.Height.ToString ());
|
||||
Assert.Equal ($"Absolute({i})", view.Height.ToString ());
|
||||
view.Height += 1;
|
||||
//Assert.Equal ($"Absolute({i + 1})", view.Height.ToString ());
|
||||
Assert.Equal ($"Absolute({i + 1})", view.Height.ToString ());
|
||||
}
|
||||
|
||||
field.KeyDown += (s, k) => {
|
||||
@@ -1168,27 +1169,27 @@ namespace Terminal.Gui.ViewTests {
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
field.Text = $"Label {i}";
|
||||
// BUGBUG: v2 - view has not been initialied yet; view.Bounds is indeterminate
|
||||
// BUGBUG: v2 - view has not been initialized yet; view.Bounds is indeterminate
|
||||
var label = new Label (field.Text) { X = 0, Y = i + 1, Width = 10 };
|
||||
view.Add (label);
|
||||
Assert.Equal ($"Label {i}", label.Text);
|
||||
// BUGBUG: Bogus test; views have not been initialized yet
|
||||
//Assert.Equal ($"Absolute({i + 1})", label.Y.ToString ());
|
||||
Assert.Equal ($"Absolute({i + 1})", label.Y.ToString ());
|
||||
listLabels.Add (label);
|
||||
|
||||
//if (i == 0) {
|
||||
// BUGBUG: Bogus test; views have not been initialized yet
|
||||
//Assert.Equal ($"Absolute({i})", view.Height.ToString ());
|
||||
//view.Height += 2;
|
||||
// BUGBUG: Bogus test; views have not been initialized yet
|
||||
//Assert.Equal ($"Absolute({i + 2})", view.Height.ToString ());
|
||||
//} else {
|
||||
// BUGBUG: Bogus test; views have not been initialized yet
|
||||
//Assert.Equal ($"Absolute({i + 1})", view.Height.ToString ());
|
||||
view.Height += 1;
|
||||
// BUGBUG: Bogus test; views have not been initialized yet
|
||||
//Assert.Equal ($"Absolute({i + 2})", view.Height.ToString ());
|
||||
//}
|
||||
if (i == 0) {
|
||||
// BUGBUG: Bogus test; views have not been initialized yet
|
||||
Assert.Equal ($"Absolute({i + 1})", view.Height.ToString ());
|
||||
view.Height += 1;
|
||||
// BUGBUG: Bogus test; views have not been initialized yet
|
||||
Assert.Equal ($"Absolute({i + 2})", view.Height.ToString ());
|
||||
} else {
|
||||
// BUGBUG: Bogus test; views have not been initialized yet
|
||||
Assert.Equal ($"Absolute({i + 1})", view.Height.ToString ());
|
||||
view.Height += 1;
|
||||
// BUGBUG: Bogus test; views have not been initialized yet
|
||||
Assert.Equal ($"Absolute({i + 2})", view.Height.ToString ());
|
||||
}
|
||||
}
|
||||
|
||||
field.KeyDown += (s, k) => {
|
||||
|
||||
@@ -770,50 +770,50 @@ namespace Terminal.Gui.ViewTests {
|
||||
// DONE: Test PosCombine
|
||||
// DONE: Test operators
|
||||
// BUGBUG: v2 - This test is bogus. v1 and references it's superview's (f) superview (w).
|
||||
//[Fact]
|
||||
//public void PosCombine_Do_Not_Throws ()
|
||||
//{
|
||||
// Application.Init (new FakeDriver ());
|
||||
[Fact]
|
||||
public void PosCombine_Refs_SuperView_Throws ()
|
||||
{
|
||||
Application.Init (new FakeDriver ());
|
||||
|
||||
// var w = new Window () {
|
||||
// X = Pos.Left (Application.Top) + 2,
|
||||
// Y = Pos.Top (Application.Top) + 2
|
||||
// };
|
||||
// var f = new FrameView ();
|
||||
// var v1 = new View () {
|
||||
// X = Pos.Left (w) + 2,
|
||||
// Y = Pos.Top (w) + 2
|
||||
// };
|
||||
// var v2 = new View () {
|
||||
// X = Pos.Left (v1) + 2,
|
||||
// Y = Pos.Top (v1) + 2
|
||||
// };
|
||||
var w = new Window () {
|
||||
X = Pos.Left (Application.Top) + 2,
|
||||
Y = Pos.Top (Application.Top) + 2
|
||||
};
|
||||
var f = new FrameView ();
|
||||
var v1 = new View () {
|
||||
X = Pos.Left (w) + 2,
|
||||
Y = Pos.Top (w) + 2
|
||||
};
|
||||
var v2 = new View () {
|
||||
X = Pos.Left (v1) + 2,
|
||||
Y = Pos.Top (v1) + 2
|
||||
};
|
||||
|
||||
// f.Add (v1, v2);
|
||||
// w.Add (f);
|
||||
// Application.Top.Add (w);
|
||||
f.Add (v1, v2);
|
||||
w.Add (f);
|
||||
Application.Top.Add (w);
|
||||
|
||||
// f.X = Pos.X (Application.Top) + Pos.X (v2) - Pos.X (v1);
|
||||
// f.Y = Pos.Y (Application.Top) + Pos.Y (v2) - Pos.Y (v1);
|
||||
f.X = Pos.X (Application.Top) + Pos.X (v2) - Pos.X (v1);
|
||||
f.Y = Pos.Y (Application.Top) + Pos.Y (v2) - Pos.Y (v1);
|
||||
|
||||
// Application.Top.LayoutComplete += (s, e) => {
|
||||
// Assert.Equal (0, Application.Top.Frame.X);
|
||||
// Assert.Equal (0, Application.Top.Frame.Y);
|
||||
// Assert.Equal (2, w.Frame.X);
|
||||
// Assert.Equal (2, w.Frame.Y);
|
||||
// Assert.Equal (2, f.Frame.X);
|
||||
// Assert.Equal (2, f.Frame.Y);
|
||||
// Assert.Equal (4, v1.Frame.X);
|
||||
// Assert.Equal (4, v1.Frame.Y);
|
||||
// Assert.Equal (6, v2.Frame.X);
|
||||
// Assert.Equal (6, v2.Frame.Y);
|
||||
// };
|
||||
Application.Top.LayoutComplete += (s, e) => {
|
||||
Assert.Equal (0, Application.Top.Frame.X);
|
||||
Assert.Equal (0, Application.Top.Frame.Y);
|
||||
Assert.Equal (2, w.Frame.X);
|
||||
Assert.Equal (2, w.Frame.Y);
|
||||
Assert.Equal (2, f.Frame.X);
|
||||
Assert.Equal (2, f.Frame.Y);
|
||||
Assert.Equal (4, v1.Frame.X);
|
||||
Assert.Equal (4, v1.Frame.Y);
|
||||
Assert.Equal (6, v2.Frame.X);
|
||||
Assert.Equal (6, v2.Frame.Y);
|
||||
};
|
||||
|
||||
// Application.Iteration += (s, a) => Application.RequestStop ();
|
||||
Application.Iteration += (s, a) => Application.RequestStop ();
|
||||
|
||||
// Application.Run ();
|
||||
// Application.Shutdown ();
|
||||
//}
|
||||
Assert.Throws< InvalidOperationException> (() => Application.Run ());
|
||||
Application.Shutdown ();
|
||||
}
|
||||
|
||||
[Fact, TestRespondersDisposed]
|
||||
public void PosCombine_Will_Throws ()
|
||||
|
||||
@@ -500,7 +500,12 @@ namespace Terminal.Gui.ViewTests {
|
||||
Assert.Equal (View.Direction.Backward, view.FocusDirection);
|
||||
Assert.Empty (view.InternalSubviews);
|
||||
// BUGBUG: v2 - _needsDisplay needs debugging - test disabled for now.
|
||||
//Assert.Equal (new Rect (new Point (0, 0), rect.Size), view._needsDisplay);
|
||||
Assert.False (view.IsInitialized);
|
||||
Assert.Equal (Rect.Empty, view._needsDisplayRect);
|
||||
view.BeginInit ();
|
||||
view.EndInit ();
|
||||
Assert.True (view.IsInitialized);
|
||||
Assert.Equal (new Rect (new Point (0, 0), rect.Size), view._needsDisplayRect);
|
||||
Assert.True (view.LayoutNeeded);
|
||||
Assert.False (view.SubViewNeedsDisplay);
|
||||
Assert.False (view._addingView);
|
||||
@@ -784,16 +789,16 @@ namespace Terminal.Gui.ViewTests {
|
||||
Assert.True (horizontalView.AutoSize);
|
||||
Assert.Equal (new Rect (0, 0, 12, 1), horizontalView.Frame);
|
||||
Assert.Equal (new Size (12, 1), horizontalView.GetSizeNeededForTextWithoutHotKey ());
|
||||
//Assert.Equal (new Size (12, 1), horizontalView.GetSizeNeededForTextAndHotKey ());
|
||||
//Assert.Equal (horizontalView.TextFormatter.Size, horizontalView.GetSizeNeededForTextAndHotKey ());
|
||||
Assert.Equal (new Size (12, 1), horizontalView.GetTextFormatterSizeNeededForTextAndHotKey ());
|
||||
Assert.Equal (horizontalView.TextFormatter.Size, horizontalView.GetTextFormatterSizeNeededForTextAndHotKey ());
|
||||
Assert.Equal (horizontalView.Frame.Size, horizontalView.GetSizeNeededForTextWithoutHotKey ());
|
||||
|
||||
Assert.True (verticalView.AutoSize);
|
||||
// BUGBUG: v2 - Autosize is broken; disabling this test
|
||||
//Assert.Equal (new Rect (0, 0, 2, 11), verticalView.Frame);
|
||||
//Assert.Equal (new Size (2, 11), verticalView.GetSizeNeededForTextWithoutHotKey ());
|
||||
//Assert.Equal (new Size (2, 11), verticalView.GetSizeNeededForTextAndHotKey ());
|
||||
//Assert.Equal (verticalView.TextFormatter.Size, verticalView.GetSizeNeededForTextAndHotKey ());
|
||||
Assert.Equal (new Rect (0, 0, 2, 11), verticalView.Frame);
|
||||
Assert.Equal (new Size (2, 11), verticalView.GetSizeNeededForTextWithoutHotKey ());
|
||||
Assert.Equal (new Size (2, 11), verticalView.GetTextFormatterSizeNeededForTextAndHotKey ());
|
||||
Assert.Equal (verticalView.TextFormatter.Size, verticalView.GetTextFormatterSizeNeededForTextAndHotKey ());
|
||||
Assert.Equal (verticalView.Frame.Size, verticalView.GetSizeNeededForTextWithoutHotKey ());
|
||||
|
||||
text = "Say He_llo 你";
|
||||
@@ -803,17 +808,17 @@ namespace Terminal.Gui.ViewTests {
|
||||
Assert.True (horizontalView.AutoSize);
|
||||
Assert.Equal (new Rect (0, 0, 12, 1), horizontalView.Frame);
|
||||
Assert.Equal (new Size (12, 1), horizontalView.GetSizeNeededForTextWithoutHotKey ());
|
||||
//Assert.Equal (new Size (13, 1), horizontalView.GetSizeNeededForTextAndHotKey ());
|
||||
//Assert.Equal (horizontalView.TextFormatter.Size, horizontalView.GetSizeNeededForTextAndHotKey ());
|
||||
Assert.Equal (new Size (13, 1), horizontalView.GetTextFormatterSizeNeededForTextAndHotKey ());
|
||||
Assert.Equal (horizontalView.TextFormatter.Size, horizontalView.GetTextFormatterSizeNeededForTextAndHotKey ());
|
||||
Assert.Equal (horizontalView.Frame.Size, horizontalView.GetSizeNeededForTextWithoutHotKey ());
|
||||
|
||||
Assert.True (verticalView.AutoSize);
|
||||
// BUGBUG: v2 - Autosize is broken; disabling this test
|
||||
//Assert.Equal (new Rect (0, 0, 2, 11), verticalView.Frame);
|
||||
//Assert.Equal (new Size (2, 11), verticalView.GetSizeNeededForTextWithoutHotKey ());
|
||||
//Assert.Equal (new Size (2, 12), verticalView.GetSizeNeededForTextAndHotKey ());
|
||||
//Assert.Equal (verticalView.TextFormatter.Size, verticalView.GetSizeNeededForTextAndHotKey ());
|
||||
//Assert.Equal (verticalView.Frame.Size, verticalView.GetSizeNeededForTextWithoutHotKey ());
|
||||
Assert.Equal (new Rect (0, 0, 2, 11), verticalView.Frame);
|
||||
Assert.Equal (new Size (2, 11), verticalView.GetSizeNeededForTextWithoutHotKey ());
|
||||
Assert.Equal (new Size (2, 12), verticalView.GetTextFormatterSizeNeededForTextAndHotKey ());
|
||||
Assert.Equal (verticalView.TextFormatter.Size, verticalView.GetTextFormatterSizeNeededForTextAndHotKey ());
|
||||
Assert.Equal (verticalView.Frame.Size, verticalView.GetSizeNeededForTextWithoutHotKey ());
|
||||
}
|
||||
|
||||
[Fact, TestRespondersDisposed]
|
||||
@@ -1003,7 +1008,7 @@ cccccccccccccccccccc", output);
|
||||
public override void OnDrawContent (Rect contentArea)
|
||||
{
|
||||
var idx = 0;
|
||||
// BUGBUG: v2 - this should use Boudns, not Frame
|
||||
// BUGBUG: v2 - this should use Bounds, not Frame
|
||||
for (int r = 0; r < Frame.Height; r++) {
|
||||
for (int c = 0; c < Frame.Width; c++) {
|
||||
if (idx < Text.Length) {
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace Terminal.Gui.TextTests {
|
||||
Assert.Equal ("f", tf.Text);
|
||||
|
||||
// When cancelling autocomplete
|
||||
Application.Driver.SendKeys ('e', ConsoleKey.Escape, false, false, false);
|
||||
Application.Driver.SendKeys ('\0', ConsoleKey.Escape, false, false, false);
|
||||
|
||||
// Suggestion should disapear
|
||||
tf.Draw ();
|
||||
@@ -131,7 +131,8 @@ namespace Terminal.Gui.TextTests {
|
||||
Application.Driver.SendKeys ('i', ConsoleKey.I, false, false, false);
|
||||
tf.Draw ();
|
||||
// BUGBUG: v2 - I broke this test and don't have time to figure out why. @tznind - help!
|
||||
//TestHelpers.AssertDriverContentsAre ("fish", output);
|
||||
tf.PositionCursor ();
|
||||
TestHelpers.AssertDriverContentsAre ("fish", output);
|
||||
Assert.Equal ("fi", tf.Text);
|
||||
}
|
||||
|
||||
|
||||
@@ -122,53 +122,51 @@ namespace Terminal.Gui.ViewsTests {
|
||||
checkBox.Checked = true;
|
||||
Assert.Equal ($"{CM.Glyphs.Checked} Check this out 你", checkBox.TextFormatter.Text);
|
||||
|
||||
//checkBox.AutoSize = false;
|
||||
checkBox.AutoSize = false;
|
||||
// It isn't auto-size so the height is guaranteed by the SetMinWidthHeight
|
||||
//checkBox.Text = "Check this out 你 changed";
|
||||
//Application.RunMainLoopIteration (ref runstate, ref first);
|
||||
checkBox.Text = "Check this out 你 changed";
|
||||
var firstIteration = false;
|
||||
Application.RunIteration (ref runstate, ref firstIteration);
|
||||
// BUGBUG - v2 - Autosize is busted; disabling tests for now
|
||||
// Assert.Equal (new Rect (1, 1, 19, 1), checkBox.Frame);
|
||||
// expected = @"
|
||||
//┌┤Test Demo 你├──────────────┐
|
||||
//│ │
|
||||
//│ √ Check this out 你 │
|
||||
//│ │
|
||||
//└────────────────────────────┘
|
||||
//";
|
||||
Assert.Equal (new Rect (1, 1, 19, 1), checkBox.Frame);
|
||||
var expected = @"
|
||||
┌┤Test Demo 你├──────────────┐
|
||||
│ │
|
||||
│ ☑ Check this out 你 │
|
||||
│ │
|
||||
└────────────────────────────┘";
|
||||
|
||||
// pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
|
||||
// Assert.Equal (new Rect (0, 0, 30, 5), pos);
|
||||
var pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
|
||||
Assert.Equal (new Rect (0, 0, 30, 5), pos);
|
||||
|
||||
// checkBox.Width = 19;
|
||||
// // It isn't auto-size so the height is guaranteed by the SetMinWidthHeight
|
||||
// checkBox.Text = "Check this out 你 changed";
|
||||
// Application.RunMainLoopIteration (ref runstate, ref first);
|
||||
// Assert.False (checkBox.AutoSize);
|
||||
// Assert.Equal (new Rect (1, 1, 19, 1), checkBox.Frame);
|
||||
// expected = @"
|
||||
//┌┤Test Demo 你├──────────────┐
|
||||
//│ │
|
||||
//│ √ Check this out 你 │
|
||||
//│ │
|
||||
//└────────────────────────────┘
|
||||
//";
|
||||
checkBox.Width = 19;
|
||||
// It isn't auto-size so the height is guaranteed by the SetMinWidthHeight
|
||||
checkBox.Text = "Check this out 你 changed";
|
||||
Application.RunIteration (ref runstate, ref firstIteration);
|
||||
Assert.False (checkBox.AutoSize);
|
||||
Assert.Equal (new Rect (1, 1, 19, 1), checkBox.Frame);
|
||||
expected = @"
|
||||
┌┤Test Demo 你├──────────────┐
|
||||
│ │
|
||||
│ ☑ Check this out 你 │
|
||||
│ │
|
||||
└────────────────────────────┘";
|
||||
|
||||
// pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
|
||||
// Assert.Equal (new Rect (0, 0, 30, 5), pos);
|
||||
pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
|
||||
Assert.Equal (new Rect (0, 0, 30, 5), pos);
|
||||
|
||||
// checkBox.AutoSize = true;
|
||||
// Application.RunMainLoopIteration (ref runstate, ref first);
|
||||
// Assert.Equal (new Rect (1, 1, 27, 1), checkBox.Frame);
|
||||
// expected = @"
|
||||
//┌┤Test Demo 你├──────────────┐
|
||||
//│ │
|
||||
//│ √ Check this out 你 changed│
|
||||
//│ │
|
||||
//└────────────────────────────┘
|
||||
//";
|
||||
checkBox.AutoSize = true;
|
||||
Application.RunIteration (ref runstate, ref firstIteration);
|
||||
Assert.Equal (new Rect (1, 1, 27, 1), checkBox.Frame);
|
||||
expected = @"
|
||||
┌┤Test Demo 你├──────────────┐
|
||||
│ │
|
||||
│ ☑ Check this out 你 changed│
|
||||
│ │
|
||||
└────────────────────────────┘";
|
||||
|
||||
// pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
|
||||
// Assert.Equal (new Rect (0, 0, 30, 5), pos);
|
||||
pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
|
||||
Assert.Equal (new Rect (0, 0, 30, 5), pos);
|
||||
}
|
||||
|
||||
[Fact, AutoInitShutdown]
|
||||
|
||||
@@ -330,26 +330,26 @@ Test
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
|
||||
}
|
||||
|
||||
//[Fact, AutoInitShutdown]
|
||||
//public void Label_HotKeyChanged_EventFires ()
|
||||
//{
|
||||
// var label = new Label ("Yar");
|
||||
[Fact, AutoInitShutdown]
|
||||
public void Label_HotKeyChanged_EventFires ()
|
||||
{
|
||||
var label = new Label ("Yar");
|
||||
label.HotKey = (Key)'Y';
|
||||
|
||||
// object sender = null;
|
||||
// KeyChangedEventArgs args = null;
|
||||
object sender = null;
|
||||
KeyChangedEventArgs args = null;
|
||||
|
||||
// label.HotKeyChanged += (s, e) =>{
|
||||
// sender = s;
|
||||
// args = e;
|
||||
label.HotKeyChanged += (s, e) => {
|
||||
sender = s;
|
||||
args = e;
|
||||
|
||||
// };
|
||||
};
|
||||
|
||||
// label.HotKey = Key.r;
|
||||
// Assert.Same (label, sender);
|
||||
// Assert.Equal (Key.Y, args.OldKey);
|
||||
// Assert.Equal (Key.r, args.NewKey);
|
||||
|
||||
//}
|
||||
label.HotKey = Key.r;
|
||||
Assert.Same (label, sender);
|
||||
Assert.Equal (Key.Y, args.OldKey);
|
||||
Assert.Equal (Key.r, args.NewKey);
|
||||
}
|
||||
|
||||
[Fact, AutoInitShutdown]
|
||||
public void Label_HotKeyChanged_EventFires_WithNone ()
|
||||
|
||||
@@ -331,8 +331,8 @@ namespace Terminal.Gui.ViewsTests {
|
||||
Position = 1
|
||||
};
|
||||
// BUGBUG: v2 - this test makes no sense to me. Why would we un-set Positon?
|
||||
//Assert.NotEqual (1, sbv.Position);
|
||||
//Assert.Equal (0, sbv.Position);
|
||||
Assert.Equal (1, sbv.Position);
|
||||
Assert.NotEqual (0, sbv.Position);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -620,75 +620,75 @@ namespace Terminal.Gui.ViewsTests {
|
||||
}
|
||||
|
||||
// BUGBUG: v2 - Tig broke these tests; @bdisp help?
|
||||
//[Fact]
|
||||
//public void Constructor_ShowBothScrollIndicator_False_And_IsVertical_True_Refresh_Does_Not_Throws_An_Object_Null_Exception ()
|
||||
//{
|
||||
// var exception = Record.Exception (() => {
|
||||
// Application.Init (new FakeDriver ());
|
||||
[Fact]
|
||||
public void Constructor_ShowBothScrollIndicator_False_And_IsVertical_True_Refresh_Does_Not_Throws_An_Object_Null_Exception ()
|
||||
{
|
||||
var exception = Record.Exception (() => {
|
||||
Application.Init (new FakeDriver ());
|
||||
|
||||
// var top = Application.Top;
|
||||
var top = Application.Top;
|
||||
|
||||
// var win = new Window () {
|
||||
// X = 0,
|
||||
// Y = 0,
|
||||
// Width = Dim.Fill (),
|
||||
// Height = Dim.Fill ()
|
||||
// };
|
||||
var win = new Window () {
|
||||
X = 0,
|
||||
Y = 0,
|
||||
Width = Dim.Fill (),
|
||||
Height = Dim.Fill ()
|
||||
};
|
||||
|
||||
// List<string> source = new List<string> ();
|
||||
List<string> source = new List<string> ();
|
||||
|
||||
// for (int i = 0; i < 50; i++) {
|
||||
// source.Add ($"item {i}");
|
||||
// }
|
||||
for (int i = 0; i < 50; i++) {
|
||||
source.Add ($"item {i}");
|
||||
}
|
||||
|
||||
// var listView = new ListView (source) {
|
||||
// X = 0,
|
||||
// Y = 0,
|
||||
// Width = Dim.Fill (),
|
||||
// Height = Dim.Fill ()
|
||||
// };
|
||||
// win.Add (listView);
|
||||
var listView = new ListView (source) {
|
||||
X = 0,
|
||||
Y = 0,
|
||||
Width = Dim.Fill (),
|
||||
Height = Dim.Fill ()
|
||||
};
|
||||
win.Add (listView);
|
||||
|
||||
// var newScrollBarView = new ScrollBarView (listView, true, false) {
|
||||
// KeepContentAlwaysInViewport = true
|
||||
// };
|
||||
// win.Add (newScrollBarView);
|
||||
var newScrollBarView = new ScrollBarView (listView, true, false) {
|
||||
KeepContentAlwaysInViewport = true
|
||||
};
|
||||
win.Add (newScrollBarView);
|
||||
|
||||
// newScrollBarView.ChangedPosition += (s,e) => {
|
||||
// listView.TopItem = newScrollBarView.Position;
|
||||
// if (listView.TopItem != newScrollBarView.Position) {
|
||||
// newScrollBarView.Position = listView.TopItem;
|
||||
// }
|
||||
// Assert.Equal (newScrollBarView.Position, listView.TopItem);
|
||||
// listView.SetNeedsDisplay ();
|
||||
// };
|
||||
newScrollBarView.ChangedPosition += (s, e) => {
|
||||
listView.TopItem = newScrollBarView.Position;
|
||||
if (listView.TopItem != newScrollBarView.Position) {
|
||||
newScrollBarView.Position = listView.TopItem;
|
||||
}
|
||||
Assert.Equal (newScrollBarView.Position, listView.TopItem);
|
||||
listView.SetNeedsDisplay ();
|
||||
};
|
||||
|
||||
// listView.DrawContent += (s,e) => {
|
||||
// newScrollBarView.Size = listView.Source.Count;
|
||||
// Assert.Equal (newScrollBarView.Size, listView.Source.Count);
|
||||
// newScrollBarView.Position = listView.TopItem;
|
||||
// Assert.Equal (newScrollBarView.Position, listView.TopItem);
|
||||
// newScrollBarView.Refresh ();
|
||||
// };
|
||||
listView.DrawContent += (s, e) => {
|
||||
newScrollBarView.Size = listView.Source.Count;
|
||||
Assert.Equal (newScrollBarView.Size, listView.Source.Count);
|
||||
newScrollBarView.Position = listView.TopItem;
|
||||
Assert.Equal (newScrollBarView.Position, listView.TopItem);
|
||||
newScrollBarView.Refresh ();
|
||||
};
|
||||
|
||||
// top.Ready += (s, e) => {
|
||||
// newScrollBarView.Position = 45;
|
||||
// Assert.Equal (newScrollBarView.Position, newScrollBarView.Size - listView.TopItem + (listView.TopItem - listView.Bounds.Height));
|
||||
// Assert.Equal (newScrollBarView.Position, listView.TopItem);
|
||||
// Assert.Equal (27, newScrollBarView.Position);
|
||||
// Assert.Equal (27, listView.TopItem);
|
||||
// Application.RequestStop ();
|
||||
// };
|
||||
top.Ready += (s, e) => {
|
||||
newScrollBarView.Position = 45;
|
||||
Assert.Equal (newScrollBarView.Position, newScrollBarView.Size - listView.TopItem + (listView.TopItem - listView.Bounds.Height));
|
||||
Assert.Equal (newScrollBarView.Position, listView.TopItem);
|
||||
Assert.Equal (27, newScrollBarView.Position);
|
||||
Assert.Equal (27, listView.TopItem);
|
||||
Application.RequestStop ();
|
||||
};
|
||||
|
||||
// top.Add (win);
|
||||
top.Add (win);
|
||||
|
||||
// Application.Run ();
|
||||
Application.Run ();
|
||||
|
||||
// Application.Shutdown ();
|
||||
// });
|
||||
Application.Shutdown ();
|
||||
});
|
||||
|
||||
// Assert.Null (exception);
|
||||
//}
|
||||
Assert.Null (exception);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Constructor_ShowBothScrollIndicator_False_And_IsVertical_False_Refresh_Does_Not_Throws_An_Object_Null_Exception ()
|
||||
|
||||
@@ -375,233 +375,236 @@ namespace Terminal.Gui.ViewsTests {
|
||||
|
||||
// BUGBUG: v2 - I can't figure out what this test is trying to test and it fails in weird ways
|
||||
// Disabling for now
|
||||
//[Fact, AutoInitShutdown]
|
||||
//public void Frame_And_Labels_Does_Not_Overspill_ScrollView ()
|
||||
//{
|
||||
// var sv = new ScrollView {
|
||||
// X = 3,
|
||||
// Y = 3,
|
||||
// Width = 10,
|
||||
// Height = 10,
|
||||
// ContentSize = new Size (50, 50)
|
||||
// };
|
||||
// for (int i = 0; i < 8; i++) {
|
||||
// sv.Add (new CustomButton ("█", $"Button {i}", 20, 3) { Y = i * 3 });
|
||||
// }
|
||||
// Application.Top.Add (sv);
|
||||
// Application.Begin (Application.Top);
|
||||
// There still have an issue with lower right corner of the scroll view
|
||||
[Fact, AutoInitShutdown]
|
||||
public void Frame_And_Labels_Does_Not_Overspill_ScrollView ()
|
||||
{
|
||||
var sv = new ScrollView {
|
||||
X = 3,
|
||||
Y = 3,
|
||||
Width = 10,
|
||||
Height = 10,
|
||||
ContentSize = new Size (50, 50)
|
||||
};
|
||||
for (int i = 0; i < 8; i++) {
|
||||
sv.Add (new CustomButton ("█", $"Button {i}", 20, 3) { Y = i * 3 });
|
||||
}
|
||||
Application.Top.Add (sv);
|
||||
Application.Begin (Application.Top);
|
||||
|
||||
// TestHelpers.AssertDriverContentsWithFrameAre (@"
|
||||
// █████████▲
|
||||
// ██████But┬
|
||||
// █████████┴
|
||||
// ┌────────░
|
||||
// │ But░
|
||||
// └────────░
|
||||
// ┌────────░
|
||||
// │ But░
|
||||
// └────────▼
|
||||
// ◄├┤░░░░░► ", output);
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (@"
|
||||
█████████▲
|
||||
██████But┬
|
||||
█████████┴
|
||||
┌────────░
|
||||
│ But░
|
||||
└────────░
|
||||
┌────────░
|
||||
│ But░
|
||||
└────────▼
|
||||
◄├┤░░░░░►─", output);
|
||||
|
||||
// sv.ContentOffset = new Point (5, 5);
|
||||
// sv.LayoutSubviews ();
|
||||
// Application.Refresh ();
|
||||
// TestHelpers.AssertDriverContentsWithFrameAre (@"
|
||||
// ─────────▲
|
||||
// ─────────┬
|
||||
// Button 2│
|
||||
// ─────────┴
|
||||
// ─────────░
|
||||
// Button 3░
|
||||
// ─────────░
|
||||
// ─────────░
|
||||
// Button 4▼
|
||||
// ◄├─┤░░░░► ", output);
|
||||
//}
|
||||
sv.ContentOffset = new Point (5, 5);
|
||||
sv.LayoutSubviews ();
|
||||
Application.Refresh ();
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (@"
|
||||
─────────▲
|
||||
─────────┬
|
||||
Button 2│
|
||||
─────────┴
|
||||
─────────░
|
||||
Button 3░
|
||||
─────────░
|
||||
─────────░
|
||||
Button 4▼
|
||||
◄├─┤░░░░►─", output);
|
||||
}
|
||||
|
||||
//private class CustomButton : FrameView {
|
||||
// private Label labelFill;
|
||||
// private Label labelText;
|
||||
private class CustomButton : FrameView {
|
||||
private Label labelFill;
|
||||
private Label labelText;
|
||||
|
||||
// public CustomButton (string fill, string text, int width, int height) : base ()
|
||||
// {
|
||||
// Width = width;
|
||||
// Height = height;
|
||||
// labelFill = new Label () { AutoSize = false, X = Pos.Center (), Y = Pos.Center (), Width = Dim.Fill (), Height = Dim.Fill (), Visible = false };
|
||||
// labelFill.LayoutComplete += (s, e) => {
|
||||
// var fillText = new System.Text.StringBuilder ();
|
||||
// for (int i = 0; i < labelFill.Bounds.Height; i++) {
|
||||
// if (i > 0) {
|
||||
// fillText.AppendLine ("");
|
||||
// }
|
||||
// for (int j = 0; j < labelFill.Bounds.Width; j++) {
|
||||
// fillText.Append (fill);
|
||||
// }
|
||||
// }
|
||||
// labelFill.Text = fillText;
|
||||
// };
|
||||
public CustomButton (string fill, string text, int width, int height) : base ()
|
||||
{
|
||||
Width = width;
|
||||
Height = height;
|
||||
//labelFill = new Label () { AutoSize = false, X = Pos.Center (), Y = Pos.Center (), Width = Dim.Fill (), Height = Dim.Fill (), Visible = false };
|
||||
labelFill = new Label () { AutoSize = false, Width = Dim.Fill (), Height = Dim.Fill (), Visible = false };
|
||||
labelFill.LayoutComplete += (s, e) => {
|
||||
var fillText = new System.Text.StringBuilder ();
|
||||
for (int i = 0; i < labelFill.Bounds.Height; i++) {
|
||||
if (i > 0) {
|
||||
fillText.AppendLine ("");
|
||||
}
|
||||
for (int j = 0; j < labelFill.Bounds.Width; j++) {
|
||||
fillText.Append (fill);
|
||||
}
|
||||
}
|
||||
labelFill.Text = fillText.ToString ();
|
||||
};
|
||||
|
||||
// labelText = new Label (text) { X = Pos.Center (), Y = Pos.Center () };
|
||||
// Add (labelFill, labelText);
|
||||
// CanFocus = true;
|
||||
// }
|
||||
labelText = new Label (text) { X = Pos.Center (), Y = Pos.Center () };
|
||||
Add (labelFill, labelText);
|
||||
CanFocus = true;
|
||||
}
|
||||
|
||||
// public override bool OnEnter (View view)
|
||||
// {
|
||||
// Border.BorderStyle = BorderStyle.None;
|
||||
// Border.DrawMarginFrame = false;
|
||||
// labelFill.Visible = true;
|
||||
// view = this;
|
||||
// return base.OnEnter (view);
|
||||
// }
|
||||
public override bool OnEnter (View view)
|
||||
{
|
||||
Border.BorderStyle = LineStyle.None;
|
||||
Border.Thickness = new Thickness (0);
|
||||
labelFill.Visible = true;
|
||||
view = this;
|
||||
return base.OnEnter (view);
|
||||
}
|
||||
|
||||
// public override bool OnLeave (View view)
|
||||
// {
|
||||
// Border.BorderStyle = BorderStyle.Single;
|
||||
// Border.DrawMarginFrame = true;
|
||||
// labelFill.Visible = false;
|
||||
// if (view == null)
|
||||
// view = this;
|
||||
// return base.OnLeave (view);
|
||||
// }
|
||||
//}
|
||||
public override bool OnLeave (View view)
|
||||
{
|
||||
Border.BorderStyle = LineStyle.Single;
|
||||
Border.Thickness = new Thickness (1);
|
||||
labelFill.Visible = false;
|
||||
if (view == null)
|
||||
view = this;
|
||||
return base.OnLeave (view);
|
||||
}
|
||||
}
|
||||
|
||||
// BUGBUG: Broke this test with #2483 - @bdisp I need your help figuring out why
|
||||
// [Fact, AutoInitShutdown]
|
||||
// public void Clear_Window_Inside_ScrollView ()
|
||||
// {
|
||||
// var topLabel = new Label ("At 15,0") { X = 15 };
|
||||
// var sv = new ScrollView {
|
||||
// X = 3,
|
||||
// Y = 3,
|
||||
// Width = 10,
|
||||
// Height = 10,
|
||||
// ContentSize = new Size (23, 23),
|
||||
// KeepContentAlwaysInViewport = false
|
||||
// };
|
||||
// var bottomLabel = new Label ("At 15,15") { X = 15, Y = 15 };
|
||||
// Application.Top.Add (topLabel, sv, bottomLabel);
|
||||
// Application.Begin (Application.Top);
|
||||
// There are still issue with the lower right corner of the scroll view
|
||||
[Fact, AutoInitShutdown]
|
||||
public void Clear_Window_Inside_ScrollView ()
|
||||
{
|
||||
var topLabel = new Label ("At 15,0") { X = 15 };
|
||||
var sv = new ScrollView {
|
||||
X = 3,
|
||||
Y = 3,
|
||||
Width = 10,
|
||||
Height = 10,
|
||||
ContentSize = new Size (23, 23),
|
||||
KeepContentAlwaysInViewport = false
|
||||
};
|
||||
var bottomLabel = new Label ("At 15,15") { X = 15, Y = 15 };
|
||||
Application.Top.Add (topLabel, sv, bottomLabel);
|
||||
Application.Begin (Application.Top);
|
||||
|
||||
// TestHelpers.AssertDriverContentsWithFrameAre (@"
|
||||
// At 15,0
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (@"
|
||||
At 15,0
|
||||
|
||||
|
||||
// ▲
|
||||
// ┬
|
||||
// ┴
|
||||
// ░
|
||||
// ░
|
||||
// ░
|
||||
// ░
|
||||
// ░
|
||||
// ▼
|
||||
// ◄├┤░░░░░►
|
||||
▲
|
||||
┬
|
||||
┴
|
||||
░
|
||||
░
|
||||
░
|
||||
░
|
||||
░
|
||||
▼
|
||||
◄├┤░░░░░►
|
||||
|
||||
|
||||
// At 15,15", output);
|
||||
At 15,15", output);
|
||||
|
||||
// var attributes = new Attribute [] {
|
||||
// Colors.TopLevel.Normal,
|
||||
// Colors.TopLevel.Focus,
|
||||
// Colors.Base.Normal
|
||||
// };
|
||||
var attributes = new Attribute [] {
|
||||
Colors.TopLevel.Normal,
|
||||
Colors.TopLevel.Focus,
|
||||
Colors.Base.Normal
|
||||
};
|
||||
|
||||
// TestHelpers.AssertDriverColorsAre (@"
|
||||
//00000000000000000000000
|
||||
//00000000000000000000000
|
||||
//00000000000000000000000
|
||||
//00000000000010000000000
|
||||
//00000000000010000000000
|
||||
//00000000000010000000000
|
||||
//00000000000010000000000
|
||||
//00000000000010000000000
|
||||
//00000000000010000000000
|
||||
//00000000000010000000000
|
||||
//00000000000010000000000
|
||||
//00000000000010000000000
|
||||
//00011111111110000000000
|
||||
//00000000000000000000000
|
||||
//00000000000000000000000
|
||||
//00000000000000000000000", attributes);
|
||||
TestHelpers.AssertDriverColorsAre (@"
|
||||
00000000000000000000000
|
||||
00000000000000000000000
|
||||
00000000000000000000000
|
||||
00000000000010000000000
|
||||
00000000000010000000000
|
||||
00000000000010000000000
|
||||
00000000000010000000000
|
||||
00000000000010000000000
|
||||
00000000000010000000000
|
||||
00000000000010000000000
|
||||
00000000000010000000000
|
||||
00000000000010000000000
|
||||
00011111111100000000000
|
||||
00000000000000000000000
|
||||
00000000000000000000000
|
||||
00000000000000000000000", null, attributes);
|
||||
|
||||
// sv.Add (new Window { X = 3, Y = 3, Width = 20, Height = 20 });
|
||||
sv.Add (new Window { X = 3, Y = 3, Width = 20, Height = 20 });
|
||||
|
||||
// Application.Refresh ();
|
||||
// TestHelpers.AssertDriverContentsWithFrameAre (@"
|
||||
// At 15,0
|
||||
Application.Refresh ();
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (@"
|
||||
At 15,0
|
||||
|
||||
|
||||
// ▲
|
||||
// ┬
|
||||
// ┴
|
||||
// ┌─────░
|
||||
// │ ░
|
||||
// │ ░
|
||||
// │ ░
|
||||
// │ ░
|
||||
// │ ▼
|
||||
// ◄├┤░░░░░►
|
||||
▲
|
||||
┬
|
||||
┴
|
||||
┌─────░
|
||||
│ ░
|
||||
│ ░
|
||||
│ ░
|
||||
│ ░
|
||||
│ ▼
|
||||
◄├┤░░░░░►
|
||||
|
||||
|
||||
// At 15,15", output);
|
||||
At 15,15", output);
|
||||
|
||||
// TestHelpers.AssertDriverColorsAre (@"
|
||||
//00000000000000000000000
|
||||
//00000000000000000000000
|
||||
//00000000000000000000000
|
||||
//00000000000010000000000
|
||||
//00000000000010000000000
|
||||
//00000000000010000000000
|
||||
//00000022222210000000000
|
||||
//00000022222210000000000
|
||||
//00000022222210000000000
|
||||
//00000022222210000000000
|
||||
//00000022222210000000000
|
||||
//00000022222210000000000
|
||||
//00011111111110000000000
|
||||
//00000000000000000000000
|
||||
//00000000000000000000000
|
||||
//00000000000000000000000", attributes);
|
||||
TestHelpers.AssertDriverColorsAre (@"
|
||||
00000000000000000000000
|
||||
00000000000000000000000
|
||||
00000000000000000000000
|
||||
00000000000010000000000
|
||||
00000000000010000000000
|
||||
00000000000010000000000
|
||||
00000022222210000000000
|
||||
00000022222210000000000
|
||||
00000022222210000000000
|
||||
00000022222210000000000
|
||||
00000022222210000000000
|
||||
00000022222210000000000
|
||||
00011111111120000000000
|
||||
00000000000000000000000
|
||||
00000000000000000000000
|
||||
00000000000000000000000", null, attributes);
|
||||
|
||||
// sv.ContentOffset = new Point (20, 20);
|
||||
// Application.Refresh ();
|
||||
// TestHelpers.AssertDriverContentsWithFrameAre (@"
|
||||
// At 15,0
|
||||
sv.ContentOffset = new Point (20, 20);
|
||||
Application.Refresh ();
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (@"
|
||||
At 15,0
|
||||
|
||||
|
||||
// │ ▲
|
||||
// │ ░
|
||||
// ──┘ ░
|
||||
// ░
|
||||
// ░
|
||||
// ┬
|
||||
// │
|
||||
// ┴
|
||||
// ▼
|
||||
// ◄░░░░├─┤►
|
||||
│ ▲
|
||||
│ ░
|
||||
──┘ ░
|
||||
░
|
||||
░
|
||||
┬
|
||||
│
|
||||
┴
|
||||
▼
|
||||
◄░░░░├─┤►
|
||||
|
||||
|
||||
// At 15,15", output);
|
||||
At 15,15", output);
|
||||
|
||||
// TestHelpers.AssertDriverColorsAre (@"
|
||||
//00000000000000000000000
|
||||
//00000000000000000000000
|
||||
//00000000000000000000000
|
||||
//00022200000010000000000
|
||||
//00022200000010000000000
|
||||
//00022200000010000000000
|
||||
//00000000000010000000000
|
||||
//00000000000010000000000
|
||||
//00000000000010000000000
|
||||
//00000000000010000000000
|
||||
//00000000000010000000000
|
||||
//00000000000010000000000
|
||||
//00011111111110000000000
|
||||
//00000000000000000000000
|
||||
//00000000000000000000000
|
||||
//00000000000000000000000", attributes);
|
||||
// }
|
||||
TestHelpers.AssertDriverColorsAre (@"
|
||||
00000000000000000000000
|
||||
00000000000000000000000
|
||||
00000000000000000000000
|
||||
00022200000010000000000
|
||||
00022200000010000000000
|
||||
00022200000010000000000
|
||||
00000000000010000000000
|
||||
00000000000010000000000
|
||||
00000000000010000000000
|
||||
00000000000010000000000
|
||||
00000000000010000000000
|
||||
00000000000010000000000
|
||||
00011111111100000000000
|
||||
00000000000000000000000
|
||||
00000000000000000000000
|
||||
00000000000000000000000", null, attributes);
|
||||
}
|
||||
|
||||
[Fact, AutoInitShutdown]
|
||||
public void DrawTextFormatter_Respects_The_Clip_Bounds ()
|
||||
|
||||
@@ -1687,93 +1687,93 @@ namespace Terminal.Gui.ViewsTests {
|
||||
TestHelpers.AssertDriverContentsAre (looksLike, output);
|
||||
|
||||
// BUGBUG: v2 - Something broke and I can't figure it out. Disabling for now.
|
||||
// tileView.Tiles.ElementAt (0).ContentView.Visible = true;
|
||||
// tileView.Tiles.ElementAt (1).ContentView.Visible = false;
|
||||
// tileView.Tiles.ElementAt (2).ContentView.Visible = true;
|
||||
// tileView.LayoutSubviews ();
|
||||
tileView.Tiles.ElementAt (0).ContentView.Visible = true;
|
||||
tileView.Tiles.ElementAt (1).ContentView.Visible = false;
|
||||
tileView.Tiles.ElementAt (2).ContentView.Visible = true;
|
||||
tileView.LayoutSubviews ();
|
||||
|
||||
// tileView.Draw ();
|
||||
tileView.Draw ();
|
||||
|
||||
// looksLike =
|
||||
//@"
|
||||
//┌────────────┬─────┐
|
||||
//│111111111111│33333│
|
||||
//│111111111111│33333│
|
||||
//│111111111111│33333│
|
||||
//│111111111111│33333│
|
||||
//│111111111111├─────┤
|
||||
//│111111111111│44444│
|
||||
//│111111111111│44444│
|
||||
//│111111111111│44444│
|
||||
//└────────────┴─────┘";
|
||||
looksLike =
|
||||
@"
|
||||
┌────────────┬─────┐
|
||||
│111111111111│33333│
|
||||
│111111111111│33333│
|
||||
│111111111111│33333│
|
||||
│111111111111│33333│
|
||||
│111111111111├─────┤
|
||||
│111111111111│44444│
|
||||
│111111111111│44444│
|
||||
│111111111111│44444│
|
||||
└────────────┴─────┘";
|
||||
|
||||
// TestHelpers.AssertDriverContentsAre (looksLike, output);
|
||||
TestHelpers.AssertDriverContentsAre (looksLike, output);
|
||||
|
||||
// tileView.Tiles.ElementAt (0).ContentView.Visible = true;
|
||||
// tileView.Tiles.ElementAt (1).ContentView.Visible = true;
|
||||
// tileView.Tiles.ElementAt (2).ContentView.Visible = false;
|
||||
// tileView.LayoutSubviews ();
|
||||
tileView.Tiles.ElementAt (0).ContentView.Visible = true;
|
||||
tileView.Tiles.ElementAt (1).ContentView.Visible = true;
|
||||
tileView.Tiles.ElementAt (2).ContentView.Visible = false;
|
||||
tileView.LayoutSubviews ();
|
||||
|
||||
// tileView.Draw ();
|
||||
tileView.Draw ();
|
||||
|
||||
// looksLike =
|
||||
//@"
|
||||
//┌─────┬────────────┐
|
||||
//│11111│222222222222│
|
||||
//│11111│222222222222│
|
||||
//│11111│222222222222│
|
||||
//│11111│222222222222│
|
||||
//│11111│222222222222│
|
||||
//│11111│222222222222│
|
||||
//│11111│222222222222│
|
||||
//│11111│222222222222│
|
||||
//└─────┴────────────┘";
|
||||
looksLike =
|
||||
@"
|
||||
┌─────┬────────────┐
|
||||
│11111│222222222222│
|
||||
│11111│222222222222│
|
||||
│11111│222222222222│
|
||||
│11111│222222222222│
|
||||
│11111│222222222222│
|
||||
│11111│222222222222│
|
||||
│11111│222222222222│
|
||||
│11111│222222222222│
|
||||
└─────┴────────────┘";
|
||||
|
||||
// TestHelpers.AssertDriverContentsAre (looksLike, output);
|
||||
TestHelpers.AssertDriverContentsAre (looksLike, output);
|
||||
|
||||
// tileView.Tiles.ElementAt (0).ContentView.Visible = true;
|
||||
// tileView.Tiles.ElementAt (1).ContentView.Visible = false;
|
||||
// tileView.Tiles.ElementAt (2).ContentView.Visible = false;
|
||||
// tileView.LayoutSubviews ();
|
||||
tileView.Tiles.ElementAt (0).ContentView.Visible = true;
|
||||
tileView.Tiles.ElementAt (1).ContentView.Visible = false;
|
||||
tileView.Tiles.ElementAt (2).ContentView.Visible = false;
|
||||
tileView.LayoutSubviews ();
|
||||
|
||||
// tileView.Draw ();
|
||||
tileView.Draw ();
|
||||
|
||||
// looksLike =
|
||||
//@"
|
||||
//┌──────────────────┐
|
||||
//│111111111111111111│
|
||||
//│111111111111111111│
|
||||
//│111111111111111111│
|
||||
//│111111111111111111│
|
||||
//│111111111111111111│
|
||||
//│111111111111111111│
|
||||
//│111111111111111111│
|
||||
//│111111111111111111│
|
||||
//└──────────────────┘";
|
||||
looksLike =
|
||||
@"
|
||||
┌──────────────────┐
|
||||
│111111111111111111│
|
||||
│111111111111111111│
|
||||
│111111111111111111│
|
||||
│111111111111111111│
|
||||
│111111111111111111│
|
||||
│111111111111111111│
|
||||
│111111111111111111│
|
||||
│111111111111111111│
|
||||
└──────────────────┘";
|
||||
|
||||
// TestHelpers.AssertDriverContentsAre (looksLike, output);
|
||||
TestHelpers.AssertDriverContentsAre (looksLike, output);
|
||||
|
||||
// tileView.Tiles.ElementAt (0).ContentView.Visible = false;
|
||||
// tileView.Tiles.ElementAt (1).ContentView.Visible = true;
|
||||
// tileView.Tiles.ElementAt (2).ContentView.Visible = false;
|
||||
// tileView.LayoutSubviews ();
|
||||
tileView.Tiles.ElementAt (0).ContentView.Visible = false;
|
||||
tileView.Tiles.ElementAt (1).ContentView.Visible = true;
|
||||
tileView.Tiles.ElementAt (2).ContentView.Visible = false;
|
||||
tileView.LayoutSubviews ();
|
||||
|
||||
// tileView.Draw ();
|
||||
tileView.Draw ();
|
||||
|
||||
// looksLike =
|
||||
//@"
|
||||
//┌──────────────────┐
|
||||
//│222222222222222222│
|
||||
//│222222222222222222│
|
||||
//│222222222222222222│
|
||||
//│222222222222222222│
|
||||
//│222222222222222222│
|
||||
//│222222222222222222│
|
||||
//│222222222222222222│
|
||||
//│222222222222222222│
|
||||
//└──────────────────┘";
|
||||
looksLike =
|
||||
@"
|
||||
┌──────────────────┐
|
||||
│222222222222222222│
|
||||
│222222222222222222│
|
||||
│222222222222222222│
|
||||
│222222222222222222│
|
||||
│222222222222222222│
|
||||
│222222222222222222│
|
||||
│222222222222222222│
|
||||
│222222222222222222│
|
||||
└──────────────────┘";
|
||||
|
||||
// TestHelpers.AssertDriverContentsAre (looksLike, output);
|
||||
TestHelpers.AssertDriverContentsAre (looksLike, output);
|
||||
|
||||
tileView.Tiles.ElementAt (0).ContentView.Visible = false;
|
||||
tileView.Tiles.ElementAt (1).ContentView.Visible = false;
|
||||
@@ -1869,132 +1869,131 @@ namespace Terminal.Gui.ViewsTests {
|
||||
TestHelpers.AssertDriverContentsAre (looksLike, output);
|
||||
|
||||
// BUGBUG: v2 - Something broke and I can't figure it out. Disabling for now.
|
||||
// tileView.Tiles.ElementAt (0).ContentView.Visible = true;
|
||||
// tileView.Tiles.ElementAt (1).ContentView.Visible = false;
|
||||
// tileView.Tiles.ElementAt (2).ContentView.Visible = true;
|
||||
// tileView.LayoutSubviews ();
|
||||
tileView.Tiles.ElementAt (0).ContentView.Visible = true;
|
||||
tileView.Tiles.ElementAt (1).ContentView.Visible = false;
|
||||
tileView.Tiles.ElementAt (2).ContentView.Visible = true;
|
||||
tileView.LayoutSubviews ();
|
||||
|
||||
// tileView.Draw ();
|
||||
tileView.Draw ();
|
||||
|
||||
// looksLike =
|
||||
//@"
|
||||
//1111111111111│333333
|
||||
//1111111111111│333333
|
||||
//1111111111111│333333
|
||||
//1111111111111│333333
|
||||
//1111111111111│333333
|
||||
//1111111111111├──────
|
||||
//1111111111111│444444
|
||||
//1111111111111│444444
|
||||
//1111111111111│444444
|
||||
//1111111111111│444444";
|
||||
looksLike =
|
||||
@"
|
||||
1111111111111│333333
|
||||
1111111111111│333333
|
||||
1111111111111│333333
|
||||
1111111111111│333333
|
||||
1111111111111│333333
|
||||
1111111111111├──────
|
||||
1111111111111│444444
|
||||
1111111111111│444444
|
||||
1111111111111│444444
|
||||
1111111111111│444444";
|
||||
|
||||
// TestHelpers.AssertDriverContentsAre (looksLike, output);
|
||||
TestHelpers.AssertDriverContentsAre (looksLike, output);
|
||||
|
||||
// tileView.Tiles.ElementAt (0).ContentView.Visible = true;
|
||||
// tileView.Tiles.ElementAt (1).ContentView.Visible = true;
|
||||
// tileView.Tiles.ElementAt (2).ContentView.Visible = false;
|
||||
// tileView.LayoutSubviews ();
|
||||
tileView.Tiles.ElementAt (0).ContentView.Visible = true;
|
||||
tileView.Tiles.ElementAt (1).ContentView.Visible = true;
|
||||
tileView.Tiles.ElementAt (2).ContentView.Visible = false;
|
||||
tileView.LayoutSubviews ();
|
||||
|
||||
// tileView.Draw ();
|
||||
tileView.Draw ();
|
||||
|
||||
// looksLike =
|
||||
//@"
|
||||
//111111│2222222222222
|
||||
//111111│2222222222222
|
||||
//111111│2222222222222
|
||||
//111111│2222222222222
|
||||
//111111│2222222222222
|
||||
//111111│2222222222222
|
||||
//111111│2222222222222
|
||||
//111111│2222222222222
|
||||
//111111│2222222222222
|
||||
//111111│2222222222222";
|
||||
looksLike =
|
||||
@"
|
||||
111111│2222222222222
|
||||
111111│2222222222222
|
||||
111111│2222222222222
|
||||
111111│2222222222222
|
||||
111111│2222222222222
|
||||
111111│2222222222222
|
||||
111111│2222222222222
|
||||
111111│2222222222222
|
||||
111111│2222222222222
|
||||
111111│2222222222222";
|
||||
|
||||
// TestHelpers.AssertDriverContentsAre (looksLike, output);
|
||||
TestHelpers.AssertDriverContentsAre (looksLike, output);
|
||||
|
||||
// tileView.Tiles.ElementAt (0).ContentView.Visible = true;
|
||||
// tileView.Tiles.ElementAt (1).ContentView.Visible = false;
|
||||
// tileView.Tiles.ElementAt (2).ContentView.Visible = false;
|
||||
// tileView.LayoutSubviews ();
|
||||
tileView.Tiles.ElementAt (0).ContentView.Visible = true;
|
||||
tileView.Tiles.ElementAt (1).ContentView.Visible = false;
|
||||
tileView.Tiles.ElementAt (2).ContentView.Visible = false;
|
||||
tileView.LayoutSubviews ();
|
||||
|
||||
// tileView.Draw ();
|
||||
tileView.Draw ();
|
||||
|
||||
// looksLike =
|
||||
//@"
|
||||
//11111111111111111111
|
||||
//11111111111111111111
|
||||
//11111111111111111111
|
||||
//11111111111111111111
|
||||
//11111111111111111111
|
||||
//11111111111111111111
|
||||
//11111111111111111111
|
||||
//11111111111111111111
|
||||
//11111111111111111111
|
||||
//11111111111111111111";
|
||||
looksLike =
|
||||
@"
|
||||
11111111111111111111
|
||||
11111111111111111111
|
||||
11111111111111111111
|
||||
11111111111111111111
|
||||
11111111111111111111
|
||||
11111111111111111111
|
||||
11111111111111111111
|
||||
11111111111111111111
|
||||
11111111111111111111
|
||||
11111111111111111111";
|
||||
|
||||
// TestHelpers.AssertDriverContentsAre (looksLike, output);
|
||||
TestHelpers.AssertDriverContentsAre (looksLike, output);
|
||||
|
||||
// tileView.Tiles.ElementAt (0).ContentView.Visible = false;
|
||||
// tileView.Tiles.ElementAt (1).ContentView.Visible = true;
|
||||
// tileView.Tiles.ElementAt (2).ContentView.Visible = false;
|
||||
// tileView.LayoutSubviews ();
|
||||
tileView.Tiles.ElementAt (0).ContentView.Visible = false;
|
||||
tileView.Tiles.ElementAt (1).ContentView.Visible = true;
|
||||
tileView.Tiles.ElementAt (2).ContentView.Visible = false;
|
||||
tileView.LayoutSubviews ();
|
||||
|
||||
// tileView.Draw ();
|
||||
tileView.Draw ();
|
||||
|
||||
// looksLike =
|
||||
//@"
|
||||
//22222222222222222222
|
||||
//22222222222222222222
|
||||
//22222222222222222222
|
||||
//22222222222222222222
|
||||
//22222222222222222222
|
||||
//22222222222222222222
|
||||
//22222222222222222222
|
||||
//22222222222222222222
|
||||
//22222222222222222222
|
||||
//22222222222222222222";
|
||||
looksLike =
|
||||
@"
|
||||
22222222222222222222
|
||||
22222222222222222222
|
||||
22222222222222222222
|
||||
22222222222222222222
|
||||
22222222222222222222
|
||||
22222222222222222222
|
||||
22222222222222222222
|
||||
22222222222222222222
|
||||
22222222222222222222
|
||||
22222222222222222222";
|
||||
|
||||
// TestHelpers.AssertDriverContentsAre (looksLike, output);
|
||||
TestHelpers.AssertDriverContentsAre (looksLike, output);
|
||||
|
||||
// tileView.Tiles.ElementAt (0).ContentView.Visible = false;
|
||||
// tileView.Tiles.ElementAt (1).ContentView.Visible = false;
|
||||
// tileView.Tiles.ElementAt (2).ContentView.Visible = true;
|
||||
// tileView.LayoutSubviews ();
|
||||
tileView.Tiles.ElementAt (0).ContentView.Visible = false;
|
||||
tileView.Tiles.ElementAt (1).ContentView.Visible = false;
|
||||
tileView.Tiles.ElementAt (2).ContentView.Visible = true;
|
||||
tileView.LayoutSubviews ();
|
||||
|
||||
// tileView.Draw ();
|
||||
tileView.Draw ();
|
||||
|
||||
// looksLike =
|
||||
//@"
|
||||
//33333333333333333333
|
||||
//33333333333333333333
|
||||
//33333333333333333333
|
||||
//33333333333333333333
|
||||
//33333333333333333333
|
||||
//────────────────────
|
||||
//44444444444444444444
|
||||
//44444444444444444444
|
||||
//44444444444444444444
|
||||
//44444444444444444444";
|
||||
looksLike =
|
||||
@"
|
||||
33333333333333333333
|
||||
33333333333333333333
|
||||
33333333333333333333
|
||||
33333333333333333333
|
||||
33333333333333333333
|
||||
────────────────────
|
||||
44444444444444444444
|
||||
44444444444444444444
|
||||
44444444444444444444
|
||||
44444444444444444444";
|
||||
|
||||
// TestHelpers.AssertDriverContentsAre (looksLike, output);
|
||||
TestHelpers.AssertDriverContentsAre (looksLike, output);
|
||||
|
||||
|
||||
// TestHelpers.AssertDriverContentsAre (looksLike, output);
|
||||
TestHelpers.AssertDriverContentsAre (looksLike, output);
|
||||
|
||||
// tileView.Tiles.ElementAt (0).ContentView.Visible = false;
|
||||
// tileView.Tiles.ElementAt (1).ContentView.Visible = false;
|
||||
// tileView.Tiles.ElementAt (2).ContentView.Visible = false;
|
||||
// tileView.LayoutSubviews ();
|
||||
tileView.Tiles.ElementAt (0).ContentView.Visible = false;
|
||||
tileView.Tiles.ElementAt (1).ContentView.Visible = false;
|
||||
tileView.Tiles.ElementAt (2).ContentView.Visible = false;
|
||||
tileView.LayoutSubviews ();
|
||||
|
||||
// tileView.Draw ();
|
||||
tileView.Draw ();
|
||||
|
||||
// looksLike =
|
||||
//@"
|
||||
// ";
|
||||
|
||||
// TestHelpers.AssertDriverContentsAre (looksLike, output);
|
||||
looksLike =
|
||||
@"
|
||||
";
|
||||
|
||||
TestHelpers.AssertDriverContentsAre (looksLike, output);
|
||||
}
|
||||
|
||||
[Fact, AutoInitShutdown]
|
||||
|
||||
Reference in New Issue
Block a user