Rename IApplication.Current to TopRunnable

Co-authored-by: tig <585482+tig@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-11-20 19:34:48 +00:00
parent 16b42e86fd
commit 4b975fd5b7
90 changed files with 916 additions and 820 deletions

View File

@@ -13,7 +13,7 @@ internal class FakeApplicationLifecycle (CancellationTokenSource hardStop) : IDi
{
hardStop.Cancel ();
Application.Current?.Dispose ();
Application.TopRunnable?.Dispose ();
Application.Shutdown ();
}
}

View File

@@ -40,13 +40,13 @@ public partial class GuiTestContext
public GuiTestContext Focus<T> (Func<T, bool>? evaluator = null) where T : View
{
evaluator ??= _ => true;
Toplevel? t = App?.Current;
Toplevel? t = App?.TopRunnable;
HashSet<View> seen = new ();
if (t == null)
{
Fail ("Application.Current was null when trying to set focus");
Fail ("Application.TopRunnable was null when trying to set focus");
return this;
}

View File

@@ -14,7 +14,7 @@ public partial class GuiTestContext
{
WaitIteration ((app) =>
{
Toplevel top = app.Current ?? throw new ("Top was null so could not add view");
Toplevel top = app.TopRunnable ?? throw new ("Top was null so could not add view");
top.Add (v);
top.Layout ();
_lastView = v;
@@ -28,15 +28,15 @@ public partial class GuiTestContext
/// <summary>
/// The last view added (e.g. with <see cref="Add"/>) or the root/current top.
/// </summary>
public View LastView => _lastView ?? App?.Current ?? throw new ("Could not determine which view to add to");
public View LastView => _lastView ?? App?.TopRunnable ?? throw new ("Could not determine which view to add to");
private T Find<T> (Func<T, bool> evaluator) where T : View
{
Toplevel? t = App?.Current;
Toplevel? t = App?.TopRunnable;
if (t == null)
{
Fail ("App.Current was null when attempting to find view");
Fail ("App.TopRunnable was null when attempting to find view");
}
T? f = FindRecursive (t!, evaluator);