mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-01 16:59:35 +01:00
Merge branch 'develop' into textview-textfield-isdrirty-fix-2212
This commit is contained in:
@@ -172,5 +172,20 @@ namespace Terminal.Gui.Views {
|
||||
Assert.True (rg.ProcessKey (new KeyEvent (Key.Space, new KeyModifiers ())));
|
||||
Assert.Equal (1, rg.SelectedItem);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ProcessColdKey_HotKey ()
|
||||
{
|
||||
var rg = new RadioGroup (new NStack.ustring [] { "Left", "Right", "Cen_tered", "Justified" });
|
||||
|
||||
Assert.True (rg.ProcessColdKey (new KeyEvent (Key.t, new KeyModifiers ())));
|
||||
Assert.Equal (2, rg.SelectedItem);
|
||||
Assert.True (rg.ProcessColdKey (new KeyEvent (Key.L, new KeyModifiers ())));
|
||||
Assert.Equal (0, rg.SelectedItem);
|
||||
Assert.True (rg.ProcessColdKey (new KeyEvent (Key.J, new KeyModifiers ())));
|
||||
Assert.Equal (3, rg.SelectedItem);
|
||||
Assert.True (rg.ProcessColdKey (new KeyEvent (Key.R, new KeyModifiers ())));
|
||||
Assert.Equal (1, rg.SelectedItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4137,5 +4137,31 @@ This TextFormatter (tf2) is rewritten.
|
||||
text = $"First Line 界\nSecond Line 界\nThird Line 界\n";
|
||||
Assert.Equal (14, TextFormatter.MaxWidthLine (text));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Ustring_Array_Is_Not_Equal_ToRunes_Array_And_String_Array ()
|
||||
{
|
||||
var text = "New Test 你";
|
||||
ustring us = text;
|
||||
string s = text;
|
||||
Assert.Equal (10, us.RuneCount);
|
||||
Assert.Equal (10, s.Length);
|
||||
// The reason is ustring index is related to byte length and not rune length
|
||||
Assert.Equal (12, us.Length);
|
||||
Assert.NotEqual (20320, us [9]);
|
||||
Assert.Equal (20320, s [9]);
|
||||
Assert.Equal (228, us [9]);
|
||||
Assert.Equal ("ä", ((Rune)us [9]).ToString ());
|
||||
Assert.Equal ("你", s [9].ToString ());
|
||||
|
||||
// Rune array is equal to string array
|
||||
var usToRunes = us.ToRunes ();
|
||||
Assert.Equal (10, usToRunes.Length);
|
||||
Assert.Equal (10, s.Length);
|
||||
Assert.Equal (20320, (int)usToRunes [9]);
|
||||
Assert.Equal (20320, s [9]);
|
||||
Assert.Equal ("你", ((Rune)usToRunes [9]).ToString ());
|
||||
Assert.Equal ("你", s [9].ToString ());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4095,5 +4095,27 @@ This is a tes
|
||||
Assert.True (subView1Leave);
|
||||
Assert.False (subView1subView1Leave);
|
||||
}
|
||||
|
||||
[Fact, AutoInitShutdown]
|
||||
public void GetNormalColor_ColorScheme ()
|
||||
{
|
||||
var view = new View { ColorScheme = Colors.Base };
|
||||
|
||||
Assert.Equal (view.ColorScheme.Normal, view.GetNormalColor ());
|
||||
|
||||
view.Enabled = false;
|
||||
Assert.Equal (view.ColorScheme.Disabled, view.GetNormalColor ());
|
||||
}
|
||||
|
||||
[Fact, AutoInitShutdown]
|
||||
public void GetHotNormalColor_ColorScheme ()
|
||||
{
|
||||
var view = new View { ColorScheme = Colors.Base };
|
||||
|
||||
Assert.Equal (view.ColorScheme.HotNormal, view.GetHotNormalColor ());
|
||||
|
||||
view.Enabled = false;
|
||||
Assert.Equal (view.ColorScheme.Disabled, view.GetHotNormalColor ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user