Partial on #2975 - Replaces Menu v1 in many places with v2 (#4040)

* touching publish.yml

* Fixed UICatalog bugs. Added fluent tests.

* marked v1 menu stuff as obsolte

* Tweaks.
Added View.GetSubMenus<type>().

* fixed unit tests

* general messing around

* general messing around

* Playing with Fluent

* ColorScheme tweaks

* WIP: ColorScheme tweaks

* Playing with Fluent

* Merged from laptop2

* Hacky-ish fixes to:
- #4016
- #4014

* Fixed Region bug preventing menus without borders from working

* Tweaks

* Fixed a bunch of CM issues

* Fixed OoptionSelector

* ip

* FixedCM issues

* Fixed CM issues2

* Revert "FixedCM issues"

This reverts commit dd6c6a70a3.

* Reverted stuff

* Found and fixed bug in AllViews_Center_Properly

* Fixed CM issues2

* removed menuv2 onapplied.
Changed how UICatalog Applys CM

* changed test time out to see if it helkps with ubuntu fails

* reset app on fail?

* back to 1500ms

* Made StatusBar nullable.

* Code Cleanup.

* HexEditor Code Cleanup.

* HexEditor Code Cleanup.

* Back to 3000ms. Sigh.

* Trying different logic

* Trying different logic2

* Fixed potential crash in runlop

* Fixed potential crash in runlop2

* Tweaked Spinner stuff

* Removed TabView from TextEffects scenario. Not needed and possible culprit.

* back to 2000ms

* WIP: Revamping menu scenarios

* Menu Scenario refinements.
Fixed a few bugs.
Code cleanup.

* fixed unit test

* Fixed warnings

* Fixed warnings2

* Fixed File.Exit

* WIP: Dealing with QuitKey struggles

* WIP: Dealing with QuitKey struggles 2

* WIP: Dealing with QuitKey struggles 3

* Fixed ListView collection nav bug

* Fixed a bunch of menu stuff.
Fixed Appv2 stuff.

* Lots of refactoring and fixing

* Lots of unit test issues

* Fixed DebugIDisposable issues

* Fixed release build issue

* Fixed release build issue 2

* DebugIDisposable -> EnableDebugIDisposableAsserts and more

* DebugIDisposable -> EnableDebugIDisposableAsserts and more 2

* Fixed Menus scenario - context menu

* Added @bdisp suggested assert. Commented it out as it breaks tests.

* Code cleanup

* Fixed disposed but

* Fixed UICatalog exit

* Fixed Unit test I broke.
Added 'Minimal' Theme that turns off all borders etc...
This commit is contained in:
Tig
2025-04-24 05:17:58 -06:00
committed by GitHub
parent 8d3d039fb3
commit 47bcf1bf57
136 changed files with 5109 additions and 2214 deletions

View File

@@ -11,7 +11,10 @@ public class FileDialogFluentTests
{
private readonly TextWriter _out;
public FileDialogFluentTests (ITestOutputHelper outputHelper) { _out = new TestOutputWriter (outputHelper); }
public FileDialogFluentTests (ITestOutputHelper outputHelper)
{
_out = new TestOutputWriter (outputHelper);
}
private MockFileSystem CreateExampleFileSystem ()
{
@@ -41,27 +44,25 @@ public class FileDialogFluentTests
[ClassData (typeof (V2TestDrivers))]
public void CancelFileDialog_UsingEscape (V2TestDriver d)
{
var sd = new SaveDialog ( CreateExampleFileSystem ());
var sd = new SaveDialog (CreateExampleFileSystem ());
using var c = With.A (sd, 100, 20, d)
.ScreenShot ("Save dialog",_out)
.Escape()
.ScreenShot ("Save dialog", _out)
.Escape ()
.Then (() => Assert.True (sd.Canceled))
.Stop ();
Assert.True (sd.Canceled);
}
[Theory]
[ClassData (typeof (V2TestDrivers))]
public void CancelFileDialog_UsingCancelButton_TabThenEnter (V2TestDriver d)
{
var sd = new SaveDialog (CreateExampleFileSystem ());
var sd = new SaveDialog (CreateExampleFileSystem ()) { Modal = false };
using var c = With.A (sd, 100, 20, d)
.ScreenShot ("Save dialog", _out)
.Focus <Button>(b=> b.Text == "_Cancel")
.Focus<Button> (b => b.Text == "_Cancel")
.Then (() => Assert.True (sd.Canceled))
.Enter ()
.Stop ();
Assert.True (sd.Canceled);
}
[Theory]
@@ -69,13 +70,13 @@ public class FileDialogFluentTests
public void CancelFileDialog_UsingCancelButton_LeftClickButton (V2TestDriver d)
{
var sd = new SaveDialog (CreateExampleFileSystem ());
using var c = With.A (sd, 100, 20, d)
.ScreenShot ("Save dialog", _out)
.LeftClick <Button> (b => b.Text == "_Cancel")
.Stop ()
.WriteOutLogs (_out);
Assert.True (sd.Canceled);
.LeftClick<Button> (b => b.Text == "_Cancel")
.WriteOutLogs (_out)
.Then (() => Assert.True (sd.Canceled))
.Stop ();
}
[Theory]
[ClassData (typeof (V2TestDrivers))]
@@ -86,9 +87,8 @@ public class FileDialogFluentTests
.ScreenShot ("Save dialog", _out)
.Send (Key.C.WithAlt)
.WriteOutLogs (_out)
.Then (() => Assert.True (sd.Canceled))
.Stop ();
Assert.True (sd.Canceled);
}
[Theory]
@@ -101,10 +101,9 @@ public class FileDialogFluentTests
.ScreenShot ("Save dialog", _out)
.LeftClick<Button> (b => b.Text == "_Save")
.WriteOutLogs (_out)
.Then (() => Assert.False (sd.Canceled))
.Then (() => AssertIsFileSystemRoot (fs, sd))
.Stop ();
Assert.False (sd.Canceled);
AssertIsFileSystemRoot (fs, sd);
}
[Theory]
@@ -117,10 +116,10 @@ public class FileDialogFluentTests
.ScreenShot ("Save dialog", _out)
.Send (Key.S.WithAlt)
.WriteOutLogs (_out)
.Then (() => Assert.False (sd.Canceled))
.Then (() => AssertIsFileSystemRoot (fs, sd))
.Stop ();
Assert.False (sd.Canceled);
AssertIsFileSystemRoot (fs, sd);
}
[Theory]
@@ -128,16 +127,15 @@ public class FileDialogFluentTests
public void SaveFileDialog_UsingOkButton_TabEnter (V2TestDriver d)
{
var fs = CreateExampleFileSystem ();
var sd = new SaveDialog (fs);
var sd = new SaveDialog (fs) { Modal = false };
using var c = With.A (sd, 100, 20, d)
.ScreenShot ("Save dialog", _out)
.Focus <Button> (b => b.Text == "_Save")
.Focus<Button> (b => b.Text == "_Save")
.Enter ()
.WriteOutLogs (_out)
.Then (() => Assert.False (sd.Canceled))
.Then (() => AssertIsFileSystemRoot (fs, sd))
.Stop ();
Assert.False (sd.Canceled);
AssertIsFileSystemRoot (fs,sd);
}
private void AssertIsFileSystemRoot (IFileSystem fs, SaveDialog sd)
@@ -155,43 +153,40 @@ public class FileDialogFluentTests
[ClassData (typeof (V2TestDrivers))]
public void SaveFileDialog_PressingPopTree_ShouldNotChangeCancel (V2TestDriver d)
{
var sd = new SaveDialog (CreateExampleFileSystem ()) { Modal = true };
var sd = new SaveDialog (CreateExampleFileSystem ()) { Modal = false };
using var c = With.A (sd, 100, 20, d)
.ScreenShot ("Save dialog", _out)
.AssertTrue (sd.Canceled)
.Then (() => Assert.True (sd.Canceled))
.Focus<Button> (b => b.Text == "►►")
.Enter ()
.ScreenShot ("After pop tree", _out)
.AssertTrue (sd.Canceled)
.WriteOutLogs (_out)
.Then (() => Assert.True (sd.Canceled))
.Stop ();
Assert.True(sd.Canceled);
}
[Theory]
[ClassData (typeof (V2TestDrivers))]
public void SaveFileDialog_PopTree_AndNavigate (V2TestDriver d)
{
var sd = new SaveDialog (CreateExampleFileSystem ()) { Modal = true };
var sd = new SaveDialog (CreateExampleFileSystem ()) { Modal = false };
using var c = With.A (sd, 100, 20, d)
.ScreenShot ("Save dialog", _out)
.AssertTrue (sd.Canceled)
.LeftClick <Button> (b => b.Text == "►►")
.Then (() => Assert.True (sd.Canceled))
.LeftClick<Button> (b => b.Text == "►►")
.ScreenShot ("After pop tree", _out)
.Focus <TreeView<IFileSystemInfo>> (_ => true)
.Focus<TreeView<IFileSystemInfo>> (_ => true)
.Right ()
.ScreenShot ("After expand tree", _out)
.Down ()
.ScreenShot ("After navigate down in tree", _out)
.Enter ()
.WaitIteration ()
.AssertFalse (sd.Canceled)
.Then (() => Assert.False (sd.Canceled))
.AssertContains ("empty-dir", sd.FileName)
.WriteOutLogs (_out)
.Stop ();
Assert.False (sd.Canceled);
}
}