fix(uploader): Start with Windows shows what Task Manager left when the settings open
The Uploader runs for the whole sign-in session and read its sign-in entry only at start, so an entry Task Manager turned off meanwhile still showed as ticked. Opening the settings panel now reads it again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
3 files changed
+41
-4
No files matched your search
@@ -125,6 +125,34 @@ public sealed class UploaderScreenSmokeTests
|
||||
}
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task StartWithWindowsShowsWhatTaskManagerLeftWhenTheSettingsOpen() => ScreenHost.RunAsync(() =>
|
||||
{
|
||||
UiLanguage.Apply("en");
|
||||
var startup = new SignInEntry { IsEnabled = true };
|
||||
var vm = new SampleData().CreateViewModel(startup);
|
||||
Assert.True(vm.StartWithWindows);
|
||||
|
||||
// The Uploader runs for the whole session: Task Manager turns its entry off meanwhile, and the box follows when
|
||||
// the settings open.
|
||||
startup.IsEnabled = false;
|
||||
var changed = new List<string?>();
|
||||
vm.PropertyChanged += (_, e) => changed.Add(e.PropertyName);
|
||||
vm.OpenSettingsCommand.Execute(null);
|
||||
Assert.False(vm.StartWithWindows, "shown as Task Manager left it");
|
||||
Assert.Contains(nameof(MainViewModel.StartWithWindows), changed);
|
||||
vm.CloseSettingsCommand.Execute(null);
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
|
||||
/// <summary>A sign-in entry another program (Task Manager) can turn off.</summary>
|
||||
private sealed class SignInEntry : Titano.Uploader.Infrastructure.IStartupRegistration
|
||||
{
|
||||
public bool IsEnabled { get; set; }
|
||||
|
||||
public void SetEnabled(bool enabled) => IsEnabled = enabled;
|
||||
}
|
||||
|
||||
/// <summary>A <see cref="MainWindow"/> on <see cref="SampleData"/>, shown off screen like <c>--capture</c>.</summary>
|
||||
private sealed class UploaderScreen : IDisposable
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user