CI / Build and test (push) Successful in 8m14s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 7s
Release / Build, test and publish (push) Successful in 13m19s
CI / PostgreSQL 16 integration (push) Successful in 4m49s
CI / PostgreSQL 17 integration (push) Successful in 5m28s
CI / Docker image (push) Successful in 53s
Release / Server image (push) Failing after 10s
The owner renamed the product and moved the repository to the self-hosted Gitea (https://gitea.encke-hake.ts.net/BalboSoft/Chronos) for more control, and asked for Actions and a first automatic release with the server package and the Windows exe (docs/requests/2026-10-23-chronos-gitea.md). - Chronos everywhere: a byte-exact rename of contents and paths, then a per-language review of the forms the old name's ending had dictated. - Gitea instead of GitHub: the update check, licence, issue and support links read ChronosReleasesUrl; the update check takes the highest stable version, offers a pre-release build its final release and reports a repository it cannot see as a failed check. EULA, security policy and Gitea issue forms live at the repository root. - Gitea Actions for the Linux act_runner (.gitea/workflows): CI, release, nightly image and performance gates in the .NET SDK container with git checkout and the system SQLite. The release cross-compiles the Windows programs, checks their icon, version and DPI manifest, packs installers and zips, publishes the Gitea release and pushes the server image (REGISTRY_TOKEN). Windows-only tests run in an opt-in job on a Windows runner (WINDOWS_RUNNER). - New Chronos.Tools commands: zip, gitea-release, postgres-ci (replaces the docker-exec script, which Gitea's service containers do not allow; the throw-away server runs without durability) and pe-check. - Timed tests take their budget from TestTiming (CHRONOS_TEST_TIME_FACTOR, 3 on the shared runner; the weekly performance gates keep theirs). BREAKING CHANGE: programs, settings, data folders, file types, environment variables and the Docker image use the new name; nothing is migrated from Titano, which never had a release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
149 lines
8.2 KiB
C#
149 lines
8.2 KiB
C#
using Chronos.App.Library;
|
|
using Chronos.App.Server;
|
|
using Chronos.Core.Localization;
|
|
using Chronos.Core.Model;
|
|
using Chronos.Data.Sync;
|
|
using Chronos.Testing;
|
|
|
|
namespace Chronos.App.Tests.Library;
|
|
|
|
/// <summary>Which selected sequences each button of the mass actions bar works on, and why a button is off (BRIEF §12.2, DESIGN §4).</summary>
|
|
public sealed class MassActionsTests
|
|
{
|
|
private const string Server = "https://nas.local:8443";
|
|
private static readonly SyncRights Editor = SyncRights.Of((long)RolePermissions.Default(UserRole.Editor));
|
|
private static readonly SyncRights Viewer = SyncRights.Of((long)RolePermissions.Default(UserRole.Viewer));
|
|
private static readonly Guid MainArchive = Guid.CreateVersion7();
|
|
|
|
private static readonly SelectionContext Offline = new(HasEngine: true, IsSignedIn: false, default);
|
|
private static readonly SelectionContext SignedIn = new(HasEngine: true, IsSignedIn: true, Editor);
|
|
|
|
private static Sequence Local(string title, Guid? archive = null) => new()
|
|
{
|
|
Id = Guid.CreateVersion7(),
|
|
ArchiveId = archive ?? MainArchive,
|
|
Title = title,
|
|
Folder = "2026/" + title,
|
|
FrameCount = 120,
|
|
};
|
|
|
|
private static SyncLink Link(Sequence sequence) => new() { Server = Server, RemoteId = Guid.CreateVersion7(), Title = sequence.DisplayTitle };
|
|
|
|
private static SelectedSequence Remote(string title)
|
|
{
|
|
var link = new SyncLink { Server = Server, RemoteId = Guid.CreateVersion7(), Title = title, FrameCount = 300 };
|
|
var card = RemoteCards.FromLink(link);
|
|
return new SelectedSequence(card, new SyncEntry(null, link, SyncStatus.RemoteOnly));
|
|
}
|
|
|
|
private static SelectedSequence Linked(string title, SyncStatus status, Func<SyncLink, SyncLink>? change = null)
|
|
{
|
|
var local = Local(title);
|
|
var link = Link(local);
|
|
return new SelectedSequence(local, new SyncEntry(local, change?.Invoke(link) ?? link, status));
|
|
}
|
|
|
|
private static SelectedSequence Only(string title) => new(Local(title), null);
|
|
|
|
[Test]
|
|
public void NothingRunsWithoutASelectionOrAnIndexButTheListExport()
|
|
{
|
|
foreach (var action in Enum.GetValues<MassAction>())
|
|
Assert.Equal(Loc.L("Library.Blocked.NoSelection"), MassActions.Blocker(action, [], SignedIn));
|
|
|
|
SelectedSequence[] one = [Only("Harbour sunset")];
|
|
var noIndex = new SelectionContext(HasEngine: false, IsSignedIn: false, default);
|
|
Assert.Equal(Loc.L("Library.Blocked.NoIndex"), MassActions.Blocker(MassAction.Analyse, one, noIndex));
|
|
Assert.Equal(Loc.L("Library.Blocked.NoIndex"), MassActions.Blocker(MassAction.Delete, one, noIndex));
|
|
Assert.Null(MassActions.Blocker(MassAction.ExportList, one, noIndex), "a CSV needs only the rows on screen");
|
|
}
|
|
|
|
[Test]
|
|
public void ArchiveActionsWorkOnTheSequencesOfThisPc()
|
|
{
|
|
var harbour = Only("Harbour sunset");
|
|
var remote = Remote("Sunrise over Superga");
|
|
SelectedSequence[] mixed = [harbour, remote];
|
|
|
|
foreach (var action in new[] { MassAction.Analyse, MassAction.Proxies, MassAction.Verify, MassAction.Tag, MassAction.Rate, MassAction.Move, MassAction.Delete })
|
|
{
|
|
Assert.Null(MassActions.Blocker(action, mixed, SignedIn), action.ToString());
|
|
Assert.SequenceEqual([harbour], MassActions.Targets(action, mixed, SignedIn), action.ToString());
|
|
Assert.Equal(Loc.L("Library.Blocked.ServerOnly"), MassActions.Blocker(action, [remote], SignedIn));
|
|
}
|
|
Assert.SequenceEqual(mixed, MassActions.Targets(MassAction.ExportList, mixed, SignedIn), "the CSV lists remote cards too");
|
|
Assert.Equal(Loc.Plural("Tooltips.Library.Mass.Delete", 1), MassActions.ToolTip(MassAction.Delete, 1));
|
|
}
|
|
|
|
[Test]
|
|
public void MoveStaysInsideOneArchive()
|
|
{
|
|
SelectedSequence[] two = [Only("Harbour sunset"), new(Local("Aurora", Guid.CreateVersion7()), null)];
|
|
Assert.Equal(Loc.L("Library.Blocked.Archives"), MassActions.Blocker(MassAction.Move, two, Offline));
|
|
Assert.Null(MassActions.Blocker(MassAction.Delete, two, Offline), "the trash of each archive takes its own sequences");
|
|
}
|
|
|
|
[Test]
|
|
public void TransfersNeedASessionAndTheRight()
|
|
{
|
|
SelectedSequence[] one = [Only("Harbour sunset")];
|
|
Assert.Equal(Loc.L("Library.Blocked.NotConnected"), MassActions.Blocker(MassAction.Upload, one, Offline));
|
|
Assert.Equal(Loc.L("Library.Blocked.NotConnected"), MassActions.Blocker(MassAction.Download, one, Offline));
|
|
Assert.Equal(Loc.L("Library.Blocked.NoUploadRight"), MassActions.Blocker(MassAction.Upload, one, SignedIn with { Rights = Viewer }));
|
|
Assert.Equal(Loc.L("Library.Blocked.NoDownloadRight"), MassActions.Blocker(MassAction.Download, one, SignedIn with { Rights = Viewer }));
|
|
Assert.Null(MassActions.Blocker(MassAction.Upload, one, SignedIn), "a sequence only here uploads before the table compares it");
|
|
Assert.Equal(Loc.L("Library.Blocked.NothingToDownload"), MassActions.Blocker(MassAction.Download, one, SignedIn));
|
|
}
|
|
|
|
[Test]
|
|
public void EachTransferTakesWhatItsSyncRowOffers()
|
|
{
|
|
var only = Only("Harbour sunset");
|
|
var ahead = Linked("Comet over the ridge", SyncStatus.LocalAhead, l => l with { MissingRemote = 4 });
|
|
var renders = Linked("Star trails", SyncStatus.InSync, l => l with { ExportsToSend = 1, ExportsToGet = 2 });
|
|
var same = Linked("Aurora, Tromsø", SyncStatus.InSync);
|
|
var behind = Linked("Fog lifting", SyncStatus.ServerAhead, l => l with { MissingLocal = 12 });
|
|
var remote = Remote("Sunrise over Superga");
|
|
SelectedSequence[] all = [only, ahead, renders, same, behind, remote];
|
|
|
|
Assert.SequenceEqual([only, ahead, renders], MassActions.Targets(MassAction.Upload, all, SignedIn));
|
|
Assert.Equal(SyncAction.Upload, MassActions.UploadStep(only, Editor));
|
|
Assert.Equal(SyncAction.Upload, MassActions.UploadStep(ahead, Editor));
|
|
Assert.Equal(SyncAction.SendExports, MassActions.UploadStep(renders, Editor));
|
|
Assert.Null(MassActions.UploadStep(same, Editor));
|
|
Assert.Null(MassActions.UploadStep(remote, Editor), "a remote card has nothing here to send");
|
|
|
|
Assert.SequenceEqual([renders, behind, remote], MassActions.Targets(MassAction.Download, all, SignedIn));
|
|
Assert.Equal(SyncAction.GetExports, MassActions.DownloadStep(renders, Editor));
|
|
Assert.Equal(SyncAction.DownloadOriginals, MassActions.DownloadStep(behind, Editor));
|
|
Assert.Equal(SyncAction.DownloadOriginals, MassActions.DownloadStep(remote, Editor));
|
|
Assert.Null(MassActions.DownloadStep(only, Editor));
|
|
|
|
Assert.Equal(Loc.L("Library.Blocked.NothingToUpload"), MassActions.Blocker(MassAction.Upload, [same, remote], SignedIn));
|
|
}
|
|
|
|
[Test]
|
|
public void TheCardsSyncDoesTheFirstThingItsRowOffers()
|
|
{
|
|
Assert.Null(MassActions.QuickSync(Only("Harbour sunset"), Offline, out var why));
|
|
Assert.Equal(Loc.L("Library.Blocked.NotConnected"), why);
|
|
|
|
Assert.Equal(SyncAction.Upload, MassActions.QuickSync(Only("Harbour sunset"), SignedIn, out why));
|
|
Assert.Null(why);
|
|
Assert.Null(MassActions.QuickSync(Only("Harbour sunset"), SignedIn with { Rights = Viewer }, out why));
|
|
Assert.Equal(Loc.L("Library.Blocked.NoUploadRight"), why);
|
|
|
|
Assert.Equal(SyncAction.DownloadOriginals, MassActions.QuickSync(Remote("Sunrise over Superga"), SignedIn, out _));
|
|
Assert.Equal(SyncAction.SyncSettings, MassActions.QuickSync(Linked("Holy grail", SyncStatus.ServerAhead), SignedIn, out _));
|
|
Assert.Equal(SyncAction.KeepMine, MassActions.QuickSync(Linked("Holy grail", SyncStatus.Conflict), SignedIn, out _), "a conflict goes to the Server screen");
|
|
|
|
Assert.Null(MassActions.QuickSync(Linked("Aurora, Tromsø", SyncStatus.InSync), SignedIn, out why));
|
|
Assert.Equal(Loc.L("Library.Blocked.InSync"), why);
|
|
|
|
var moving = Linked("Comet over the ridge", SyncStatus.LocalAhead);
|
|
var transferring = moving with { Sync = moving.Sync! with { Transfer = new Job { Id = Guid.CreateVersion7(), Kind = JobKind.UploadCommit, State = JobState.Running } } };
|
|
Assert.Null(MassActions.QuickSync(transferring, SignedIn, out why));
|
|
Assert.Equal(Loc.L("Library.Blocked.Transferring"), why);
|
|
}
|
|
}
|