WIP: More refining

This commit is contained in:
Tig
2024-07-29 10:17:10 -04:00
parent 65592b4135
commit f2eb9ce6e2
24 changed files with 149 additions and 96 deletions

View File

@@ -815,7 +815,7 @@ Three ",
cb.SetSource (source);
var top = new Toplevel ();
top.Add (cb);
top.FocusFirst ();
top.FocusFirst (null);
Assert.Equal (-1, cb.SelectedItem);
Assert.Equal (string.Empty, cb.Text);
var opened = false;
@@ -845,7 +845,7 @@ Three ",
Assert.True (cb.NewKeyDownEvent (Key.CursorDown)); // losing focus
Assert.False (cb.IsShow);
Assert.False (cb.HasFocus);
top.FocusFirst (); // Gets focus again
top.FocusFirst (null); // Gets focus again
Assert.False (cb.IsShow);
Assert.True (cb.HasFocus);
cb.Expand ();
@@ -954,7 +954,7 @@ Three
Assert.False (cb.IsShow);
Assert.Equal (-1, cb.SelectedItem);
Assert.Equal ("One", cb.Text);
top.FocusFirst (); // Gets focus again
top.FocusFirst (null); // Gets focus again
Assert.True (cb.HasFocus);
Assert.False (cb.IsShow);
Assert.Equal (-1, cb.SelectedItem);
@@ -974,7 +974,7 @@ Three
var cb = new ComboBox ();
var top = new Toplevel ();
top.Add (cb);
top.FocusFirst ();
top.FocusFirst (null);
Assert.Null (cb.Source);
Assert.Equal (-1, cb.SelectedItem);
ObservableCollection<string> source = [];

View File

@@ -616,7 +616,7 @@ public class TableViewTests (ITestOutputHelper output)
top.Add (tableView);
Application.Begin (top);
top.FocusFirst ();
top.FocusFirst (null);
Assert.True (tableView.HasFocus);
Assert.Equal (0, tableView.RowOffset);
@@ -1606,7 +1606,7 @@ public class TableViewTests (ITestOutputHelper output)
top.Add (tv);
Application.Begin (top);
top.FocusFirst ();
top.FocusFirst (null);
Assert.True (tv.HasFocus);
// already on fish

View File

@@ -78,7 +78,7 @@ public class TextFieldTests (ITestOutputHelper output)
public void Cancel_TextChanging_ThenBackspace ()
{
var tf = new TextField ();
tf.FocusFirstOrLast ();
tf.RestoreFocus ();
tf.NewKeyDownEvent (Key.A.WithShift);
Assert.Equal ("A", tf.Text);
@@ -929,7 +929,7 @@ public class TextFieldTests (ITestOutputHelper output)
public void Backspace_From_End ()
{
var tf = new TextField { Text = "ABC" };
tf.FocusFirstOrLast ();
tf.RestoreFocus ();
Assert.Equal ("ABC", tf.Text);
tf.BeginInit ();
tf.EndInit ();
@@ -956,7 +956,7 @@ public class TextFieldTests (ITestOutputHelper output)
public void Backspace_From_Middle ()
{
var tf = new TextField { Text = "ABC" };
tf.FocusFirstOrLast ();
tf.RestoreFocus ();
tf.CursorPosition = 2;
Assert.Equal ("ABC", tf.Text);

View File

@@ -289,7 +289,7 @@ public class TreeTableSourceTests : IDisposable
var top = new Toplevel ();
top.Add (tableView);
top.FocusFirstOrLast ();
top.RestoreFocus ();
Assert.Equal (tableView, top.MostFocused);
return tableView;