Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions tests/UI/Logic/AccessibleNamesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,21 +104,22 @@
}

/// <summary>
/// Runs pending dispatcher jobs, ignoring what they throw. Some view models probe media
/// on a background thread from Loaded and post a message box back (Video OCR: "unable
/// to read video"); when that post lands after the window is closed, showing the box
/// throws "Cannot show a window with a closed owner" - a timing artifact of opening
/// windows without files, not an accessibility finding.
/// Runs pending dispatcher jobs, tolerating only the known closed-owner race. Some view
/// models probe media on a background thread from Loaded and post a message box back (Video
/// OCR: "unable to read video"); when that post lands after the window is closed, Avalonia
/// throws "Cannot show a window with a closed owner" - a timing artifact of opening windows
/// without files, not an accessibility finding. Other dispatcher failures must still fail
/// the test instead of being hidden.
/// </summary>
private static void DrainJobs()
{
try
{
Dispatcher.UIThread.RunJobs();
}
catch (Exception)
catch (InvalidOperationException ex) when (ex.Message == "Cannot show a window with a closed owner.")
{
// Ignored - see summary.
// Expected headless-test race - see summary.
}
}

Expand All @@ -130,9 +131,9 @@
parts.Add($"name={control.Name}");
}

if (control is TextBox textBox && !string.IsNullOrEmpty(textBox.Watermark))

Check warning on line 134 in tests/UI/Logic/AccessibleNamesTests.cs

View workflow job for this annotation

GitHub Actions / test

'TextBox.Watermark' is obsolete: 'Use PlaceholderText instead.'
{
parts.Add($"watermark={textBox.Watermark}");

Check warning on line 136 in tests/UI/Logic/AccessibleNamesTests.cs

View workflow job for this annotation

GitHub Actions / test

'TextBox.Watermark' is obsolete: 'Use PlaceholderText instead.'
}

var parent = control.Parent;
Expand Down
Loading