From 55a8989733f253debffb23ef98bb8fbc28a04610 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 5 Oct 2026 22:14:01 +0000 Subject: [PATCH] fix(app): announce job and transfer states, not progress ticks; smoke tests for the screens - Jobs and sync rows announce a new state with their job or sequence; the update check announces each state, not each download percent. Live regions stay quiet when a recycled row shows another item or a language switch relabels them. - The first-run dialog keeps its chosen card as the window's focused element, so focus starts inside it even before the window is active. - Known-server addresses read left to right in the menu. - Smoke tests: row names and states, row buttons, radio chips, header and cell columns, Workers readout, badge and strip counts, Settings values set elsewhere, German labels never cut, the cache row at 1200 px, no Reset on Advanced, Forget asks first, first-run focus and the RTL window direction. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC --- i18n/en/About.resx | 1 + i18n/en/Jobs.resx | 1 + i18n/en/Server.resx | 1 + i18n/it/About.it.resx | 1 + i18n/it/Jobs.it.resx | 1 + i18n/it/Server.it.resx | 1 + src/Titano.App/Infrastructure/LiveRegion.cs | 16 +- src/Titano.App/Jobs/JobRowViewModel.cs | 4 + src/Titano.App/Sections/AboutView.xaml | 2 +- src/Titano.App/Sections/AboutViewModel.cs | 4 + src/Titano.App/Sections/JobsView.xaml | 5 +- src/Titano.App/Sections/ServerView.xaml | 12 +- src/Titano.App/Sections/SettingsView.xaml | 2 +- src/Titano.App/Sections/WelcomeView.xaml.cs | 7 +- src/Titano.App/Server/SyncRow.cs | 7 +- .../Jobs/JobsScreenSmokeTests.cs | 90 ++++++++ .../Server/ServerScreenSmokeTests.cs | 56 +++++ .../Settings/SettingsScreenSmokeTests.cs | 195 ++++++++++++++++++ 18 files changed, 398 insertions(+), 8 deletions(-) create mode 100644 tests/Titano.App.Tests/Jobs/JobsScreenSmokeTests.cs create mode 100644 tests/Titano.App.Tests/Settings/SettingsScreenSmokeTests.cs diff --git a/i18n/en/About.resx b/i18n/en/About.resx index 37466cd9..fe6b0d73 100644 --- a/i18n/en/About.resx +++ b/i18n/en/About.resx @@ -27,6 +27,7 @@ Download failed Downloading {0:P0} Check failed + Downloading… Download not verified Titano {0} downloaded Show file diff --git a/i18n/en/Jobs.resx b/i18n/en/Jobs.resx index b8ab8847..9e6c4cd8 100644 --- a/i18n/en/Jobs.resx +++ b/i18n/en/Jobs.resx @@ -56,6 +56,7 @@ Pause all Rendering settings {0} · {1} + {0}: {1}invariant Search target or kind {0} fps {0}/s diff --git a/i18n/en/Server.resx b/i18n/en/Server.resx index 341cfbb2..378cdb93 100644 --- a/i18n/en/Server.resx +++ b/i18n/en/Server.resx @@ -182,6 +182,7 @@ {0} uploads queued{0} count {0} received{0} percent Not compared · retrying + {0}: {1}invariant This PC's settings savedlong Search Show file diff --git a/i18n/it/About.it.resx b/i18n/it/About.it.resx index c290af5d..86977362 100644 --- a/i18n/it/About.it.resx +++ b/i18n/it/About.it.resx @@ -27,6 +27,7 @@ Download non riuscito Download in corso {0:P0} Verifica non riuscita + Download in corso… Download non verificato Titano {0} scaricato Mostra file diff --git a/i18n/it/Jobs.it.resx b/i18n/it/Jobs.it.resx index ec6f193b..4524e528 100644 --- a/i18n/it/Jobs.it.resx +++ b/i18n/it/Jobs.it.resx @@ -56,6 +56,7 @@ Sospendi tutte Impostazioni di rendering {0} · {1} + {0}: {1} Cerca oggetto o tipo {0} fps {0}/s diff --git a/i18n/it/Server.it.resx b/i18n/it/Server.it.resx index 148043a7..14baa2bc 100644 --- a/i18n/it/Server.it.resx +++ b/i18n/it/Server.it.resx @@ -179,6 +179,7 @@ {0} caricamenti in coda {0} ricevuto Confronto fallito · riprovo + {0}: {1} Impostazioni di questo PC salvate Cerca Mostra file diff --git a/src/Titano.App/Infrastructure/LiveRegion.cs b/src/Titano.App/Infrastructure/LiveRegion.cs index 3bfdf6e2..c9129e1f 100644 --- a/src/Titano.App/Infrastructure/LiveRegion.cs +++ b/src/Titano.App/Infrastructure/LiveRegion.cs @@ -1,7 +1,9 @@ +using System.Globalization; using System.Windows; using System.Windows.Automation; using System.Windows.Automation.Peers; using System.Windows.Threading; +using Titano.Core.Localization; namespace Titano.App.Infrastructure; @@ -15,6 +17,13 @@ public static class LiveRegion public static readonly DependencyProperty TextProperty = DependencyProperty.RegisterAttached( "Text", typeof(string), typeof(LiveRegion), new PropertyMetadata(null, OnTextChanged)); + /// + /// The data and language the last text came from: a recycled list row showing another item, or every status + /// relabelled by a language switch, is not news. + /// + private static readonly DependencyProperty SourceProperty = DependencyProperty.RegisterAttached( + "Source", typeof(Origin), typeof(LiveRegion), new PropertyMetadata(null)); + public static string? GetText(DependencyObject element) => (string?)element.GetValue(TextProperty); public static void SetText(DependencyObject element, string? value) => element.SetValue(TextProperty, value); @@ -23,10 +32,15 @@ public static class LiveRegion { if (d is not FrameworkElement element) return; AutomationProperties.SetName(element, (string?)e.NewValue ?? string.Empty); + var origin = new Origin(element.DataContext, Loc.Culture); + var sameSource = element.GetValue(SourceProperty) is Origin last && ReferenceEquals(last.Data, origin.Data) && last.Culture.Equals(origin.Culture); + element.SetValue(SourceProperty, origin); // The first value arrives with the screen: only what changes while it is shown is announced, once layout has shown // it (a status that appears with its text is still collapsed when the text arrives). - if (!element.IsLoaded || e.NewValue is null || !AutomationPeer.ListenerExists(AutomationEvents.LiveRegionChanged)) return; + if (!sameSource || !element.IsLoaded || e.NewValue is null || !AutomationPeer.ListenerExists(AutomationEvents.LiveRegionChanged)) return; element.Dispatcher.InvokeAsync(() => UIElementAutomationPeer.CreatePeerForElement(element)?.RaiseAutomationEvent(AutomationEvents.LiveRegionChanged), DispatcherPriority.Background); } + + private sealed record Origin(object? Data, CultureInfo Culture); } diff --git a/src/Titano.App/Jobs/JobRowViewModel.cs b/src/Titano.App/Jobs/JobRowViewModel.cs index 5f9a5e2e..6893f915 100644 --- a/src/Titano.App/Jobs/JobRowViewModel.cs +++ b/src/Titano.App/Jobs/JobRowViewModel.cs @@ -53,6 +53,9 @@ public sealed class JobRowViewModel : ObservableObject public string StateText => JobText.State(_entry); + /// "Render · Harbour sunset: done · 3:00": what a screen reader announces when the state changes (not progress). + public string StateAnnouncement => Loc.L("Jobs.Row.State", AccessibleName, StateText); + /// Glyph and colour of the state (paired with the word, never colour alone). public StatusKind StateKind => _entry.State switch { @@ -131,6 +134,7 @@ public sealed class JobRowViewModel : ObservableObject OnPropertyChanged(nameof(LeftText)); OnPropertyChanged(nameof(WhereText)); OnPropertyChanged(nameof(StateText)); + OnPropertyChanged(nameof(StateAnnouncement)); if (_isExpanded) OnPropertyChanged(nameof(LogText)); } diff --git a/src/Titano.App/Sections/AboutView.xaml b/src/Titano.App/Sections/AboutView.xaml index bf79c9a9..ac29b3b4 100644 --- a/src/Titano.App/Sections/AboutView.xaml +++ b/src/Titano.App/Sections/AboutView.xaml @@ -58,7 +58,7 @@ + AutomationProperties.LiveSetting="Polite" infra:LiveRegion.Text="{Binding UpdateAnnouncement}" />