fix(import): keep a server rename on re-import and show multi-day sessions

A whole folder imported again to the server sent its folder name as the
sequence title on every run, undoing a rename made on the server. The
sink now sends a typed title as before, but the folder's default name
only to a sequence that has no title yet (it reads the sequence first).
The archive already applied a title only when it created the sequence.

A session that ends on another day, as a whole folder often does,
showed only its first date ("28/09/2026 · 18:02 → 18:05"), which read
as a few minutes on one day. Its plan row and Show plan heading now
show both dates, from two new invariant resources (with the
right-to-left arrow).

The Gap and Minimum boxes now show their tooltip while disabled, so the
reason Whole folder turns them off reaches them, not only the Sessions
check box. Doc comments that said a merge needs the same camera now
mention the whole-folder rule.

Tests: a server whole-folder import run twice keeps the server's rename
and still applies a typed title; multi-day time text in both reading
directions; and the Import view model's Group rules (folder only, cards
planned by sessions, switching drops splits, tooltips say why).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-10-26 23:33:16 +01:00
1 parent a34b33d50b
commit a809416199
13 files changed
+181 -25

No files matched your search

@@ -9,6 +9,7 @@ using Chronos.App.Infrastructure;
using Chronos.App.Sections;
using Chronos.App.Shell;
using Chronos.App.Tests.Windows;
using Chronos.Core.Import;
using Chronos.Core.Localization;
using Chronos.Testing;
using Chronos.Ui.Controls;
@@ -222,6 +223,75 @@ public sealed class ImportScreenSmokeTests
await import.WaitForPlanAsync();
});
/// <summary>
/// "Group" (BRIEF §12.4) is offered for a picked folder only, and a card is always planned by sessions. Switching the
/// grouping drops the splits made on the other grouping's sessions, and the session controls it turns off say why.
/// </summary>
[Test]
public Task AWholeFolderIsOfferedForAFolderOnlyAndDropsTheSplitsMadeBefore() => ScreenHost.RunAsync(async () =>
{
await using var app = await ScreenSmokeTests.SampleApp.StartAsync();
await app.Sample.FillAsync();
var import = app.Shell.Import;
var card = SampleCards.Card(app.Services.Environment.DataDirectory);
// A card: no Group choice, and asking for a whole folder changes nothing.
await ShowAsync(app, "plan");
Assert.False(import.CanGroupFolder);
import.GroupWholeFolder = true;
Assert.True(import.GroupBySessions);
Assert.Equal(ImportGrouping.Sessions, import.Choices.Grouping);
Assert.True(import.SessionsApply);
// The card's photos picked as a folder start by sessions: night, dawn and sunset.
await import.ImportFolderAsync(card.Root);
await import.WaitForPlanAsync();
Assert.True(import.CanGroupFolder);
Assert.True(import.GroupBySessions);
Assert.Equal((ImportGrouping.Sessions, 3), (import.Plan!.Grouping, import.Plan.Sessions.Count));
// The sunset split in two halves of twelve photos.
import.ShowPlanCommand.Execute(null);
import.SplitCommand.Execute(import.Details!.Rows.Where(r => r.Kind == PlanRowKind.File).ToList()[^12]);
await import.WaitForPlanAsync();
Assert.Equal(4, import.Plan!.Sessions.Count, "the split starts a session");
// The whole folder is one sequence for its one format, not cut where the sessions were split.
import.GroupWholeFolder = true;
await WaitUntilAsync(app, () => import.Plan is { Grouping: ImportGrouping.WholeFolder } && import.Phase == ImportPhase.Ready, "the whole folder is planned");
Assert.Equal(ImportGrouping.WholeFolder, import.Choices.Grouping);
Assert.Equal(1, import.Plan!.Sessions.Count);
Assert.False(import.SessionsApply);
Assert.False(import.GapApplies);
var why = Loc.L("Import.Blocked.WholeFolder");
Assert.Equal((why, why, why), (import.SessionsToolTip, import.GapMinutes.ToolTip, import.MinimumFrames.ToolTip));
var boxes = app.FindAll<TextBox>().Where(t => IsInImport(t) && EditBehavior.GetField(t) is { } f && (f == import.GapMinutes || f == import.MinimumFrames)).ToList();
Assert.Equal(2, boxes.Count);
foreach (var box in boxes)
{
Assert.False(box.IsEnabled);
Assert.True(ToolTipService.GetShowOnDisabled(box), "a disabled session box still shows why");
Assert.Equal(why, box.ToolTip as string);
}
// Back to sessions: the split made before stays gone.
import.GroupBySessions = true;
await WaitUntilAsync(app, () => import.Plan is { Grouping: ImportGrouping.Sessions } && import.Phase == ImportPhase.Ready, "the sessions are planned again");
Assert.Equal(3, import.Plan!.Sessions.Count);
Assert.True(import.SessionsApply);
Assert.Equal(Loc.L("Tooltips.Import.Gap"), import.GapMinutes.ToolTip);
// Choosing the card again leaves the folder's whole-folder choice behind.
import.GroupWholeFolder = true;
await WaitUntilAsync(app, () => import.Plan is { Grouping: ImportGrouping.WholeFolder } && import.Phase == ImportPhase.Ready, "the whole folder is planned");
import.SelectSource(card.Identity);
await import.WaitForPlanAsync();
Assert.False(import.CanGroupFolder);
Assert.True(import.GroupBySessions);
Assert.Equal(ImportGrouping.Sessions, import.Choices.Grouping);
Assert.Equal((ImportGrouping.Sessions, 3), (import.Plan!.Grouping, import.Plan.Sessions.Count));
});
/// <summary>As <c>--capture</c> does: toasts of the previous state go, those of an insertion state stay.</summary>
private static async Task ShowAsync(ScreenSmokeTests.SampleApp app, string state)
{