test(app): screen smoke tests and thumbnail decoding on Windows

Every screen is rendered from the --capture sample data in an off-screen
main window in both themes; thumbnails are decoded from embedded previews
with orientation. The sign-in flow now stores the login token on every
IServerApi, and thumbnail pending loads include index lookups so capture
waits for them. A cancelled-load test no longer depends on scheduling.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-02 12:40:57 +00:00
1 parent ffbea7cb74
commit 8d4b00aceb
6 files changed
+461 -9

No files matched your search

+23 -6
View File
@@ -28,6 +28,7 @@ public sealed class ThumbnailService : IDisposable
private readonly ThumbnailCache<ThumbnailKey, ImageSource> _cache;
private readonly ConcurrentDictionary<Guid, string?> _archiveRoots = new();
private readonly ConcurrentDictionary<Guid, Guid?> _firstFrames = new();
private int _requests;
public ThumbnailService(TitanoDatabase db, int capacity)
{
@@ -37,8 +38,8 @@ public sealed class ThumbnailService : IDisposable
public int Count => _cache.Count;
/// <summary>Decodes in flight (capture waits for them).</summary>
public int PendingLoads => _cache.PendingLoads;
/// <summary>Thumbnail requests in flight, index lookups included (capture and tests wait for them).</summary>
public int PendingLoads => Math.Max(Volatile.Read(ref _requests), _cache.PendingLoads);
/// <summary>Maximum thumbnails kept in memory (Settings › Storage).</summary>
public int Capacity
@@ -50,15 +51,31 @@ public sealed class ThumbnailService : IDisposable
/// <summary>The hero thumbnail of a sequence: its hero frame, or the first frame.</summary>
public async Task<ImageSource?> HeroAsync(Sequence sequence, int pixelWidth, CancellationToken ct)
{
var frameId = sequence.HeroFrameId ?? await FirstFrameAsync(sequence.Id, ct).ConfigureAwait(false);
return frameId is { } id ? await _cache.GetAsync(Key(id, pixelWidth), ct).ConfigureAwait(false) : null;
Interlocked.Increment(ref _requests);
try
{
var frameId = sequence.HeroFrameId ?? await FirstFrameAsync(sequence.Id, ct).ConfigureAwait(false);
return frameId is { } id ? await _cache.GetAsync(Key(id, pixelWidth), ct).ConfigureAwait(false) : null;
}
finally
{
Interlocked.Decrement(ref _requests);
}
}
/// <summary>A frame of a sequence by index (hover scrubbing).</summary>
public async Task<ImageSource?> FrameAsync(Guid sequenceId, int index, int pixelWidth, CancellationToken ct)
{
var frames = await _db.Frames.ListBySequenceAsync(sequenceId, index - 1, 1, ct).ConfigureAwait(false);
return frames.Count == 0 ? null : await _cache.GetAsync(Key(frames[0].Id, pixelWidth), ct).ConfigureAwait(false);
Interlocked.Increment(ref _requests);
try
{
var frames = await _db.Frames.ListBySequenceAsync(sequenceId, index - 1, 1, ct).ConfigureAwait(false);
return frames.Count == 0 ? null : await _cache.GetAsync(Key(frames[0].Id, pixelWidth), ct).ConfigureAwait(false);
}
finally
{
Interlocked.Decrement(ref _requests);
}
}
/// <summary>Hover-scrub frames of a sequence, sampled to at most <paramref name="positions"/> positions.</summary>
+2
View File
@@ -141,6 +141,8 @@ public sealed class ConnectFlow(IServerApiFactory factory, ITrustStore trust) :
{
var login = await _api.LoginAsync(username.Trim(), password, ct);
if (login.Token is null) return Retry(ConnectError.BadCredentials);
// TitanoClient keeps the token itself; set it explicitly so every IServerApi behaves the same.
_api.Token = login.Token;
User = login.User;
return Set(ConnectStep.Connected, ConnectError.None);
}