Fixes #3691 - Adds ViewArrangement.Popover (#3852)

* Added Applicaton.Popover.
Refactored FindDeepestView

* Popover prototype

* Testing highlight

* Fixed click outside issue

* Fixed DialogTests

* Fixed click outside issue (agbain)

* Enabled mouse wheel in Bar

* Enabled mouse wheel in Bar

* Progress. Broke arrangement

* Added popover tests.
Fixed a bunch more CM issues related ot unreliable unit tests.
Updated config.json to include Glyphs.

* Can't set ForceDriver to empty in Resources/config.json.

* added BUGBUG

* Made Position/ScreenPosition clear

* Added View.IsInHierarchy tests

* Added Contextmenuv2 scenario.

* Implemented CM2 in TextView

* Removed unneeded CM stuff from testhelpers

* Shortcut API docs

* Fixed keybinding unit tests

* Fixed mouse handling

* Fighting with CM related unit test failures

* Unit tests pass. I think.

* Shortcut code cleanup

* TextView uses new CM2

* Starting on OnSelect etc...

* Starting on OnSelect etc...

* Fixed ContextMenuv2

* ContextMenu is working again.

* Ugh. ANd fixed button api docs

* Fixed DrawHorizontalShadowTransparent (vertical was already fixed).

* Made Scenarios compatible with #nullable enable

* Undid some keybinding stuff

* Fixed stuff

* Sped up unit tests

* Sped up unit tests 2

* Sped up unit tests 3

* Messing with menus

* merged latest v2_develop

* Added more Popover unit tests

* Added more Popover unit tests2

* Fixed positioning bug

* Fixed mouse bug

* Fixed Bar draw issue

* WIP

* merge v2_develop

* CM2 sorta works

* Enabled Bar subclasses to have IDesignable

* Added ViewportSettings.Transparent

* Region -> nullable enable

* Added ViewportSettigs Editor

* merged v2_develop part 2

* merged v2_develop part 3

* WIP: GetViewsUnderMouse

* WIP: More GetViewsUnderMouse work

* Bars works again

* Added unit tests

* CM now works

* MenuItemv2 POC

* SubMenu POC

* CommandNotBound

* More POC

* Optimize Margin to not defer draw if there's no shadow

* Logger cleanup

* Reverted Generic

* Cascading mostly working

* fixed layout bug

* API docs

* API docs

* Fixed cascade

* Events basically work

* code cleanup

* Fixed IsDefault bug;

* Enabled hotkey support

* Made context-menu-like

* Improved usability

* Refactored ApplicationPopover again

* Cleanup

* Menuv2 POC basically complete

* Code Cleanup

* Made menu API simpler

* Fixed Strings bugs

* Got old ContextMenu scenario mostly working

* ContextMenu scenario now works

* ContextMenu fixes

* ContextMenu fixes

* Tons of menu cleanup

* ContextMenu works in TextView

* Fixed unit tes

* Added unit tests

* Fixed tests

* code cleanup

* More code cleanup

* Deep dive

* scenario

* typos

* Demo colorpicker in a Menu

* Added Region tests proving Region is broken in some Union cases

* fixed v2win/net
This commit is contained in:
Tig
2025-03-29 11:30:52 -06:00
parent e089108e72
commit cabe4115d1
89 changed files with 4438 additions and 911 deletions

View File

@@ -226,10 +226,52 @@ public class ViewCommandTests
#endregion OnHotKey/HotKey tests
#region InvokeCommand Tests
[Fact]
public void InvokeCommand_NotBound_Invokes_CommandNotBound ()
{
ViewEventTester view = new ();
view.InvokeCommand (Command.NotBound);
Assert.False (view.HasFocus);
Assert.Equal (1, view.OnCommandNotBoundCount);
Assert.Equal (1, view.CommandNotBoundCount);
}
[Fact]
public void InvokeCommand_Command_Not_Bound_Invokes_CommandNotBound ()
{
ViewEventTester view = new ();
view.InvokeCommand (Command.New);
Assert.False (view.HasFocus);
Assert.Equal (1, view.OnCommandNotBoundCount);
Assert.Equal (1, view.CommandNotBoundCount);
}
[Fact]
public void InvokeCommand_Command_Bound_Does_Not_Invoke_CommandNotBound ()
{
ViewEventTester view = new ();
view.InvokeCommand (Command.Accept);
Assert.False (view.HasFocus);
Assert.Equal (0, view.OnCommandNotBoundCount);
Assert.Equal (0, view.CommandNotBoundCount);
}
#endregion
public class ViewEventTester : View
{
public ViewEventTester ()
{
Id = "viewEventTester";
CanFocus = true;
Accepting += (s, a) =>
@@ -249,6 +291,12 @@ public class ViewCommandTests
a.Cancel = HandleSelecting;
SelectingCount++;
};
CommandNotBound += (s, a) =>
{
a.Cancel = HandleCommandNotBound;
CommandNotBoundCount++;
};
}
public int OnAcceptedCount { get; set; }
@@ -282,6 +330,8 @@ public class ViewCommandTests
public int OnSelectingCount { get; set; }
public int SelectingCount { get; set; }
public bool HandleOnSelecting { get; set; }
public bool HandleSelecting { get; set; }
/// <inheritdoc/>
protected override bool OnSelecting (CommandEventArgs args)
@@ -291,6 +341,17 @@ public class ViewCommandTests
return HandleOnSelecting;
}
public bool HandleSelecting { get; set; }
public int OnCommandNotBoundCount { get; set; }
public int CommandNotBoundCount { get; set; }
public bool HandleOnCommandNotBound { get; set; }
public bool HandleCommandNotBound { get; set; }
protected override bool OnCommandNotBound (CommandEventArgs args)
{
OnCommandNotBoundCount++;
return HandleOnCommandNotBound;
}
}
}