mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
* Add collection search matcher * Fix naming * fix naming * Move FileDialogCollectionNavigator to its own file (no longer private class) Add class diagram for collectionNavigation * Add ICollectionNavigator interface * Move to separate file IListCollectionNavigator * Update class diagram * update class diagram * Add tests for overriding ICollectionNavigatorMatcher * xmldoc and nullability warning fixes * Code Cleanup * Make requested changes to naming and terminology * Move to seperate namespace * Update class diagram and change TreeView to reference the interface not concrete class * Switch to implicit new * highlight that this class also works with tree view * Apply tig patch to ensure keybindings get priority over navigator See: https://github.com/gui-cs/Terminal.Gui/issues/4027#issuecomment-2810020893 * Apply 'keybinding has priority' fix to TreeView too * Apply 'keybindngs priority over navigation' fix to TableView * Remove entire branch for selectively returning false now that it is default when there is a keybinding collision * Make classes internal and remove 'custom' navigator that was configured in UICatlaogToplevel * Change logging in collection navigator from Trace to Debug * Switch to NewKeyDownEvent and directly setting HasFocus * Remove application top dependency * Remove references to application * Remove Application * Move new tests to parallel --------- Co-authored-by: Tig <tig@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System.Collections;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using Moq;
|
||||
using UnitTests;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
@@ -1157,34 +1158,4 @@ Item 6",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CollectionNavigatorMatcher_KeybindingsOverrideNavigator ()
|
||||
{
|
||||
Application.Top = new ();
|
||||
|
||||
ObservableCollection<string> source = new () { "apricot", "arm", "bat", "batman", "bates hotel", "candle" };
|
||||
ListView lv = new ListView { Source = new ListWrapper<string> (source) };
|
||||
|
||||
Application.Top.Add (lv);
|
||||
lv.SetFocus ();
|
||||
|
||||
lv.KeyBindings.Add (Key.B, Command.Down);
|
||||
|
||||
Assert.Equal (-1, lv.SelectedItem);
|
||||
|
||||
// Keys should be consumed to move down the navigation i.e. to apricot
|
||||
Assert.True (Application.RaiseKeyDownEvent (Key.B));
|
||||
Assert.Equal (0, lv.SelectedItem);
|
||||
|
||||
Assert.True (Application.RaiseKeyDownEvent (Key.B));
|
||||
Assert.Equal (1, lv.SelectedItem);
|
||||
|
||||
// There is no keybinding for Key.C so it hits collection navigator i.e. we jump to candle
|
||||
Assert.True (Application.RaiseKeyDownEvent (Key.C));
|
||||
Assert.Equal (5, lv.SelectedItem);
|
||||
|
||||
Application.Top.Dispose ();
|
||||
Application.ResetState ();
|
||||
}
|
||||
}
|
||||
@@ -68,11 +68,7 @@ public class TableViewTests (ITestOutputHelper output)
|
||||
|
||||
tv.Table = new DataTableSource (dt);
|
||||
tv.NullSymbol = string.Empty;
|
||||
|
||||
var top = new Toplevel ();
|
||||
top.Add (tv);
|
||||
Application.Begin (top);
|
||||
|
||||
tv.ColorScheme = new ColorScheme ();
|
||||
tv.Draw ();
|
||||
|
||||
var expected =
|
||||
@@ -105,6 +101,8 @@ public class TableViewTests (ITestOutputHelper output)
|
||||
style.ColorGetter = e => { return scheme; };
|
||||
}
|
||||
|
||||
// Required or won't draw properly
|
||||
Application.Driver.Clip = new Region (tv.Frame);
|
||||
tv.SetNeedsDraw ();
|
||||
tv.Draw ();
|
||||
|
||||
@@ -116,7 +114,6 @@ public class TableViewTests (ITestOutputHelper output)
|
||||
01111101101111111110
|
||||
";
|
||||
DriverAssert.AssertDriverAttributesAre (expected, output, Application.Driver, tv.ColorScheme.Normal, color);
|
||||
top.Dispose ();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user