Skip to content
Closed
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions src/ui/Features/Translate/TranslateSettingsWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public TranslateSettingsWindow(TranslateSettingsViewModel vm)
TextWrapping = Avalonia.Media.TextWrapping.Wrap,
}.BindIsVisible(vm, nameof(vm.PromptIsVisible))
.BindText(vm, nameof(vm.PromptText));
promptTextBox.WithLabeledBy(labelPrompt);

var buttonOk = UiUtil.MakeButtonOk(vm.OkCommand);
var buttonCancel = UiUtil.MakeButtonCancel(vm.CancelCommand);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@

var searchBox = new TextBox
{
Watermark = Se.Language.Video.TextToSpeech.SearchVoices,

Check warning on line 219 in src/ui/Features/Video/TextToSpeech/VoiceManager/VoiceManagerWindow.cs

View workflow job for this annotation

GitHub Actions / test

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

Check warning on line 219 in src/ui/Features/Video/TextToSpeech/VoiceManager/VoiceManagerWindow.cs

View workflow job for this annotation

GitHub Actions / test

'TextBox.Watermark' is obsolete: 'Use PlaceholderText instead.'
MinWidth = 180,
VerticalAlignment = VerticalAlignment.Center,
[!TextBox.TextProperty] = new Binding(nameof(vm.FilterText)) { Mode = BindingMode.TwoWay },
Expand Down Expand Up @@ -504,6 +504,7 @@
HorizontalAlignment = HorizontalAlignment.Stretch,
[!TextBox.TextProperty] = new Binding(nameof(vm.Transcript)) { Mode = BindingMode.TwoWay },
};
transcriptBox.WithLabeledBy(transcriptHeader);

var transcriptPanel = new StackPanel
{
Expand Down
29 changes: 13 additions & 16 deletions tests/UI/Logic/AccessibleNamesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
/// by the window or derived from its visible label by <see cref="AccessibleLabels"/>
/// (#12087: "I hear a value followed by combo box, but no label telling me which setting
/// I am changing"). This opens every tool window that takes a single DI-resolvable view
/// model and lists the inputs that still have no name.
/// model and lists the inputs that still have no name. Hidden inputs are included because
/// AccessibleLabels.Apply runs once when the window loads; controls that become visible later
/// do not get a second inference pass.
/// </summary>
public class AccessibleNamesTests
{
Expand All @@ -43,6 +45,7 @@
.ToList();

var unnamed = new StringBuilder();
var openFailures = new StringBuilder();
var opened = 0;
var skipped = new List<string>();
foreach (var type in windowTypes)
Expand Down Expand Up @@ -71,7 +74,8 @@
}
catch (Exception e)
{
skipped.Add($"{type.Name} ({(e as TargetInvocationException)?.InnerException?.GetType().Name ?? e.GetType().Name})");
var cause = (e as TargetInvocationException)?.InnerException ?? e;
openFailures.AppendLine($"{type.Name}: {cause.GetType().Name}: {cause.Message}");
continue;
}

Expand All @@ -80,7 +84,7 @@
{
foreach (var control in window.GetLogicalDescendants().OfType<Control>())
{
if (!AccessibleLabels.IsInput(control) || control.TemplatedParent != null || !control.IsEffectivelyVisible)
if (!AccessibleLabels.IsInput(control) || control.TemplatedParent != null)
{
continue;
}
Expand All @@ -99,27 +103,20 @@
}
}

Assert.True(openFailures.Length == 0, $"Windows that failed to open:\n{openFailures}");
Assert.True(opened > 50, $"Only {opened} windows opened; skipped: {string.Join(", ", skipped)}");
Assert.True(unnamed.Length == 0, $"Inputs without an accessible name ({opened} windows opened, {skipped.Count} skipped):\n{unnamed}");
}

/// <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. Unexpected dispatcher failures must fail the test;
/// the Video OCR closed-owner race that previously required suppression is now fixed
/// at the source by checking whether its window is already closing before showing the
/// message box (upstream 6840e797).
/// </summary>
private static void DrainJobs()
{
try
{
Dispatcher.UIThread.RunJobs();
}
catch (Exception)
{
// Ignored - see summary.
}
Dispatcher.UIThread.RunJobs();
}

private static string Describe(Control control)
Expand All @@ -130,9 +127,9 @@
parts.Add($"name={control.Name}");
}

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

Check warning on line 130 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 132 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