Fixes #4022 file dialog tests and bugfix for cancellation (#4024)

* Add class for detecting information about console in extensible way

* WIP - Create test for reordering

* Change Dictionary to List and preserve TreeBuilder order

* Add test to ensure branch expansion/status remains consistent despite reorder

* Cleanup code

* Fix regression when removed child was the selected one

* Revert "Add class for detecting information about console in extensible way"

This reverts commit 7e4253cf28.

* Code cleanup and enable nullable on Branch

* Remove color scheme and driver from Branch draw

* Add xunit context extensions

* Investigate codegen for xunit

* Getting closer to something that works

* Fix code generation

* Further explore code gen

* Generate all methods in single class for easier extensibility

* Simplify code gen by moving parameter creation to its own method

* Implement asserts A-I

* Add remaining assert calls that are not obsolete

* Fix unit test

* Roll back versions to be compatible with CI version of csharp

* Handle params and ref etc

* Fix null warning

* WIP - start to add integration tests for FileDialog

* Add ability to tab focus to specific control with simple one line delegate

* Clarify test criteria

* Add unit tests for Ok and other ways of canceling dialog

* Fix other buttons also triggering save

* Fix for linux environment tests

* Fix for linux again

* Fix application null race condition - add better way of knowing if stuff is finished

* Better fix for shutdown detection

* Add test that shows #4026 is not an issue

* Switch to `_fileSystem.Directory.GetLogicalDrives ()`

* Don't show duplicate MyDocuments etc
This commit is contained in:
Thomas Nind
2025-04-16 16:25:07 +01:00
committed by Tig
parent 4d87d5f249
commit eaa9ee1ef6
14 changed files with 946 additions and 101 deletions

View File

@@ -1,5 +1,6 @@
using Terminal.Gui;
using TerminalGuiFluentTesting;
using TerminalGuiFluentTestingXunit;
using Xunit.Abstractions;
namespace IntegrationTests.FluentTests;
@@ -33,7 +34,6 @@ public class TreeViewFluentTests
bike = new ("Bike")
]
};
tv.AddObject (root);
using GuiTestContext context =
@@ -46,10 +46,15 @@ public class TreeViewFluentTests
.Then (() => Assert.Null (tv.GetObjectOnRow (1)))
.Right ()
.ScreenShot ("After expanding", _out)
.AssertEqual (root, tv.GetObjectOnRow (0))
.AssertEqual (car, tv.GetObjectOnRow (1))
.AssertEqual (lorry, tv.GetObjectOnRow (2))
.AssertEqual (bike, tv.GetObjectOnRow (3))
.AssertMultiple (
() =>
{
Assert.Equal (root, tv.GetObjectOnRow (0));
Assert.Equal (car, tv.GetObjectOnRow (1));
Assert.Equal (lorry, tv.GetObjectOnRow (2));
Assert.Equal (bike, tv.GetObjectOnRow (3));
})
.AssertIsAssignableFrom <ITreeNode>(tv.SelectedObject)
.Then (
() =>
{
@@ -59,10 +64,14 @@ public class TreeViewFluentTests
})
.WaitIteration ()
.ScreenShot ("After re-order", _out)
.AssertEqual (root, tv.GetObjectOnRow (0))
.AssertEqual (bike, tv.GetObjectOnRow (1))
.AssertEqual (car, tv.GetObjectOnRow (2))
.AssertEqual (lorry, tv.GetObjectOnRow (3))
.AssertMultiple (
() =>
{
Assert.Equal (root, tv.GetObjectOnRow (0));
Assert.Equal (bike, tv.GetObjectOnRow (1));
Assert.Equal (car, tv.GetObjectOnRow (2));
Assert.Equal (lorry, tv.GetObjectOnRow (3));
})
.WriteOutLogs (_out);
context.Stop ();
@@ -128,15 +137,19 @@ public class TreeViewFluentTests
.Add (tv)
.WaitIteration ()
.ScreenShot ("Initial State", _out)
.AssertEqual (root, tv.GetObjectOnRow (0))
.AssertEqual (car, tv.GetObjectOnRow (1))
.AssertEqual (mrA, tv.GetObjectOnRow (2))
.AssertEqual (mrB, tv.GetObjectOnRow (3))
.AssertEqual (lorry, tv.GetObjectOnRow (4))
.AssertEqual (mrC, tv.GetObjectOnRow (5))
.AssertEqual (bike, tv.GetObjectOnRow (6))
.AssertEqual (mrD, tv.GetObjectOnRow (7))
.AssertEqual (mrE, tv.GetObjectOnRow (8))
.AssertMultiple (
() =>
{
Assert.Equal (root, tv.GetObjectOnRow (0));
Assert.Equal (car, tv.GetObjectOnRow (1));
Assert.Equal (mrA, tv.GetObjectOnRow (2));
Assert.Equal (mrB, tv.GetObjectOnRow (3));
Assert.Equal (lorry, tv.GetObjectOnRow (4));
Assert.Equal (mrC, tv.GetObjectOnRow (5));
Assert.Equal (bike, tv.GetObjectOnRow (6));
Assert.Equal (mrD, tv.GetObjectOnRow (7));
Assert.Equal (mrE, tv.GetObjectOnRow (8));
})
.Then (
() =>
{
@@ -146,15 +159,19 @@ public class TreeViewFluentTests
})
.WaitIteration ()
.ScreenShot ("After re-order", _out)
.AssertEqual (root, tv.GetObjectOnRow (0))
.AssertEqual (bike, tv.GetObjectOnRow (1))
.AssertEqual (mrD, tv.GetObjectOnRow (2))
.AssertEqual (mrE, tv.GetObjectOnRow (3))
.AssertEqual (car, tv.GetObjectOnRow (4))
.AssertEqual (mrA, tv.GetObjectOnRow (5))
.AssertEqual (mrB, tv.GetObjectOnRow (6))
.AssertEqual (lorry, tv.GetObjectOnRow (7))
.AssertEqual (mrC, tv.GetObjectOnRow (8))
.AssertMultiple (
() =>
{
Assert.Equal (root, tv.GetObjectOnRow (0));
Assert.Equal (bike, tv.GetObjectOnRow (1));
Assert.Equal (mrD, tv.GetObjectOnRow (2));
Assert.Equal (mrE, tv.GetObjectOnRow (3));
Assert.Equal (car, tv.GetObjectOnRow (4));
Assert.Equal (mrA, tv.GetObjectOnRow (5));
Assert.Equal (mrB, tv.GetObjectOnRow (6));
Assert.Equal (lorry, tv.GetObjectOnRow (7));
Assert.Equal (mrC, tv.GetObjectOnRow (8));
})
.WriteOutLogs (_out);
context.Stop ();