Files
Chronos/tests/Titano.App.Tests/Uploader/WatchFolderViewModelTests.cs
T
Claude 1187c36d66 fix(uploader): follow right-to-left languages, name and reach every control by keyboard
Uploader:
- Mirror the main window, the confirmation dialog and the tray menu for ar/he/fa/ur; keep paths, addresses,
  file names, the fingerprint, the brand mark and media glyphs left to right.
- Queue rows take keyboard focus, are named "file · state" for screen readers, and Enter retries a failed
  file; a "✕ n failed" link jumps to the first failure; the list follows the upload near its top.
- Focus moves into the settings panel (Tab cycles inside) and back to the gear, to Browse after sign-in and
  to the refused field after a failed one; activity changes and sign-in errors are announced.
- A wrong address or password marks its field (error border, message in the tooltip); Retry only where it
  can help; session-ended toasts offer Sign in; the form stays visible while its own sign-in runs.
- Watch chips and the add button wrap and shorten long paths; target choices wrap with their fields; the
  settings panel uses the side-panel width with wrapping labels; disabled controls say why.
- The window opens at 760x700 (min 630 high) so the per-file list shows five rows; --capture adds an
  Arabic pass.

Setup:
- Every stage has a default and a cancel button (safe action first), the keyboard moves to the new
  default and outcomes are announced; the title-bar Close is disabled while files are written.
- "Remove my data" measures the user data folder and shows the plan (largest entries, total) before
  Uninstall can run; the tooltip names backups and the uploader queue.
- Folder field before Browse in Tab order; paths and file names left to right; disabled tooltips say why.

Both: byte units come from the language (Common.Size.*).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
2026-10-03 17:14:54 +00:00

53 lines
2.1 KiB
C#

using Titano.Core.Localization;
using Titano.Testing;
using Titano.Uploader.Shell;
using Titano.Uploader.Text;
namespace Titano.App.Tests.Uploader;
/// <summary>A watch-folder chip shows the path (which it may shorten) and the interval apart; the tooltip carries the whole path.</summary>
public sealed class WatchFolderViewModelTests
{
private const string Path = @"\\garage-pi\cam";
[Test]
public void TheChipNamesThePathAndTheInterval()
{
var chip = Chip(isNetwork: false);
var interval = UploaderText.Duration(TimeSpan.FromMinutes(5), Loc.Culture);
Assert.Equal(Loc.L("Uploader.Watch.Interval", interval), chip.IntervalText);
Assert.Equal(Loc.L("Uploader.Watch.Chip", Path, interval), chip.Text);
}
[Test]
public void TheTooltipStartsWithTheWholePathKeptLeftToRight()
{
var interval = UploaderText.Duration(TimeSpan.FromMinutes(5), Loc.Culture);
var embedded = "\u202A" + Path + "\u202C · ";
Assert.Equal(embedded + Loc.L("Tooltips.Uploader.WatchFolder", interval), Chip(isNetwork: false).ToolTip);
Assert.Equal(embedded + Loc.L("Tooltips.Uploader.WatchFolderNetwork", interval), Chip(isNetwork: true).ToolTip);
var missing = Chip(isNetwork: true);
missing.IsAvailable = false;
Assert.Equal(embedded + Loc.L("Tooltips.Uploader.WatchFolderMissing", interval), missing.ToolTip);
}
[Test]
public void ANewIntervalRefreshesTheChip()
{
var chip = Chip(isNetwork: false);
var changed = new List<string?>();
chip.PropertyChanged += (_, e) => changed.Add(e.PropertyName);
chip.IntervalSeconds = 60;
Assert.Contains(nameof(WatchFolderViewModel.IntervalText), changed);
Assert.Contains(nameof(WatchFolderViewModel.Text), changed);
Assert.Contains(nameof(WatchFolderViewModel.ToolTip), changed);
Assert.Equal(Loc.L("Uploader.Watch.Interval", UploaderText.Duration(TimeSpan.FromMinutes(1), Loc.Culture)), chip.IntervalText);
}
private static WatchFolderViewModel Chip(bool isNetwork) => new(Path, 300, isNetwork, (_, _) => { }, _ => { });
}