Fixes #2222. RadioGroup first upper case and ProcessColdKey is not working well.

This commit is contained in:
BDisp
2022-11-14 13:22:52 +00:00
parent 9afdc4df3b
commit 8d44217c8a
4 changed files with 82 additions and 5 deletions

View File

@@ -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);
}
}
}

View File

@@ -4062,5 +4062,27 @@ This is a tes
Assert.False (view.IsKeyPress);
Assert.True (view.IsKeyUp);
}
[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 ());
}
}
}