mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-01 16:59:35 +01:00
Remove NStack and replace ustring to string.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using NStack;
|
||||
using System.Text;
|
||||
using System;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
@@ -16,18 +16,18 @@ namespace Terminal.Gui.ViewsTests {
|
||||
[Fact, AutoInitShutdown]
|
||||
public void Non_Bmp_ConsoleWidth_ColumnWidth_Equal_Two ()
|
||||
{
|
||||
ustring us = "\U0001d539";
|
||||
Rune r = 0x1d539;
|
||||
string us = "\U0001d539";
|
||||
Rune r = (Rune)0x1d539;
|
||||
|
||||
Assert.Equal ("𝔹", us);
|
||||
Assert.Equal ("𝔹", r.ToString ());
|
||||
Assert.Equal (us, r.ToString ());
|
||||
|
||||
Assert.Equal (2, us.ConsoleWidth);
|
||||
Assert.Equal (2, Rune.ColumnWidth (r));
|
||||
Assert.Equal (2, us.ConsoleWidth ());
|
||||
Assert.Equal (2, r.ColumnWidth ());
|
||||
|
||||
var win = new Window () { Title = us };
|
||||
var label = new Label (ustring.Make (r));
|
||||
var label = new Label (r.ToString ());
|
||||
var tf = new TextField (us) { Y = 1, Width = 3 };
|
||||
win.Add (label, tf);
|
||||
var top = Application.Top;
|
||||
@@ -64,18 +64,18 @@ namespace Terminal.Gui.ViewsTests {
|
||||
[Fact, AutoInitShutdown]
|
||||
public void CJK_Compatibility_Ideographs_ConsoleWidth_ColumnWidth_Equal_Two ()
|
||||
{
|
||||
ustring us = "\U0000f900";
|
||||
Rune r = 0xf900;
|
||||
string us = "\U0000f900";
|
||||
Rune r = (Rune)0xf900;
|
||||
|
||||
Assert.Equal ("豈", us);
|
||||
Assert.Equal ("豈", r.ToString ());
|
||||
Assert.Equal (us, r.ToString ());
|
||||
|
||||
Assert.Equal (2, us.ConsoleWidth);
|
||||
Assert.Equal (2, Rune.ColumnWidth (r));
|
||||
Assert.Equal (2, us.ConsoleWidth());
|
||||
Assert.Equal (2, r.ColumnWidth ());
|
||||
|
||||
var win = new Window () { Title = us };
|
||||
var label = new Label (ustring.Make (r));
|
||||
var label = new Label (r.ToString ());
|
||||
var tf = new TextField (us) { Y = 1, Width = 3 };
|
||||
win.Add (label, tf);
|
||||
var top = Application.Top;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using NStack;
|
||||
using System.Text;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Linq;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
using NStack;
|
||||
using System.Text;
|
||||
|
||||
// Alias Console to MockConsole so we don't accidentally use Console
|
||||
using Console = Terminal.Gui.FakeConsole;
|
||||
@@ -104,7 +104,7 @@ namespace Terminal.Gui.ViewTests {
|
||||
public bool IsKeyDown { get; set; }
|
||||
public bool IsKeyPress { get; set; }
|
||||
public bool IsKeyUp { get; set; }
|
||||
public override ustring Text { get; set; }
|
||||
public override string Text { get; set; }
|
||||
|
||||
public override bool OnKeyDown (KeyEvent keyEvent)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using NStack;
|
||||
using System.Text;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Linq;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using NStack;
|
||||
using System.Text;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Xunit;
|
||||
@@ -259,7 +259,7 @@ namespace Terminal.Gui.ViewTests {
|
||||
Assert.False (view.AutoSize);
|
||||
Assert.Equal (new Rect (0, 0, 3, 1), view.Frame);
|
||||
Assert.Equal (new Size (3, 1), view.TextFormatter.Size);
|
||||
Assert.Equal (new List<ustring> () { "Vie" }, view.TextFormatter.Lines);
|
||||
Assert.Equal (new List<string> () { "Vie" }, view.TextFormatter.Lines);
|
||||
Assert.Equal (new Rect (0, 0, 10, 4), win.Frame);
|
||||
Assert.Equal (new Rect (0, 0, 10, 4), Application.Top.Frame);
|
||||
var expected = @"
|
||||
@@ -279,7 +279,7 @@ namespace Terminal.Gui.ViewTests {
|
||||
|
||||
Assert.Equal (new Rect (0, 0, 0, 1), view.Frame);
|
||||
Assert.Equal (new Size (0, 1), view.TextFormatter.Size);
|
||||
Assert.Equal (new List<ustring> () { ustring.Empty }, view.TextFormatter.Lines);
|
||||
Assert.Equal (new List<string> () { string.Empty }, view.TextFormatter.Lines);
|
||||
expected = @"
|
||||
┌────────┐
|
||||
│ │
|
||||
@@ -332,7 +332,7 @@ namespace Terminal.Gui.ViewTests {
|
||||
|
||||
Assert.Equal (new Rect (0, 0, 0, 1), view.Frame);
|
||||
Assert.Equal (new Size (0, 1), view.TextFormatter.Size);
|
||||
var exception = Record.Exception (() => Assert.Equal (new List<ustring> () { ustring.Empty }, view.TextFormatter.Lines));
|
||||
var exception = Record.Exception (() => Assert.Equal (new List<string> () { string.Empty }, view.TextFormatter.Lines));
|
||||
Assert.Null (exception);
|
||||
expected = @"
|
||||
┌────────┐
|
||||
@@ -367,7 +367,7 @@ namespace Terminal.Gui.ViewTests {
|
||||
Assert.True (label.AutoSize);
|
||||
Assert.Equal (new Rect (0, 0, 5, 1), label.Frame);
|
||||
Assert.Equal (new Size (5, 1), label.TextFormatter.Size);
|
||||
Assert.Equal (new List<ustring> () { "Label" }, label.TextFormatter.Lines);
|
||||
Assert.Equal (new List<string> () { "Label" }, label.TextFormatter.Lines);
|
||||
Assert.Equal (new Rect (0, 0, 10, 4), win.Frame);
|
||||
Assert.Equal (new Rect (0, 0, 10, 4), Application.Top.Frame);
|
||||
var expected = @"
|
||||
@@ -423,7 +423,7 @@ namespace Terminal.Gui.ViewTests {
|
||||
Assert.False (label.AutoSize);
|
||||
Assert.Equal (new Rect (0, 0, 3, 1), label.Frame);
|
||||
Assert.Equal (new Size (3, 1), label.TextFormatter.Size);
|
||||
Assert.Equal (new List<ustring> () { "Lab" }, label.TextFormatter.Lines);
|
||||
Assert.Equal (new List<string> () { "Lab" }, label.TextFormatter.Lines);
|
||||
Assert.Equal (new Rect (0, 0, 10, 4), win.Frame);
|
||||
Assert.Equal (new Rect (0, 0, 10, 4), Application.Top.Frame);
|
||||
var expected = @"
|
||||
@@ -444,7 +444,7 @@ namespace Terminal.Gui.ViewTests {
|
||||
Assert.False (label.AutoSize);
|
||||
Assert.Equal (new Rect (0, 0, 0, 1), label.Frame);
|
||||
Assert.Equal (new Size (0, 1), label.TextFormatter.Size);
|
||||
Assert.Equal (new List<ustring> { ustring.Empty }, label.TextFormatter.Lines);
|
||||
Assert.Equal (new List<string> { string.Empty }, label.TextFormatter.Lines);
|
||||
expected = @"
|
||||
┌────────┐
|
||||
│ │
|
||||
@@ -477,7 +477,7 @@ namespace Terminal.Gui.ViewTests {
|
||||
Assert.True (label.AutoSize);
|
||||
Assert.Equal (new Rect (0, 0, 5, 1), label.Frame);
|
||||
Assert.Equal (new Size (5, 1), label.TextFormatter.Size);
|
||||
Assert.Equal (new List<ustring> () { "Label" }, label.TextFormatter.Lines);
|
||||
Assert.Equal (new List<string> () { "Label" }, label.TextFormatter.Lines);
|
||||
Assert.Equal (new Rect (0, 0, 10, 4), win.Frame);
|
||||
Assert.Equal (new Rect (0, 0, 10, 4), Application.Top.Frame);
|
||||
var expected = @"
|
||||
@@ -552,7 +552,7 @@ namespace Terminal.Gui.ViewTests {
|
||||
|
||||
Assert.Equal (new Rect (0, 0, 0, 1), label.Frame);
|
||||
Assert.Equal (new Size (0, 1), label.TextFormatter.Size);
|
||||
var exception = Record.Exception (() => Assert.Equal (new List<ustring> () { ustring.Empty }, label.TextFormatter.Lines));
|
||||
var exception = Record.Exception (() => Assert.Equal (new List<string> () { string.Empty }, label.TextFormatter.Lines));
|
||||
Assert.Null (exception);
|
||||
expected = @"
|
||||
┌────────┐
|
||||
@@ -588,7 +588,7 @@ namespace Terminal.Gui.ViewTests {
|
||||
Assert.True (view.AutoSize);
|
||||
Assert.Equal (new Rect (0, 0, 1, 5), view.Frame);
|
||||
Assert.Equal (new Size (1, 5), view.TextFormatter.Size);
|
||||
Assert.Equal (new List<ustring> () { "Views" }, view.TextFormatter.Lines);
|
||||
Assert.Equal (new List<string> () { "Views" }, view.TextFormatter.Lines);
|
||||
Assert.Equal (new Rect (0, 0, 4, 10), win.Frame);
|
||||
Assert.Equal (new Rect (0, 0, 4, 10), Application.Top.Frame);
|
||||
var expected = @"
|
||||
@@ -681,7 +681,7 @@ namespace Terminal.Gui.ViewTests {
|
||||
|
||||
Assert.Equal (new Rect (0, 0, 1, 0), view.Frame);
|
||||
Assert.Equal (new Size (1, 0), view.TextFormatter.Size);
|
||||
var exception = Record.Exception (() => Assert.Equal (new List<ustring> () { ustring.Empty }, view.TextFormatter.Lines));
|
||||
var exception = Record.Exception (() => Assert.Equal (new List<string> () { string.Empty }, view.TextFormatter.Lines));
|
||||
Assert.Null (exception);
|
||||
expected = @"
|
||||
┌──┐
|
||||
@@ -723,7 +723,7 @@ namespace Terminal.Gui.ViewTests {
|
||||
Assert.True (view.AutoSize);
|
||||
Assert.Equal (new Rect (0, 0, 2, 5), view.Frame);
|
||||
Assert.Equal (new Size (2, 5), view.TextFormatter.Size);
|
||||
Assert.Equal (new List<ustring> () { "界View" }, view.TextFormatter.Lines);
|
||||
Assert.Equal (new List<string> () { "界View" }, view.TextFormatter.Lines);
|
||||
Assert.Equal (new Rect (0, 0, 4, 10), win.Frame);
|
||||
Assert.Equal (new Rect (0, 0, 4, 10), Application.Top.Frame);
|
||||
var expected = @"
|
||||
@@ -749,7 +749,7 @@ namespace Terminal.Gui.ViewTests {
|
||||
|
||||
Assert.Equal (new Rect (0, 0, 2, 5), view.Frame);
|
||||
Assert.Equal (new Size (2, 5), view.TextFormatter.Size);
|
||||
var exception = Record.Exception (() => Assert.Equal (new List<ustring> () { "界View" }, view.TextFormatter.Lines));
|
||||
var exception = Record.Exception (() => Assert.Equal (new List<string> () { "界View" }, view.TextFormatter.Lines));
|
||||
Assert.Null (exception);
|
||||
expected = @"
|
||||
┌──┐
|
||||
@@ -816,7 +816,7 @@ namespace Terminal.Gui.ViewTests {
|
||||
|
||||
Assert.Equal (new Rect (0, 0, 2, 0), view.Frame);
|
||||
Assert.Equal (new Size (2, 0), view.TextFormatter.Size);
|
||||
var exception = Record.Exception (() => Assert.Equal (new List<ustring> () { ustring.Empty }, view.TextFormatter.Lines));
|
||||
var exception = Record.Exception (() => Assert.Equal (new List<string> () { string.Empty }, view.TextFormatter.Lines));
|
||||
Assert.Null (exception);
|
||||
expected = @"
|
||||
┌──┐
|
||||
|
||||
@@ -1187,7 +1187,7 @@ namespace Terminal.Gui.ViewTests {
|
||||
if (listLabels.Count > 0)
|
||||
field.Text = listLabels [count - 1].Text;
|
||||
else
|
||||
field.Text = NStack.ustring.Empty;
|
||||
field.Text = string.Empty;
|
||||
}
|
||||
Assert.Equal ($"Absolute({count + 1})", view.Height.ToString ());
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
@@ -984,14 +985,14 @@ Y
|
||||
var horizontalView = new View () {
|
||||
Id = "horizontalView",
|
||||
AutoSize = true,
|
||||
HotKeySpecifier = '_',
|
||||
HotKeySpecifier = (Rune)'_',
|
||||
Text = text
|
||||
};
|
||||
var verticalView = new View () {
|
||||
Id = "verticalView",
|
||||
Y = 3,
|
||||
AutoSize = true,
|
||||
HotKeySpecifier = '_',
|
||||
HotKeySpecifier = (Rune)'_',
|
||||
Text = text,
|
||||
TextDirection = TextDirection.TopBottom_LeftRight
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
using NStack;
|
||||
using System.Text;
|
||||
|
||||
// Alias Console to MockConsole so we don't accidentally use Console
|
||||
using Console = Terminal.Gui.FakeConsole;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using NStack;
|
||||
using System.Text;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Linq;
|
||||
@@ -22,7 +22,7 @@ namespace Terminal.Gui.ViewTests {
|
||||
public void Set_Title_Fires_TitleChanging ()
|
||||
{
|
||||
var r = new View ();
|
||||
Assert.Equal (ustring.Empty, r.Title);
|
||||
Assert.Equal (string.Empty, r.Title);
|
||||
|
||||
string expectedOld = null;
|
||||
string expectedDuring = null;
|
||||
@@ -55,7 +55,7 @@ namespace Terminal.Gui.ViewTests {
|
||||
public void Set_Title_Fires_TitleChanged ()
|
||||
{
|
||||
var r = new View ();
|
||||
Assert.Equal (ustring.Empty, r.Title);
|
||||
Assert.Equal (string.Empty, r.Title);
|
||||
|
||||
string expectedOld = null;
|
||||
string expected = null;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
using NStack;
|
||||
using System.Text;
|
||||
|
||||
// Alias Console to MockConsole so we don't accidentally use Console
|
||||
using Console = Terminal.Gui.FakeConsole;
|
||||
@@ -820,13 +820,13 @@ namespace Terminal.Gui.ViewTests {
|
||||
var horizontalView = new View () {
|
||||
Text = text,
|
||||
AutoSize = true,
|
||||
HotKeySpecifier = '_'
|
||||
HotKeySpecifier = (Rune)'_'
|
||||
};
|
||||
|
||||
var verticalView = new View () {
|
||||
Text = text,
|
||||
AutoSize = true,
|
||||
HotKeySpecifier = '_',
|
||||
HotKeySpecifier = (Rune)'_',
|
||||
TextDirection = TextDirection.TopBottom_LeftRight
|
||||
};
|
||||
Application.Top.Add (horizontalView, verticalView);
|
||||
@@ -1022,7 +1022,7 @@ cccccccccccccccccccc", output);
|
||||
public bool IsKeyDown { get; set; }
|
||||
public bool IsKeyPress { get; set; }
|
||||
public bool IsKeyUp { get; set; }
|
||||
public override ustring Text { get; set; }
|
||||
public override string Text { get; set; }
|
||||
|
||||
public override bool OnKeyDown (KeyEvent keyEvent)
|
||||
{
|
||||
@@ -1051,7 +1051,7 @@ cccccccccccccccccccc", output);
|
||||
if (idx < Text.Length) {
|
||||
var rune = Text [idx];
|
||||
if (rune != '\n') {
|
||||
AddRune (c, r, Text [idx]);
|
||||
AddRune (c, r, (Rune)Text [idx]);
|
||||
}
|
||||
idx++;
|
||||
if (rune == '\n') {
|
||||
|
||||
Reference in New Issue
Block a user