|
@@ -1,17 +1,10 @@
|
|
using System.Text;
|
|
using System.Text;
|
|
using Xunit.Abstractions;
|
|
using Xunit.Abstractions;
|
|
|
|
|
|
-//using GraphViewTests = Terminal.Gui.Views.GraphViewTests;
|
|
|
|
-
|
|
|
|
-// Alias Console to MockConsole so we don't accidentally use Console
|
|
|
|
-
|
|
|
|
namespace Terminal.Gui.ViewTests;
|
|
namespace Terminal.Gui.ViewTests;
|
|
|
|
|
|
-public class TitleTests
|
|
|
|
|
|
+public class TitleTests (ITestOutputHelper output)
|
|
{
|
|
{
|
|
- private readonly ITestOutputHelper _output;
|
|
|
|
- public TitleTests (ITestOutputHelper output) { this._output = output; }
|
|
|
|
-
|
|
|
|
[Fact]
|
|
[Fact]
|
|
public void Set_Title_Fires_TitleChanged ()
|
|
public void Set_Title_Fires_TitleChanged ()
|
|
{
|
|
{
|
|
@@ -81,27 +74,41 @@ public class TitleTests
|
|
[Fact]
|
|
[Fact]
|
|
public void Change_View_Size_Update_Title_Size ()
|
|
public void Change_View_Size_Update_Title_Size ()
|
|
{
|
|
{
|
|
- var view = new View { Title = "_Hello World", Width = Dim.Auto (), Height = Dim.Auto (), BorderStyle = LineStyle.Single};
|
|
|
|
|
|
+ var view = new View
|
|
|
|
+ {
|
|
|
|
+ Title = "_Hello World",
|
|
|
|
+ Width = Dim.Auto (), Height = Dim.Auto (),
|
|
|
|
+ BorderStyle = LineStyle.Single
|
|
|
|
+ };
|
|
var top = new Toplevel ();
|
|
var top = new Toplevel ();
|
|
top.Add (view);
|
|
top.Add (view);
|
|
- Application.Begin (top);
|
|
|
|
|
|
+ top.BeginInit ();
|
|
|
|
+ top.EndInit ();
|
|
|
|
|
|
Assert.Equal (string.Empty, view.Text);
|
|
Assert.Equal (string.Empty, view.Text);
|
|
Assert.Equal (new (2, 2), view.Frame.Size);
|
|
Assert.Equal (new (2, 2), view.Frame.Size);
|
|
- TestHelpers.AssertDriverContentsWithFrameAre (@"
|
|
|
|
|
|
+ top.Draw ();
|
|
|
|
+
|
|
|
|
+ TestHelpers.AssertDriverContentsWithFrameAre (
|
|
|
|
+ @"
|
|
┌┐
|
|
┌┐
|
|
-└┘", _output);
|
|
|
|
|
|
+└┘",
|
|
|
|
+ output);
|
|
|
|
|
|
var text = "This text will increment the view size and display the title.";
|
|
var text = "This text will increment the view size and display the title.";
|
|
view.Text = text;
|
|
view.Text = text;
|
|
top.Draw ();
|
|
top.Draw ();
|
|
Assert.Equal (text, view.Text);
|
|
Assert.Equal (text, view.Text);
|
|
|
|
+
|
|
// SetupFakeDriver only create a screen with 25 cols and 25 rows
|
|
// SetupFakeDriver only create a screen with 25 cols and 25 rows
|
|
Assert.Equal (new (25, 3), view.Frame.Size);
|
|
Assert.Equal (new (25, 3), view.Frame.Size);
|
|
- TestHelpers.AssertDriverContentsWithFrameAre (@"
|
|
|
|
|
|
+
|
|
|
|
+ TestHelpers.AssertDriverContentsWithFrameAre (
|
|
|
|
+ @"
|
|
┌┤Hello World├──────────┐
|
|
┌┤Hello World├──────────┐
|
|
│This text will incremen│
|
|
│This text will incremen│
|
|
-└───────────────────────┘", _output);
|
|
|
|
|
|
+└───────────────────────┘",
|
|
|
|
+ output);
|
|
|
|
|
|
top.Dispose ();
|
|
top.Dispose ();
|
|
}
|
|
}
|