mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-27 16:27:55 +01:00
* Remove NStack and replace ustring to string.
* Add unit test and improving some code.
* Adjust code and fix all unit tests errors.
* Add XML Document and move the Rune folder into the Text folder.
* Improve unit tests with byte array on DecodeRune and DecodeLastRune.
* Fix unit test.
* 😂Code review
* Reduce unit tests code.
* Change StringExtensions.Make to StringExtensions.ToString and added some more unit tests.
* Fix merge errors.
* Remove GetTextWidth and calls replaced with StringExtensions.GetColumns.
* Hack to use UseSystemConsole passed in the command line arguments.
* Revert "Hack to use UseSystemConsole passed in the command line arguments."
This reverts commit b74d11c786.
* Remove Application.UseSystemConsole from the config file.
* Fix errors related by removing UseSystemConsole from the config file.
* Fixes #2633. DecodeEscSeq throw an exception if cki is null.
* Fix an exception if SelectedItem is -1.
* Set SelectedItem to 0 and remove unnecessary ToString.
* Using a unique ToString method for Rune and other for byte.
* Fix a bug where a wider rune is added with only a width of 1.
* Force the SelectedGlyph is the one that was typed after jumpList is executed.
* Added more InlineData to RuneTests.
* Reducing significantly the code by using Theory attribute in the TextFormatterTests.
* Override PositionCursor to handle the CharMap cursor position.
* Fix merge errors.
* Minor tweaks to API docs
---------
Co-authored-by: Tig Kindel <tig@users.noreply.github.com>
75 lines
1.9 KiB
C#
75 lines
1.9 KiB
C#
using System.Text;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Xml.Linq;
|
|
using Xunit;
|
|
using Xunit.Abstractions;
|
|
//using GraphViewTests = Terminal.Gui.Views.GraphViewTests;
|
|
|
|
// Alias Console to MockConsole so we don't accidentally use Console
|
|
using Console = Terminal.Gui.FakeConsole;
|
|
|
|
namespace Terminal.Gui.ViewTests {
|
|
public class TitleTests {
|
|
readonly ITestOutputHelper output;
|
|
|
|
public TitleTests (ITestOutputHelper output)
|
|
{
|
|
this.output = output;
|
|
}
|
|
|
|
[Fact]
|
|
public void Set_Title_Fires_TitleChanging ()
|
|
{
|
|
var r = new View ();
|
|
Assert.Equal (string.Empty, r.Title);
|
|
|
|
string expectedOld = null;
|
|
string expectedDuring = null;
|
|
string expectedAfter = null;
|
|
bool cancel = false;
|
|
r.TitleChanging += (s, args) => {
|
|
Assert.Equal (expectedOld, args.OldTitle);
|
|
Assert.Equal (expectedDuring, args.NewTitle);
|
|
args.Cancel = cancel;
|
|
};
|
|
|
|
expectedOld = string.Empty;
|
|
r.Title = expectedDuring = expectedAfter = "title";
|
|
Assert.Equal (expectedAfter, r.Title.ToString ());
|
|
|
|
expectedOld = r.Title.ToString ();
|
|
r.Title = expectedDuring = expectedAfter = "a different title";
|
|
Assert.Equal (expectedAfter, r.Title.ToString ());
|
|
|
|
// Now setup cancelling the change and change it back to "title"
|
|
cancel = true;
|
|
expectedOld = r.Title.ToString ();
|
|
r.Title = expectedDuring = "title";
|
|
Assert.Equal (expectedAfter, r.Title.ToString ());
|
|
r.Dispose ();
|
|
|
|
}
|
|
|
|
[Fact]
|
|
public void Set_Title_Fires_TitleChanged ()
|
|
{
|
|
var r = new View ();
|
|
Assert.Equal (string.Empty, r.Title);
|
|
|
|
string expectedOld = null;
|
|
string expected = null;
|
|
r.TitleChanged += (s, args) => {
|
|
Assert.Equal (expectedOld, args.OldTitle);
|
|
Assert.Equal (r.Title, args.NewTitle);
|
|
};
|
|
|
|
expected = "title";
|
|
expectedOld = r.Title.ToString ();
|
|
r.Title = expected;
|
|
Assert.Equal (expected, r.Title.ToString ());
|
|
}
|
|
|
|
}
|
|
}
|