Fixes #4076 cursor text field (#4077)

* Add test for TextField cursor position

* Add comment and one more assert

* Fix cursor position at the end

* Remove unused local field

---------

Co-authored-by: BDisp <bd.bdisp@gmail.com>
This commit is contained in:
Thomas Nind
2025-05-11 23:29:22 +01:00
committed by Tig
parent 6f6c2d3320
commit 38c6f385f1
6 changed files with 97 additions and 5 deletions

View File

@@ -1,4 +1,5 @@
using TerminalGuiFluentTesting;
using System.Drawing;
using TerminalGuiFluentTesting;
using Xunit;
namespace TerminalGuiFluentTestingXunit;
@@ -6,4 +7,27 @@ namespace TerminalGuiFluentTestingXunit;
public static partial class XunitContextExtensions
{
// Placeholder
/// <summary>
/// Asserts that the last set cursor position matches <paramref name="expected"/>
/// </summary>
/// <param name="context"></param>
/// <param name="expected"></param>
/// <returns></returns>
public static GuiTestContext AssertCursorPosition (this GuiTestContext context, Point expected)
{
try
{
Assert.Equal (expected, context.GetCursorPosition ());
}
catch (Exception)
{
context.HardStop ();
throw;
}
return context;
}
}