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>
90 lines
4.0 KiB
C#
90 lines
4.0 KiB
C#
using System.Globalization;
|
|
using Chronos.App.Import;
|
|
using Chronos.Core.Localization;
|
|
using Chronos.Core.Model;
|
|
using Chronos.Testing;
|
|
|
|
namespace Chronos.App.Tests.Import;
|
|
|
|
public sealed class CardPoolTests
|
|
{
|
|
internal static readonly CardDevice CardA = new(@"F:\", "EOS_DIGITAL", 0x3F2A9C11, 128_000_000_000, 31_800_000_000, true, true);
|
|
private static readonly CardDevice GoPro = new(@"E:\", "GOPRO", 0x11112222, 64_000_000_000, 52_600_000_000, true, true);
|
|
internal static readonly CardDevice Usb = new(@"G:\", "BACKUP", 0x99990000, 2_000_000_000_000, 1_800_000_000_000, true, false);
|
|
|
|
public CardPoolTests() => Loc.SetCulture(CultureInfo.GetCultureInfo("en"));
|
|
|
|
private static MediaCard Known(CardDevice device, string nickname, DateTimeOffset seen) => new()
|
|
{
|
|
Id = Guid.CreateVersion7(),
|
|
Identity = device.Identity,
|
|
VolumeSerial = device.SerialNumber,
|
|
Label = device.Label,
|
|
Capacity = device.TotalBytes,
|
|
Nickname = nickname,
|
|
CameraMake = "Canon",
|
|
CameraModel = "Canon EOS R5",
|
|
CameraSerial = "0431",
|
|
LastSeen = seen,
|
|
};
|
|
|
|
[Test]
|
|
public void InsertedVolumesComeFirstThenRememberedCardsThenTheFolder()
|
|
{
|
|
var away = new CardDevice(@"H:\", "NIKON", 0x55556666, 64_000_000_000, 0, true, true);
|
|
var cards = new[] { Known(CardA, "EOS R5 · card A", DateTimeOffset.UtcNow), Known(away, "Z 8 card", DateTimeOffset.UtcNow.AddDays(-3)) };
|
|
var pool = CardPool.Build([Usb, CardA, GoPro], cards, @"D:\Shoots\2026");
|
|
|
|
Assert.SequenceEqual(new[] { GoPro.Identity, CardA.Identity, Usb.Identity, away.Identity, @"D:\Shoots\2026" }, pool.Select(s => s.Key));
|
|
Assert.Equal(SourceKind.Card, pool[0].Kind);
|
|
Assert.False(pool[0].IsKnown);
|
|
Assert.Equal("GOPRO", pool[0].Title);
|
|
Assert.Equal("New card", pool[0].StateText);
|
|
Assert.Equal("EOS R5 · card A", pool[1].Title);
|
|
Assert.Equal("Known card", pool[1].StateText);
|
|
Assert.Equal("128 GB · 96.2 GB used", pool[1].Subtitle);
|
|
Assert.Equal("128 GB · serial 3F2A-9C11 · Canon EOS R5 #0431", pool[1].IdentityText);
|
|
Assert.Equal(SourceKind.Drive, pool[2].Kind);
|
|
Assert.Equal("no DCIM · 1.8 TB free", pool[2].Subtitle);
|
|
Assert.False(pool[3].IsInserted);
|
|
Assert.Null(pool[3].Root);
|
|
Assert.Equal("Canon EOS R5 · not inserted", pool[3].Subtitle);
|
|
Assert.Equal(SourceKind.Folder, pool[4].Kind);
|
|
Assert.Equal(@"D:\Shoots\2026", pool[4].Root);
|
|
}
|
|
|
|
[Test]
|
|
public void ARememberedCardStaysNewUntilItHasANickname()
|
|
{
|
|
var unnamed = Known(GoPro, "GoPro 12", DateTimeOffset.UtcNow) with { Nickname = null };
|
|
var source = CardPool.Build([GoPro], [unnamed], null).Single();
|
|
Assert.NotNull(source.Card, "the first plan remembered it");
|
|
Assert.False(source.IsKnown);
|
|
Assert.Equal("New card", source.StateText);
|
|
Assert.Equal("GOPRO", source.Title);
|
|
|
|
var named = CardPool.Build([GoPro], [unnamed with { Nickname = "GoPro 12" }], null).Single();
|
|
Assert.True(named.IsKnown);
|
|
Assert.Equal("Known card", named.StateText);
|
|
}
|
|
|
|
[Test]
|
|
public void TheEntryTooltipCarriesTheStateAndTheWholeSubtitle()
|
|
{
|
|
var pool = CardPool.Build([CardA, Usb], [Known(CardA, "EOS R5 · card A", DateTimeOffset.UtcNow)], @"D:\Shoots\2026");
|
|
Assert.Equal("Known card · 128 GB · 96.2 GB used", pool[0].ToolTip);
|
|
Assert.Equal("no DCIM · 1.8 TB free", pool[1].ToolTip);
|
|
Assert.Equal(@"Folder · D:\Shoots\2026", pool[2].ToolTip);
|
|
}
|
|
|
|
[Test]
|
|
public void AKnownCardWithoutDcimIsStillACard()
|
|
{
|
|
var pool = CardPool.Build([Usb], [Known(Usb, "Backup card", DateTimeOffset.UtcNow)], null);
|
|
Assert.Equal(SourceKind.Card, pool.Single().Kind);
|
|
Assert.Equal("3F2A-9C11", ImportSource.SerialText(0x3F2A9C11));
|
|
Assert.Equal("3F2A9C11-EOS_DIGITAL-128000000000", CardA.Identity);
|
|
Assert.Equal("EOS_DIGITAL", CardA.ToVolume().Label);
|
|
}
|
|
}
|