mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-02 01:03:29 +01:00
Fixing broken unit tests.
This commit is contained in:
@@ -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