DESK-1: SyncHost's dispose, session switch and stop now continue on the thread pool (ConfigureAwait(false)) and keep the running agent in one reference. A signed-in user whose archive is not polled no longer waits 10 s at every exit, after which the job engine and the index were never closed. DESK-7: ShellViewModel.Dispose disposes the Sequence section first, so the open editor stops its runners and closes its source before the engine and the index go. DESK-8: Cancel stays available while the server answers a sign-in. It now cancels the request; an answer that still arrives changes nothing (the connection flow ignores answers for a client it dropped), and a sign-in that completed just before the cancel was handled is signed out again. The form no longer sets a result after it closed, and an unexpected failure shows inline instead of escaping async void. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
54 lines
2.0 KiB
C#
54 lines
2.0 KiB
C#
using Titano.App.DesignTime;
|
|
using Titano.App.Infrastructure;
|
|
using Titano.App.Shell;
|
|
using Titano.Testing;
|
|
using Titano.Ui.Theming;
|
|
|
|
namespace Titano.App.Tests.Windows;
|
|
|
|
/// <summary>What the shell stops when the app exits (App.OnExit disposes it before the services).</summary>
|
|
[WindowsOnly]
|
|
[Serial]
|
|
[Timeout(120_000)]
|
|
public sealed class ShellLifetimeTests
|
|
{
|
|
private sealed class NoDialogs : IAppDialogs
|
|
{
|
|
public string? PickFolder(string title, string? initialFolder = null) => null;
|
|
public string? PickJsonFile(string title) => null;
|
|
public bool Confirm(ConfirmRequest request) => false;
|
|
public bool SignIn(string server, string? username, Func<string, string, Task<string?>> signIn) => false;
|
|
}
|
|
|
|
/// <summary>DESK-7: the open editor goes with the shell, before the engine and the index under it.</summary>
|
|
[Test]
|
|
public Task DisposingTheShellClosesTheOpenEditor() => ScreenHost.RunAsync(async () =>
|
|
{
|
|
var environment = AppEnvironment.ForCapture();
|
|
UiLanguage.Apply("en");
|
|
ThemeManager.Apply(AppTheme.Dark);
|
|
var services = new AppServices(environment, new AppSettings { Language = "en", FirstRunCompleted = true }, () => { }, new NoDialogs());
|
|
try
|
|
{
|
|
var sample = SampleData.Configure(services);
|
|
var shell = new ShellViewModel(services);
|
|
await sample.OpenEmptyAsync();
|
|
await shell.StartAsync();
|
|
var id = await sample.FillEditorAsync();
|
|
shell.OpenSequence(id);
|
|
await shell.Sequence.OpenAsync(id);
|
|
var editor = Assert.NotNull(shell.Sequence.Editor);
|
|
editor.PlayCommand.Execute(null);
|
|
Assert.True(editor.IsPlaying, "the editor plays");
|
|
|
|
shell.Dispose();
|
|
Assert.False(editor.IsPlaying, "the editor's player stopped with the shell");
|
|
}
|
|
finally
|
|
{
|
|
await services.DisposeAsync();
|
|
environment.DeleteCaptureData();
|
|
}
|
|
});
|
|
}
|