refactor!: rename Titano to Chronos and move CI and releases to Gitea
CI / Build and test (pull_request) Failing after 2m3s
CI / PostgreSQL 16 integration (pull_request) Skipped
CI / PostgreSQL 17 integration (pull_request) Skipped
CI / Docker image (pull_request) Skipped
CI / Windows tests and installer (pull_request) Skipped
CI / YAML check (pull_request) Successful in 4s
CI / Build and test (pull_request) Failing after 2m3s
CI / PostgreSQL 16 integration (pull_request) Skipped
CI / PostgreSQL 17 integration (pull_request) Skipped
CI / Docker image (pull_request) Skipped
CI / Windows tests and installer (pull_request) Skipped
CI / YAML check (pull_request) Successful in 4s
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. 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) and pe-check. 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>
This commit is contained in:
1 parent
c99842cc86
commit
5f27a86406
1799 files changed
+11728
-10668
No files matched your search
@@ -0,0 +1,124 @@
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using Chronos.App.About;
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Chronos.App.Tests.About;
|
||||
|
||||
public sealed class UpdateCheckTests
|
||||
{
|
||||
[Theory]
|
||||
[Case("v1.2.3", "1.2.3")]
|
||||
[Case("1.2", "1.2.0")]
|
||||
[Case("V0.10.0-beta.2", "0.10.0")]
|
||||
[Case("v2.0.1+abc", "2.0.1")]
|
||||
public void TagsParseToVersions(string tag, string expected) =>
|
||||
Assert.Equal(Version.Parse(expected), UpdateCheck.ParseVersion(tag));
|
||||
|
||||
[Theory]
|
||||
[Case(new object?[] { null })]
|
||||
[Case("")]
|
||||
[Case("latest")]
|
||||
[Case("v-one")]
|
||||
public void OtherTagsAreIgnored(string? tag) => Assert.Null(UpdateCheck.ParseVersion(tag));
|
||||
|
||||
[Test]
|
||||
public void TheLatestReleaseIsComparedWithTheRunningVersion()
|
||||
{
|
||||
var release = UpdateCheck.Parse("""{ "tag_name": "v0.2.0", "html_url": "https://gitea.example/o/r/releases/tag/v0.2.0", "draft": false, "prerelease": false }""");
|
||||
Assert.NotNull(release);
|
||||
Assert.Equal(new Version(0, 2, 0), release!.Version);
|
||||
Assert.True(UpdateCheck.IsNewer(release, UpdateCheck.RunningVersion("0.1.0")));
|
||||
Assert.False(UpdateCheck.IsNewer(release, UpdateCheck.RunningVersion("0.2.0+local")));
|
||||
Assert.False(UpdateCheck.IsNewer(release, new Version(0, 2, 0, 0)));
|
||||
Assert.False(UpdateCheck.IsNewer(release, UpdateCheck.RunningVersion("1.0.0")));
|
||||
Assert.Equal("0.2.0", UpdateCheck.Display(release.Version));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void APreReleaseBuildIsOfferedTheFinalReleaseOfItsVersion()
|
||||
{
|
||||
var final = UpdateCheck.Parse("""{ "tag_name": "v0.1.0", "html_url": "https://gitea.example/o/r/releases/tag/v0.1.0" }""")!;
|
||||
Assert.True(UpdateCheck.IsPrerelease("0.1.0-rc.1"));
|
||||
Assert.True(UpdateCheck.IsPrerelease("v0.1.0-beta+abc"));
|
||||
Assert.False(UpdateCheck.IsPrerelease("0.1.0+abc-def"));
|
||||
Assert.False(UpdateCheck.IsPrerelease("0.1.0"));
|
||||
Assert.True(UpdateCheck.IsNewer(final, UpdateCheck.RunningVersion("0.1.0-rc.1"), UpdateCheck.IsPrerelease("0.1.0-rc.1")));
|
||||
Assert.False(UpdateCheck.IsNewer(final, UpdateCheck.RunningVersion("0.1.0"), UpdateCheck.IsPrerelease("0.1.0")));
|
||||
Assert.False(UpdateCheck.IsNewer(final, UpdateCheck.RunningVersion("0.2.0-rc.1"), UpdateCheck.IsPrerelease("0.2.0-rc.1")));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DraftsPrereleasesAndOddLinksAreIgnored()
|
||||
{
|
||||
Assert.Null(UpdateCheck.Parse("""{ "tag_name": "v9.0.0", "html_url": "https://x", "prerelease": true }"""));
|
||||
Assert.Null(UpdateCheck.Parse("""{ "tag_name": "v9.0.0", "html_url": "https://x", "draft": true }"""));
|
||||
Assert.Null(UpdateCheck.Parse("""{ "tag_name": "v9.0.0", "html_url": "javascript:alert(1)" }"""));
|
||||
Assert.Null(UpdateCheck.Parse("""{ "html_url": "https://x" }"""));
|
||||
Assert.Null(UpdateCheck.Parse("[]"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task FetchReadsTheApiAndToleratesMissingReleases()
|
||||
{
|
||||
// Gitea lists the most recently created first: a re-published 0.9.0 must not hide 1.0.0.
|
||||
using var ok = new HttpClient(new Reply(HttpStatusCode.OK, """
|
||||
[ { "tag_name": "v0.9.0", "html_url": "https://gitea.example/o/r/releases/tag/v0.9.0" },
|
||||
{ "tag_name": "v1.0.0", "html_url": "https://gitea.example/o/r/releases/tag/v1.0.0" },
|
||||
{ "tag_name": "v2.0.0", "html_url": "https://gitea.example/o/r/releases/tag/v2.0.0", "prerelease": true } ]
|
||||
"""));
|
||||
var release = await UpdateCheck.FetchAsync(ok, Api, "0.1.0", CancellationToken.None);
|
||||
Assert.Equal(new Version(1, 0, 0), release!.Version);
|
||||
|
||||
using var none = new HttpClient(new Reply(HttpStatusCode.OK, "[]"));
|
||||
Assert.Null(await UpdateCheck.FetchAsync(none, Api, "0.1.0", CancellationToken.None));
|
||||
|
||||
using var garbage = new HttpClient(new Reply(HttpStatusCode.OK, "<html>"));
|
||||
Assert.Null(await UpdateCheck.FetchAsync(garbage, Api, "0.1.0", CancellationToken.None));
|
||||
|
||||
using var broken = new HttpClient(new Reply(HttpStatusCode.InternalServerError, "{}"));
|
||||
await Assert.ThrowsAsync<HttpRequestException>(() => UpdateCheck.FetchAsync(broken, Api, "0.1.0", CancellationToken.None));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task ARepositoryThatCannotBeSeenIsAFailedCheckNotUpToDate()
|
||||
{
|
||||
using var hidden = new HttpClient(new Reply(HttpStatusCode.NotFound, """{ "message": "not found" }"""));
|
||||
var error = await Assert.ThrowsAsync<HttpRequestException>(() => UpdateCheck.FetchAsync(hidden, Api, "0.1.0", CancellationToken.None));
|
||||
Assert.Equal(HttpStatusCode.NotFound, error.StatusCode);
|
||||
}
|
||||
|
||||
private const string Api = "https://gitea.example/api/v1/repos/o/r/releases?draft=false&pre-release=false&limit=50";
|
||||
|
||||
[Theory]
|
||||
[Case("https://gitea.example/BalboSoft/Chronos", "https://gitea.example/api/v1/repos/BalboSoft/Chronos/releases?draft=false&pre-release=false&limit=50")]
|
||||
[Case("https://example.org:8443/git/BalboSoft/Chronos", "https://example.org:8443/git/api/v1/repos/BalboSoft/Chronos/releases?draft=false&pre-release=false&limit=50")]
|
||||
public void TheReleasesAreAskedOfTheGiteaApiOfTheRepository(string repository, string expected) =>
|
||||
Assert.Equal(expected, ProductLinks.StableReleasesApiOf(repository));
|
||||
|
||||
[Theory]
|
||||
[Case(" https://gitea.example/o/r/ ", "https://gitea.example/o/r")]
|
||||
[Case("https://gitea.example/o/r.git", "https://gitea.example/o/r")]
|
||||
[Case("", null)]
|
||||
public void TheReleasesRepositoryAddressIsNormalised(string address, string? expected) =>
|
||||
Assert.Equal(expected, ProductLinks.Normalise(address));
|
||||
|
||||
[Test]
|
||||
public void LocalBuildsLinkTheRepositoryTheBuildPropertiesName()
|
||||
{
|
||||
Assert.Equal(ProductLinks.DefaultRepository, ProductLinks.Repository);
|
||||
Assert.Equal(ProductLinks.DefaultRepository + "/src/branch/main/EULA.md", ProductLinks.Licence);
|
||||
Assert.Throws<ArgumentException>(() => ProductLinks.StableReleasesApiOf("https://gitea.example/only-owner"));
|
||||
}
|
||||
|
||||
private sealed class Reply(HttpStatusCode status, string body) : HttpMessageHandler
|
||||
{
|
||||
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
|
||||
{
|
||||
Assert.True(request.Headers.UserAgent.ToString().StartsWith("Chronos/", StringComparison.Ordinal), "the update requests identify the program");
|
||||
return Task.FromResult(new HttpResponseMessage(status) { Content = new StringContent(body, Encoding.UTF8, "application/json") });
|
||||
}
|
||||
}
|
||||
}
|
||||
+18
-18
@@ -4,16 +4,16 @@ using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using Titano.App.About;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.About;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.About;
|
||||
namespace Chronos.App.Tests.About;
|
||||
|
||||
public sealed class UpdateDownloadTests(TestContext context)
|
||||
{
|
||||
private const string Base = "https://github.com/o/r/releases/download/v1.0.0/";
|
||||
private const string SetupName = "Titano-Setup-1.0.0.exe";
|
||||
private const string PortableName = "Titano-win-x64-portable-1.0.0.zip";
|
||||
private const string Base = "https://gitea.example/o/r/releases/download/v1.0.0/";
|
||||
private const string SetupName = "Chronos-Setup-1.0.0.exe";
|
||||
private const string PortableName = "Chronos-win-x64-portable-1.0.0.zip";
|
||||
|
||||
private static readonly TimeSpan Idle = TimeSpan.FromSeconds(30);
|
||||
private static readonly byte[] Setup = Encoding.ASCII.GetBytes(string.Concat(Enumerable.Repeat("MZ setup payload ", 20_000)));
|
||||
@@ -24,18 +24,18 @@ public sealed class UpdateDownloadTests(TestContext context)
|
||||
{
|
||||
var hash = new string('A', 64);
|
||||
var sums = UpdateDownload.ParseChecksums(
|
||||
$"{hash} Titano-Setup-1.0.0.exe\r\n{new string('b', 64)} *Titano-Uploader-Setup-1.0.0.exe\nnot a checksum line\n{new string('c', 63)} short.exe\n\n");
|
||||
$"{hash} Chronos-Setup-1.0.0.exe\r\n{new string('b', 64)} *Chronos-Uploader-Setup-1.0.0.exe\nnot a checksum line\n{new string('c', 63)} short.exe\n\n");
|
||||
Assert.Equal(2, sums.Count);
|
||||
Assert.Equal(new string('a', 64), sums["Titano-Setup-1.0.0.exe"]);
|
||||
Assert.Equal(new string('b', 64), sums["Titano-Uploader-Setup-1.0.0.exe"]);
|
||||
Assert.Equal(new string('a', 64), sums["Chronos-Setup-1.0.0.exe"]);
|
||||
Assert.Equal(new string('b', 64), sums["Chronos-Uploader-Setup-1.0.0.exe"]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ThePackageForEachKindOfCopyAndTheChecksumsAreFoundAmongTheAssets()
|
||||
{
|
||||
var release = UpdateCheck.Parse($$"""
|
||||
{ "tag_name": "v1.0.0", "html_url": "https://github.com/o/r/releases/tag/v1.0.0", "assets": [
|
||||
{ "name": "Titano-Uploader-Setup-1.0.0.exe", "browser_download_url": "{{Base}}Titano-Uploader-Setup-1.0.0.exe", "size": 10 },
|
||||
{ "tag_name": "v1.0.0", "html_url": "https://gitea.example/o/r/releases/tag/v1.0.0", "assets": [
|
||||
{ "name": "Chronos-Uploader-Setup-1.0.0.exe", "browser_download_url": "{{Base}}Chronos-Uploader-Setup-1.0.0.exe", "size": 10 },
|
||||
{ "name": "{{SetupName}}", "browser_download_url": "{{Base}}{{SetupName}}", "size": {{Setup.Length}} },
|
||||
{ "name": "{{PortableName}}", "browser_download_url": "{{Base}}{{PortableName}}", "size": {{Portable.Length}} },
|
||||
{ "name": "SHA256SUMS", "browser_download_url": "{{Base}}SHA256SUMS", "size": 300 },
|
||||
@@ -51,7 +51,7 @@ public sealed class UpdateDownloadTests(TestContext context)
|
||||
Assert.False(UpdateDownload.CanDownload(release with { Assets = [.. release.Assets.Where(a => a.Name != "SHA256SUMS")] }, portable: false));
|
||||
Assert.False(UpdateDownload.CanDownload(release with { Assets = [.. release.Assets.Where(a => a.Name != PortableName)] }, portable: true));
|
||||
var root = UpdateDownload.Root(Path.GetTempPath());
|
||||
Assert.True(root.EndsWith(Path.Combine("Titano", "updates"), StringComparison.Ordinal), root);
|
||||
Assert.True(root.EndsWith(Path.Combine("Chronos", "updates"), StringComparison.Ordinal), root);
|
||||
Assert.Equal(Path.Combine(root, "v1.0.0"), UpdateDownload.Folder(root, release));
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ public sealed class UpdateDownloadTests(TestContext context)
|
||||
public async Task ASetupWithoutAChecksumLineIsNeverDownloaded()
|
||||
{
|
||||
var root = context.CreateTempDirectory();
|
||||
var server = new FakeReleases(Setup) { Sums = $"{new string('0', 64)} Titano-Uploader-Setup-1.0.0.exe\n" };
|
||||
var server = new FakeReleases(Setup) { Sums = $"{new string('0', 64)} Chronos-Uploader-Setup-1.0.0.exe\n" };
|
||||
using var http = new HttpClient(server);
|
||||
await Assert.ThrowsAsync<UpdateVerificationException>(() => DownloadAsync(http, root));
|
||||
Assert.Equal(0, server.PackageRequests);
|
||||
@@ -225,7 +225,7 @@ public sealed class UpdateDownloadTests(TestContext context)
|
||||
{
|
||||
var root = context.CreateTempDirectory();
|
||||
var old = Directory.CreateDirectory(Path.Combine(root, "v0.9.0")).FullName;
|
||||
await File.WriteAllTextAsync(Path.Combine(old, "Titano-Setup-0.9.0.exe"), "old setup");
|
||||
await File.WriteAllTextAsync(Path.Combine(old, "Chronos-Setup-0.9.0.exe"), "old setup");
|
||||
using var http = new HttpClient(new FakeReleases(Setup));
|
||||
await DownloadAsync(http, root);
|
||||
Assert.SequenceEqual(new[] { "v1.0.0" }, Directory.GetDirectories(root).Select(d => Path.GetFileName(d)));
|
||||
@@ -235,7 +235,7 @@ public sealed class UpdateDownloadTests(TestContext context)
|
||||
CancellationToken ct = default) =>
|
||||
UpdateDownload.DownloadAsync(http, Release(), portable, root, "0.1.0", progress, idle ?? Idle, ct);
|
||||
|
||||
private static ReleaseInfo Release() => new(new Version(1, 0, 0), "v1.0.0", "https://github.com/o/r/releases/tag/v1.0.0")
|
||||
private static ReleaseInfo Release() => new(new Version(1, 0, 0), "v1.0.0", "https://gitea.example/o/r/releases/tag/v1.0.0")
|
||||
{
|
||||
Assets =
|
||||
[
|
||||
@@ -246,12 +246,12 @@ public sealed class UpdateDownloadTests(TestContext context)
|
||||
};
|
||||
|
||||
private static string Sums(byte[] setup, byte[] portable) =>
|
||||
$"{new string('1', 64)} Titano-Uploader-Setup-1.0.0.exe\n{Hash(setup)} {SetupName}\n{Hash(portable)} *{PortableName}\n";
|
||||
$"{new string('1', 64)} Chronos-Uploader-Setup-1.0.0.exe\n{Hash(setup)} {SetupName}\n{Hash(portable)} *{PortableName}\n";
|
||||
|
||||
private static string Hash(byte[] bytes) => Convert.ToHexStringLower(SHA256.HashData(bytes));
|
||||
|
||||
/// <summary>
|
||||
/// Serves SHA256SUMS, the setup and the portable zip like GitHub's release downloads: honours single open-ended
|
||||
/// Serves SHA256SUMS, the setup and the portable zip like Gitea's release downloads: honours single open-ended
|
||||
/// ranges, and can fail, end a transfer early or stall in the middle of it.
|
||||
/// </summary>
|
||||
private sealed class FakeReleases(byte[] setup) : HttpMessageHandler
|
||||
@@ -271,7 +271,7 @@ public sealed class UpdateDownloadTests(TestContext context)
|
||||
|
||||
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
|
||||
{
|
||||
Assert.True(request.Headers.UserAgent.ToString().StartsWith("Titano/", StringComparison.Ordinal), "GitHub requires a User-Agent");
|
||||
Assert.True(request.Headers.UserAgent.ToString().StartsWith("Chronos/", StringComparison.Ordinal), "the update requests identify the program");
|
||||
var url = request.RequestUri!.AbsoluteUri;
|
||||
if (url == Base + "SHA256SUMS") return Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(Sums) });
|
||||
var bytes = url == Base + SetupName ? Served : url == Base + PortableName ? Portable : throw new AssertionException("Unexpected request " + url);
|
||||
+12
-12
@@ -1,15 +1,15 @@
|
||||
using System.IO;
|
||||
using Titano.App.About;
|
||||
using Titano.Testing;
|
||||
using Titano.Ui.Mvvm;
|
||||
using Chronos.App.About;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Ui.Mvvm;
|
||||
|
||||
namespace Titano.App.Tests.About;
|
||||
namespace Chronos.App.Tests.About;
|
||||
|
||||
/// <summary>The update notice: start-up opt-out, capture runs, portable copies, failures and cancellation of the download.</summary>
|
||||
[Serial] // AsyncRelayCommand.Failed is a static event
|
||||
public sealed class UpdateFlowTests(TestContext context)
|
||||
{
|
||||
private const string Page = "https://github.com/o/r/releases/tag/v1.0.0";
|
||||
private const string Page = "https://gitea.example/o/r/releases/tag/v1.0.0";
|
||||
|
||||
[Test]
|
||||
public async Task TheStartUpCheckFollowsTheOptOut()
|
||||
@@ -43,11 +43,11 @@ public sealed class UpdateFlowTests(TestContext context)
|
||||
[Test]
|
||||
public async Task ADownloadedSetupIsShownAndOfferedUntilANewerReleaseAppears()
|
||||
{
|
||||
var host = new Host { Downloaded = Path.Combine(context.CreateTempDirectory(), "Titano-Setup-1.0.0.exe") };
|
||||
var host = new Host { Downloaded = Path.Combine(context.CreateTempDirectory(), "Chronos-Setup-1.0.0.exe") };
|
||||
File.WriteAllText(host.Downloaded, "setup");
|
||||
var flow = host.Flow();
|
||||
flow.SetResult(Release(withSetup: true, withZip: false, withSums: true));
|
||||
Assert.Equal("Titano-Setup-1.0.0.exe", flow.Package?.Name);
|
||||
Assert.Equal("Chronos-Setup-1.0.0.exe", flow.Package?.Name);
|
||||
|
||||
await RunAsync(flow.Download);
|
||||
Assert.Equal((UpdateState.Downloaded, host.Downloaded), (flow.State, flow.PackagePath));
|
||||
@@ -72,7 +72,7 @@ public sealed class UpdateFlowTests(TestContext context)
|
||||
Assert.SequenceEqual(new[] { Page }, host.Opened);
|
||||
|
||||
flow.SetResult(Release(withSetup: true, withZip: true, withSums: true));
|
||||
Assert.Equal("Titano-win-x64-portable-1.0.0.zip", flow.Package?.Name);
|
||||
Assert.Equal("Chronos-win-x64-portable-1.0.0.zip", flow.Package?.Name);
|
||||
await RunAsync(flow.Download);
|
||||
Assert.Equal(1, host.Downloads);
|
||||
Assert.Equal(UpdateState.Downloaded, flow.State);
|
||||
@@ -156,10 +156,10 @@ public sealed class UpdateFlowTests(TestContext context)
|
||||
|
||||
private static ReleaseInfo Release(bool withSetup, bool withZip, bool withSums)
|
||||
{
|
||||
const string Base = "https://github.com/o/r/releases/download/v1.0.0/";
|
||||
const string Base = "https://gitea.example/o/r/releases/download/v1.0.0/";
|
||||
var assets = new List<ReleaseAsset>();
|
||||
if (withSetup) assets.Add(new ReleaseAsset("Titano-Setup-1.0.0.exe", Base + "Titano-Setup-1.0.0.exe", 1000));
|
||||
if (withZip) assets.Add(new ReleaseAsset("Titano-win-x64-portable-1.0.0.zip", Base + "Titano-win-x64-portable-1.0.0.zip", 900));
|
||||
if (withSetup) assets.Add(new ReleaseAsset("Chronos-Setup-1.0.0.exe", Base + "Chronos-Setup-1.0.0.exe", 1000));
|
||||
if (withZip) assets.Add(new ReleaseAsset("Chronos-win-x64-portable-1.0.0.zip", Base + "Chronos-win-x64-portable-1.0.0.zip", 900));
|
||||
if (withSums) assets.Add(new ReleaseAsset("SHA256SUMS", Base + "SHA256SUMS", 300));
|
||||
return new ReleaseInfo(new Version(1, 0, 0), "v1.0.0", Page) { Assets = assets };
|
||||
}
|
||||
@@ -182,7 +182,7 @@ public sealed class UpdateFlowTests(TestContext context)
|
||||
public bool IsPortable { get; init; }
|
||||
public Exception? Failure { get; init; }
|
||||
public bool Stall { get; init; }
|
||||
public string Downloaded { get; init; } = "Titano-Setup-1.0.0.exe";
|
||||
public string Downloaded { get; init; } = "Chronos-Setup-1.0.0.exe";
|
||||
public int Checks { get; private set; }
|
||||
public int Downloads { get; private set; }
|
||||
public List<string> Opened { get; } = [];
|
||||
+6
-6
@@ -1,11 +1,11 @@
|
||||
using System.Globalization;
|
||||
using Titano.App.Archiving;
|
||||
using Titano.Core.Archiving;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Testing;
|
||||
using static Titano.App.Tests.Archiving.ArchiveLogicTests;
|
||||
using Chronos.App.Archiving;
|
||||
using Chronos.Core.Archiving;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Testing;
|
||||
using static Chronos.App.Tests.Archiving.ArchiveLogicTests;
|
||||
|
||||
namespace Titano.App.Tests.Archiving;
|
||||
namespace Chronos.App.Tests.Archiving;
|
||||
|
||||
/// <summary>
|
||||
/// Archive texts in other languages. They switch the process-wide UI language, so the class is serial: in parallel it
|
||||
+19
-19
@@ -1,23 +1,23 @@
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using Titano.App.Archiving;
|
||||
using Titano.App.Infrastructure;
|
||||
using Titano.App.Library;
|
||||
using Titano.Core.Archiving;
|
||||
using Titano.Core.Imaging;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Data;
|
||||
using Titano.Data.Archiving;
|
||||
using Titano.Data.Repositories;
|
||||
using Titano.Testing;
|
||||
using Titano.Ui.Controls;
|
||||
using Chronos.App.Archiving;
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.App.Library;
|
||||
using Chronos.Core.Archiving;
|
||||
using Chronos.Core.Imaging;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Data;
|
||||
using Chronos.Data.Archiving;
|
||||
using Chronos.Data.Repositories;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Ui.Controls;
|
||||
|
||||
namespace Titano.App.Tests.Archiving;
|
||||
namespace Chronos.App.Tests.Archiving;
|
||||
|
||||
public sealed class ArchiveLogicTests
|
||||
{
|
||||
internal static readonly Core.Model.Archive Main = new() { Id = Guid.CreateVersion7(), Name = "TitanoArchive", RootPath = "/archive" };
|
||||
internal static readonly Core.Model.Archive Main = new() { Id = Guid.CreateVersion7(), Name = "ChronosArchive", RootPath = "/archive" };
|
||||
|
||||
public ArchiveLogicTests() => Loc.SetCulture(CultureInfo.GetCultureInfo("en"));
|
||||
|
||||
@@ -42,7 +42,7 @@ public sealed class ArchiveLogicTests
|
||||
var d = Seq("Scans", null);
|
||||
var tree = ArchiveTree.Build(Main, ArchiveAvailability.Online, [c, d, b, a]);
|
||||
|
||||
Assert.Equal("TitanoArchive", tree.Root.Title);
|
||||
Assert.Equal("ChronosArchive", tree.Root.Title);
|
||||
Assert.SequenceEqual(new[] { "2026", "2025", "Undated" }, tree.Root.Children.Select(n => n.Title));
|
||||
Assert.SequenceEqual(new[] { "Harbour", "Comet" }, tree.Root.Children[0].Children.Select(n => n.Title));
|
||||
Assert.Equal("3,600 photos · 72 GB", tree.Root.Children[0].Children[0].Detail);
|
||||
@@ -51,7 +51,7 @@ public sealed class ArchiveLogicTests
|
||||
// Collapsed years show only themselves; expanding one reveals its sequences.
|
||||
Assert.Equal(4, tree.Visible().Count);
|
||||
tree.Root.Children[1].IsExpanded = true;
|
||||
Assert.SequenceEqual(new[] { "TitanoArchive", "2026", "2025", "Stars", "Undated" }, tree.Visible().Select(n => n.Title));
|
||||
Assert.SequenceEqual(new[] { "ChronosArchive", "2026", "2025", "Stars", "Undated" }, tree.Visible().Select(n => n.Title));
|
||||
var expanded = tree.ExpandedKeys();
|
||||
var rebuilt = ArchiveTree.Build(Main, ArchiveAvailability.ReadOnly, [a, b, c, d]);
|
||||
rebuilt.Expand(expanded);
|
||||
@@ -217,7 +217,7 @@ public sealed class ArchiveLogicTests
|
||||
ArchiveFailures.Cause(new ArchiveOfflineException("/archive", ArchiveAvailability.Offline)));
|
||||
Assert.Equal("The archive " + Formatting.LeftToRight("/archive") + " is read-only.",
|
||||
ArchiveFailures.Cause(new ArchiveOfflineException("/archive", ArchiveAvailability.ReadOnly)));
|
||||
Assert.Equal("Titano was denied access to the archive.", ArchiveFailures.Cause(new UnauthorizedAccessException("Access to '/x' is denied.")));
|
||||
Assert.Equal("Chronos was denied access to the archive.", ArchiveFailures.Cause(new UnauthorizedAccessException("Access to '/x' is denied.")));
|
||||
Assert.Equal("The index could not be read or written.", ArchiveFailures.Cause(new DatabaseConnectionException("socket closed")));
|
||||
Assert.Equal("The sequence is no longer in the index.", ArchiveFailures.Cause(new ArgumentException("Unknown sequence 42.")));
|
||||
Assert.Equal("A file of the archive could not be read or written.", ArchiveFailures.Cause(new IOException("The device is not ready.")));
|
||||
@@ -301,11 +301,11 @@ public sealed class ArchiveLogicTests
|
||||
var now = DateTimeOffset.UtcNow;
|
||||
var jobs = new[]
|
||||
{
|
||||
new Job { Id = Guid.NewGuid(), Kind = JobKind.Verify, State = JobState.Running, ProgressDone = 71, ProgressTotal = 100, TargetLabel = "TitanoArchive", Created = now },
|
||||
new Job { Id = Guid.NewGuid(), Kind = JobKind.Verify, State = JobState.Running, ProgressDone = 71, ProgressTotal = 100, TargetLabel = "ChronosArchive", Created = now },
|
||||
new Job { Id = Guid.NewGuid(), Kind = JobKind.Scan, State = JobState.Done, Created = now.AddDays(-2), Finished = now.AddDays(-2) },
|
||||
};
|
||||
var recent = MaintenanceReports.Recent(jobs, 5);
|
||||
Assert.Equal("Verify · TitanoArchive", recent[0].Text);
|
||||
Assert.Equal("Verify · ChronosArchive", recent[0].Text);
|
||||
Assert.Equal("71 %", recent[0].StateText);
|
||||
Assert.Equal(StatusKind.Running, recent[0].StateKind);
|
||||
Assert.Equal(JobState.Done, recent[1].State);
|
||||
+12
-12
@@ -5,17 +5,17 @@ using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using Titano.App.Archiving;
|
||||
using Titano.App.Infrastructure;
|
||||
using Titano.App.Sections;
|
||||
using Titano.App.Shell;
|
||||
using Titano.App.Tests.Windows;
|
||||
using Titano.Core.Archiving;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Testing;
|
||||
using Titano.Ui.Controls;
|
||||
using Chronos.App.Archiving;
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.App.Sections;
|
||||
using Chronos.App.Shell;
|
||||
using Chronos.App.Tests.Windows;
|
||||
using Chronos.Core.Archiving;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Ui.Controls;
|
||||
|
||||
namespace Titano.App.Tests.Archiving;
|
||||
namespace Chronos.App.Tests.Archiving;
|
||||
|
||||
/// <summary>
|
||||
/// Every Archive view of <c>--capture</c> (<see cref="ArchiveScenes"/>) on the sample archive, rendered in both themes
|
||||
@@ -159,14 +159,14 @@ public sealed class ArchiveScreenSmokeTests
|
||||
Assert.Equal(Loc.L("Archive.Error.Offline", Formatting.LeftToRight("/nowhere")), sidecars.ToolTip);
|
||||
Assert.True(Fact(offline, "Archive.Rebuild.Root").IsPath, "the archive folder is shown left to right");
|
||||
|
||||
var missing = Path.Combine(Path.GetTempPath(), "titano-missing-" + Guid.NewGuid().ToString("N"));
|
||||
var missing = Path.Combine(Path.GetTempPath(), "chronos-missing-" + Guid.NewGuid().ToString("N"));
|
||||
var unreadable = new RebuildDialogViewModel(Archive(missing), ArchiveAvailability.Online, 3, () => Task.CompletedTask, _ => { });
|
||||
await unreadable.CountAsync();
|
||||
Assert.Equal("—", Fact(unreadable, "Archive.Rebuild.Metadata").Value);
|
||||
Assert.Equal(Loc.L("Archive.Failed.Files"), Fact(unreadable, "Archive.Rebuild.Metadata").ToolTip);
|
||||
Assert.Null(unreadable.BusyText, "nothing is counting any more");
|
||||
|
||||
static Core.Model.Archive Archive(string root) => new() { Id = Guid.CreateVersion7(), Name = "TitanoArchive", RootPath = root };
|
||||
static Core.Model.Archive Archive(string root) => new() { Id = Guid.CreateVersion7(), Name = "ChronosArchive", RootPath = root };
|
||||
static DialogFact Fact(RebuildDialogViewModel dialog, string label) => dialog.FactRows.Single(f => f.Label == Loc.L(label));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0-windows</TargetFramework>
|
||||
<UseWPF>true</UseWPF>
|
||||
<RootNamespace>Chronos.App.Tests</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Chronos.Testing\Chronos.Testing.csproj" />
|
||||
<ProjectReference Include="..\..\src\Chronos.App\Chronos.App.csproj" />
|
||||
<ProjectReference Include="..\..\src\Chronos.Uploader\Chronos.Uploader.csproj" />
|
||||
<ProjectReference Include="..\..\src\Chronos.Setup\Chronos.Setup.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
+10
-10
@@ -4,16 +4,16 @@ using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
using Titano.App.Editor;
|
||||
using Titano.App.Infrastructure;
|
||||
using Titano.App.Sections;
|
||||
using Titano.App.Shell;
|
||||
using Titano.App.Tests.Windows;
|
||||
using Titano.Core.Export;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Editor;
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.App.Sections;
|
||||
using Chronos.App.Shell;
|
||||
using Chronos.App.Tests.Windows;
|
||||
using Chronos.Core.Export;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Editor;
|
||||
namespace Chronos.App.Tests.Editor;
|
||||
|
||||
/// <summary>
|
||||
/// The Edit path in the real main window at the 1200 × 788 capture size (owner review 1, R7): the step bar for screen
|
||||
@@ -271,7 +271,7 @@ public sealed class EditPathSmokeTests
|
||||
await SettleAsync(app.Window);
|
||||
Assert.True(editor.IsTallMeasure);
|
||||
var measure = Find<ContentControl>(view).Single(c => c.Name == "StepMeasure");
|
||||
var preview = Find<Titano.Ui.Visuals.PreviewViewport>(view).Single(v => v.IsVisible);
|
||||
var preview = Find<Chronos.Ui.Visuals.PreviewViewport>(view).Single(v => v.IsVisible);
|
||||
Assert.Greater(measure.ActualHeight, preview.ActualHeight, "the preset cards take more room than the preview");
|
||||
|
||||
editor.SelectedTab = editor.Analysis;
|
||||
+9
-9
@@ -1,14 +1,14 @@
|
||||
using System.Reflection;
|
||||
using Titano.App.Editor;
|
||||
using Titano.Core.Advice;
|
||||
using Titano.Core.Analysis;
|
||||
using Titano.Core.Analysis.Deep;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Core.Project;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Editor;
|
||||
using Chronos.Core.Advice;
|
||||
using Chronos.Core.Analysis;
|
||||
using Chronos.Core.Analysis.Deep;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Core.Project;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Editor;
|
||||
namespace Chronos.App.Tests.Editor;
|
||||
|
||||
/// <summary>The Edit path (owner review 1, R7): where each step stands, the step of each finding, the opening step and the render comparison.</summary>
|
||||
public sealed class EditPathTests
|
||||
+11
-11
@@ -1,16 +1,16 @@
|
||||
using System.Globalization;
|
||||
using Titano.App.Editor;
|
||||
using Titano.Core.Analysis;
|
||||
using Titano.Core.Analysis.Deep;
|
||||
using Titano.Core.Diagnostics.Synthetic;
|
||||
using Titano.Core.Imaging;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Core.Project;
|
||||
using Titano.Core.Render.Diagnostics;
|
||||
using Titano.Data.Archiving.Jobs;
|
||||
using Chronos.App.Editor;
|
||||
using Chronos.Core.Analysis;
|
||||
using Chronos.Core.Analysis.Deep;
|
||||
using Chronos.Core.Diagnostics.Synthetic;
|
||||
using Chronos.Core.Imaging;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Core.Project;
|
||||
using Chronos.Core.Render.Diagnostics;
|
||||
using Chronos.Data.Archiving.Jobs;
|
||||
|
||||
namespace Titano.App.Tests.Editor;
|
||||
namespace Chronos.App.Tests.Editor;
|
||||
|
||||
/// <summary>A synthetic sunset with flicker and two exposure steps, as the editor tests open it.</summary>
|
||||
internal static class EditorFixture
|
||||
+8
-8
@@ -1,14 +1,14 @@
|
||||
using System.IO;
|
||||
using System.Text.Json;
|
||||
using Titano.App.Editor;
|
||||
using Titano.Core.Advice;
|
||||
using Titano.Core.Analysis;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Core.Project;
|
||||
using Titano.Protocol;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Editor;
|
||||
using Chronos.Core.Advice;
|
||||
using Chronos.Core.Analysis;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Core.Project;
|
||||
using Chronos.Protocol;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Editor;
|
||||
namespace Chronos.App.Tests.Editor;
|
||||
|
||||
public sealed class EditorSessionTests
|
||||
{
|
||||
+20
-20
@@ -7,24 +7,24 @@ using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Threading;
|
||||
using Titano.App.DesignTime;
|
||||
using Titano.App.Editor;
|
||||
using Titano.App.Infrastructure;
|
||||
using Titano.App.Sections;
|
||||
using Titano.App.Shell;
|
||||
using Titano.App.Tests.Windows;
|
||||
using Titano.Core.Advice;
|
||||
using Titano.Core.Analysis;
|
||||
using Titano.Core.Export;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Core.Project;
|
||||
using Titano.Testing;
|
||||
using Titano.Ui.Controls;
|
||||
using Titano.Ui.Theming;
|
||||
using Titano.Ui.Visuals;
|
||||
using Chronos.App.DesignTime;
|
||||
using Chronos.App.Editor;
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.App.Sections;
|
||||
using Chronos.App.Shell;
|
||||
using Chronos.App.Tests.Windows;
|
||||
using Chronos.Core.Advice;
|
||||
using Chronos.Core.Analysis;
|
||||
using Chronos.Core.Export;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Core.Project;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Ui.Controls;
|
||||
using Chronos.Ui.Theming;
|
||||
using Chronos.Ui.Visuals;
|
||||
|
||||
namespace Titano.App.Tests.Editor;
|
||||
namespace Chronos.App.Tests.Editor;
|
||||
|
||||
/// <summary>
|
||||
/// The sequence editor in the real main window, off screen at the minimum capture size, on the synthetic sunset of
|
||||
@@ -90,7 +90,7 @@ public sealed class EditorSmokeTests
|
||||
Assert.NotNull(editor.Session.Content.Deep, "the sample is analysed");
|
||||
Assert.True(editor.Session.Project.Exposure.Deflicker.HasAdvice, "the advice is in the project");
|
||||
Assert.Equal("Harbour sunset", editor.Title);
|
||||
Assert.Equal("Titano — Harbour sunset", shell.WindowTitle, "the window title follows the open sequence");
|
||||
Assert.Equal("Chronos — Harbour sunset", shell.WindowTitle, "the window title follows the open sequence");
|
||||
Assert.False(shell.IsJobBarVisible, "the idle job bar gives its height to the editor");
|
||||
|
||||
// The Render split button can be clicked once the plan exists (its command re-reads its state).
|
||||
@@ -266,7 +266,7 @@ public sealed class EditorSmokeTests
|
||||
foreach (var (remote, failure, cause) in new (bool, Exception, string)[]
|
||||
{
|
||||
(true, new HttpRequestException("No such host is known."), "Server.Error.Unreachable"),
|
||||
(false, new UnauthorizedAccessException(@"Access to the path 'D:\Archive\.titano\sequence.json' is denied."), "Archive.Failed.Access"),
|
||||
(false, new UnauthorizedAccessException(@"Access to the path 'D:\Archive\.chronos\sequence.json' is denied."), "Archive.Failed.Access"),
|
||||
(true, new ProxiesOutdatedException(Loc.L("Editor.Error.FramesChanged")), "Editor.Error.FramesChanged"),
|
||||
(true, new EditorException(Loc.L("Editor.Error.RemoteReadOnly")), "Editor.Error.RemoteReadOnly"),
|
||||
(false, new EditorException(Loc.L("Editor.Error.SaveConflict")), "Editor.Error.SaveConflict"),
|
||||
@@ -317,7 +317,7 @@ public sealed class EditorSmokeTests
|
||||
var shown = content.Frames[5].Id;
|
||||
// An earlier photo arrives and the last frame goes: as many frames as before, each one place later.
|
||||
var first = content.Frames[0];
|
||||
IReadOnlyList<Titano.Core.Model.Frame> frames =
|
||||
IReadOnlyList<Chronos.Core.Model.Frame> frames =
|
||||
[.. new[] { first with { Id = Guid.CreateVersion7(), CapturedAt = first.CapturedAt!.Value.AddMinutes(-1) } }.Concat(content.Frames.SkipLast(1))
|
||||
.Select((f, i) => f with { Index = i })];
|
||||
source.Content = content with { Frames = frames, Light = LightAnalyzer.Analyze(frames) };
|
||||
+7
-7
@@ -1,11 +1,11 @@
|
||||
using Titano.App.Editor;
|
||||
using Titano.Core.Advice;
|
||||
using Titano.Core.Imaging;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Core.Project;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Editor;
|
||||
using Chronos.Core.Advice;
|
||||
using Chronos.Core.Imaging;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Core.Project;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Editor;
|
||||
namespace Chronos.App.Tests.Editor;
|
||||
|
||||
/// <summary>Composed texts of the editor (the conflict prompt among them), crop margins and the waveform monitor.</summary>
|
||||
public sealed class EditorTextTests
|
||||
+8
-8
@@ -1,12 +1,12 @@
|
||||
using Titano.App.Editor;
|
||||
using Titano.Core.Advice;
|
||||
using Titano.Core.Export;
|
||||
using Titano.Core.Project;
|
||||
using Titano.Core.Video;
|
||||
using Titano.Core.Video.Managed;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Editor;
|
||||
using Chronos.Core.Advice;
|
||||
using Chronos.Core.Export;
|
||||
using Chronos.Core.Project;
|
||||
using Chronos.Core.Video;
|
||||
using Chronos.Core.Video.Managed;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Editor;
|
||||
namespace Chronos.App.Tests.Editor;
|
||||
|
||||
public sealed class ExportPlannerTests
|
||||
{
|
||||
+11
-11
@@ -1,15 +1,15 @@
|
||||
using System.IO;
|
||||
using Titano.App.Editor;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Core.Project;
|
||||
using Titano.Data;
|
||||
using Titano.Data.Archiving;
|
||||
using Titano.Data.Jobs;
|
||||
using Titano.Data.Processing;
|
||||
using Titano.Data.Sync;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Editor;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Core.Project;
|
||||
using Chronos.Data;
|
||||
using Chronos.Data.Archiving;
|
||||
using Chronos.Data.Jobs;
|
||||
using Chronos.Data.Processing;
|
||||
using Chronos.Data.Sync;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Editor;
|
||||
namespace Chronos.App.Tests.Editor;
|
||||
|
||||
/// <summary>Export "Sync" (Export.html): when it applies, how the project remembers it, and the send it queues after a render.</summary>
|
||||
public sealed class ExportSyncTests(TestContext context)
|
||||
@@ -40,7 +40,7 @@ public sealed class ExportSyncTests(TestContext context)
|
||||
public async Task AFinishedRenderIsSentOnlyWhenAskedLinkedAndAllowed()
|
||||
{
|
||||
var directory = context.CreateTempDirectory("export-sync");
|
||||
await using var db = await TitanoDatabase.OpenAsync(DatabaseOptions.Sqlite(Path.Combine(directory, "index.db")));
|
||||
await using var db = await ChronosDatabase.OpenAsync(DatabaseOptions.Sqlite(Path.Combine(directory, "index.db")));
|
||||
var archives = new ArchiveService(db, new ArchiveServiceOptions { Owner = "test" });
|
||||
var archive = await archives.CreateAsync(Path.Combine(directory, "archive"), "Test");
|
||||
var sequence = new Sequence { Id = Guid.CreateVersion7(), ArchiveId = archive.Id, Title = "Harbour sunset", Folder = "Harbour", FrameCount = 1 };
|
||||
+10
-10
@@ -3,12 +3,12 @@ using System.IO;
|
||||
using System.Net;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading.Channels;
|
||||
using Titano.App.Editor;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Protocol;
|
||||
using Titano.Protocol.Client;
|
||||
using Chronos.App.Editor;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Protocol;
|
||||
using Chronos.Protocol.Client;
|
||||
|
||||
namespace Titano.App.Tests.Editor;
|
||||
namespace Chronos.App.Tests.Editor;
|
||||
|
||||
/// <summary>
|
||||
/// One server sequence as the API serves it to an editor: its frames, settings with a version that refuses stale edits
|
||||
@@ -104,12 +104,12 @@ internal sealed class FakeRemoteSequenceApi(Sequence sequence, IReadOnlyList<Gui
|
||||
if (request.ExpectedSettingsVersion is { } expected && expected != SettingsVersion)
|
||||
{
|
||||
Edits.Add((request, false));
|
||||
throw new TitanoApiException(HttpStatusCode.Conflict, new ApiError("settings_conflict", "changed", SettingsVersion.ToString()));
|
||||
throw new ChronosApiException(HttpStatusCode.Conflict, new ApiError("settings_conflict", "changed", SettingsVersion.ToString()));
|
||||
}
|
||||
if (request.ExpectedFramesVersion is { } frames && frames != FramesVersion)
|
||||
{
|
||||
Edits.Add((request, false));
|
||||
throw new TitanoApiException(HttpStatusCode.Conflict, new ApiError("frames_conflict", "frames changed", FramesVersion.ToString()));
|
||||
throw new ChronosApiException(HttpStatusCode.Conflict, new ApiError("frames_conflict", "frames changed", FramesVersion.ToString()));
|
||||
}
|
||||
Edits.Add((request, true));
|
||||
SettingsJson = request.SettingsJson ?? SettingsJson;
|
||||
@@ -149,7 +149,7 @@ internal sealed class FakeRemoteSequenceApi(Sequence sequence, IReadOnlyList<Gui
|
||||
}
|
||||
return Jobs.TryGetValue(id, out var job)
|
||||
? Task.FromResult(job)
|
||||
: throw new TitanoApiException(HttpStatusCode.NotFound, new ApiError("not_found", "job", "job"));
|
||||
: throw new ChronosApiException(HttpStatusCode.NotFound, new ApiError("not_found", "job", "job"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,13 +193,13 @@ internal sealed class FakeRemoteSequenceApi(Sequence sequence, IReadOnlyList<Gui
|
||||
{
|
||||
lock (_gate)
|
||||
{
|
||||
if (!Jobs.TryGetValue(id, out var job)) throw new TitanoApiException(HttpStatusCode.NotFound, new ApiError("not_found", "job", "job"));
|
||||
if (!Jobs.TryGetValue(id, out var job)) throw new ChronosApiException(HttpStatusCode.NotFound, new ApiError("not_found", "job", "job"));
|
||||
return Task.FromResult(Jobs[id] = change(job));
|
||||
}
|
||||
}
|
||||
|
||||
private void Check(Guid id)
|
||||
{
|
||||
if (Gone || id != sequence.Id) throw new TitanoApiException(HttpStatusCode.NotFound, new ApiError("not_found", "gone", "sequence"));
|
||||
if (Gone || id != sequence.Id) throw new ChronosApiException(HttpStatusCode.NotFound, new ApiError("not_found", "gone", "sequence"));
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -1,9 +1,9 @@
|
||||
using Titano.App.Editor;
|
||||
using Titano.Core.Imaging;
|
||||
using Titano.Core.Project;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Editor;
|
||||
using Chronos.Core.Imaging;
|
||||
using Chronos.Core.Project;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Editor;
|
||||
namespace Chronos.App.Tests.Editor;
|
||||
|
||||
/// <summary>The corrected-frame preview through the render pipeline at preview size.</summary>
|
||||
public sealed class PreviewRendererTests
|
||||
+25
-25
@@ -1,20 +1,20 @@
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using Titano.App.DesignTime;
|
||||
using Titano.App.Editor;
|
||||
using Titano.App.Infrastructure;
|
||||
using Titano.App.Shell;
|
||||
using Titano.App.Tests.Windows;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Core.Project;
|
||||
using Titano.Testing;
|
||||
using Titano.Ui.Controls;
|
||||
using Titano.Ui.Theming;
|
||||
using Chronos.App.DesignTime;
|
||||
using Chronos.App.Editor;
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.App.Shell;
|
||||
using Chronos.App.Tests.Windows;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Core.Project;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Ui.Controls;
|
||||
using Chronos.Ui.Theming;
|
||||
|
||||
namespace Titano.App.Tests.Editor;
|
||||
namespace Chronos.App.Tests.Editor;
|
||||
|
||||
/// <summary>
|
||||
/// <c>.titano</c> project files (BRIEF §18) in the real main window on the editor sample: the editor saves one, and
|
||||
/// <c>.chronos</c> project files (BRIEF §18) in the real main window on the editor sample: the editor saves one, and
|
||||
/// opening one shows its sequence with the file's settings as one undo step, or says in one sentence why not.
|
||||
/// </summary>
|
||||
[WindowsOnly]
|
||||
@@ -56,9 +56,9 @@ public sealed class ProjectFilesTests(TestContext context)
|
||||
var editor = Assert.NotNull(await shell.Sequence.ShowAsync(id));
|
||||
await files.SaveAsync(editor.Session);
|
||||
await files.SaveAsync(editor.Session);
|
||||
var path = Path.Combine(folder, "Harbour sunset.titano");
|
||||
var path = Path.Combine(folder, "Harbour sunset.chronos");
|
||||
Assert.FileExists(path);
|
||||
Assert.FileExists(Path.Combine(folder, "Harbour sunset (2).titano"));
|
||||
Assert.FileExists(Path.Combine(folder, "Harbour sunset (2).chronos"));
|
||||
Assert.Equal(Loc.L("Editor.ProjectFile.Saved"), toasts[^1].Title);
|
||||
var bundle = ProjectBundle.Load(path);
|
||||
Assert.Equal(id, bundle.Sequence.Id);
|
||||
@@ -83,13 +83,13 @@ public sealed class ProjectFilesTests(TestContext context)
|
||||
Archive = bundle.Archive with { Id = Guid.CreateVersion7() },
|
||||
Sequence = bundle.Sequence with { Id = Guid.CreateVersion7(), Folder = "2026/elsewhere" },
|
||||
};
|
||||
var missing = Path.Combine(folder, "Elsewhere.titano");
|
||||
var missing = Path.Combine(folder, "Elsewhere.chronos");
|
||||
elsewhere.Save(missing);
|
||||
await files.OpenAsync(missing);
|
||||
Assert.Equal(Loc.L("Editor.ProjectFile.NotFound"), toasts[^1].Title);
|
||||
Assert.True(toasts[^1].IsError);
|
||||
|
||||
var text = Path.Combine(folder, "notes.titano");
|
||||
var text = Path.Combine(folder, "notes.chronos");
|
||||
await File.WriteAllTextAsync(text, "not a project");
|
||||
await files.OpenAsync(text);
|
||||
Assert.Equal(Loc.L("Editor.ProjectFile.Unreadable"), toasts[^1].Title);
|
||||
@@ -110,10 +110,10 @@ public sealed class ProjectFilesTests(TestContext context)
|
||||
[Test]
|
||||
public void AHandOverMessageRoundTrips()
|
||||
{
|
||||
string[] args = [@"C:\Users\me\Desktop\Harbour sunset.titano"];
|
||||
string[] args = [@"C:\Users\me\Desktop\Harbour sunset.chronos"];
|
||||
Assert.SequenceEqual(args, SingleInstance.Decode(SingleInstance.Encode(args))!);
|
||||
Assert.Empty(SingleInstance.Decode(SingleInstance.Encode([]))!);
|
||||
Assert.Null(SingleInstance.Decode("TITANO-UPLOADER/1\nE:\\"u8));
|
||||
Assert.Null(SingleInstance.Decode("CHRONOS-UPLOADER/1\nE:\\"u8));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -124,24 +124,24 @@ public sealed class ProjectFilesTests(TestContext context)
|
||||
try
|
||||
{
|
||||
first.Listen();
|
||||
Assert.Null(SingleInstance.TryAcquire(data), "one Titano per data folder");
|
||||
Assert.Null(SingleInstance.TryAcquire(data), "one Chronos per data folder");
|
||||
using (var other = SingleInstance.TryAcquire(context.CreateTempDirectory("other-copy")))
|
||||
Assert.NotNull(other, "a portable copy with its own data folder runs on its own");
|
||||
|
||||
// Launches while the first one is still opening its window are kept until the window takes them. The pipe
|
||||
// takes one launch at a time, so once the second hand-over is through, the first one is already waiting.
|
||||
Assert.True(SingleInstance.HandOver(data, [@"D:\Projects\Early.titano"]));
|
||||
Assert.True(SingleInstance.HandOver(data, [@"D:\Projects\Early.chronos"]));
|
||||
Assert.True(SingleInstance.HandOver(data, []));
|
||||
using var received = new System.Collections.Concurrent.BlockingCollection<IReadOnlyList<string>>();
|
||||
first.Receive(received.Add);
|
||||
Assert.True(received.TryTake(out var early, TimeSpan.FromSeconds(10)), "the hand-over that came first is delivered");
|
||||
Assert.SequenceEqual([@"D:\Projects\Early.titano"], early!);
|
||||
Assert.SequenceEqual([@"D:\Projects\Early.chronos"], early!);
|
||||
Assert.True(received.TryTake(out var show, TimeSpan.FromSeconds(10)), "then the plain launch");
|
||||
Assert.Empty(show!);
|
||||
|
||||
Assert.True(SingleInstance.HandOver(data, [@"D:\Projects\Roof.titano"]));
|
||||
Assert.True(SingleInstance.HandOver(data, [@"D:\Projects\Roof.chronos"]));
|
||||
Assert.True(received.TryTake(out var later, TimeSpan.FromSeconds(10)), "the running instance received the hand-over");
|
||||
Assert.SequenceEqual([@"D:\Projects\Roof.titano"], later!);
|
||||
Assert.SequenceEqual([@"D:\Projects\Roof.chronos"], later!);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -150,7 +150,7 @@ public sealed class ProjectFilesTests(TestContext context)
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ALaunchWhileTitanoClosesWaitsForItAndStartsInItsPlace()
|
||||
public void ALaunchWhileChronosClosesWaitsForItAndStartsInItsPlace()
|
||||
{
|
||||
var data = context.CreateTempDirectory("closing");
|
||||
var first = Assert.NotNull(SingleInstance.TryAcquire(data));
|
||||
@@ -158,7 +158,7 @@ public sealed class ProjectFilesTests(TestContext context)
|
||||
first.Receive(_ => { });
|
||||
// Closing: it no longer answers, but it still holds the data folder until its services have stopped.
|
||||
first.StopListening();
|
||||
Assert.False(SingleInstance.HandOver(data, [@"D:\Projects\Roof.titano"]), "a closing Titano takes no file it could not open");
|
||||
Assert.False(SingleInstance.HandOver(data, [@"D:\Projects\Roof.chronos"]), "a closing Chronos takes no file it could not open");
|
||||
Assert.Null(SingleInstance.TryAcquire(data));
|
||||
|
||||
// The next launch waits (the mutex belongs to a thread, so it waits on its own) and gets its turn once the first exits.
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
using Titano.App.Editor;
|
||||
using Titano.Core.Project;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Editor;
|
||||
using Chronos.Core.Project;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Editor;
|
||||
namespace Chronos.App.Tests.Editor;
|
||||
|
||||
public sealed class ProjectHistoryTests
|
||||
{
|
||||
+24
-24
@@ -1,21 +1,21 @@
|
||||
using System.IO;
|
||||
using Titano.App.Editor;
|
||||
using Titano.Core.Archiving;
|
||||
using Titano.Core.Codecs.Jpeg;
|
||||
using Titano.Core.Imaging;
|
||||
using Titano.Core.Imaging.Decoders;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Core.Metadata;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Core.Project;
|
||||
using Titano.Data;
|
||||
using Titano.Data.Archiving;
|
||||
using Titano.Data.Jobs;
|
||||
using Titano.Data.Processing;
|
||||
using Titano.Data.Repositories;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Editor;
|
||||
using Chronos.Core.Archiving;
|
||||
using Chronos.Core.Codecs.Jpeg;
|
||||
using Chronos.Core.Imaging;
|
||||
using Chronos.Core.Imaging.Decoders;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Core.Metadata;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Core.Project;
|
||||
using Chronos.Data;
|
||||
using Chronos.Data.Archiving;
|
||||
using Chronos.Data.Jobs;
|
||||
using Chronos.Data.Processing;
|
||||
using Chronos.Data.Repositories;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Editor;
|
||||
namespace Chronos.App.Tests.Editor;
|
||||
|
||||
/// <summary>Project merges, and the local source over a real SQLite index and archive folder.</summary>
|
||||
public sealed class ProjectStoreTests(TestContext context)
|
||||
@@ -79,7 +79,7 @@ public sealed class ProjectStoreTests(TestContext context)
|
||||
var edited = content.Project with { HeroFrame = 4, Exposure = content.Project.Exposure with { ExposureOffsetEv = 0.3 } };
|
||||
var stored = await source.SaveProjectAsync(edited, content.Project, context.Cancellation);
|
||||
Assert.True(ProjectMerge.SameValues(edited, stored));
|
||||
var projectPath = Path.Combine(root, "Synthetic", ".titano", "project.json");
|
||||
var projectPath = Path.Combine(root, "Synthetic", ".chronos", "project.json");
|
||||
Assert.FileExists(projectPath);
|
||||
Assert.Equal(edited.ToJson(), File.ReadAllText(projectPath));
|
||||
var row = await db.Sequences.GetAsync(sequenceId);
|
||||
@@ -133,7 +133,7 @@ public sealed class ProjectStoreTests(TestContext context)
|
||||
}
|
||||
|
||||
// "Save both" copies kept by a sync conflict are listed with the sequence.
|
||||
File.WriteAllText(Path.Combine(root, "Synthetic", ".titano", "project.this-pc-20261003-142200.json"), new ProjectSettings().ToJson());
|
||||
File.WriteAllText(Path.Combine(root, "Synthetic", ".chronos", "project.this-pc-20261003-142200.json"), new ProjectSettings().ToJson());
|
||||
Assert.Equal(new DateTime(2026, 10, 3, 14, 22, 0), Assert.Contains((await source.LoadAsync(context.Cancellation)).SavedCopies, _ => true).SavedAt);
|
||||
}
|
||||
}
|
||||
@@ -175,7 +175,7 @@ public sealed class ProjectStoreTests(TestContext context)
|
||||
Assert.SequenceEqual([content.Frames[5].Id, content.Frames[7].Id], stored.ExcludedFrames.Select(i => frames[i].Id), "the photos the user chose");
|
||||
Assert.Equal(content.Frames[6].Id, frames[stored.HeroFrame!.Value].Id);
|
||||
Assert.Equal(content.Frames[6].Id, row.HeroFrameId);
|
||||
Assert.Equal(row.SettingsJson, File.ReadAllText(Path.Combine(root, "Synthetic", ".titano", "project.json")));
|
||||
Assert.Equal(row.SettingsJson, File.ReadAllText(Path.Combine(root, "Synthetic", ".chronos", "project.json")));
|
||||
|
||||
// Undo takes back the user's last step on the new frames too.
|
||||
Assert.True(session.Undo());
|
||||
@@ -254,14 +254,14 @@ public sealed class ProjectStoreTests(TestContext context)
|
||||
var (db, sequenceId, root) = await ArchiveAsync(4);
|
||||
await using (db)
|
||||
{
|
||||
var path = Path.Combine(root, "Synthetic", ".titano", "project.json");
|
||||
var path = Path.Combine(root, "Synthetic", ".chronos", "project.json");
|
||||
File.WriteAllText(path, "{ not json");
|
||||
await using var source = new LocalSequenceSource(db, sequenceId, DecoderFactory.CreateClient(null), null);
|
||||
var unreadable = await Assert.ThrowsAsync<EditorException>(() => source.LoadAsync(context.Cancellation));
|
||||
Assert.Equal(Loc.L("Editor.Error.Project"), unreadable.Message);
|
||||
Assert.Equal("{ not json", File.ReadAllText(path));
|
||||
|
||||
// A project written by a newer Titano reads the same, not as the parser's English sentence.
|
||||
// A project written by a newer Chronos reads the same, not as the parser's English sentence.
|
||||
var newer = $"{{\"version\":{ProjectSettings.CurrentVersion + 1}}}";
|
||||
File.WriteAllText(path, newer);
|
||||
Assert.Equal(Loc.L("Editor.Error.Project"), (await Assert.ThrowsAsync<EditorException>(() => source.LoadAsync(context.Cancellation))).Message);
|
||||
@@ -273,7 +273,7 @@ public sealed class ProjectStoreTests(TestContext context)
|
||||
/// Writes <paramref name="count"/> photos taken before the sequence's first frame into its folder and scans the
|
||||
/// archive: they are inserted in front, and the index moves the stored positions with their frames.
|
||||
/// </summary>
|
||||
private async Task InsertEarlierAsync(TitanoDatabase db, string root, SequenceContent content, ArchiveServiceOptions options, int count)
|
||||
private async Task InsertEarlierAsync(ChronosDatabase db, string root, SequenceContent content, ArchiveServiceOptions options, int count)
|
||||
{
|
||||
var sequence = EditorFixture.Sequence(count);
|
||||
var first = content.Frames[0].CapturedAt!.Value;
|
||||
@@ -327,11 +327,11 @@ public sealed class ProjectStoreTests(TestContext context)
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<(TitanoDatabase Db, Guid SequenceId, string Root)> ArchiveAsync(int frames)
|
||||
private async Task<(ChronosDatabase Db, Guid SequenceId, string Root)> ArchiveAsync(int frames)
|
||||
{
|
||||
var directory = context.CreateTempDirectory("editor");
|
||||
var root = Path.Combine(directory, "archive");
|
||||
var db = await TitanoDatabase.OpenAsync(DatabaseOptions.Sqlite(Path.Combine(directory, "index.db")));
|
||||
var db = await ChronosDatabase.OpenAsync(DatabaseOptions.Sqlite(Path.Combine(directory, "index.db")));
|
||||
var service = new ArchiveService(db, new ArchiveServiceOptions { Owner = "test", LeaseWait = TimeSpan.FromSeconds(20) });
|
||||
var archive = await service.CreateAsync(root, "Test");
|
||||
var sequence = EditorFixture.Sequence(frames);
|
||||
+13
-13
@@ -1,19 +1,19 @@
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using Titano.App.Editor;
|
||||
using Titano.Core.Codecs.Jpeg;
|
||||
using Titano.Core.Diagnostics.Synthetic;
|
||||
using Titano.Core.Imaging;
|
||||
using Titano.Core.Imaging.Decoders;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Core.Project;
|
||||
using Titano.Data.Processing;
|
||||
using Titano.Data.Sync;
|
||||
using Titano.Protocol;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Editor;
|
||||
using Chronos.Core.Codecs.Jpeg;
|
||||
using Chronos.Core.Diagnostics.Synthetic;
|
||||
using Chronos.Core.Imaging;
|
||||
using Chronos.Core.Imaging.Decoders;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Core.Project;
|
||||
using Chronos.Data.Processing;
|
||||
using Chronos.Data.Sync;
|
||||
using Chronos.Protocol;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Editor;
|
||||
namespace Chronos.App.Tests.Editor;
|
||||
|
||||
/// <summary>
|
||||
/// A server sequence in the editor (BRIEF §14.5): proxies from the cache, the project from the server with its
|
||||
+4
-4
@@ -1,9 +1,9 @@
|
||||
using System.IO;
|
||||
using Titano.App.Editor;
|
||||
using Titano.Core.Project;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Editor;
|
||||
using Chronos.Core.Project;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Editor;
|
||||
namespace Chronos.App.Tests.Editor;
|
||||
|
||||
/// <summary>"Save both" copies of this PC's settings: listed newest first and restored as one undoable step.</summary>
|
||||
public sealed class SavedCopiesTests(TestContext context)
|
||||
+4
-4
@@ -1,9 +1,9 @@
|
||||
using System.Collections.Concurrent;
|
||||
using Titano.App.Editor;
|
||||
using Titano.Core.Project;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Editor;
|
||||
using Chronos.Core.Project;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Editor;
|
||||
namespace Chronos.App.Tests.Editor;
|
||||
|
||||
/// <summary>Debouncing and cancellation of preview work, and the coalescing project writer.</summary>
|
||||
public sealed class SchedulingTests
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
using Titano.App.Editor;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Editor;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Editor;
|
||||
namespace Chronos.App.Tests.Editor;
|
||||
|
||||
/// <summary>The jobs of the open sequence: the busy lock, Analyse queued twice, and the server job the header shows.</summary>
|
||||
public sealed class SequenceJobsTests
|
||||
+5
-5
@@ -1,10 +1,10 @@
|
||||
using System.Globalization;
|
||||
using Titano.App.Import;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Import;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Import;
|
||||
namespace Chronos.App.Tests.Import;
|
||||
|
||||
public sealed class CardPoolTests
|
||||
{
|
||||
+6
-6
@@ -1,12 +1,12 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Titano.App.Import;
|
||||
using Titano.Core.Import;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Data.Archiving;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Import;
|
||||
using Chronos.Core.Import;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Data.Archiving;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Import;
|
||||
namespace Chronos.App.Tests.Import;
|
||||
|
||||
public sealed class ImportChoicesTests
|
||||
{
|
||||
+23
-23
@@ -2,16 +2,16 @@ using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using Titano.App.Import;
|
||||
using Titano.Core.Archiving;
|
||||
using Titano.Core.Import;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Data;
|
||||
using Titano.Protocol;
|
||||
using Titano.Protocol.Client;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Import;
|
||||
using Chronos.Core.Archiving;
|
||||
using Chronos.Core.Import;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Data;
|
||||
using Chronos.Protocol;
|
||||
using Chronos.Protocol.Client;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Import;
|
||||
namespace Chronos.App.Tests.Import;
|
||||
|
||||
/// <summary>A stopped import or plan says what happened in one localized sentence, never the exception's raw text.</summary>
|
||||
public sealed class ImportFailuresTests
|
||||
@@ -24,10 +24,10 @@ public sealed class ImportFailuresTests
|
||||
const string Card = "EOS R5 · card A";
|
||||
Assert.Equal("EOS R5 · card A is no longer available.", ImportFailures.Import(new ImportSourceUnavailableException(@"C:\Users\me\AppData\Local\Temp\card\"), Card));
|
||||
Assert.Equal("The destination is full.", ImportFailures.Import(new IOException("There is not enough space on the disk.", unchecked((int)0x80070070)), Card));
|
||||
Assert.Equal("Titano may not write to the destination.", ImportFailures.Import(new UnauthorizedAccessException(@"Access to D:\Shoots is denied."), Card));
|
||||
Assert.Equal("Chronos may not write to the destination.", ImportFailures.Import(new UnauthorizedAccessException(@"Access to D:\Shoots is denied."), Card));
|
||||
Assert.Equal("The server did not accept the photos.", ImportFailures.Import(new HttpRequestException("No such host is known."), Card));
|
||||
Assert.Equal("The server did not accept the photos.",
|
||||
ImportFailures.Import(new TitanoApiException(HttpStatusCode.InsufficientStorage, new ApiError("quota", "Quota exceeded", null)), Card));
|
||||
ImportFailures.Import(new ChronosApiException(HttpStatusCode.InsufficientStorage, new ApiError("quota", "Quota exceeded", null)), Card));
|
||||
Assert.Equal("The import stopped before the end.", ImportFailures.Import(new InvalidDataException("Bad sidecar. Second sentence."), Card));
|
||||
}
|
||||
|
||||
@@ -37,14 +37,14 @@ public sealed class ImportFailuresTests
|
||||
const string Card = "EOS R5 · card A";
|
||||
Assert.Equal("EOS R5 · card A is no longer available.", ImportFailures.Stop(new ImportSourceUnavailableException(@"E:\"), Card));
|
||||
Assert.Equal("The destination is full.", ImportFailures.Stop(new IOException("There is not enough space on the disk.", unchecked((int)0x80070070)), Card));
|
||||
Assert.Equal("Titano may not write to the destination.", ImportFailures.Stop(new UnauthorizedAccessException(@"Access to D:\Shoots is denied."), Card));
|
||||
Assert.Equal("Chronos may not write to the destination.", ImportFailures.Stop(new UnauthorizedAccessException(@"Access to D:\Shoots is denied."), Card));
|
||||
Assert.Equal("The import stopped before the end.", ImportFailures.Stop(new IOException("The specified network name is no longer available."), Card));
|
||||
// The server's own sentence, else why it could not be asked.
|
||||
Assert.Equal("Sign in again",
|
||||
ImportFailures.Stop(new TitanoApiException(HttpStatusCode.Unauthorized, new ApiError("unauthorized", "Sign in again", null)), Card));
|
||||
ImportFailures.Stop(new ChronosApiException(HttpStatusCode.Unauthorized, new ApiError("unauthorized", "Sign in again", null)), Card));
|
||||
Assert.Equal(Loc.L("Server.Error.Unreachable"), ImportFailures.Stop(new HttpRequestException("An error occurred while sending the request."), Card));
|
||||
// A reverse proxy answered while the server restarted: its reason phrase is English, never the server's sentence.
|
||||
Assert.Equal(Loc.L("Server.Error.Unreachable"), ImportFailures.Stop(new TitanoApiException(HttpStatusCode.BadGateway, new ApiError("http_502", "Bad Gateway")), Card));
|
||||
Assert.Equal(Loc.L("Server.Error.Unreachable"), ImportFailures.Stop(new ChronosApiException(HttpStatusCode.BadGateway, new ApiError("http_502", "Bad Gateway")), Card));
|
||||
Assert.Equal(Loc.L("Server.Error.Unreachable"), ImportFailures.Stop(new TaskCanceledException("The operation was canceled."), Card));
|
||||
Assert.Equal(Loc.L("Server.Error.Untrusted"), ImportFailures.Stop(new UntrustedCertificateException("AB:CD"), Card));
|
||||
}
|
||||
@@ -54,13 +54,13 @@ public sealed class ImportFailuresTests
|
||||
{
|
||||
// The server import stages its copies in this PC's cache folder; the server answers for its own space and rights.
|
||||
const string Card = "EOS R5 · card A";
|
||||
using var client = new TitanoClient(new Uri("https://nas.local:8443/"), new CertificatePinning([]), "tests");
|
||||
var staging = Path.Combine(Path.GetTempPath(), "titano-server-import");
|
||||
using var client = new ChronosClient(new Uri("https://nas.local:8443/"), new CertificatePinning([]), "tests");
|
||||
var staging = Path.Combine(Path.GetTempPath(), "chronos-server-import");
|
||||
Assert.True(((IImportSink)new ServerImportSink(client, staging)).StagesOnThisPc);
|
||||
Assert.Equal("The drive of this PC's cache folder is full.",
|
||||
ImportFailures.Stop(new IOException("There is not enough space on the disk.", unchecked((int)0x80070070)), Card, stagesOnThisPc: true));
|
||||
Assert.Equal("Titano may not write to this PC's cache folder.",
|
||||
ImportFailures.Stop(new UnauthorizedAccessException(@"Access to the path 'C:\Users\me\AppData\Local\Titano\cache\server-import' is denied."), Card,
|
||||
Assert.Equal("Chronos may not write to this PC's cache folder.",
|
||||
ImportFailures.Stop(new UnauthorizedAccessException(@"Access to the path 'C:\Users\me\AppData\Local\Chronos\cache\server-import' is denied."), Card,
|
||||
stagesOnThisPc: true));
|
||||
Assert.Equal("EOS R5 · card A is no longer available.", ImportFailures.Stop(new ImportSourceUnavailableException(@"E:\"), Card, stagesOnThisPc: true));
|
||||
Assert.Equal("The import stopped before the end.", ImportFailures.Stop(new IOException("The specified network name is no longer available."), Card, stagesOnThisPc: true));
|
||||
@@ -74,17 +74,17 @@ public sealed class ImportFailuresTests
|
||||
Assert.Equal("The archive D:\\Shoots is offline.", ImportFailures.Job(new ArchiveOfflineException(@"D:\Shoots", ArchiveAvailability.Offline).Message));
|
||||
Assert.Equal("The archive D:\\Shoots is read-only.", ImportFailures.Job(new ArchiveOfflineException(@"D:\Shoots", ArchiveAvailability.ReadOnly).Message));
|
||||
Assert.Equal("The card or folder E:\\ is no longer available.", ImportFailures.Job(new ImportSourceUnavailableException(@"E:\").Message));
|
||||
var busy = new LeaseUnavailableException("settings", new LeaseRecord("t", "Titano Server (nas)", "nas", 42, DateTimeOffset.UnixEpoch, DateTimeOffset.UnixEpoch));
|
||||
var busy = new LeaseUnavailableException("settings", new LeaseRecord("t", "Chronos Server (nas)", "nas", 42, DateTimeOffset.UnixEpoch, DateTimeOffset.UnixEpoch));
|
||||
Assert.Equal(busy.Message, ImportFailures.Job(busy.Message));
|
||||
var newer = new NewerFormatException(Path.Combine(Path.GetTempPath(), "archive.json"), 3);
|
||||
Assert.Equal("archive.json was written by a newer Titano (format 3).", ImportFailures.Job(newer.Message));
|
||||
Assert.Equal("archive.json was written by a newer Chronos (format 3).", ImportFailures.Job(newer.Message));
|
||||
Assert.Equal("IMG_0001.CR3 could not be added to the sequence.", ImportFailures.Job(Loc.L("Archive.Error.DuplicateLost", "IMG_0001.CR3")));
|
||||
|
||||
// A database, framework or system text reads as the catalog's sentence; the tooltip keeps it.
|
||||
Assert.Equal("The import stopped before the end.", ImportFailures.Job("database is locked: no write lock within 30 s"));
|
||||
Assert.Equal("The import stopped before the end.",
|
||||
ImportFailures.Job(@"The process cannot access the file 'D:\Shoots\2026\IMG_0001.CR3' because it is being used by another process."));
|
||||
Assert.Equal("The import stopped before the end.", ImportFailures.Job("There is not enough space on the disk. : 'D:\\Shoots\\.titano\\journal'"));
|
||||
Assert.Equal("The import stopped before the end.", ImportFailures.Job("There is not enough space on the disk. : 'D:\\Shoots\\.chronos\\journal'"));
|
||||
Assert.Equal("The import stopped before the end.", ImportFailures.Job($"Sequence {Guid.Empty} is not indexed."));
|
||||
Assert.Equal("The import stopped before the end.", ImportFailures.Job(null));
|
||||
Assert.Equal("The import stopped before the end.", ImportFailures.Job(string.Empty));
|
||||
@@ -104,7 +104,7 @@ public sealed class ImportFailuresTests
|
||||
public void ACardCheckOrDeleteFailureIsOneSentenceByCause()
|
||||
{
|
||||
const string Card = "EOS R5 · card A";
|
||||
var root = Directory.CreateTempSubdirectory("titano-card-").FullName;
|
||||
var root = Directory.CreateTempSubdirectory("chronos-card-").FullName;
|
||||
try
|
||||
{
|
||||
Assert.Equal("A photo or its archive copy could not be read.", ImportFailures.Check(new IOException("The semaphore timeout period has expired."), Card, root));
|
||||
@@ -122,7 +122,7 @@ public sealed class ImportFailuresTests
|
||||
Directory.Delete(root);
|
||||
}
|
||||
// A card that left explains whatever failed while it was read or written.
|
||||
var gone = Path.Combine(Path.GetTempPath(), "titano-card-" + Guid.NewGuid().ToString("N"));
|
||||
var gone = Path.Combine(Path.GetTempPath(), "chronos-card-" + Guid.NewGuid().ToString("N"));
|
||||
Assert.Equal("EOS R5 · card A is no longer available.", ImportFailures.Check(new IOException("The device is not ready."), Card, gone));
|
||||
Assert.Equal("EOS R5 · card A is no longer available.", ImportFailures.Erase(new UnauthorizedAccessException("Access denied."), Card, gone));
|
||||
}
|
||||
+14
-14
@@ -1,17 +1,17 @@
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using Titano.App.Import;
|
||||
using Titano.Core.Import;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Data;
|
||||
using Titano.Data.Archiving;
|
||||
using Titano.Data.Jobs;
|
||||
using Titano.Testing;
|
||||
using static Titano.App.Tests.Import.ImportTestData;
|
||||
using Chronos.App.Import;
|
||||
using Chronos.Core.Import;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Data;
|
||||
using Chronos.Data.Archiving;
|
||||
using Chronos.Data.Jobs;
|
||||
using Chronos.Testing;
|
||||
using static Chronos.App.Tests.Import.ImportTestData;
|
||||
|
||||
namespace Titano.App.Tests.Import;
|
||||
namespace Chronos.App.Tests.Import;
|
||||
|
||||
/// <summary>Card to archive and card to folder on real files and a real index, and the card-erase gate around them.</summary>
|
||||
[Category("import")]
|
||||
@@ -23,7 +23,7 @@ public sealed class ImportFlowTests(TestContext context)
|
||||
public async Task AVerifiedArchiveImportUnlocksDeleteAndFormat()
|
||||
{
|
||||
Loc.SetCulture(CultureInfo.GetCultureInfo("en"));
|
||||
await using var db = await TitanoDatabase.OpenAsync(DatabaseOptions.Sqlite(Path.Combine(context.CreateTempDirectory("db"), "titano.db")), context.Cancellation);
|
||||
await using var db = await ChronosDatabase.OpenAsync(DatabaseOptions.Sqlite(Path.Combine(context.CreateTempDirectory("db"), "chronos.db")), context.Cancellation);
|
||||
var archives = new ArchiveService(db, new ArchiveServiceOptions { Owner = "test" });
|
||||
var archive = await archives.AdoptAsync(context.CreateTempDirectory("archive"), "Main", context.Cancellation);
|
||||
var card = Card(context.CreateTempDirectory("card"), 10, Start, Start.AddHours(3), Start.AddDays(1));
|
||||
@@ -69,7 +69,7 @@ public sealed class ImportFlowTests(TestContext context)
|
||||
Assert.True(ready.CanDelete);
|
||||
Assert.True(ready.CanFormat);
|
||||
Assert.Equal(30, ready.DeleteCount);
|
||||
Assert.Equal("30 verified on the card · " + Titano.App.Infrastructure.Formatting.Bytes(ready.DeleteBytes), ready.EraseText);
|
||||
Assert.Equal("30 verified on the card · " + Chronos.App.Infrastructure.Formatting.Bytes(ready.DeleteBytes), ready.EraseText);
|
||||
Assert.False((ready with { Card = null }).CanDelete, "the dry run lists the card too");
|
||||
Assert.True(snapshot.IsUnchanged(CardSnapshot.Take(card, Volume.Identity)));
|
||||
Assert.False(snapshot.IsUnchanged(CardSnapshot.Take(card, "another card")), "another card with the same files is not the checked card");
|
||||
@@ -79,7 +79,7 @@ public sealed class ImportFlowTests(TestContext context)
|
||||
var withVideo = ready with { Card = CardSnapshot.Take(card, Volume.Identity) };
|
||||
Assert.True(withVideo.CanFormat);
|
||||
Assert.SequenceEqual(["DCIM/100CANON/MVI_0031.MP4"], withVideo.NotImported);
|
||||
Assert.Equal("30 verified on the card · " + Titano.App.Infrastructure.Formatting.Bytes(ready.DeleteBytes) + " · 1 other file not imported", withVideo.EraseText);
|
||||
Assert.Equal("30 verified on the card · " + Chronos.App.Infrastructure.Formatting.Bytes(ready.DeleteBytes) + " · 1 other file not imported", withVideo.EraseText);
|
||||
Assert.False(snapshot.IsUnchanged(withVideo.Card!), "a file added since the check changes the card");
|
||||
File.Delete(Path.Combine(card, "DCIM", "100CANON", "MVI_0031.MP4"));
|
||||
|
||||
@@ -180,7 +180,7 @@ public sealed class ImportFlowTests(TestContext context)
|
||||
Assert.True(outcome.Failures.All(f => f.Message == Loc.L("Server.Error.Unreachable")), "the stop reason is the catalog's, never the exception's text");
|
||||
}
|
||||
|
||||
private async Task WaitDoneAsync(TitanoDatabase db, Guid jobId)
|
||||
private async Task WaitDoneAsync(ChronosDatabase db, Guid jobId)
|
||||
{
|
||||
var until = DateTime.UtcNow.AddSeconds(60);
|
||||
while (DateTime.UtcNow < until)
|
||||
+6
-6
@@ -1,11 +1,11 @@
|
||||
using System.Globalization;
|
||||
using Titano.App.Import;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Testing;
|
||||
using static Titano.App.Tests.Import.CardPoolTests;
|
||||
using static Titano.App.Tests.Import.ImportPlansTests;
|
||||
using Chronos.App.Import;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Testing;
|
||||
using static Chronos.App.Tests.Import.CardPoolTests;
|
||||
using static Chronos.App.Tests.Import.ImportPlansTests;
|
||||
|
||||
namespace Titano.App.Tests.Import;
|
||||
namespace Chronos.App.Tests.Import;
|
||||
|
||||
/// <summary>
|
||||
/// Import texts in a right-to-left language. They switch the process-wide UI language, so the class is serial: in
|
||||
+6
-6
@@ -1,11 +1,11 @@
|
||||
using System.Globalization;
|
||||
using Titano.App.Import;
|
||||
using Titano.Core.Import;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Testing;
|
||||
using static Titano.App.Tests.Import.ImportTestData;
|
||||
using Chronos.App.Import;
|
||||
using Chronos.Core.Import;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Testing;
|
||||
using static Chronos.App.Tests.Import.ImportTestData;
|
||||
|
||||
namespace Titano.App.Tests.Import;
|
||||
namespace Chronos.App.Tests.Import;
|
||||
|
||||
public sealed class ImportPlansTests
|
||||
{
|
||||
+9
-9
@@ -4,16 +4,16 @@ using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using Titano.App.Import;
|
||||
using Titano.App.Infrastructure;
|
||||
using Titano.App.Sections;
|
||||
using Titano.App.Shell;
|
||||
using Titano.App.Tests.Windows;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Testing;
|
||||
using Titano.Ui.Controls;
|
||||
using Chronos.App.Import;
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.App.Sections;
|
||||
using Chronos.App.Shell;
|
||||
using Chronos.App.Tests.Windows;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Ui.Controls;
|
||||
|
||||
namespace Titano.App.Tests.Import;
|
||||
namespace Chronos.App.Tests.Import;
|
||||
|
||||
/// <summary>
|
||||
/// Every Import state of <c>--capture</c> (<see cref="ImportScenes"/>) on the simulated cards, rendered in both themes
|
||||
+5
-5
@@ -1,10 +1,10 @@
|
||||
using System.IO;
|
||||
using Titano.Core.Codecs.Jpeg;
|
||||
using Titano.Core.Imaging;
|
||||
using Titano.Core.Import;
|
||||
using Titano.Core.Metadata;
|
||||
using Chronos.Core.Codecs.Jpeg;
|
||||
using Chronos.Core.Imaging;
|
||||
using Chronos.Core.Import;
|
||||
using Chronos.Core.Metadata;
|
||||
|
||||
namespace Titano.App.Tests.Import;
|
||||
namespace Chronos.App.Tests.Import;
|
||||
|
||||
/// <summary>Synthetic cards (small JPEGs with Exif) and hand-made plans for the Import tests.</summary>
|
||||
internal static class ImportTestData
|
||||
+8
-8
@@ -1,12 +1,12 @@
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using Titano.App.Import;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Data;
|
||||
using Titano.Data.Archiving;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Import;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Data;
|
||||
using Chronos.Data.Archiving;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Import;
|
||||
namespace Chronos.App.Tests.Import;
|
||||
|
||||
/// <summary>The simulated card behind the Import captures plans like a real one and gates the after-import actions.</summary>
|
||||
[Category("import")]
|
||||
@@ -16,7 +16,7 @@ public sealed class SampleCardsTests(TestContext context)
|
||||
public async Task TheSampleCardPlansThreeSessionsAndAllowsOnlyAVerifiedDelete()
|
||||
{
|
||||
Loc.SetCulture(CultureInfo.GetCultureInfo("en"));
|
||||
await using var db = await TitanoDatabase.OpenAsync(DatabaseOptions.Sqlite(Path.Combine(context.CreateTempDirectory("db"), "titano.db")), context.Cancellation);
|
||||
await using var db = await ChronosDatabase.OpenAsync(DatabaseOptions.Sqlite(Path.Combine(context.CreateTempDirectory("db"), "chronos.db")), context.Cancellation);
|
||||
var archives = new ArchiveService(db, new ArchiveServiceOptions { Owner = "test" });
|
||||
var archive = await archives.AdoptAsync(context.CreateTempDirectory("archive"), "Main", context.Cancellation);
|
||||
var devices = new SampleDeviceMonitor();
|
||||
@@ -31,7 +31,7 @@ public sealed class SampleCardsTests(TestContext context)
|
||||
Assert.Contains("50 photos", pool[0].Subtitle);
|
||||
Assert.Equal("SONY", pool[1].Title);
|
||||
Assert.False(pool[1].IsKnown);
|
||||
Assert.Equal("12 photos · not yet known to Titano", pool[1].ToastText[(pool[1].ToastText.IndexOf(" · ", StringComparison.Ordinal) + 3)..],
|
||||
Assert.Equal("12 photos · not yet known to Chronos", pool[1].ToastText[(pool[1].ToastText.IndexOf(" · ", StringComparison.Ordinal) + 3)..],
|
||||
"the camera of its first photo, its photos, and that it is new");
|
||||
Assert.Equal("GoPro 12", pool[3].Title);
|
||||
Assert.False(pool[3].IsInserted);
|
||||
+17
-17
@@ -4,14 +4,14 @@ using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Json;
|
||||
using System.Security.Cryptography;
|
||||
using Titano.App.Import;
|
||||
using Titano.Core.Import;
|
||||
using Titano.Protocol;
|
||||
using Titano.Protocol.Client;
|
||||
using Titano.Testing;
|
||||
using static Titano.App.Tests.Import.ImportTestData;
|
||||
using Chronos.App.Import;
|
||||
using Chronos.Core.Import;
|
||||
using Chronos.Protocol;
|
||||
using Chronos.Protocol.Client;
|
||||
using Chronos.Testing;
|
||||
using static Chronos.App.Tests.Import.ImportTestData;
|
||||
|
||||
namespace Titano.App.Tests.Import;
|
||||
namespace Chronos.App.Tests.Import;
|
||||
|
||||
/// <summary>The "Server" destination over the real protocol client against an in-memory upload endpoint.</summary>
|
||||
[Category("import")]
|
||||
@@ -23,7 +23,7 @@ public sealed class ServerImportSinkTests(TestContext context)
|
||||
var card = Card(context.CreateTempDirectory("card"), 8, Start, Start.AddHours(2));
|
||||
var staging = context.CreateTempDirectory("staging");
|
||||
var server = new FakeUploadServer(chunkSize: 256);
|
||||
using var client = new TitanoClient(new Uri("https://nas.local:8443/"), new CertificatePinning([]), "tests", server) { Token = "t" };
|
||||
using var client = new ChronosClient(new Uri("https://nas.local:8443/"), new CertificatePinning([]), "tests", server) { Token = "t" };
|
||||
var plan = await new UnindexedDestination(ImportDestinationKind.Server, staging).PlanAsync(card, new ImportChoices().ToOptions(), null, null, context.Cancellation);
|
||||
plan = plan with { Sessions = [plan.Sessions[0] with { Title = "Harbour sunset" }, .. plan.Sessions.Skip(1)] };
|
||||
|
||||
@@ -52,7 +52,7 @@ public sealed class ServerImportSinkTests(TestContext context)
|
||||
var card = Card(context.CreateTempDirectory("card"), 8, Start);
|
||||
var staging = context.CreateTempDirectory("staging");
|
||||
var server = new FakeUploadServer(chunkSize: 4096);
|
||||
using var client = new TitanoClient(new Uri("https://nas.local:8443/"), new CertificatePinning([]), "tests", server) { Token = "t" };
|
||||
using var client = new ChronosClient(new Uri("https://nas.local:8443/"), new CertificatePinning([]), "tests", server) { Token = "t" };
|
||||
var destination = new UnindexedDestination(ImportDestinationKind.Server, staging);
|
||||
var plan = await destination.PlanAsync(card, new ImportChoices().ToOptions(), null, null, context.Cancellation);
|
||||
await LocalImport.RunAsync(plan, new ServerImportSink(client, staging), "EOS R5 · card A", verify: true, null, context.Cancellation);
|
||||
@@ -70,7 +70,7 @@ public sealed class ServerImportSinkTests(TestContext context)
|
||||
var card = Card(context.CreateTempDirectory("card"), 8, Start);
|
||||
var staging = context.CreateTempDirectory("staging");
|
||||
var server = new FakeUploadServer(chunkSize: 4096) { CorruptFile = "IMG_0003.JPG" };
|
||||
using var client = new TitanoClient(new Uri("https://nas.local:8443/"), new CertificatePinning([]), "tests", server) { Token = "t" };
|
||||
using var client = new ChronosClient(new Uri("https://nas.local:8443/"), new CertificatePinning([]), "tests", server) { Token = "t" };
|
||||
var plan = await new UnindexedDestination(ImportDestinationKind.Server, staging).PlanAsync(card, new ImportChoices().ToOptions(), null, null, context.Cancellation);
|
||||
var sink = new ServerImportSink(client, staging);
|
||||
|
||||
@@ -87,14 +87,14 @@ public sealed class ServerImportSinkTests(TestContext context)
|
||||
var card = Card(context.CreateTempDirectory("card"), 8, Start);
|
||||
var staging = context.CreateTempDirectory("staging");
|
||||
var server = new FakeUploadServer(chunkSize: 4096) { ProxyRefusesFile = "IMG_0005.JPG" };
|
||||
using var client = new TitanoClient(new Uri("https://nas.local:8443/"), new CertificatePinning([]), "tests", server) { Token = "t" };
|
||||
using var client = new ChronosClient(new Uri("https://nas.local:8443/"), new CertificatePinning([]), "tests", server) { Token = "t" };
|
||||
var plan = await new UnindexedDestination(ImportDestinationKind.Server, staging).PlanAsync(card, new ImportChoices().ToOptions(), null, null, context.Cancellation);
|
||||
var sink = new ServerImportSink(client, staging);
|
||||
|
||||
var outcome = await LocalImport.RunAsync(plan, sink, "EOS R5 · card A", true, null, context.Cancellation, sink.Report);
|
||||
Assert.Equal(7, outcome.Copied);
|
||||
// The proxy's page says "Request Entity Too Large" in English: the photo reads the catalog's sentence instead.
|
||||
Assert.Equal(new ImportFailure("DCIM/100CANON/IMG_0005.JPG", Titano.Core.Localization.Loc.L("Server.Error.TooLarge")), outcome.Failures.Single());
|
||||
Assert.Equal(new ImportFailure("DCIM/100CANON/IMG_0005.JPG", Chronos.Core.Localization.Loc.L("Server.Error.TooLarge")), outcome.Failures.Single());
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -103,7 +103,7 @@ public sealed class ServerImportSinkTests(TestContext context)
|
||||
var card = Card(context.CreateTempDirectory("card"), 8, Start);
|
||||
var staging = context.CreateTempDirectory("staging");
|
||||
var server = new FakeUploadServer(chunkSize: 4096) { SignedOutAfter = 3 };
|
||||
using var client = new TitanoClient(new Uri("https://nas.local:8443/"), new CertificatePinning([]), "tests", server) { Token = "t" };
|
||||
using var client = new ChronosClient(new Uri("https://nas.local:8443/"), new CertificatePinning([]), "tests", server) { Token = "t" };
|
||||
var plan = await new UnindexedDestination(ImportDestinationKind.Server, staging).PlanAsync(card, new ImportChoices().ToOptions(), null, null, context.Cancellation);
|
||||
var sink = new ServerImportSink(client, staging);
|
||||
|
||||
@@ -136,7 +136,7 @@ public sealed class ServerImportSinkTests(TestContext context)
|
||||
var card = Card(context.CreateTempDirectory("card"), 8, Start);
|
||||
var staging = context.CreateTempDirectory("staging");
|
||||
var server = new FakeUploadServer(chunkSize: 4096);
|
||||
using var client = new TitanoClient(new Uri("https://nas.local:8443/"), new CertificatePinning([]), "tests", server) { Token = "t" };
|
||||
using var client = new ChronosClient(new Uri("https://nas.local:8443/"), new CertificatePinning([]), "tests", server) { Token = "t" };
|
||||
var plan = await new UnindexedDestination(ImportDestinationKind.Server, staging).PlanAsync(card, new ImportChoices().ToOptions(), null, null, context.Cancellation);
|
||||
var progress = new List<ImportProgress>();
|
||||
|
||||
@@ -158,7 +158,7 @@ public sealed class ServerImportSinkTests(TestContext context)
|
||||
var card = Card(context.CreateTempDirectory("card"), 8, Start);
|
||||
var staging = context.CreateTempDirectory("staging");
|
||||
var server = new FakeUploadServer(chunkSize: 4096) { CardsUnsupported = true };
|
||||
using var client = new TitanoClient(new Uri("https://nas.local:8443/"), new CertificatePinning([]), "tests", server) { Token = "t" };
|
||||
using var client = new ChronosClient(new Uri("https://nas.local:8443/"), new CertificatePinning([]), "tests", server) { Token = "t" };
|
||||
var plan = await new UnindexedDestination(ImportDestinationKind.Server, staging).PlanAsync(card, new ImportChoices().ToOptions(), null, null, context.Cancellation);
|
||||
|
||||
var outcome = await new ServerImportSink(client, staging).RunAsync(plan, "EOS R5 · card A", true, null, context.Cancellation);
|
||||
@@ -172,7 +172,7 @@ public sealed class ServerImportSinkTests(TestContext context)
|
||||
{
|
||||
var gate = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
var server = new FakeUploadServer(chunkSize: 4096) { CardGate = gate.Task };
|
||||
using var client = new TitanoClient(new Uri("https://nas.local:8443/"), new CertificatePinning([]), "tests", server) { Token = "t" };
|
||||
using var client = new ChronosClient(new Uri("https://nas.local:8443/"), new CertificatePinning([]), "tests", server) { Token = "t" };
|
||||
var time = new ManualTime();
|
||||
var reporter = new CardImportReporter(client, Guid.CreateVersion7(), "EOS R5 · card A", 100, time);
|
||||
|
||||
@@ -199,7 +199,7 @@ public sealed class ServerImportSinkTests(TestContext context)
|
||||
public async Task AnImportOverDoesNotWaitForAServerThatDoesNotAnswer()
|
||||
{
|
||||
var server = new FakeUploadServer(chunkSize: 4096) { CardGate = new TaskCompletionSource().Task };
|
||||
using var client = new TitanoClient(new Uri("https://nas.local:8443/"), new CertificatePinning([]), "tests", server) { Token = "t" };
|
||||
using var client = new ChronosClient(new Uri("https://nas.local:8443/"), new CertificatePinning([]), "tests", server) { Token = "t" };
|
||||
var reporter = new CardImportReporter(client, Guid.CreateVersion7(), "EOS R5 · card A", 100);
|
||||
|
||||
reporter.Started();
|
||||
+13
-13
@@ -1,9 +1,9 @@
|
||||
using System.IO;
|
||||
using Titano.App.Infrastructure;
|
||||
using Titano.Core.Windows.Shell;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.Core.Windows.Shell;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Infrastructure;
|
||||
namespace Chronos.App.Tests.Infrastructure;
|
||||
|
||||
/// <summary>BRIEF §6.2: the client's data folder, which is never inside a folder OneDrive synchronises.</summary>
|
||||
public sealed class AppEnvironmentTests(TestContext context)
|
||||
@@ -12,13 +12,13 @@ public sealed class AppEnvironmentTests(TestContext context)
|
||||
public void APortableCopyInOneDriveKeepsItsDataInTheUserFolderAndSaysSo()
|
||||
{
|
||||
var oneDrive = context.CreateTempDirectory("onedrive");
|
||||
var app = Directory.CreateDirectory(Path.Combine(oneDrive, "Desktop", "Titano")).FullName;
|
||||
var app = Directory.CreateDirectory(Path.Combine(oneDrive, "Desktop", "Chronos")).FullName;
|
||||
File.WriteAllText(Path.Combine(app, PortableMode.MarkerFileName), "");
|
||||
var local = context.CreateTempDirectory("local");
|
||||
|
||||
var environment = AppEnvironment.From(AppPaths.Resolve(app, local, [oneDrive]));
|
||||
|
||||
Assert.Equal(Path.Combine(local, "Titano", "titano.db"), environment.DatabasePath);
|
||||
Assert.Equal(Path.Combine(local, "Chronos", "chronos.db"), environment.DatabasePath);
|
||||
Assert.True(environment.IsPortable, "still a portable copy: updates fetch the portable zip, no sign-in entry");
|
||||
Assert.Equal<string?>(oneDrive, environment.PortableSyncRoot);
|
||||
Assert.Null(environment.SyncedFolder);
|
||||
@@ -39,24 +39,24 @@ public sealed class AppEnvironmentTests(TestContext context)
|
||||
public void TheDataAPortableCopyKeptInOneDriveBeforeIsNamedAndLeftAlone()
|
||||
{
|
||||
var oneDrive = context.CreateTempDirectory("onedrive");
|
||||
var app = Directory.CreateDirectory(Path.Combine(oneDrive, "Documents", "Titano")).FullName;
|
||||
var app = Directory.CreateDirectory(Path.Combine(oneDrive, "Documents", "Chronos")).FullName;
|
||||
File.WriteAllText(Path.Combine(app, PortableMode.MarkerFileName), "");
|
||||
// An earlier version kept its index and settings beside the program.
|
||||
var earlier = Directory.CreateDirectory(Path.Combine(app, "data")).FullName;
|
||||
File.WriteAllText(Path.Combine(earlier, "settings.json"), "{}");
|
||||
File.WriteAllBytes(Path.Combine(earlier, "titano.db"), [1, 2, 3]);
|
||||
File.WriteAllBytes(Path.Combine(earlier, "chronos.db"), [1, 2, 3]);
|
||||
var local = context.CreateTempDirectory("local");
|
||||
|
||||
var environment = AppEnvironment.From(AppPaths.Resolve(app, local, [oneDrive]));
|
||||
|
||||
Assert.Equal<string?>(earlier, environment.EarlierPortableData);
|
||||
Assert.Equal(Path.Combine(local, "Titano"), environment.DataDirectory);
|
||||
Assert.SequenceEqual(new byte[] { 1, 2, 3 }, File.ReadAllBytes(Path.Combine(earlier, "titano.db")));
|
||||
Assert.Equal(Path.Combine(local, "Chronos"), environment.DataDirectory);
|
||||
Assert.SequenceEqual(new byte[] { 1, 2, 3 }, File.ReadAllBytes(Path.Combine(earlier, "chronos.db")));
|
||||
Assert.Equal("{}", File.ReadAllText(Path.Combine(earlier, "settings.json")));
|
||||
|
||||
// A data folder with neither (logs only) holds nothing the user would miss.
|
||||
File.Delete(Path.Combine(earlier, "settings.json"));
|
||||
File.Delete(Path.Combine(earlier, "titano.db"));
|
||||
File.Delete(Path.Combine(earlier, "chronos.db"));
|
||||
Directory.CreateDirectory(Path.Combine(earlier, "logs"));
|
||||
Assert.Null(AppEnvironment.From(AppPaths.Resolve(app, local, [oneDrive])).EarlierPortableData);
|
||||
}
|
||||
@@ -64,7 +64,7 @@ public sealed class AppEnvironmentTests(TestContext context)
|
||||
[Test]
|
||||
public void AUserFolderOneDriveSynchronisesIsReportedNotHidden()
|
||||
{
|
||||
// Nowhere is safe: Titano starts all the same, and the folder that is synchronised is named for the warning.
|
||||
// Nowhere is safe: Chronos starts all the same, and the folder that is synchronised is named for the warning.
|
||||
var oneDrive = context.CreateTempDirectory("onedrive");
|
||||
var local = Directory.CreateDirectory(Path.Combine(oneDrive, "AppData", "Local")).FullName;
|
||||
|
||||
@@ -74,7 +74,7 @@ public sealed class AppEnvironmentTests(TestContext context)
|
||||
Assert.True(Directory.Exists(installed.LogDirectory));
|
||||
|
||||
// A portable copy in that OneDrive has nowhere safe either: its data is not said to be kept outside it.
|
||||
var app = Directory.CreateDirectory(Path.Combine(oneDrive, "Desktop", "Titano")).FullName;
|
||||
var app = Directory.CreateDirectory(Path.Combine(oneDrive, "Desktop", "Chronos")).FullName;
|
||||
File.WriteAllText(Path.Combine(app, PortableMode.MarkerFileName), "");
|
||||
var portable = AppEnvironment.From(AppPaths.Resolve(app, local, [oneDrive]));
|
||||
Assert.Equal<(string?, string?)>((oneDrive, oneDrive), (portable.SyncedFolder, portable.PortableSyncRoot));
|
||||
+9
-9
@@ -1,12 +1,12 @@
|
||||
using System.IO;
|
||||
using Titano.App.Infrastructure;
|
||||
using Titano.App.Tests.Uploader;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Data;
|
||||
using Titano.Data.Archiving;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.App.Tests.Uploader;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Data;
|
||||
using Chronos.Data.Archiving;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Infrastructure;
|
||||
namespace Chronos.App.Tests.Infrastructure;
|
||||
|
||||
public sealed class AppServicesTests
|
||||
{
|
||||
@@ -29,7 +29,7 @@ public sealed class AppServicesTests
|
||||
SingleThreadedContext.Run(async () =>
|
||||
{
|
||||
var root = Path.Combine(environment.DataDirectory, "archive");
|
||||
await using (var setup = await TitanoDatabase.OpenAsync(DatabaseOptions.Sqlite(Path.Combine(environment.DataDirectory, "setup.db"))))
|
||||
await using (var setup = await ChronosDatabase.OpenAsync(DatabaseOptions.Sqlite(Path.Combine(environment.DataDirectory, "setup.db"))))
|
||||
await new ArchiveService(setup).CreateAsync(root, "Exit");
|
||||
var services = new AppServices(environment, new AppSettings { Language = "en", LastArchivePath = root }, () => { }, new NoDialogs());
|
||||
await services.OpenAsync(environment.DatabasePath);
|
||||
@@ -121,7 +121,7 @@ public sealed class AppServicesTests
|
||||
{
|
||||
SingleThreadedContext.Run(async () =>
|
||||
{
|
||||
await using (var db = await TitanoDatabase.OpenAsync(DatabaseOptions.Sqlite(environment.DatabasePath)))
|
||||
await using (var db = await ChronosDatabase.OpenAsync(DatabaseOptions.Sqlite(environment.DatabasePath)))
|
||||
{
|
||||
await db.Archives.UpsertAsync(new Archive { Id = Guid.CreateVersion7(), Name = "Kept", RootPath = @"C:\Kept", Created = DateTimeOffset.UtcNow });
|
||||
var backup = await db.BackupAsync(environment.BackupDirectory, DatabaseBackups.Keep);
|
||||
+13
-13
@@ -2,14 +2,14 @@ using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using Titano.App.Shell;
|
||||
using Titano.Core.Archiving;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Protocol;
|
||||
using Titano.Protocol.Client;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Shell;
|
||||
using Chronos.Core.Archiving;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Protocol;
|
||||
using Chronos.Protocol.Client;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Infrastructure;
|
||||
namespace Chronos.App.Tests.Infrastructure;
|
||||
|
||||
/// <summary>An error toast says what happened in one localized sentence; framework and OS messages stay in the log.</summary>
|
||||
public sealed class ErrorTextTests
|
||||
@@ -21,7 +21,7 @@ public sealed class ErrorTextTests
|
||||
{
|
||||
const string Unreachable = "The server does not answer; check the address and the network.";
|
||||
Assert.Equal("The server is out of disk space.",
|
||||
ErrorText.ForServer(new TitanoApiException(HttpStatusCode.InsufficientStorage, new ApiError("insufficient_storage", "The server is out of disk space.", null))));
|
||||
ErrorText.ForServer(new ChronosApiException(HttpStatusCode.InsufficientStorage, new ApiError("insufficient_storage", "The server is out of disk space.", null))));
|
||||
Assert.Equal(Unreachable, ErrorText.ForServer(new HttpRequestException("No such host is known. (nas.local:8443)")));
|
||||
Assert.Equal(Unreachable, ErrorText.ForServer(new TaskCanceledException("A task was canceled.")));
|
||||
Assert.Equal(Unreachable, ErrorText.ForServer(new IOException("The response ended prematurely.")));
|
||||
@@ -30,16 +30,16 @@ public sealed class ErrorTextTests
|
||||
// Failures that already carry a catalog sentence keep it.
|
||||
Assert.Equal(@"The archive D:\Shoots is offline.", ErrorText.ForServer(new ArchiveOfflineException(@"D:\Shoots", ArchiveAvailability.Offline)));
|
||||
Assert.Equal("Something went wrong.", ErrorText.ForServer(new InvalidOperationException("Sequence contains no elements")));
|
||||
Assert.Equal("Something went wrong.", ErrorText.ForServer(new TitanoApiException(HttpStatusCode.Conflict, new ApiError("conflict", " ", null))));
|
||||
Assert.Equal(Unreachable, ErrorText.ForServer(new TitanoApiException(HttpStatusCode.BadGateway, new ApiError("bad_gateway", " ", null))));
|
||||
Assert.Equal("Something went wrong.", ErrorText.ForServer(new ChronosApiException(HttpStatusCode.Conflict, new ApiError("conflict", " ", null))));
|
||||
Assert.Equal(Unreachable, ErrorText.ForServer(new ChronosApiException(HttpStatusCode.BadGateway, new ApiError("bad_gateway", " ", null))));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AReplyThatIsNotTheServersOwnSaysWhatItsStatusMeans()
|
||||
{
|
||||
// A reverse proxy answers for the server (the NAS setup): its page is no Titano JSON, so TitanoClient keeps only
|
||||
// A reverse proxy answers for the server (the NAS setup): its page is no Chronos JSON, so ChronosClient keeps only
|
||||
// the reason phrase, in English, which never reaches the screen.
|
||||
static TitanoApiException Proxy(HttpStatusCode status, string reason) => new(status, new ApiError("http_" + (int)status, reason));
|
||||
static ChronosApiException Proxy(HttpStatusCode status, string reason) => new(status, new ApiError("http_" + (int)status, reason));
|
||||
const string Unreachable = "The server does not answer; check the address and the network.";
|
||||
Assert.Equal(Unreachable, ErrorText.ForServer(Proxy(HttpStatusCode.BadGateway, "Bad Gateway")));
|
||||
Assert.Equal(Unreachable, ErrorText.ForServer(Proxy(HttpStatusCode.ServiceUnavailable, "Service Unavailable")));
|
||||
@@ -50,7 +50,7 @@ public sealed class ErrorTextTests
|
||||
Assert.Equal("Unexpected server error; try again.", ErrorText.ForServer(Proxy(HttpStatusCode.InternalServerError, "Internal Server Error")));
|
||||
Assert.Equal("Something went wrong.", ErrorText.ForServer(Proxy(HttpStatusCode.NotFound, "Not Found")));
|
||||
// JSON of another shape has no code: its message is not the server's either.
|
||||
Assert.Equal(Unreachable, ErrorText.ForServer(new TitanoApiException(HttpStatusCode.BadGateway, new ApiError(null!, "upstream connect error"))));
|
||||
Assert.Equal(Unreachable, ErrorText.ForServer(new ChronosApiException(HttpStatusCode.BadGateway, new ApiError(null!, "upstream connect error"))));
|
||||
}
|
||||
|
||||
[Test]
|
||||
+15
-15
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Win32;
|
||||
using Titano.App.Infrastructure;
|
||||
using Titano.Core.IO;
|
||||
using Titano.Testing;
|
||||
using Titano.Uploader.Infrastructure;
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.Core.IO;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Uploader.Infrastructure;
|
||||
|
||||
namespace Titano.App.Tests.Infrastructure;
|
||||
namespace Chronos.App.Tests.Infrastructure;
|
||||
|
||||
/// <summary>Settings › General › Startup: one sign-in entry shared by every copy of Titano, which no copy takes over by starting.</summary>
|
||||
/// <summary>Settings › General › Startup: one sign-in entry shared by every copy of Chronos, which no copy takes over by starting.</summary>
|
||||
public sealed class StartWithWindowsTests
|
||||
{
|
||||
private const string Installed = @"C:\Users\ada\AppData\Local\Programs\Titano\Titano.exe";
|
||||
private const string Installed = @"C:\Users\ada\AppData\Local\Programs\Chronos\Chronos.exe";
|
||||
|
||||
[Test]
|
||||
public void AStartFollowsOnlyAnEntryAnUpdateLeftBehindInItsOwnFolder()
|
||||
@@ -21,13 +21,13 @@ public sealed class StartWithWindowsTests
|
||||
// The entry already starts this copy: nothing to write.
|
||||
Assert.False(RunKeyStartWithWindows.Follows(installed, Installed, Gone));
|
||||
// An update renamed the program in its folder: the entry follows it.
|
||||
Assert.True(RunKeyStartWithWindows.Follows(StartupCommand.Format(@"C:\Users\ada\AppData\Local\Programs\Titano\Titano.old.exe", "--minimized"),
|
||||
Assert.True(RunKeyStartWithWindows.Follows(StartupCommand.Format(@"C:\Users\ada\AppData\Local\Programs\Chronos\Chronos.old.exe", "--minimized"),
|
||||
Installed, Gone));
|
||||
// The installed copy is still there: a portable copy, a second install or a development build that starts leaves it alone.
|
||||
Assert.False(RunKeyStartWithWindows.Follows(installed, @"E:\Titano\Titano.exe", Present));
|
||||
Assert.False(RunKeyStartWithWindows.Follows(installed, @"C:\src\Titano\bin\Debug\Titano.exe", Present));
|
||||
Assert.False(RunKeyStartWithWindows.Follows(installed, @"E:\Chronos\Chronos.exe", Present));
|
||||
Assert.False(RunKeyStartWithWindows.Follows(installed, @"C:\src\Chronos\bin\Debug\Chronos.exe", Present));
|
||||
// Gone from another folder (a USB stick that is not plugged in): still not this copy's entry.
|
||||
Assert.False(RunKeyStartWithWindows.Follows(installed, @"E:\Titano\Titano.exe", Gone));
|
||||
Assert.False(RunKeyStartWithWindows.Follows(installed, @"E:\Chronos\Chronos.exe", Gone));
|
||||
// No entry, or no executable path: nothing to follow.
|
||||
Assert.False(RunKeyStartWithWindows.Follows(null, Installed, Gone));
|
||||
Assert.False(RunKeyStartWithWindows.Follows(installed, null, Gone));
|
||||
@@ -38,7 +38,7 @@ public sealed class StartWithWindowsTests
|
||||
public void AnEntryTaskManagerTurnedOffShowsOffUntilTheBoxIsTickedAgain()
|
||||
{
|
||||
// A scratch hive of its own: the user's sign-in entries are never touched.
|
||||
var hive = @"Software\Titano.StartupTests." + Guid.NewGuid().ToString("N");
|
||||
var hive = @"Software\Chronos.StartupTests." + Guid.NewGuid().ToString("N");
|
||||
try
|
||||
{
|
||||
using var root = Registry.CurrentUser.CreateSubKey(hive, writable: true);
|
||||
@@ -52,7 +52,7 @@ public sealed class StartWithWindowsTests
|
||||
Assert.True(StartupCommand.Starts(Value(root, StartupCommand.RunKey, StartupCommand.ClientValue) as string, Installed), "the command stays");
|
||||
|
||||
// An update renamed the program: the command follows it, and the entry stays off.
|
||||
const string renamed = @"C:\Users\ada\AppData\Local\Programs\Titano\Titano.next.exe";
|
||||
const string renamed = @"C:\Users\ada\AppData\Local\Programs\Chronos\Chronos.next.exe";
|
||||
var updated = new RunKeyStartWithWindows(renamed, root);
|
||||
updated.Refresh();
|
||||
Assert.True(StartupCommand.Starts(Value(root, StartupCommand.RunKey, StartupCommand.ClientValue) as string, renamed));
|
||||
@@ -77,11 +77,11 @@ public sealed class StartWithWindowsTests
|
||||
[WindowsOnly]
|
||||
public void TheUploadersEntryHonoursTaskManagerToo()
|
||||
{
|
||||
var hive = @"Software\Titano.StartupTests." + Guid.NewGuid().ToString("N");
|
||||
var hive = @"Software\Chronos.StartupTests." + Guid.NewGuid().ToString("N");
|
||||
try
|
||||
{
|
||||
using var root = Registry.CurrentUser.CreateSubKey(hive, writable: true);
|
||||
var uploader = @"C:\Users\ada\AppData\Local\Programs\Titano\Uploader\Titano.Uploader.exe";
|
||||
var uploader = @"C:\Users\ada\AppData\Local\Programs\Chronos\Uploader\Chronos.Uploader.exe";
|
||||
var startup = new RunKeyStartupRegistration(uploader, root);
|
||||
startup.SetEnabled(true);
|
||||
Assert.True(startup.IsEnabled);
|
||||
+7
-7
@@ -1,12 +1,12 @@
|
||||
using System.Globalization;
|
||||
using Titano.App.Infrastructure;
|
||||
using Titano.App.Jobs;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Data.Jobs;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.App.Jobs;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Data.Jobs;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Jobs;
|
||||
namespace Chronos.App.Tests.Jobs;
|
||||
|
||||
public sealed class JobListModelTests
|
||||
{
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
using Titano.App.Jobs;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Jobs;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Jobs;
|
||||
namespace Chronos.App.Tests.Jobs;
|
||||
|
||||
/// <summary>UI-08: which job endings raise the shell's toast, whichever screen started the job, and how a batch speaks once.</summary>
|
||||
public sealed class JobNoticesTests
|
||||
+5
-5
@@ -1,10 +1,10 @@
|
||||
using System.Collections.Concurrent;
|
||||
using Titano.App.Jobs;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Data.Jobs;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Jobs;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Data.Jobs;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Jobs;
|
||||
namespace Chronos.App.Tests.Jobs;
|
||||
|
||||
public sealed class JobUpdateBufferTests
|
||||
{
|
||||
+9
-9
@@ -3,16 +3,16 @@ using System.Windows.Automation;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using Titano.App.Infrastructure;
|
||||
using Titano.App.Jobs;
|
||||
using Titano.App.Sections;
|
||||
using Titano.App.Shell;
|
||||
using Titano.App.Tests.Windows;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Testing;
|
||||
using Titano.Ui.Controls;
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.App.Jobs;
|
||||
using Chronos.App.Sections;
|
||||
using Chronos.App.Shell;
|
||||
using Chronos.App.Tests.Windows;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Ui.Controls;
|
||||
|
||||
namespace Titano.App.Tests.Jobs;
|
||||
namespace Chronos.App.Tests.Jobs;
|
||||
|
||||
/// <summary>The Jobs screen on the capture sample: keyboard reach, names for screen readers, counts and the table's columns.</summary>
|
||||
[WindowsOnly]
|
||||
+11
-11
@@ -1,14 +1,14 @@
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using Titano.App.Archiving;
|
||||
using Titano.App.Infrastructure;
|
||||
using Titano.Core.Archiving;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Data.Archiving;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Archiving;
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.Core.Archiving;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Data.Archiving;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Library;
|
||||
namespace Chronos.App.Tests.Library;
|
||||
|
||||
/// <summary>The confirmation of Delete in the Library and the Archive manager: the engine's dry run behind a typed confirmation (DESIGN §4).</summary>
|
||||
public sealed class DeletePlansTests
|
||||
@@ -23,7 +23,7 @@ public sealed class DeletePlansTests
|
||||
};
|
||||
|
||||
private static DeleteStep Step(string title, int frames, int files, long bytes) =>
|
||||
new(Sequence(title, frames), $".titano/trash/{Guid.CreateVersion7():N}", files, bytes);
|
||||
new(Sequence(title, frames), $".chronos/trash/{Guid.CreateVersion7():N}", files, bytes);
|
||||
|
||||
[Test]
|
||||
public void ThePlanAsksToTypeHowManySequencesMove()
|
||||
@@ -85,8 +85,8 @@ public sealed class DeletePlansTests
|
||||
{
|
||||
Assert.Equal(Loc.L("Archive.Error.StalePlan"), ArchiveFailures.Cause(new StaleDeletePlanException(Guid.NewGuid())));
|
||||
Assert.Equal(Loc.L("Archive.Error.InLibrary", "Harbour sunset"), ArchiveFailures.Cause(new SequenceInLibraryException(Guid.NewGuid(), "Harbour sunset")));
|
||||
Assert.Equal(Loc.L("Archive.Error.NewerFormat", "sequence.json", 9), ArchiveFailures.Cause(new NewerFormatException("/a/2026/x/.titano/sequence.json", 9)));
|
||||
Assert.Equal(Loc.L("Archive.Failed.Files"), ArchiveFailures.Cause(new DirectoryNotFoundException("/a/.titano/trash/0123 is not in the trash")),
|
||||
Assert.Equal(Loc.L("Archive.Error.NewerFormat", "sequence.json", 9), ArchiveFailures.Cause(new NewerFormatException("/a/2026/x/.chronos/sequence.json", 9)));
|
||||
Assert.Equal(Loc.L("Archive.Failed.Files"), ArchiveFailures.Cause(new DirectoryNotFoundException("/a/.chronos/trash/0123 is not in the trash")),
|
||||
"the engine's own words stay in the log");
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
using Titano.App.Library;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Library;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Library;
|
||||
namespace Chronos.App.Tests.Library;
|
||||
|
||||
/// <summary>"Export list as CSV" (BRIEF §12.2): RFC 4180 rows that spreadsheets read as data, never as formulas.</summary>
|
||||
public sealed class LibraryCsvTests
|
||||
+5
-5
@@ -1,9 +1,9 @@
|
||||
using Titano.App.Library;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Data.Repositories;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Library;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Data.Repositories;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Library;
|
||||
namespace Chronos.App.Tests.Library;
|
||||
|
||||
/// <summary>Mixed mode (BRIEF §4.4): the server's sequences without a copy here count in the Year and Camera choices and the timeline.</summary>
|
||||
public sealed class LibraryFacetsTests
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
using Titano.App.Library;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Library;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Library;
|
||||
namespace Chronos.App.Tests.Library;
|
||||
|
||||
/// <summary>The Status choices of Main.html (analysed, proxies, rendered, synced): the index's query and the same test in memory agree.</summary>
|
||||
public sealed class LibraryFilterTests
|
||||
+5
-5
@@ -1,9 +1,9 @@
|
||||
using Titano.App.Library;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Data.Repositories;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Library;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Data.Repositories;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Library;
|
||||
namespace Chronos.App.Tests.Library;
|
||||
|
||||
public sealed class LibraryPagerTests
|
||||
{
|
||||
+12
-12
@@ -3,19 +3,19 @@ using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using Titano.App.Archiving;
|
||||
using Titano.App.Infrastructure;
|
||||
using Titano.App.Library;
|
||||
using Titano.App.Sections;
|
||||
using Titano.App.Shell;
|
||||
using Titano.App.Tests.Windows;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Testing;
|
||||
using Titano.Ui.Controls;
|
||||
using Titano.Ui.Visuals;
|
||||
using Chronos.App.Archiving;
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.App.Library;
|
||||
using Chronos.App.Sections;
|
||||
using Chronos.App.Shell;
|
||||
using Chronos.App.Tests.Windows;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Ui.Controls;
|
||||
using Chronos.Ui.Visuals;
|
||||
|
||||
namespace Titano.App.Tests.Library;
|
||||
namespace Chronos.App.Tests.Library;
|
||||
|
||||
/// <summary>
|
||||
/// The Library's new states of <c>--capture</c> (<see cref="LibraryScenes"/>) on the sample index while signed in to the
|
||||
+5
-5
@@ -1,9 +1,9 @@
|
||||
using Titano.App.Library;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Data.Repositories;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Library;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Data.Repositories;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Library;
|
||||
namespace Chronos.App.Tests.Library;
|
||||
|
||||
/// <summary>The Library's timeline: year bands of photos per month and the way from a month to the grid (BRIEF §12.2).</summary>
|
||||
public sealed class LibraryTimelineTests
|
||||
+7
-7
@@ -1,11 +1,11 @@
|
||||
using Titano.App.Library;
|
||||
using Titano.App.Server;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Data.Sync;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Library;
|
||||
using Chronos.App.Server;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Data.Sync;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Library;
|
||||
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
|
||||
+10
-10
@@ -1,14 +1,14 @@
|
||||
using Titano.App.Infrastructure;
|
||||
using Titano.App.Library;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Data.Repositories;
|
||||
using Titano.Data.Sync;
|
||||
using Titano.Protocol;
|
||||
using Titano.Testing;
|
||||
using Titano.Ui.Controls;
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.App.Library;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Data.Repositories;
|
||||
using Chronos.Data.Sync;
|
||||
using Chronos.Protocol;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Ui.Controls;
|
||||
|
||||
namespace Titano.App.Tests.Library;
|
||||
namespace Chronos.App.Tests.Library;
|
||||
|
||||
/// <summary>Server sequences without a copy here as Library cards, and their place among the index's pages (BRIEF §4.4).</summary>
|
||||
public sealed class RemoteCardsTests
|
||||
+7
-7
@@ -1,11 +1,11 @@
|
||||
using System.IO;
|
||||
using Titano.App.Library;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Data;
|
||||
using Titano.Data.Repositories;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Library;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Data;
|
||||
using Chronos.Data.Repositories;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Library;
|
||||
namespace Chronos.App.Tests.Library;
|
||||
|
||||
/// <summary>Saved views of the Library (BRIEF §12.2): a name for filters and sort, kept as app-scope settings rows.</summary>
|
||||
public sealed class SavedViewTests(TestContext context)
|
||||
@@ -55,7 +55,7 @@ public sealed class SavedViewTests(TestContext context)
|
||||
[Test]
|
||||
public async Task ViewsRoundTripThroughTheSettingsTable()
|
||||
{
|
||||
await using var db = await TitanoDatabase.OpenAsync(DatabaseOptions.Sqlite(Path.Combine(context.CreateTempDirectory("db"), "titano.db")), context.Cancellation);
|
||||
await using var db = await ChronosDatabase.OpenAsync(DatabaseOptions.Sqlite(Path.Combine(context.CreateTempDirectory("db"), "chronos.db")), context.Cancellation);
|
||||
var store = new SavedViewStore(db.Settings);
|
||||
Assert.Empty(await store.ListAsync());
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
using System.Collections.Concurrent;
|
||||
using System.IO;
|
||||
using Titano.App.Library;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Library;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Library;
|
||||
namespace Chronos.App.Tests.Library;
|
||||
|
||||
public sealed class ThumbnailCacheTests
|
||||
{
|
||||
+1
-1
@@ -6,7 +6,7 @@ using System.Security.Authentication;
|
||||
using System.Security.Cryptography;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
|
||||
namespace Titano.App.Tests.Library;
|
||||
namespace Chronos.App.Tests.Library;
|
||||
|
||||
/// <summary>
|
||||
/// A TLS endpoint on loopback with a self-signed certificate no client trusted (a server whose certificate changed since
|
||||
@@ -1,8 +1,8 @@
|
||||
using System.Globalization;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Testing;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests;
|
||||
namespace Chronos.App.Tests;
|
||||
|
||||
internal static class TestMain
|
||||
{
|
||||
+12
-12
@@ -1,11 +1,11 @@
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using Titano.App.Server;
|
||||
using Titano.Protocol;
|
||||
using Titano.Protocol.Client;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Server;
|
||||
using Chronos.Protocol;
|
||||
using Chronos.Protocol.Client;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Server;
|
||||
namespace Chronos.App.Tests.Server;
|
||||
|
||||
public sealed class ConnectFlowTests
|
||||
{
|
||||
@@ -59,7 +59,7 @@ public sealed class ConnectFlowTests
|
||||
{
|
||||
var server = new FakeServer();
|
||||
using var flow = new ConnectFlow(server, new MemoryTrust());
|
||||
Assert.Equal(ConnectStep.AwaitingCredentials, await flow.ProbeAsync("https://titano.example.com"));
|
||||
Assert.Equal(ConnectStep.AwaitingCredentials, await flow.ProbeAsync("https://chronos.example.com"));
|
||||
Assert.Null(flow.PendingFingerprint);
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public sealed class ConnectFlowTests
|
||||
[Case("", ConnectError.InvalidAddress)]
|
||||
[Case("ftp://nas.local", ConnectError.InvalidAddress)]
|
||||
[Case("down.local", ConnectError.Unreachable)]
|
||||
[Case("web.local", ConnectError.NotTitano)]
|
||||
[Case("web.local", ConnectError.NotChronos)]
|
||||
public async Task ProbeFailuresAreClassified(string address, ConnectError error)
|
||||
{
|
||||
using var flow = new ConnectFlow(new FakeServer(), new MemoryTrust());
|
||||
@@ -146,8 +146,8 @@ public sealed class ConnectFlowTests
|
||||
{
|
||||
Assert.True(ServerAddress.TryParse("nas.local:8443", out var a));
|
||||
Assert.Equal("https://nas.local:8443/", a.ToString());
|
||||
Assert.True(ServerAddress.TryParse(" http://10.0.0.5:8080/titano?x=1 ", out var b));
|
||||
Assert.Equal("http://10.0.0.5:8080/titano/", b.ToString());
|
||||
Assert.True(ServerAddress.TryParse(" http://10.0.0.5:8080/chronos?x=1 ", out var b));
|
||||
Assert.Equal("http://10.0.0.5:8080/chronos/", b.ToString());
|
||||
Assert.False(ServerAddress.TryParse(" ", out _));
|
||||
Assert.False(ServerAddress.TryParse("ftp://nas", out _));
|
||||
Assert.Equal("https://nas.local:8443", ServerAddress.Display(a));
|
||||
@@ -201,7 +201,7 @@ public sealed class ConnectFlowTests
|
||||
{
|
||||
Handshake();
|
||||
server.Logins++;
|
||||
if (password != server.Password) throw new TitanoApiException(HttpStatusCode.Unauthorized, new ApiError("bad_credentials", "Wrong"));
|
||||
if (password != server.Password) throw new ChronosApiException(HttpStatusCode.Unauthorized, new ApiError("bad_credentials", "Wrong"));
|
||||
return Task.FromResult(new LoginResponse("token-" + server.Logins, User(username), false, DateTimeOffset.UtcNow.AddDays(1)));
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ public sealed class ConnectFlowTests
|
||||
{
|
||||
Handshake();
|
||||
server.LastTokenSeen = Token;
|
||||
if (server.ValidToken is { } valid && Token != valid) throw new TitanoApiException(HttpStatusCode.Unauthorized, new ApiError("expired", "Expired"));
|
||||
if (server.ValidToken is { } valid && Token != valid) throw new ChronosApiException(HttpStatusCode.Unauthorized, new ApiError("expired", "Expired"));
|
||||
return Task.FromResult(User("alberto"));
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@ public sealed class ConnectFlowTests
|
||||
private void Handshake()
|
||||
{
|
||||
if (BaseAddress.Host == "down.local") throw new HttpRequestException("No such host");
|
||||
if (BaseAddress.Host == "web.local") throw new TitanoApiException(HttpStatusCode.NotFound, new ApiError("http_404", "Not Found"));
|
||||
if (BaseAddress.Host == "web.local") throw new ChronosApiException(HttpStatusCode.NotFound, new ApiError("http_404", "Not Found"));
|
||||
if (server.SelfSigned && !trusted.Contains(Fingerprint)) throw new UntrustedCertificateException(Fingerprint);
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
using System.IO;
|
||||
using Titano.App.Infrastructure;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Server;
|
||||
namespace Chronos.App.Tests.Server;
|
||||
|
||||
public sealed class RenderNodeHostTests
|
||||
{
|
||||
+11
-11
@@ -2,18 +2,18 @@ using System.Windows;
|
||||
using System.Windows.Automation;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using Titano.App.Infrastructure;
|
||||
using Titano.App.Sections;
|
||||
using Titano.App.Server;
|
||||
using Titano.App.Shell;
|
||||
using Titano.App.Tests.Windows;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Data.Sync;
|
||||
using Titano.Testing;
|
||||
using Titano.Ui.Controls;
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.App.Sections;
|
||||
using Chronos.App.Server;
|
||||
using Chronos.App.Shell;
|
||||
using Chronos.App.Tests.Windows;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Data.Sync;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Ui.Controls;
|
||||
|
||||
namespace Titano.App.Tests.Server;
|
||||
namespace Chronos.App.Tests.Server;
|
||||
|
||||
/// <summary>The Server screen's sync table on the capture sample data: comparison, transfers, conflict and the Library's glyphs.</summary>
|
||||
[WindowsOnly]
|
||||
+7
-7
@@ -1,11 +1,11 @@
|
||||
using System.Net;
|
||||
using Titano.App.Infrastructure;
|
||||
using Titano.App.Server;
|
||||
using Titano.Protocol;
|
||||
using Titano.Protocol.Client;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.App.Server;
|
||||
using Chronos.Protocol;
|
||||
using Chronos.Protocol.Client;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Server;
|
||||
namespace Chronos.App.Tests.Server;
|
||||
|
||||
/// <summary>The login form cancelled while the server is still answering (DESK-8): nothing signs this PC in afterwards.</summary>
|
||||
public sealed class ServerSessionSignInTests
|
||||
@@ -131,7 +131,7 @@ public sealed class ServerSessionSignInTests
|
||||
{
|
||||
server.Logins++;
|
||||
await (server.HonoursCancellation ? server._answer.Task.WaitAsync(ct) : server._answer.Task);
|
||||
if (password != "secret") throw new TitanoApiException(HttpStatusCode.Unauthorized, new ApiError("bad_credentials", "Wrong"));
|
||||
if (password != "secret") throw new ChronosApiException(HttpStatusCode.Unauthorized, new ApiError("bad_credentials", "Wrong"));
|
||||
return new LoginResponse("token-" + server.Logins, User(username), false, DateTimeOffset.UtcNow.AddDays(1));
|
||||
}
|
||||
|
||||
+5
-5
@@ -1,10 +1,10 @@
|
||||
using System.Diagnostics;
|
||||
using Titano.App.DesignTime;
|
||||
using Titano.App.Infrastructure;
|
||||
using Titano.App.Tests.Uploader;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.DesignTime;
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.App.Tests.Uploader;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Server;
|
||||
namespace Chronos.App.Tests.Server;
|
||||
|
||||
public sealed class SyncHostTests
|
||||
{
|
||||
+8
-8
@@ -1,11 +1,11 @@
|
||||
using Titano.App.Server;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Data.Sync;
|
||||
using Titano.Testing;
|
||||
using Titano.Ui.Controls;
|
||||
using Chronos.App.Server;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Data.Sync;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Ui.Controls;
|
||||
|
||||
namespace Titano.App.Tests.Server;
|
||||
namespace Chronos.App.Tests.Server;
|
||||
|
||||
/// <summary>Words, glyphs and actions of the sync table rows (Server.html).</summary>
|
||||
public sealed class SyncTextTests
|
||||
@@ -66,7 +66,7 @@ public sealed class SyncTextTests
|
||||
Assert.SequenceEqual([SyncAction.GetExports, SyncAction.SendExports], SyncText.Actions(Entry(SyncStatus.InSync, exports), Editor));
|
||||
Assert.SequenceEqual([SyncAction.GetExports], SyncText.Actions(Entry(SyncStatus.InSync, exports), Viewer));
|
||||
Assert.SequenceEqual([SyncAction.KeepMine, SyncAction.TakeServer, SyncAction.SaveBoth], SyncText.Actions(Entry(SyncStatus.Conflict, exports), Editor));
|
||||
Assert.Equal(Loc.Plural("Tooltips.Server.Sync.GetExports", 3, Titano.App.Infrastructure.Formatting.Bytes(1_900_000_000)),
|
||||
Assert.Equal(Loc.Plural("Tooltips.Server.Sync.GetExports", 3, Chronos.App.Infrastructure.Formatting.Bytes(1_900_000_000)),
|
||||
SyncText.ToolTip(Entry(SyncStatus.InSync, exports), SyncAction.GetExports));
|
||||
|
||||
Assert.SequenceEqual([SyncAction.Pause], SyncText.Actions(Entry(SyncStatus.Transferring, transfer: Upload(JobState.Running)), Editor));
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
using Titano.App.Settings;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Settings;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Settings;
|
||||
namespace Chronos.App.Tests.Settings;
|
||||
|
||||
/// <summary>
|
||||
/// Settings › Archive never shows a read of the archive's settings that overlapped an edit being written: on a slow share
|
||||
+57
-57
@@ -1,13 +1,13 @@
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using Titano.App.Settings;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Core.Naming;
|
||||
using Titano.Core.Video;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Settings;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Core.Naming;
|
||||
using Chronos.Core.Video;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Settings;
|
||||
namespace Chronos.App.Tests.Settings;
|
||||
|
||||
public sealed class SettingsLogicTests
|
||||
{
|
||||
@@ -139,7 +139,7 @@ public sealed class SettingsLogicTests
|
||||
var hevc = new EncoderRow("HEVC", "NVIDIA HEVC Encoder MFT", "NVIDIA", EncoderSource.MediaFoundation, true, true, 8192, 8192, VideoCodec.Hevc);
|
||||
var av1 = hevc with { Codec = "AV1", Name = "NVIDIA AV1 Encoder MFT", VideoCodec = VideoCodec.Av1 };
|
||||
var h264 = new EncoderRow("H.264", "H264 Encoder MFT", "Microsoft", EncoderSource.MediaFoundation, false, false, 4096, 2304, VideoCodec.H264);
|
||||
var animation = new EncoderRow("GIF · APNG", "Titano", null, EncoderSource.BuiltInAnimation, false, false, 0, 0, null);
|
||||
var animation = new EncoderRow("GIF · APNG", "Chronos", null, EncoderSource.BuiltInAnimation, false, false, 0, 0, null);
|
||||
|
||||
Assert.SequenceEqual(["8K archive", "4K archive", "4K HEVC", "DCI 4K", "Cinema 21:9", "4K 60 fps"], EncoderUse.Presets(hevc));
|
||||
Assert.Equal("Animated GIF · Animated PNG", EncoderUse.Text(animation));
|
||||
@@ -155,7 +155,7 @@ public sealed class SettingsLogicTests
|
||||
new("HEVC", "NVIDIA HEVC Encoder MFT", "NVIDIA", EncoderSource.MediaFoundation, true, true, 8192, 8192, VideoCodec.Hevc),
|
||||
new("H.264", "NVIDIA H.264 Encoder MFT", "NVIDIA", EncoderSource.MediaFoundation, true, false, 4096, 4096, VideoCodec.H264),
|
||||
new("H.264", "H264 Encoder MFT", "Microsoft", EncoderSource.MediaFoundation, false, false, 4096, 2304, VideoCodec.H264),
|
||||
new("MJPEG · AVI", "Titano", null, EncoderSource.BuiltInMjpeg, false, false, 0, 0, VideoCodec.Mjpeg),
|
||||
new("MJPEG · AVI", "Chronos", null, EncoderSource.BuiltInMjpeg, false, false, 0, 0, VideoCodec.Mjpeg),
|
||||
];
|
||||
|
||||
Assert.Equal("HEVC · H.264", EncoderUse.Codecs(EncoderUse.Node(rows, allowsHardware: true)));
|
||||
@@ -178,13 +178,13 @@ public sealed class SettingsLogicTests
|
||||
[Test]
|
||||
public void TheQualityProfileTunesTheJobs()
|
||||
{
|
||||
var settings = new Titano.App.Infrastructure.AppSettings { Quality = Titano.App.Infrastructure.QualityProfile.Best, Parallelism = 3, MemoryBudgetGb = 6 };
|
||||
var basis = new Titano.Data.Processing.ProcessingOptions();
|
||||
var settings = new Chronos.App.Infrastructure.AppSettings { Quality = Chronos.App.Infrastructure.QualityProfile.Best, Parallelism = 3, MemoryBudgetGb = 6 };
|
||||
var basis = new Chronos.Data.Processing.ProcessingOptions();
|
||||
|
||||
// One job runs at a time (owner review 1): it has the whole 6 GB, and decodes and measures 3 photos at once.
|
||||
var best = ProcessingTuning.Apply(basis, settings, 64L << 30, 16, @"C:\cache");
|
||||
Assert.Equal((6L << 30, @"C:\cache", 8, 3), (best.FrameWindow.MemoryBudget, best.FrameWindow.SpillDirectory, best.FrameWindow.Ahead, best.FrameWindow.MaxConcurrentLoads));
|
||||
Assert.Equal((1024, Titano.Core.Project.FlowQualitySetting.Best), (best.Render.AnalysisLongEdge, best.Render.DefaultFlowQuality));
|
||||
Assert.Equal((1024, Chronos.Core.Project.FlowQualitySetting.Best), (best.Render.AnalysisLongEdge, best.Render.DefaultFlowQuality));
|
||||
Assert.Equal(3, best.DeepAnalysis.MaxDegreeOfParallelism);
|
||||
settings.Parallelism = 1;
|
||||
var single = ProcessingTuning.Apply(basis, settings, 64L << 30, 16, @"C:\cache");
|
||||
@@ -195,14 +195,14 @@ public sealed class SettingsLogicTests
|
||||
Assert.Equal((12, 12, 12), (wide.FrameWindow.Ahead, wide.FrameWindow.MaxConcurrentLoads, wide.DeepAnalysis.MaxDegreeOfParallelism));
|
||||
|
||||
// Auto: a quarter of 32 GB, and half the 16 cores at once, with no cap of the analysis threads.
|
||||
settings.Quality = Titano.App.Infrastructure.QualityProfile.Fast;
|
||||
settings.Quality = Chronos.App.Infrastructure.QualityProfile.Fast;
|
||||
settings.MemoryBudgetGb = null;
|
||||
settings.Parallelism = null;
|
||||
var fast = ProcessingTuning.Apply(basis, settings, 32L << 30, 16, @"C:\cache");
|
||||
Assert.Equal((8L << 30, 8), (fast.FrameWindow.MemoryBudget, fast.FrameWindow.Ahead));
|
||||
Assert.Equal((8, 8), (fast.FrameWindow.MaxConcurrentLoads, fast.DeepAnalysis.MaxDegreeOfParallelism));
|
||||
Assert.Equal((256, Titano.Core.Project.FlowQualitySetting.Draft), (fast.Render.AnalysisLongEdge, fast.Render.DefaultFlowQuality));
|
||||
Assert.Equal(512, ProcessingTuning.PreparationLongEdge(Titano.App.Infrastructure.QualityProfile.Balanced));
|
||||
Assert.Equal((256, Chronos.Core.Project.FlowQualitySetting.Draft), (fast.Render.AnalysisLongEdge, fast.Render.DefaultFlowQuality));
|
||||
Assert.Equal(512, ProcessingTuning.PreparationLongEdge(Chronos.App.Infrastructure.QualityProfile.Balanced));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -212,73 +212,73 @@ public sealed class SettingsLogicTests
|
||||
Assert.Equal(8, ProcessingTuning.ParallelismAuto(16));
|
||||
Assert.Equal(2, ProcessingTuning.ParallelismAuto(4));
|
||||
Assert.Equal(1, ProcessingTuning.ParallelismAuto(1));
|
||||
Assert.Equal(Titano.Data.Archiving.ArchiveServiceOptions.DefaultParallelism, ProcessingTuning.ParallelismAuto(Environment.ProcessorCount));
|
||||
Assert.Equal(1, new Titano.Data.Jobs.JobEngineOptions().Workers);
|
||||
Assert.Equal(8, ProcessingTuning.Parallelism(new Titano.App.Infrastructure.AppSettings(), 16));
|
||||
Assert.Equal(5, ProcessingTuning.Parallelism(new Titano.App.Infrastructure.AppSettings { Parallelism = 5 }, 16));
|
||||
Assert.Equal(Chronos.Data.Archiving.ArchiveServiceOptions.DefaultParallelism, ProcessingTuning.ParallelismAuto(Environment.ProcessorCount));
|
||||
Assert.Equal(1, new Chronos.Data.Jobs.JobEngineOptions().Workers);
|
||||
Assert.Equal(8, ProcessingTuning.Parallelism(new Chronos.App.Infrastructure.AppSettings(), 16));
|
||||
Assert.Equal(5, ProcessingTuning.Parallelism(new Chronos.App.Infrastructure.AppSettings { Parallelism = 5 }, 16));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TheAnalysisSettingsBecomeTheDeepAnalysisParameters()
|
||||
{
|
||||
var defaults = new Titano.App.Infrastructure.AppSettings().DeepAnalysis(Titano.Core.Analysis.Deep.DeepAnalysisOptions.Default);
|
||||
var defaults = new Chronos.App.Infrastructure.AppSettings().DeepAnalysis(Chronos.Core.Analysis.Deep.DeepAnalysisOptions.Default);
|
||||
// The defaults of Settings › Analysis are the engine's own: nothing changes until the user does.
|
||||
Assert.Equal(Titano.Core.Analysis.Deep.DeepAnalysisOptions.Default.Fingerprint(), defaults.Fingerprint());
|
||||
Assert.Equal(Titano.Core.Analysis.Deep.DeepAnalysisOptions.Default.StarFieldDensity, defaults.StarFieldDensity);
|
||||
Assert.Equal(Chronos.Core.Analysis.Deep.DeepAnalysisOptions.Default.Fingerprint(), defaults.Fingerprint());
|
||||
Assert.Equal(Chronos.Core.Analysis.Deep.DeepAnalysisOptions.Default.StarFieldDensity, defaults.StarFieldDensity);
|
||||
|
||||
var tuned = new Titano.App.Infrastructure.AppSettings { AnalysisLongEdge = 1024, NightBrightnessPercent = 12.5, StarFieldDensity = 60 }
|
||||
.DeepAnalysis(Titano.Core.Analysis.Deep.DeepAnalysisOptions.Default);
|
||||
var tuned = new Chronos.App.Infrastructure.AppSettings { AnalysisLongEdge = 1024, NightBrightnessPercent = 12.5, StarFieldDensity = 60 }
|
||||
.DeepAnalysis(Chronos.Core.Analysis.Deep.DeepAnalysisOptions.Default);
|
||||
Assert.Equal((1024, -3.0, 60.0), (tuned.MaxAnalysisLongEdge, tuned.DarkLogLuminance, tuned.StarFieldDensity));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NewCardsStartFromSettingsImport()
|
||||
{
|
||||
var settings = new Titano.App.Infrastructure.AppSettings
|
||||
var settings = new Chronos.App.Infrastructure.AppSettings
|
||||
{
|
||||
ImportSessionGapMinutes = 90,
|
||||
ImportMinimumFrames = 20,
|
||||
ImportSubfolders = false,
|
||||
ImportVerify = false,
|
||||
ImportDuplicates = Titano.Core.Import.DuplicatePolicy.ImportAgain,
|
||||
ImportAfter = Titano.Data.Archiving.AfterImport.DeleteImported,
|
||||
ImportDuplicates = Chronos.Core.Import.DuplicatePolicy.ImportAgain,
|
||||
ImportAfter = Chronos.Data.Archiving.AfterImport.DeleteImported,
|
||||
ImportEject = false,
|
||||
DeepAnalysisAfterImport = false,
|
||||
};
|
||||
var profile = settings.ImportProfile("{year}", "{name}");
|
||||
Assert.Equal(("{year}", "{name}", 90, 20), (profile.FolderTemplate, profile.FileTemplate, profile.SessionGapMinutes, profile.MinimumSessionFrames));
|
||||
Assert.Equal((false, false, false, false), (profile.IncludeSubfolders, profile.VerifyCopies, profile.Eject, profile.DeepAnalysis));
|
||||
Assert.Equal((Titano.Core.Import.DuplicatePolicy.ImportAgain, Titano.Data.Archiving.AfterImport.DeleteImported), (profile.Duplicates, profile.AfterImport));
|
||||
Assert.Equal((Chronos.Core.Import.DuplicatePolicy.ImportAgain, Chronos.Data.Archiving.AfterImport.DeleteImported), (profile.Duplicates, profile.AfterImport));
|
||||
// Untouched settings give the brief's card defaults.
|
||||
Assert.Equal(new Titano.Data.Archiving.CardProfile(), new Titano.App.Infrastructure.AppSettings().ImportProfile(TemplateDefaults.Folder, TemplateDefaults.File));
|
||||
Assert.Equal(new Chronos.Data.Archiving.CardProfile(), new Chronos.App.Infrastructure.AppSettings().ImportProfile(TemplateDefaults.Folder, TemplateDefaults.File));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NewArchivesTakeSettingsArchive()
|
||||
{
|
||||
var settings = new Titano.App.Infrastructure.AppSettings { FolderTemplate = "{year}", FileTemplate = "{name}", ProxyLongEdge = 2560, ThumbnailLongEdge = 480 };
|
||||
var settings = new Chronos.App.Infrastructure.AppSettings { FolderTemplate = "{year}", FileTemplate = "{name}", ProxyLongEdge = 2560, ThumbnailLongEdge = 480 };
|
||||
var archive = settings.ArchiveDefaults();
|
||||
Assert.Equal(("{year}", "{name}", 2560, 480), (archive.Templates.Folder, archive.Templates.File, archive.Proxies.LongEdge, archive.Thumbnails.LongEdge));
|
||||
Assert.Null((new Titano.App.Infrastructure.AppSettings().ArchiveDefaults() with { Name = "Archive" }).Problem());
|
||||
Assert.Null((new Chronos.App.Infrastructure.AppSettings().ArchiveDefaults() with { Name = "Archive" }).Problem());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TheArchiveRowsEditOnlyTheArchiveAtTheArchiveFolder()
|
||||
{
|
||||
var main = new Titano.Core.Model.Archive { Id = Guid.CreateVersion7(), Name = "Main", RootPath = "/archive", Created = DateTimeOffset.UtcNow };
|
||||
var travel = new Titano.Core.Model.Archive { Id = Guid.CreateVersion7(), Name = "Travel", RootPath = "/media/travel", Created = DateTimeOffset.UtcNow };
|
||||
var main = new Chronos.Core.Model.Archive { Id = Guid.CreateVersion7(), Name = "Main", RootPath = "/archive", Created = DateTimeOffset.UtcNow };
|
||||
var travel = new Chronos.Core.Model.Archive { Id = Guid.CreateVersion7(), Name = "Travel", RootPath = "/media/travel", Created = DateTimeOffset.UtcNow };
|
||||
|
||||
Assert.Equal(travel.Id, Titano.App.Archiving.CurrentArchive.At([main, travel], "/media/travel/")!.Id);
|
||||
Assert.Equal(travel.Id, Chronos.App.Archiving.CurrentArchive.At([main, travel], "/media/travel/")!.Id);
|
||||
// A folder no archive of the index is at: no archive at all, never the first one (its archive.json is someone else's).
|
||||
Assert.Null(Titano.App.Archiving.CurrentArchive.At([main, travel], "/media/new"));
|
||||
Assert.Equal(main.Id, Titano.App.Archiving.CurrentArchive.Pick([main, travel], "/media/new")!.Id);
|
||||
Assert.Null(Chronos.App.Archiving.CurrentArchive.At([main, travel], "/media/new"));
|
||||
Assert.Equal(main.Id, Chronos.App.Archiving.CurrentArchive.Pick([main, travel], "/media/new")!.Id);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SettingsSurviveARoundTripWithTheNewSections()
|
||||
{
|
||||
var settings = new Titano.App.Infrastructure.AppSettings { ThumbnailLongEdge = 640, ScanIntervalMinutes = 30, NightBrightnessPercent = 3.5, DeepAnalysisAfterScan = true };
|
||||
var copy = Titano.App.Infrastructure.AppSettings.Parse(settings.ToJson())!;
|
||||
var settings = new Chronos.App.Infrastructure.AppSettings { ThumbnailLongEdge = 640, ScanIntervalMinutes = 30, NightBrightnessPercent = 3.5, DeepAnalysisAfterScan = true };
|
||||
var copy = Chronos.App.Infrastructure.AppSettings.Parse(settings.ToJson())!;
|
||||
Assert.Equal((640, 30, 3.5, true), (copy.ThumbnailLongEdge, copy.ScanIntervalMinutes, copy.NightBrightnessPercent, copy.DeepAnalysisAfterScan));
|
||||
}
|
||||
|
||||
@@ -293,18 +293,18 @@ public sealed class SettingsLogicTests
|
||||
[Test]
|
||||
public void FormatsShowTheirTierAndWhatToInstall()
|
||||
{
|
||||
Assert.Equal(("JPEG XL", "CR3", "3FR"), (FormatNames.Of(Titano.Core.Imaging.ImageFileFormat.JpegXl), FormatNames.Of(Titano.Core.Imaging.ImageFileFormat.Cr3),
|
||||
FormatNames.Of(Titano.Core.Imaging.ImageFileFormat.ThreeFr)));
|
||||
var heif = Titano.Core.Windows.Codecs.StoreExtension.Get(Titano.Core.Windows.Codecs.StoreExtensionKind.HeifImage);
|
||||
var format = Titano.Core.Imaging.Decoders.DecoderFactory.DescribeFormats(Titano.Core.Imaging.Decoders.DecoderFactory.CreateClient(null))
|
||||
.First(f => f.Format.Format == Titano.Core.Imaging.ImageFileFormat.Heif).Format;
|
||||
var row = new FormatRowViewModel(new FormatRow(format, Titano.Core.Imaging.DecodeTier.EmbeddedPreview, "managed", [heif]));
|
||||
Assert.Equal(("Preview only", "Titano", heif.ProductName), (row.TierText, row.DecoderText, row.NeedsText));
|
||||
Assert.Equal(Titano.Ui.Controls.StatusKind.Warning, row.TierKind);
|
||||
Assert.Equal(("JPEG XL", "CR3", "3FR"), (FormatNames.Of(Chronos.Core.Imaging.ImageFileFormat.JpegXl), FormatNames.Of(Chronos.Core.Imaging.ImageFileFormat.Cr3),
|
||||
FormatNames.Of(Chronos.Core.Imaging.ImageFileFormat.ThreeFr)));
|
||||
var heif = Chronos.Core.Windows.Codecs.StoreExtension.Get(Chronos.Core.Windows.Codecs.StoreExtensionKind.HeifImage);
|
||||
var format = Chronos.Core.Imaging.Decoders.DecoderFactory.DescribeFormats(Chronos.Core.Imaging.Decoders.DecoderFactory.CreateClient(null))
|
||||
.First(f => f.Format.Format == Chronos.Core.Imaging.ImageFileFormat.Heif).Format;
|
||||
var row = new FormatRowViewModel(new FormatRow(format, Chronos.Core.Imaging.DecodeTier.EmbeddedPreview, "managed", [heif]));
|
||||
Assert.Equal(("Preview only", "Chronos", heif.ProductName), (row.TierText, row.DecoderText, row.NeedsText));
|
||||
Assert.Equal(Chronos.Ui.Controls.StatusKind.Warning, row.TierKind);
|
||||
Assert.Equal("HEIF: Preview only", row.Announcement);
|
||||
var missing = new MissingExtensionViewModel(heif, new Titano.Ui.Mvvm.RelayCommand(() => { }));
|
||||
var missing = new MissingExtensionViewModel(heif, new Chronos.Ui.Mvvm.RelayCommand(() => { }));
|
||||
Assert.Equal(heif.ProductName + " missing", missing.Text);
|
||||
var none = new FormatRowViewModel(new FormatRow(format, Titano.Core.Imaging.DecodeTier.Unavailable, null, []));
|
||||
var none = new FormatRowViewModel(new FormatRow(format, Chronos.Core.Imaging.DecodeTier.Unavailable, null, []));
|
||||
Assert.Equal(("Not supported", "—", "—", false), (none.TierText, none.DecoderText, none.NeedsText, none.HasNeeds));
|
||||
}
|
||||
|
||||
@@ -312,18 +312,18 @@ public sealed class SettingsLogicTests
|
||||
public void EnumDrivenKeysExistInEveryRequiredLanguage()
|
||||
{
|
||||
var keys = new List<string>();
|
||||
keys.AddRange(Enum.GetNames<Titano.Core.Model.JobKind>().Select(k => "Jobs.Kind." + k));
|
||||
keys.AddRange(Enum.GetNames<Titano.Core.Model.JobState>().Select(k => "Jobs.State." + k));
|
||||
keys.AddRange(Enum.GetNames<Titano.Core.Model.JobState>().Select(k => "Tooltips.Jobs.State." + k));
|
||||
keys.AddRange(Enum.GetNames<Titano.App.Jobs.JobFilter>().SelectMany(k => new[] { "Jobs.Filter." + k, "Tooltips.Jobs.Filter." + k }));
|
||||
keys.AddRange(Enum.GetNames<Titano.App.Library.StatusFilter>().Where(k => k != "Any").Select(k => "Library.Filter.Status." + k));
|
||||
keys.AddRange(Enum.GetNames<Titano.Data.Repositories.SequenceSort>().Select(k => "Library.Sort." + k));
|
||||
keys.AddRange(Enum.GetNames<Titano.App.Server.ConnectError>().Where(k => k != "None").Select(k => "Server.Error." + k));
|
||||
keys.AddRange(Enum.GetNames<Titano.Core.Model.UserRole>().SelectMany(k => new[] { "Server.Role." + k, "Tooltips.Server.Role." + k }));
|
||||
keys.AddRange(Enum.GetNames<Chronos.Core.Model.JobKind>().Select(k => "Jobs.Kind." + k));
|
||||
keys.AddRange(Enum.GetNames<Chronos.Core.Model.JobState>().Select(k => "Jobs.State." + k));
|
||||
keys.AddRange(Enum.GetNames<Chronos.Core.Model.JobState>().Select(k => "Tooltips.Jobs.State." + k));
|
||||
keys.AddRange(Enum.GetNames<Chronos.App.Jobs.JobFilter>().SelectMany(k => new[] { "Jobs.Filter." + k, "Tooltips.Jobs.Filter." + k }));
|
||||
keys.AddRange(Enum.GetNames<Chronos.App.Library.StatusFilter>().Where(k => k != "Any").Select(k => "Library.Filter.Status." + k));
|
||||
keys.AddRange(Enum.GetNames<Chronos.Data.Repositories.SequenceSort>().Select(k => "Library.Sort." + k));
|
||||
keys.AddRange(Enum.GetNames<Chronos.App.Server.ConnectError>().Where(k => k != "None").Select(k => "Server.Error." + k));
|
||||
keys.AddRange(Enum.GetNames<Chronos.Core.Model.UserRole>().SelectMany(k => new[] { "Server.Role." + k, "Tooltips.Server.Role." + k }));
|
||||
keys.AddRange(Enum.GetNames<SettingsPage>().SelectMany(k => new[] { "Settings.Page." + k, "Tooltips.Settings.Page." + k }));
|
||||
keys.AddRange(Enum.GetNames<Titano.App.Infrastructure.QualityProfile>().Select(k => "Settings.Rendering.Quality." + k));
|
||||
keys.AddRange(Enum.GetNames<Chronos.App.Infrastructure.QualityProfile>().Select(k => "Settings.Rendering.Quality." + k));
|
||||
keys.AddRange(new[] { "UnclosedBrace", "EmptyToken", "UnknownToken", "UnopenedBrace", "Empty" }.Select(k => "Errors.Template." + k));
|
||||
// Italian completeness is checked by `Titano.Tools i18n check`; here every enum value must have its key.
|
||||
// Italian completeness is checked by `Chronos.Tools i18n check`; here every enum value must have its key.
|
||||
var english = Loc.GetArea("Jobs", CultureInfo.InvariantCulture).Keys
|
||||
.Concat(new[] { "Library", "Server", "Settings", "Tooltips", "Errors" }.SelectMany(a => Loc.GetArea(a, CultureInfo.InvariantCulture).Keys))
|
||||
.ToHashSet(StringComparer.Ordinal);
|
||||
+33
-33
@@ -3,16 +3,16 @@ using System.Windows.Automation;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using Titano.App.Infrastructure;
|
||||
using Titano.App.Sections;
|
||||
using Titano.App.Server;
|
||||
using Titano.App.Settings;
|
||||
using Titano.App.Shell;
|
||||
using Titano.App.Tests.Windows;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.App.Sections;
|
||||
using Chronos.App.Server;
|
||||
using Chronos.App.Settings;
|
||||
using Chronos.App.Shell;
|
||||
using Chronos.App.Tests.Windows;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Settings;
|
||||
namespace Chronos.App.Tests.Settings;
|
||||
|
||||
/// <summary>
|
||||
/// Settings, the first-run dialog and the reading direction on the capture sample: values other screens set, labels and
|
||||
@@ -34,7 +34,7 @@ public sealed class SettingsScreenSmokeTests
|
||||
|
||||
// The open archive and the server connected to were set after Settings was built: it shows them when opened.
|
||||
shell.Navigate(SectionKey.Settings);
|
||||
Assert.Equal(@"D:\TitanoArchive", settings.ArchiveRoot.Text);
|
||||
Assert.Equal(@"D:\ChronosArchive", settings.ArchiveRoot.Text);
|
||||
Assert.Equal("https://nas.local:8443", settings.DefaultServer.Text);
|
||||
Assert.False(settings.ArchiveRoot.IsDirty || settings.DefaultServer.IsDirty, "values loaded, not edits");
|
||||
|
||||
@@ -111,35 +111,35 @@ public sealed class SettingsScreenSmokeTests
|
||||
await app.Sample.FillAsync();
|
||||
var settings = shell.Settings;
|
||||
// The open archive's own thumbnail size (archive.json) is what Settings › Archive shows.
|
||||
var archive = Assert.NotNull(await Titano.App.Archiving.CurrentArchive.FindAsync(shell.Services.Database!, shell.Services.Settings.LastArchivePath));
|
||||
var archive = Assert.NotNull(await Chronos.App.Archiving.CurrentArchive.FindAsync(shell.Services.Database!, shell.Services.Settings.LastArchivePath));
|
||||
// The sample shows a display path as its archive folder; the rows edit only the archive at the archive folder.
|
||||
shell.Services.Settings.LastArchivePath = archive.RootPath;
|
||||
var manifestPath = new Titano.Core.Archiving.ArchivePaths(archive.RootPath).ManifestPath;
|
||||
var manifest = Titano.Core.Archiving.ManifestStore.ReadArchive(manifestPath);
|
||||
Titano.Core.Archiving.ManifestStore.WriteArchive(manifestPath, manifest with { ThumbnailPolicy = new Titano.Core.Archiving.ThumbnailPolicy { LongEdge = 240 } });
|
||||
var manifestPath = new Chronos.Core.Archiving.ArchivePaths(archive.RootPath).ManifestPath;
|
||||
var manifest = Chronos.Core.Archiving.ManifestStore.ReadArchive(manifestPath);
|
||||
Chronos.Core.Archiving.ManifestStore.WriteArchive(manifestPath, manifest with { ThumbnailPolicy = new Chronos.Core.Archiving.ThumbnailPolicy { LongEdge = 240 } });
|
||||
|
||||
shell.Navigate(SectionKey.Settings);
|
||||
settings.Page = SettingsPage.Archive;
|
||||
await WaitAsync(() => settings.SelectedThumbnailSize.Value == 240, "the archive's thumbnail size is shown");
|
||||
await app.ExpectAsync<SettingsView>("settings-archive");
|
||||
settings.SelectedThumbnailSize = settings.ThumbnailSizes.Single(s => s.Value == 480);
|
||||
await WaitAsync(() => Titano.Core.Archiving.ManifestStore.ReadArchive(manifestPath).ThumbnailPolicy.LongEdge == 480, "written into archive.json");
|
||||
await WaitAsync(() => Chronos.Core.Archiving.ManifestStore.ReadArchive(manifestPath).ThumbnailPolicy.LongEdge == 480, "written into archive.json");
|
||||
Assert.Equal(480, shell.Services.Settings.ThumbnailLongEdge);
|
||||
|
||||
// A proxy size the admin panel set (3840 is none of the presets) is shown as it is, not as 1920.
|
||||
manifest = Titano.Core.Archiving.ManifestStore.ReadArchive(manifestPath);
|
||||
Titano.Core.Archiving.ManifestStore.WriteArchive(manifestPath, manifest with { ProxyPolicy = manifest.ProxyPolicy with { LongEdge = 3840 } });
|
||||
manifest = Chronos.Core.Archiving.ManifestStore.ReadArchive(manifestPath);
|
||||
Chronos.Core.Archiving.ManifestStore.WriteArchive(manifestPath, manifest with { ProxyPolicy = manifest.ProxyPolicy with { LongEdge = 3840 } });
|
||||
shell.Navigate(SectionKey.Library);
|
||||
shell.Navigate(SectionKey.Settings);
|
||||
await WaitAsync(() => settings.SelectedProxySize.Value == 3840, "the archive's own proxy size is shown");
|
||||
Assert.Equal("3840", settings.SelectedProxySize.Label);
|
||||
Assert.SequenceEqual([1280, 1920, 2560, 3840, Titano.Core.Archiving.ProxyPolicy.FullSize, Titano.Core.Archiving.ProxyPolicy.Disabled],
|
||||
Assert.SequenceEqual([1280, 1920, 2560, 3840, Chronos.Core.Archiving.ProxyPolicy.FullSize, Chronos.Core.Archiving.ProxyPolicy.Disabled],
|
||||
settings.ProxySizes.Select(s => s.Value));
|
||||
|
||||
// Reset section on Archive changes the archive everyone shares: it asks first, and a "no" leaves archive.json alone.
|
||||
settings.ResetSectionCommand.Execute(null);
|
||||
Assert.Equal((480, 3840), (Titano.Core.Archiving.ManifestStore.ReadArchive(manifestPath).ThumbnailPolicy.LongEdge,
|
||||
Titano.Core.Archiving.ManifestStore.ReadArchive(manifestPath).ProxyPolicy.LongEdge));
|
||||
Assert.Equal((480, 3840), (Chronos.Core.Archiving.ManifestStore.ReadArchive(manifestPath).ThumbnailPolicy.LongEdge,
|
||||
Chronos.Core.Archiving.ManifestStore.ReadArchive(manifestPath).ProxyPolicy.LongEdge));
|
||||
Assert.Equal(480, settings.SelectedThumbnailSize.Value);
|
||||
|
||||
// Import: the defaults of new cards.
|
||||
@@ -148,7 +148,7 @@ public sealed class SettingsScreenSmokeTests
|
||||
settings.SessionGap.Text = "90";
|
||||
Assert.True(settings.SessionGap.Commit());
|
||||
settings.IsFormatCard = true;
|
||||
Assert.Equal((90, Titano.Data.Archiving.AfterImport.FormatCard), (shell.Services.Settings.ImportSessionGapMinutes, shell.Services.Settings.ImportAfter));
|
||||
Assert.Equal((90, Chronos.Data.Archiving.AfterImport.FormatCard), (shell.Services.Settings.ImportSessionGapMinutes, shell.Services.Settings.ImportAfter));
|
||||
Assert.True(settings.CanResetSection);
|
||||
settings.ResetSectionCommand.Execute(null);
|
||||
Assert.Equal(("45", true), (settings.SessionGap.Text, settings.IsKeepCard));
|
||||
@@ -171,7 +171,7 @@ public sealed class SettingsScreenSmokeTests
|
||||
var installs = app.FindAll<Button>().Where(b => b.IsVisible && b.Content as string == Loc.L("Settings.Formats.Install")).ToList();
|
||||
Assert.Count(3, installs);
|
||||
Assert.True(installs.All(b => AutomationProperties.GetName(b).StartsWith(Loc.L("Settings.Formats.InstallName", string.Empty), StringComparison.Ordinal)), "named after the extension");
|
||||
Assert.Contains(settings.Formats, f => f.Row.Tier == Titano.Core.Imaging.DecodeTier.Native);
|
||||
Assert.Contains(settings.Formats, f => f.Row.Tier == Chronos.Core.Imaging.DecodeTier.Native);
|
||||
Assert.False(settings.CanResetSection, "Formats only shows this PC");
|
||||
installs[0].Command.Execute(null);
|
||||
});
|
||||
@@ -184,9 +184,9 @@ public sealed class SettingsScreenSmokeTests
|
||||
await app.Sample.FillAsync();
|
||||
var settings = shell.Settings;
|
||||
var db = shell.Services.Database!;
|
||||
var archive = Assert.NotNull(await Titano.App.Archiving.CurrentArchive.FindAsync(db, null));
|
||||
var manifestPath = new Titano.Core.Archiving.ArchivePaths(archive.RootPath).ManifestPath;
|
||||
static Titano.Core.Archiving.ArchiveManifest Read(string path) => Titano.Core.Archiving.ManifestStore.ReadArchive(path);
|
||||
var archive = Assert.NotNull(await Chronos.App.Archiving.CurrentArchive.FindAsync(db, null));
|
||||
var manifestPath = new Chronos.Core.Archiving.ArchivePaths(archive.RootPath).ManifestPath;
|
||||
static Chronos.Core.Archiving.ArchiveManifest Read(string path) => Chronos.Core.Archiving.ManifestStore.ReadArchive(path);
|
||||
shell.Navigate(SectionKey.Settings);
|
||||
settings.Page = SettingsPage.Archive;
|
||||
|
||||
@@ -213,7 +213,7 @@ public sealed class SettingsScreenSmokeTests
|
||||
// archive: never to the archive at the folder chosen after it.
|
||||
var otherRoot = System.IO.Path.Combine(shell.Services.Environment.DataDirectory, "other-archive");
|
||||
await shell.Services.Archives!.CreateAsync(otherRoot, "Other");
|
||||
var otherManifestPath = new Titano.Core.Archiving.ArchivePaths(otherRoot).ManifestPath;
|
||||
var otherManifestPath = new Chronos.Core.Archiving.ArchivePaths(otherRoot).ManifestPath;
|
||||
settings.ArchiveRoot.Text = otherRoot;
|
||||
Assert.True(settings.ArchiveRoot.Commit());
|
||||
await settings.ArchiveRetarget;
|
||||
@@ -235,7 +235,7 @@ public sealed class SettingsScreenSmokeTests
|
||||
await settings.ArchiveRetarget;
|
||||
|
||||
// Offline, only archive.json knows the thumbnail size: this PC's stays instead of becoming the default.
|
||||
Titano.Core.Archiving.ManifestStore.WriteArchive(manifestPath, Read(manifestPath) with { ThumbnailPolicy = new Titano.Core.Archiving.ThumbnailPolicy { LongEdge = 480 } });
|
||||
Chronos.Core.Archiving.ManifestStore.WriteArchive(manifestPath, Read(manifestPath) with { ThumbnailPolicy = new Chronos.Core.Archiving.ThumbnailPolicy { LongEdge = 480 } });
|
||||
shell.Navigate(SectionKey.Library);
|
||||
shell.Navigate(SectionKey.Settings);
|
||||
await WaitAsync(() => shell.Services.Settings.ThumbnailLongEdge == 480, "the archive's thumbnail size is shown");
|
||||
@@ -256,9 +256,9 @@ public sealed class SettingsScreenSmokeTests
|
||||
var shell = app.Shell;
|
||||
await app.Sample.FillAsync();
|
||||
var settings = shell.Settings;
|
||||
var archive = Assert.NotNull(await Titano.App.Archiving.CurrentArchive.FindAsync(shell.Services.Database!, null));
|
||||
var paths = new Titano.Core.Archiving.ArchivePaths(archive.RootPath);
|
||||
static Titano.Core.Archiving.ArchiveManifest Read(string path) => Titano.Core.Archiving.ManifestStore.ReadArchive(path);
|
||||
var archive = Assert.NotNull(await Chronos.App.Archiving.CurrentArchive.FindAsync(shell.Services.Database!, null));
|
||||
var paths = new Chronos.Core.Archiving.ArchivePaths(archive.RootPath);
|
||||
static Chronos.Core.Archiving.ArchiveManifest Read(string path) => Chronos.Core.Archiving.ManifestStore.ReadArchive(path);
|
||||
shell.Navigate(SectionKey.Settings);
|
||||
settings.Page = SettingsPage.Archive;
|
||||
settings.ArchiveRoot.Text = archive.RootPath;
|
||||
@@ -271,7 +271,7 @@ public sealed class SettingsScreenSmokeTests
|
||||
|
||||
// Another PC holds the archive's settings, so the edit waits to be written. Settings is shown again just before
|
||||
// the edit is committed: its read of archive.json answers meanwhile, with the file from before the edit.
|
||||
var lease = Assert.NotNull(Titano.Core.Archiving.LeaseFile.TryAcquire(paths.LocksDirectory, "archive-settings", "other-pc"));
|
||||
var lease = Assert.NotNull(Chronos.Core.Archiving.LeaseFile.TryAcquire(paths.LocksDirectory, "archive-settings", "other-pc"));
|
||||
Task reload;
|
||||
try
|
||||
{
|
||||
@@ -316,7 +316,7 @@ public sealed class SettingsScreenSmokeTests
|
||||
Assert.NotNull(focused, "a card has focus");
|
||||
Assert.True(focused.IsChecked == true && welcome.IsAncestorOf(focused), "the chosen card of the dialog has focus");
|
||||
// The logo is not mirrored in right-to-left languages.
|
||||
Assert.True(app.FindAll<Titano.Ui.Controls.BrandMarkIcon>().Where(b => b.IsVisible).All(b => b.FlowDirection == FlowDirection.LeftToRight));
|
||||
Assert.True(app.FindAll<Chronos.Ui.Controls.BrandMarkIcon>().Where(b => b.IsVisible).All(b => b.FlowDirection == FlowDirection.LeftToRight));
|
||||
app.Shell.CompleteWelcome();
|
||||
});
|
||||
|
||||
@@ -357,7 +357,7 @@ public sealed class SettingsScreenSmokeTests
|
||||
Assert.Equal(FlowDirection.LeftToRight, path.FlowDirection);
|
||||
Assert.Equal(app.Shell.About.DataFolder, path.ToolTip);
|
||||
// The update result is a live region: screen readers hear each new state.
|
||||
var update = app.FindAll<Titano.Ui.Controls.StatusGlyph>().First(g => g.IsVisible && g.Text == app.Shell.About.UpdateText);
|
||||
var update = app.FindAll<Chronos.Ui.Controls.StatusGlyph>().First(g => g.IsVisible && g.Text == app.Shell.About.UpdateText);
|
||||
Assert.Equal(AutomationLiveSetting.Polite, AutomationProperties.GetLiveSetting(update));
|
||||
Assert.Equal(app.Shell.About.UpdateAnnouncement, AutomationProperties.GetName(update));
|
||||
}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Titano.App.Tests.Setup;
|
||||
namespace Chronos.App.Tests.Setup;
|
||||
|
||||
/// <summary>
|
||||
/// Throwaway Windows services for the tests of setup's service steps: stopped, started on demand only, never running.
|
||||
+95
-95
@@ -1,13 +1,13 @@
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using Microsoft.Win32;
|
||||
using Titano.Core.Packaging;
|
||||
using Titano.Setup.Cli;
|
||||
using Titano.Setup.Engine;
|
||||
using Titano.Setup.Interop;
|
||||
using Titano.Testing;
|
||||
using Chronos.Core.Packaging;
|
||||
using Chronos.Setup.Cli;
|
||||
using Chronos.Setup.Engine;
|
||||
using Chronos.Setup.Interop;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Setup;
|
||||
namespace Chronos.App.Tests.Setup;
|
||||
|
||||
/// <summary>
|
||||
/// What setup leaves behind and what it registers: services and startup entries of the programs it installed, never
|
||||
@@ -16,17 +16,17 @@ namespace Titano.App.Tests.Setup;
|
||||
/// </summary>
|
||||
public sealed class SetupEngineTests(TestContext context)
|
||||
{
|
||||
private const string TestsKey = @"Software\Titano.Tests";
|
||||
private const string TestsKey = @"Software\Chronos.Tests";
|
||||
|
||||
/// <summary>The StartupApproved state Task Manager writes for an entry it turned off.</summary>
|
||||
private static readonly byte[] TurnedOff = [0x03, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
||||
|
||||
[Theory]
|
||||
[Case(@"""C:\Program Files\Titano\Titano.Server.exe"" --service", @"C:\Program Files\Titano\Titano.Server.exe")]
|
||||
[Case(@"C:\Program Files\Titano\Titano.Server.exe --service", @"C:\Program Files\Titano\Titano.Server.exe")]
|
||||
[Case(@"""C:\Program Files\dotnet\dotnet.exe"" ""C:\Apps\Titano\Titano.Server.dll"" --service", @"C:\Apps\Titano\Titano.Server.dll")]
|
||||
[Case(@"""C:\Program Files\Chronos\Chronos.Server.exe"" --service", @"C:\Program Files\Chronos\Chronos.Server.exe")]
|
||||
[Case(@"C:\Program Files\Chronos\Chronos.Server.exe --service", @"C:\Program Files\Chronos\Chronos.Server.exe")]
|
||||
[Case(@"""C:\Program Files\dotnet\dotnet.exe"" ""C:\Apps\Chronos\Chronos.Server.dll"" --service", @"C:\Apps\Chronos\Chronos.Server.dll")]
|
||||
[Case(@"C:\Windows\system32\svchost.exe -k netsvcs", @"C:\Windows\system32\svchost.exe")]
|
||||
[Case(@"Titano.Uploader.exe --tray", null)]
|
||||
[Case(@"Chronos.Uploader.exe --tray", null)]
|
||||
[Case("", null)]
|
||||
public void TheProgramOfACommandLineIsItsFirstFullPath(string commandLine, string? program) =>
|
||||
Assert.Equal(program, CommandProgram.Of(commandLine));
|
||||
@@ -37,25 +37,25 @@ public sealed class SetupEngineTests(TestContext context)
|
||||
var arguments = new SetupArguments
|
||||
{
|
||||
Services = ServiceActions.Prune | ServiceActions.Start,
|
||||
ServiceNames = ["TitanoServer"],
|
||||
Directory = @"C:\Program Files\Titano",
|
||||
ServiceNames = ["ChronosServer"],
|
||||
Directory = @"C:\Program Files\Chronos",
|
||||
Elevated = true,
|
||||
};
|
||||
var switches = arguments.ToSwitches().ToList();
|
||||
Assert.Contains("/SERVICES=prune,start", switches);
|
||||
Assert.Contains("/NAMES=TitanoServer", switches);
|
||||
Assert.Contains("/NAMES=ChronosServer", switches);
|
||||
var parsed = SetupArguments.Parse(switches);
|
||||
Assert.Equal(arguments.Services, parsed.Services);
|
||||
Assert.Equal(arguments.Directory, parsed.Directory);
|
||||
Assert.SequenceEqual(["TitanoServer"], parsed.ServiceNames!);
|
||||
Assert.SequenceEqual(["ChronosServer"], parsed.ServiceNames!);
|
||||
Assert.True(parsed.Elevated);
|
||||
|
||||
Assert.Equal(ServiceActions.Remove, SetupArguments.Parse(["/SERVICES=Remove", "/NAMES=TitanoServer", "/DIR=C:\\Apps\\Titano"]).Services);
|
||||
Assert.Equal(ServiceActions.Remove, SetupArguments.Parse(["/SERVICES=Remove", "/NAMES=ChronosServer", "/DIR=C:\\Apps\\Chronos"]).Services);
|
||||
// The step acts only on services the unelevated setup named.
|
||||
Assert.Throws<ArgumentException>(() => SetupArguments.Parse(["/SERVICES=stop", "/NAMES=TitanoServer"]));
|
||||
Assert.Throws<ArgumentException>(() => SetupArguments.Parse(["/SERVICES=stop", "/DIR=C:\\Apps\\Titano"]));
|
||||
Assert.Throws<ArgumentException>(() => SetupArguments.Parse(["/SERVICES=kill", "/NAMES=TitanoServer", "/DIR=C:\\Apps\\Titano"]));
|
||||
Assert.Throws<ArgumentException>(() => SetupArguments.Parse(["/SERVICES=none", "/NAMES=TitanoServer", "/DIR=C:\\Apps\\Titano"]));
|
||||
Assert.Throws<ArgumentException>(() => SetupArguments.Parse(["/SERVICES=stop", "/NAMES=ChronosServer"]));
|
||||
Assert.Throws<ArgumentException>(() => SetupArguments.Parse(["/SERVICES=stop", "/DIR=C:\\Apps\\Chronos"]));
|
||||
Assert.Throws<ArgumentException>(() => SetupArguments.Parse(["/SERVICES=kill", "/NAMES=ChronosServer", "/DIR=C:\\Apps\\Chronos"]));
|
||||
Assert.Throws<ArgumentException>(() => SetupArguments.Parse(["/SERVICES=none", "/NAMES=ChronosServer", "/DIR=C:\\Apps\\Chronos"]));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -63,28 +63,28 @@ public sealed class SetupEngineTests(TestContext context)
|
||||
public void OnlyTheServicesOfProgramsSetupInstalledAreFound()
|
||||
{
|
||||
var folder = Path.Combine(context.CreateTempDirectory("services"), "Apps");
|
||||
var owned = CommandProgram.FullPaths(folder, ["Titano.Server.exe", "Titano.exe", "lib/Titano.Core.dll"]);
|
||||
var owned = CommandProgram.FullPaths(folder, ["Chronos.Server.exe", "Chronos.exe", "lib/Chronos.Core.dll"]);
|
||||
var keyPath = TestsKey + @"\" + Guid.NewGuid().ToString("N");
|
||||
try
|
||||
{
|
||||
using var services = Registry.CurrentUser.CreateSubKey(keyPath, writable: true);
|
||||
Service(services, "TitanoServer", 0x10, $"\"{Path.Combine(folder, "Titano.Server.exe")}\" --service");
|
||||
Service(services, "TitanoServerUnquoted", 0x10, Path.Combine(folder, "TITANO.SERVER.EXE") + " --service");
|
||||
// Another vendor's service, and a driver, that live in the same folder (a shared D:\Apps): never Titano's.
|
||||
Service(services, "ChronosServer", 0x10, $"\"{Path.Combine(folder, "Chronos.Server.exe")}\" --service");
|
||||
Service(services, "ChronosServerUnquoted", 0x10, Path.Combine(folder, "CHRONOS.SERVER.EXE") + " --service");
|
||||
// Another vendor's service, and a driver, that live in the same folder (a shared D:\Apps): never Chronos's.
|
||||
Service(services, "OtherVendor", 0x10, $"\"{Path.Combine(folder, "Other", "Other.exe")}\"");
|
||||
Service(services, "OtherBeside", 0x10, $"\"{Path.Combine(folder, "Helper.exe")}\" /run");
|
||||
Service(services, "Driver", 0x1, Path.Combine(folder, "Titano.Server.exe"));
|
||||
Service(services, "Driver", 0x1, Path.Combine(folder, "Chronos.Server.exe"));
|
||||
using (var deleting = services.CreateSubKey("Deleting", writable: true))
|
||||
{
|
||||
deleting.SetValue("Type", 0x10, RegistryValueKind.DWord);
|
||||
deleting.SetValue("DeleteFlag", 1, RegistryValueKind.DWord);
|
||||
deleting.SetValue("ImagePath", Path.Combine(folder, "Titano.Server.exe"), RegistryValueKind.ExpandString);
|
||||
deleting.SetValue("ImagePath", Path.Combine(folder, "Chronos.Server.exe"), RegistryValueKind.ExpandString);
|
||||
}
|
||||
|
||||
var found = InstalledServices.Find(services, owned);
|
||||
Assert.SequenceEqual(["TitanoServer", "TitanoServerUnquoted"], found.Select(s => s.Name).Order(StringComparer.Ordinal));
|
||||
Assert.True(found.All(s => s.Program.Equals(Path.Combine(folder, "Titano.Server.exe"), StringComparison.OrdinalIgnoreCase)));
|
||||
Assert.Empty(InstalledServices.Find(services, CommandProgram.FullPaths(folder, ["Titano.exe"])));
|
||||
Assert.SequenceEqual(["ChronosServer", "ChronosServerUnquoted"], found.Select(s => s.Name).Order(StringComparer.Ordinal));
|
||||
Assert.True(found.All(s => s.Program.Equals(Path.Combine(folder, "Chronos.Server.exe"), StringComparison.OrdinalIgnoreCase)));
|
||||
Assert.Empty(InstalledServices.Find(services, CommandProgram.FullPaths(folder, ["Chronos.exe"])));
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -105,10 +105,10 @@ public sealed class SetupEngineTests(TestContext context)
|
||||
{
|
||||
var folder = context.CreateTempDirectory("services");
|
||||
// No service starts a program of a fresh folder, and nothing is asked of the Service Control Manager.
|
||||
Assert.Empty(InstalledServices.Find(CommandProgram.FullPaths(folder, ["Titano.Server.exe"])));
|
||||
Assert.Empty(InstalledServices.Find(CommandProgram.FullPaths(folder, ["Chronos.Server.exe"])));
|
||||
Assert.Equal(SetupExitCode.Success, InstalledServices.Apply([], ServiceActions.Remove));
|
||||
|
||||
var gone = new InstalledService("TitanoTest" + Guid.NewGuid().ToString("N"), "Titano Server", Path.Combine(folder, "Titano.Server.exe"));
|
||||
var gone = new InstalledService("ChronosTest" + Guid.NewGuid().ToString("N"), "Chronos Server", Path.Combine(folder, "Chronos.Server.exe"));
|
||||
Assert.False(InstalledServices.IsRunning(gone));
|
||||
foreach (var action in (ServiceActions[])[ServiceActions.Stop, ServiceActions.Prune, ServiceActions.Start, ServiceActions.Remove])
|
||||
Assert.False(InstalledServices.NeedsWork([gone], action), $"{action} of a service that does not exist");
|
||||
@@ -125,15 +125,15 @@ public sealed class SetupEngineTests(TestContext context)
|
||||
var root = context.CreateTempDirectory("services");
|
||||
var folder = Path.Combine(root, "Apps");
|
||||
Directory.CreateDirectory(folder);
|
||||
var ours = "TitanoTest" + Guid.NewGuid().ToString("N");
|
||||
var other = "TitanoTest" + Guid.NewGuid().ToString("N");
|
||||
var ours = "ChronosTest" + Guid.NewGuid().ToString("N");
|
||||
var other = "ChronosTest" + Guid.NewGuid().ToString("N");
|
||||
try
|
||||
{
|
||||
// Two stopped services whose programs are gone: one in the install folder, one in a folder setup did not install.
|
||||
ScratchServices.Create(ours, $"\"{Path.Combine(folder, "Titano.Server.exe")}\" --service");
|
||||
ScratchServices.Create(other, $"\"{Path.Combine(root, "Elsewhere", "Titano.Server.exe")}\" --service");
|
||||
ScratchServices.Create(ours, $"\"{Path.Combine(folder, "Chronos.Server.exe")}\" --service");
|
||||
ScratchServices.Create(other, $"\"{Path.Combine(root, "Elsewhere", "Chronos.Server.exe")}\" --service");
|
||||
|
||||
var found = InstalledServices.Find(CommandProgram.FullPaths(folder, ["Titano.Server.exe"]));
|
||||
var found = InstalledServices.Find(CommandProgram.FullPaths(folder, ["Chronos.Server.exe"]));
|
||||
var service = Assert.Contains(found, s => s.Name == ours);
|
||||
Assert.False(found.Any(s => s.Name == other), "a service of another folder is not this installation's");
|
||||
Assert.False(InstalledServices.IsRunning(service));
|
||||
@@ -144,7 +144,7 @@ public sealed class SetupEngineTests(TestContext context)
|
||||
|
||||
Assert.False(ScratchServices.Exists(ours), "the pruned service is deleted");
|
||||
Assert.True(ScratchServices.Exists(other), "the other folder's service stays");
|
||||
Assert.Empty(InstalledServices.Find(CommandProgram.FullPaths(folder, ["Titano.Server.exe"])));
|
||||
Assert.Empty(InstalledServices.Find(CommandProgram.FullPaths(folder, ["Chronos.Server.exe"])));
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -164,20 +164,20 @@ public sealed class SetupEngineTests(TestContext context)
|
||||
using (var run = Registry.CurrentUser.CreateSubKey(keyPath + @"\Run", writable: true))
|
||||
using (var approval = Registry.CurrentUser.CreateSubKey(keyPath + @"\Approved", writable: true))
|
||||
{
|
||||
run.SetValue("Titano Uploader", $"\"{Path.Combine(folder, "Uploader", "Titano.Uploader.exe")}\" --tray");
|
||||
// A portable Titano unpacked in a subfolder of the same folder: not a program this installation lists.
|
||||
run.SetValue("Titano", $"\"{Path.Combine(folder, "Portable", "Titano.exe")}\" --minimized");
|
||||
run.SetValue("Chronos Uploader", $"\"{Path.Combine(folder, "Uploader", "Chronos.Uploader.exe")}\" --tray");
|
||||
// A portable Chronos unpacked in a subfolder of the same folder: not a program this installation lists.
|
||||
run.SetValue("Chronos", $"\"{Path.Combine(folder, "Portable", "Chronos.exe")}\" --minimized");
|
||||
// Another program in the same folder, and a copy in a sibling folder.
|
||||
run.SetValue("Other", $"\"{Path.Combine(folder, "Other.exe")}\" --background");
|
||||
run.SetValue("Sibling", $"\"{folder} 2\\Titano.Uploader.exe\"");
|
||||
// Both Titano entries were turned off in Task Manager.
|
||||
approval.SetValue("Titano Uploader", TurnedOff, RegistryValueKind.Binary);
|
||||
approval.SetValue("Titano", TurnedOff, RegistryValueKind.Binary);
|
||||
run.SetValue("Sibling", $"\"{folder} 2\\Chronos.Uploader.exe\"");
|
||||
// Both Chronos entries were turned off in Task Manager.
|
||||
approval.SetValue("Chronos Uploader", TurnedOff, RegistryValueKind.Binary);
|
||||
approval.SetValue("Chronos", TurnedOff, RegistryValueKind.Binary);
|
||||
|
||||
var programs = CommandProgram.FullPaths(folder, ["Titano.exe", "Uploader/Titano.Uploader.exe", "Other.exe"]);
|
||||
Assert.SequenceEqual(["Titano Uploader"], SetupRegistry.DeleteStartupEntries(run, approval, programs));
|
||||
Assert.SequenceEqual(["Other", "Sibling", "Titano"], run.GetValueNames().Order(StringComparer.Ordinal));
|
||||
Assert.SequenceEqual(["Titano"], approval.GetValueNames());
|
||||
var programs = CommandProgram.FullPaths(folder, ["Chronos.exe", "Uploader/Chronos.Uploader.exe", "Other.exe"]);
|
||||
Assert.SequenceEqual(["Chronos Uploader"], SetupRegistry.DeleteStartupEntries(run, approval, programs));
|
||||
Assert.SequenceEqual(["Chronos", "Other", "Sibling"], run.GetValueNames().Order(StringComparer.Ordinal));
|
||||
Assert.SequenceEqual(["Chronos"], approval.GetValueNames());
|
||||
}
|
||||
}
|
||||
finally
|
||||
@@ -192,36 +192,36 @@ public sealed class SetupEngineTests(TestContext context)
|
||||
{
|
||||
var folder = Path.Combine(context.CreateTempDirectory("upgrade"), "Apps");
|
||||
var keyPath = TestsKey + @"\" + Guid.NewGuid().ToString("N");
|
||||
// This version ships the client as Titano.exe (the previous one as Titano.old.exe), and the user left out the Uploader.
|
||||
// This version ships the client as Chronos.exe (the previous one as Chronos.old.exe), and the user left out the Uploader.
|
||||
var manifest = Manifest();
|
||||
manifest.Components.Add(new PayloadComponent { Id = "Uploader", DisplayName = "Titano Uploader", DefaultSelected = true });
|
||||
manifest.Shortcuts.Add(new PayloadShortcut { Component = "Titano", Name = "Titano", Target = "Titano.exe", StartMenu = true });
|
||||
manifest.Shortcuts.Add(new PayloadShortcut { Component = "Uploader", Name = "Titano Uploader", Target = "Titano.Uploader.exe", StartMenu = true });
|
||||
var programs = InstallEngine.StartupPrograms(manifest, folder, ["Titano", "Server"]);
|
||||
Assert.SequenceEqual(["Titano"], programs.Keys);
|
||||
Assert.Equal(Path.Combine(folder, "Titano.exe"), programs["Titano"]);
|
||||
manifest.Components.Add(new PayloadComponent { Id = "Uploader", DisplayName = "Chronos Uploader", DefaultSelected = true });
|
||||
manifest.Shortcuts.Add(new PayloadShortcut { Component = "Chronos", Name = "Chronos", Target = "Chronos.exe", StartMenu = true });
|
||||
manifest.Shortcuts.Add(new PayloadShortcut { Component = "Uploader", Name = "Chronos Uploader", Target = "Chronos.Uploader.exe", StartMenu = true });
|
||||
var programs = InstallEngine.StartupPrograms(manifest, folder, ["Chronos", "Server"]);
|
||||
Assert.SequenceEqual(["Chronos"], programs.Keys);
|
||||
Assert.Equal(Path.Combine(folder, "Chronos.exe"), programs["Chronos"]);
|
||||
try
|
||||
{
|
||||
using (var run = Registry.CurrentUser.CreateSubKey(keyPath + @"\Run", writable: true))
|
||||
using (var approval = Registry.CurrentUser.CreateSubKey(keyPath + @"\Approved", writable: true))
|
||||
{
|
||||
run.SetValue("Titano", $"\"{Path.Combine(folder, "Titano.old.exe")}\" --minimized");
|
||||
run.SetValue("Titano Uploader", $"\"{Path.Combine(folder, "Titano.Uploader.exe")}\" --tray");
|
||||
run.SetValue("Chronos", $"\"{Path.Combine(folder, "Chronos.old.exe")}\" --minimized");
|
||||
run.SetValue("Chronos Uploader", $"\"{Path.Combine(folder, "Chronos.Uploader.exe")}\" --tray");
|
||||
run.SetValue("Other", $"\"{Path.Combine(folder, "Other.exe")}\" --background");
|
||||
approval.SetValue("Titano", TurnedOff, RegistryValueKind.Binary);
|
||||
approval.SetValue("Titano Uploader", TurnedOff, RegistryValueKind.Binary);
|
||||
approval.SetValue("Chronos", TurnedOff, RegistryValueKind.Binary);
|
||||
approval.SetValue("Chronos Uploader", TurnedOff, RegistryValueKind.Binary);
|
||||
|
||||
var dropped = CommandProgram.FullPaths(folder, ["Titano.old.exe", "Titano.Uploader.exe", "Other.exe"]);
|
||||
Assert.SequenceEqual(["Titano", "Titano Uploader"], SetupRegistry.MoveStartupEntries(run, approval, dropped, programs));
|
||||
var dropped = CommandProgram.FullPaths(folder, ["Chronos.old.exe", "Chronos.Uploader.exe", "Other.exe"]);
|
||||
Assert.SequenceEqual(["Chronos", "Chronos Uploader"], SetupRegistry.MoveStartupEntries(run, approval, dropped, programs));
|
||||
// The new client finds its entry with its option, still turned off; the Uploader no longer starts; other values stay.
|
||||
Assert.Equal($"\"{Path.Combine(folder, "Titano.exe")}\" --minimized", run.GetValue("Titano"));
|
||||
Assert.SequenceEqual(["Other", "Titano"], run.GetValueNames().Order(StringComparer.Ordinal));
|
||||
Assert.SequenceEqual(["Titano"], approval.GetValueNames());
|
||||
Assert.Equal($"\"{Path.Combine(folder, "Chronos.exe")}\" --minimized", run.GetValue("Chronos"));
|
||||
Assert.SequenceEqual(["Chronos", "Other"], run.GetValueNames().Order(StringComparer.Ordinal));
|
||||
Assert.SequenceEqual(["Chronos"], approval.GetValueNames());
|
||||
// An entry that starts another copy is not this upgrade's to move.
|
||||
var other = $"\"{Path.Combine(folder + " 2", "Titano.old.exe")}\" --minimized";
|
||||
run.SetValue("Titano", other);
|
||||
var other = $"\"{Path.Combine(folder + " 2", "Chronos.old.exe")}\" --minimized";
|
||||
run.SetValue("Chronos", other);
|
||||
Assert.Empty(SetupRegistry.MoveStartupEntries(run, approval, dropped, programs));
|
||||
Assert.Equal(other, run.GetValue("Titano"));
|
||||
Assert.Equal(other, run.GetValue("Chronos"));
|
||||
}
|
||||
}
|
||||
finally
|
||||
@@ -235,11 +235,11 @@ public sealed class SetupEngineTests(TestContext context)
|
||||
public void AShortcutTellsWhichProgramItStarts()
|
||||
{
|
||||
var folder = context.CreateTempDirectory("links");
|
||||
var target = Path.Combine(folder, "Product A", "Titano.Uploader.exe");
|
||||
var target = Path.Combine(folder, "Product A", "Chronos.Uploader.exe");
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(target)!);
|
||||
File.WriteAllBytes(target, [0x4D, 0x5A]);
|
||||
var link = Path.Combine(folder, "Titano Uploader.lnk");
|
||||
ShellLink.Create(link, target, "Titano Uploader");
|
||||
var link = Path.Combine(folder, "Chronos Uploader.lnk");
|
||||
ShellLink.Create(link, target, "Chronos Uploader");
|
||||
|
||||
// The shell may store the long form of a short (8.3) temporary path: the same file either way.
|
||||
var stored = Assert.NotNull(ShellLink.TargetOf(link));
|
||||
@@ -263,17 +263,17 @@ public sealed class SetupEngineTests(TestContext context)
|
||||
foreach (var product in (string[])["Product A", "Product B"])
|
||||
{
|
||||
Directory.CreateDirectory(Path.Combine(root, product));
|
||||
File.WriteAllBytes(Path.Combine(root, product, "Titano.Uploader.exe"), [0x4D, 0x5A]);
|
||||
File.WriteAllBytes(Path.Combine(root, product, "Chronos.Uploader.exe"), [0x4D, 0x5A]);
|
||||
}
|
||||
// A uniquely named shortcut in the user's own Start menu, the only folder setup deletes shortcuts from.
|
||||
var link = Path.Combine(SetupPaths.StartMenu(InstallScope.CurrentUser), "Titano Test " + Guid.NewGuid().ToString("N") + ".lnk");
|
||||
var link = Path.Combine(SetupPaths.StartMenu(InstallScope.CurrentUser), "Chronos Test " + Guid.NewGuid().ToString("N") + ".lnk");
|
||||
try
|
||||
{
|
||||
ShellLink.Create(link, Path.Combine(root, "Product A", "Titano.Uploader.exe"), "Titano Test");
|
||||
ShellLink.Create(link, Path.Combine(root, "Product A", "Chronos.Uploader.exe"), "Chronos Test");
|
||||
// The folders as the shell stores them (the long form of a short temporary path).
|
||||
var productA = Path.GetDirectoryName(Assert.NotNull(ShellLink.TargetOf(link)))!;
|
||||
var productB = Path.Combine(Path.GetDirectoryName(productA)!, "Product B");
|
||||
var logB = new InstallLog { Product = "Titano Uploader", Version = "1.0.0", Scope = InstallScope.CurrentUser, Files = ["Titano.Uploader.exe"], Shortcuts = [link] };
|
||||
var logB = new InstallLog { Product = "Chronos Uploader", Version = "1.0.0", Scope = InstallScope.CurrentUser, Files = ["Chronos.Uploader.exe"], Shortcuts = [link] };
|
||||
|
||||
// Product B also has the program and lists the shortcut: uninstalling A points it at B's copy.
|
||||
UninstallEngine.DeleteShortcut(link, InstallScope.CurrentUser, productA, [new OtherInstall(productB, logB)]);
|
||||
@@ -287,8 +287,8 @@ public sealed class SetupEngineTests(TestContext context)
|
||||
Assert.FileMissing(link);
|
||||
|
||||
// A product that does not list the shortcut, or whose folder cannot be read now, takes nothing over.
|
||||
ShellLink.Create(link, Path.Combine(productA, "Titano.Uploader.exe"), "Titano Test");
|
||||
UninstallEngine.DeleteShortcut(link, InstallScope.CurrentUser, productA, [new OtherInstall(productB, new InstallLog { Product = "Titano", Version = "1.0.0", Files = ["Titano.Uploader.exe"] })]);
|
||||
ShellLink.Create(link, Path.Combine(productA, "Chronos.Uploader.exe"), "Chronos Test");
|
||||
UninstallEngine.DeleteShortcut(link, InstallScope.CurrentUser, productA, [new OtherInstall(productB, new InstallLog { Product = "Chronos", Version = "1.0.0", Files = ["Chronos.Uploader.exe"] })]);
|
||||
Assert.FileMissing(link);
|
||||
}
|
||||
finally
|
||||
@@ -302,23 +302,23 @@ public sealed class SetupEngineTests(TestContext context)
|
||||
public void TheServerMakesANewInstallationAnAllUsersOneInsideProgramFiles()
|
||||
{
|
||||
var manifest = Manifest();
|
||||
var plan = InstallPlan.Resolve(manifest, new SetupArguments { Components = ["Titano", "Server"] });
|
||||
var plan = InstallPlan.Resolve(manifest, new SetupArguments { Components = ["Chronos", "Server"] });
|
||||
Assert.Equal(InstallScope.AllUsers, plan.Scope);
|
||||
Assert.Equal(SetupPaths.DefaultDirectory(InstallScope.AllUsers, manifest.Product), plan.Directory);
|
||||
Assert.True(InstallPlan.IsValidDirectory(manifest, plan.Scope, plan.Directory, plan.Components));
|
||||
|
||||
// A folder standard users can change (C:\Titano, D:\Apps\Titano) would let them replace what the service starts.
|
||||
// A folder standard users can change (C:\Chronos, D:\Apps\Chronos) would let them replace what the service starts.
|
||||
var programFiles = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
|
||||
var custom = Path.Combine(Path.GetPathRoot(programFiles)!, "Titano");
|
||||
Assert.False(InstallPlan.IsValidDirectory(manifest, InstallScope.AllUsers, custom, ["Titano", "Server"]));
|
||||
Assert.True(InstallPlan.IsValidDirectory(manifest, InstallScope.AllUsers, custom, ["Titano"]));
|
||||
Assert.True(InstallPlan.IsValidDirectory(manifest, InstallScope.CurrentUser, custom, ["Titano"]));
|
||||
Assert.False(InstallPlan.IsValidDirectory(manifest, InstallScope.CurrentUser, Path.Combine(programFiles, "Titano"), ["Server"]));
|
||||
Assert.True(InstallPlan.IsValidDirectory(manifest, InstallScope.AllUsers, Path.Combine(programFiles, "Vendor", "Titano"), ["Server"]));
|
||||
var custom = Path.Combine(Path.GetPathRoot(programFiles)!, "Chronos");
|
||||
Assert.False(InstallPlan.IsValidDirectory(manifest, InstallScope.AllUsers, custom, ["Chronos", "Server"]));
|
||||
Assert.True(InstallPlan.IsValidDirectory(manifest, InstallScope.AllUsers, custom, ["Chronos"]));
|
||||
Assert.True(InstallPlan.IsValidDirectory(manifest, InstallScope.CurrentUser, custom, ["Chronos"]));
|
||||
Assert.False(InstallPlan.IsValidDirectory(manifest, InstallScope.CurrentUser, Path.Combine(programFiles, "Chronos"), ["Server"]));
|
||||
Assert.True(InstallPlan.IsValidDirectory(manifest, InstallScope.AllUsers, Path.Combine(programFiles, "Vendor", "Chronos"), ["Server"]));
|
||||
Assert.False(SetupPaths.IsInsideProgramFiles(programFiles), "Program Files itself is shared by every program");
|
||||
Assert.False(SetupPaths.IsInsideProgramFiles(programFiles + " Extra" + Path.DirectorySeparatorChar + "Titano"));
|
||||
Assert.False(SetupPaths.IsInsideProgramFiles(programFiles + " Extra" + Path.DirectorySeparatorChar + "Chronos"));
|
||||
|
||||
var desktop = InstallPlan.Resolve(manifest, new SetupArguments { Components = ["Titano"] });
|
||||
var desktop = InstallPlan.Resolve(manifest, new SetupArguments { Components = ["Chronos"] });
|
||||
Assert.Equal(InstallScope.CurrentUser, desktop.Scope);
|
||||
Assert.True(desktop.CanInstall(manifest.FindComponent("Server")!));
|
||||
|
||||
@@ -326,21 +326,21 @@ public sealed class SetupEngineTests(TestContext context)
|
||||
// all-users one in a folder outside Program Files.
|
||||
var perUser = desktop with { Existing = new ExistingInstall(InstallScope.CurrentUser, desktop.Directory, "0.9.0") };
|
||||
Assert.False(perUser.CanInstall(manifest.FindComponent("Server")!));
|
||||
Assert.True(perUser.CanInstall(manifest.FindComponent("Titano")!));
|
||||
Assert.True(perUser.CanInstall(manifest.FindComponent("Chronos")!));
|
||||
var elsewhere = desktop with { Existing = new ExistingInstall(InstallScope.AllUsers, custom, "0.9.0") };
|
||||
Assert.False(elsewhere.CanInstall(manifest.FindComponent("Server")!));
|
||||
var protectedFolder = desktop with { Existing = new ExistingInstall(InstallScope.AllUsers, Path.Combine(programFiles, "Titano"), "0.9.0") };
|
||||
var protectedFolder = desktop with { Existing = new ExistingInstall(InstallScope.AllUsers, Path.Combine(programFiles, "Chronos"), "0.9.0") };
|
||||
Assert.True(protectedFolder.CanInstall(manifest.FindComponent("Server")!));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TheProjectFileTypeIsNamedInSetupsLanguage()
|
||||
{
|
||||
var association = new PayloadAssociation { Component = "Titano", Extension = ".titano", ProgId = "Titano.Project", Description = "Titano project", Target = "Titano.exe" };
|
||||
Assert.Equal("Titano project", InstallEngine.FileTypeName(association, CultureInfo.GetCultureInfo("en")));
|
||||
Assert.Equal("Progetto Titano", InstallEngine.FileTypeName(association, CultureInfo.GetCultureInfo("it")));
|
||||
var association = new PayloadAssociation { Component = "Chronos", Extension = ".chronos", ProgId = "Chronos.Project", Description = "Chronos project", Target = "Chronos.exe" };
|
||||
Assert.Equal("Chronos project", InstallEngine.FileTypeName(association, CultureInfo.GetCultureInfo("en")));
|
||||
Assert.Equal("Progetto Chronos", InstallEngine.FileTypeName(association, CultureInfo.GetCultureInfo("it")));
|
||||
|
||||
var unknown = new PayloadAssociation { Component = "Titano", Extension = ".tlx", ProgId = "Titano.Unknown", Description = "Something else", Target = "Titano.exe" };
|
||||
var unknown = new PayloadAssociation { Component = "Chronos", Extension = ".tlx", ProgId = "Chronos.Unknown", Description = "Something else", Target = "Chronos.exe" };
|
||||
Assert.Equal("Something else", InstallEngine.FileTypeName(unknown, CultureInfo.GetCultureInfo("it")));
|
||||
}
|
||||
|
||||
@@ -356,12 +356,12 @@ public sealed class SetupEngineTests(TestContext context)
|
||||
/// <summary>A manifest under a product name no machine has installed, so the registry holds no installation of it.</summary>
|
||||
private static PayloadManifest Manifest() => new()
|
||||
{
|
||||
Product = "TitanoTest" + Guid.NewGuid().ToString("N")[..12],
|
||||
Product = "ChronosTest" + Guid.NewGuid().ToString("N")[..12],
|
||||
Version = "1.0.0",
|
||||
Components =
|
||||
[
|
||||
new PayloadComponent { Id = "Titano", DisplayName = "Titano", DefaultSelected = true },
|
||||
new PayloadComponent { Id = "Server", DisplayName = "Titano Server", AllUsersOnly = true },
|
||||
new PayloadComponent { Id = "Chronos", DisplayName = "Chronos", DefaultSelected = true },
|
||||
new PayloadComponent { Id = "Server", DisplayName = "Chronos Server", AllUsersOnly = true },
|
||||
],
|
||||
};
|
||||
}
|
||||
+25
-25
@@ -1,12 +1,12 @@
|
||||
using System.IO;
|
||||
using Titano.Setup.Engine;
|
||||
using Titano.Testing;
|
||||
using Chronos.Setup.Engine;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Setup;
|
||||
namespace Chronos.App.Tests.Setup;
|
||||
|
||||
/// <summary>
|
||||
/// "Remove my data" covers only the programs being removed (SRS-05): the desktop app and the Uploader share
|
||||
/// %LOCALAPPDATA%\Titano and its logs folder, and uninstalling one product never deletes what another still uses.
|
||||
/// %LOCALAPPDATA%\Chronos and its logs folder, and uninstalling one product never deletes what another still uses.
|
||||
/// </summary>
|
||||
public sealed class UserDataPlanTests(TestContext context)
|
||||
{
|
||||
@@ -14,10 +14,10 @@ public sealed class UserDataPlanTests(TestContext context)
|
||||
public void TheDesktopAppsPlanLeavesTheUploadersFiles()
|
||||
{
|
||||
var folder = SampleFolder();
|
||||
var plan = UserDataPlan.Measure(folder, Owners(UserDataOwners.Titano));
|
||||
var plan = UserDataPlan.Measure(folder, Owners(UserDataOwners.Chronos));
|
||||
|
||||
Assert.SequenceEqual(
|
||||
["backups", "cache", "logs" + Path.DirectorySeparatorChar + "titano-20261012.log", "settings.json", "titano.db"],
|
||||
["backups", "cache", "chronos.db", "logs" + Path.DirectorySeparatorChar + "chronos-20261012.log", "settings.json"],
|
||||
plan.Entries.Select(e => e.Name).Order(StringComparer.Ordinal));
|
||||
Assert.Equal(4000L + 3000 + 300 + 20 + 100, plan.TotalBytes);
|
||||
|
||||
@@ -39,13 +39,13 @@ public sealed class UserDataPlanTests(TestContext context)
|
||||
plan.Entries.Select(e => e.Name).Order(StringComparer.Ordinal));
|
||||
|
||||
plan.Remove();
|
||||
Assert.True(File.Exists(Path.Combine(folder, "titano.db")));
|
||||
Assert.True(File.Exists(Path.Combine(folder, "logs", "titano-20261012.log")));
|
||||
Assert.True(File.Exists(Path.Combine(folder, "chronos.db")));
|
||||
Assert.True(File.Exists(Path.Combine(folder, "logs", "chronos-20261012.log")));
|
||||
Assert.FileMissing(Path.Combine(folder, "uploader.json"));
|
||||
Assert.FileMissing(Path.Combine(folder, "logs", "uploader-20261012.log"));
|
||||
|
||||
// Once the desktop app's data goes too, nothing is left of the folder.
|
||||
UserDataPlan.Measure(folder, Owners(UserDataOwners.Titano)).Remove();
|
||||
UserDataPlan.Measure(folder, Owners(UserDataOwners.Chronos)).Remove();
|
||||
Assert.False(Directory.Exists(folder));
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public sealed class UserDataPlanTests(TestContext context)
|
||||
var folder = SampleFolder();
|
||||
var whole = UserDataPlan.Measure(folder, UserDataOwners.All);
|
||||
Assert.SequenceEqual(
|
||||
["backups", "cache", "logs", "settings.json", "titano.db", "uploader-queue.json", "uploader.json"],
|
||||
["backups", "cache", "chronos.db", "logs", "settings.json", "uploader-queue.json", "uploader.json"],
|
||||
whole.Entries.Select(e => e.Name).Order(StringComparer.Ordinal));
|
||||
Assert.Empty(UserDataPlan.Measure(folder, Owners()).Entries);
|
||||
|
||||
@@ -66,39 +66,39 @@ public sealed class UserDataPlanTests(TestContext context)
|
||||
[Test]
|
||||
public void AProductRemovesTheDataOfItsProgramsThatNoOtherInstalledProductHas()
|
||||
{
|
||||
string[] titano = ["Titano", "Uploader", "Server"];
|
||||
string[] chronos = ["Chronos", "Uploader", "Server"];
|
||||
string[] uploader = ["Uploader"];
|
||||
|
||||
Assert.SequenceEqual(["Titano", "Uploader"], UserDataOwners.Removable(titano, []).Order(StringComparer.Ordinal));
|
||||
Assert.SequenceEqual(["Titano"], UserDataOwners.Removable(titano, [uploader]).Order(StringComparer.Ordinal));
|
||||
Assert.Empty(UserDataOwners.Removable(uploader, [titano]));
|
||||
Assert.SequenceEqual(["Uploader"], UserDataOwners.Removable(uploader, [["titano"]]));
|
||||
// Titano Server keeps its data elsewhere: a Server-only product removes nothing here.
|
||||
Assert.SequenceEqual(["Chronos", "Uploader"], UserDataOwners.Removable(chronos, []).Order(StringComparer.Ordinal));
|
||||
Assert.SequenceEqual(["Chronos"], UserDataOwners.Removable(chronos, [uploader]).Order(StringComparer.Ordinal));
|
||||
Assert.Empty(UserDataOwners.Removable(uploader, [chronos]));
|
||||
Assert.SequenceEqual(["Uploader"], UserDataOwners.Removable(uploader, [["chronos"]]));
|
||||
// Chronos Server keeps its data elsewhere: a Server-only product removes nothing here.
|
||||
Assert.Empty(UserDataOwners.Removable(["Server"], []));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AnInstallationThatCannotBeReadNowKeepsEveryProgramsData()
|
||||
{
|
||||
string[] titano = ["Titano", "Uploader", "Server"];
|
||||
var uploader = new InstallLog { Product = "Titano Uploader", Version = "1.0.0", Components = ["Uploader"] };
|
||||
string[] chronos = ["Chronos", "Uploader", "Server"];
|
||||
var uploader = new InstallLog { Product = "Chronos Uploader", Version = "1.0.0", Components = ["Uploader"] };
|
||||
|
||||
Assert.SequenceEqual(["Titano"], UserDataOwners.RemovableBeside(titano, [new OtherInstall(@"D:\Titano Uploader", uploader)]).Order(StringComparer.Ordinal));
|
||||
Assert.SequenceEqual(["Chronos"], UserDataOwners.RemovableBeside(chronos, [new OtherInstall(@"D:\Chronos Uploader", uploader)]).Order(StringComparer.Ordinal));
|
||||
// Its drive is offline, its folder is gone or its log is damaged: it may still use the desktop app's index.
|
||||
Assert.Empty(UserDataOwners.RemovableBeside(titano, [new OtherInstall(@"E:\Titano Uploader", null)]));
|
||||
Assert.Empty(UserDataOwners.RemovableBeside(titano, [new OtherInstall(null, null)]));
|
||||
Assert.Empty(UserDataOwners.RemovableBeside(chronos, [new OtherInstall(@"E:\Chronos Uploader", null)]));
|
||||
Assert.Empty(UserDataOwners.RemovableBeside(chronos, [new OtherInstall(null, null)]));
|
||||
}
|
||||
|
||||
private static HashSet<string> Owners(params string[] owners) => new(owners, StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
private string SampleFolder()
|
||||
{
|
||||
var folder = Path.Combine(context.CreateTempDirectory("userdata"), "Titano");
|
||||
Write(folder, "titano.db", 4000);
|
||||
var folder = Path.Combine(context.CreateTempDirectory("userdata"), "Chronos");
|
||||
Write(folder, "chronos.db", 4000);
|
||||
Write(folder, "settings.json", 20);
|
||||
Write(folder, Path.Combine("cache", "proxies", "a.jpg"), 3000);
|
||||
Write(folder, Path.Combine("backups", "titano-1.db"), 100);
|
||||
Write(folder, Path.Combine("logs", "titano-20261012.log"), 300);
|
||||
Write(folder, Path.Combine("backups", "chronos-1.db"), 100);
|
||||
Write(folder, Path.Combine("logs", "chronos-20261012.log"), 300);
|
||||
Write(folder, Path.Combine("logs", "uploader-20261012.log"), 200);
|
||||
Write(folder, "uploader.json", 10);
|
||||
Write(folder, "uploader-queue.json", 50);
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
using System.IO;
|
||||
using Titano.Testing;
|
||||
using Titano.Uploader.Infrastructure;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Uploader.Infrastructure;
|
||||
|
||||
namespace Titano.App.Tests.Uploader;
|
||||
namespace Chronos.App.Tests.Uploader;
|
||||
|
||||
public sealed class CoalescingWriterTests(TestContext context)
|
||||
{
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
using Titano.Testing;
|
||||
using Titano.Uploader.Infrastructure;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Uploader.Infrastructure;
|
||||
|
||||
namespace Titano.App.Tests.Uploader;
|
||||
namespace Chronos.App.Tests.Uploader;
|
||||
|
||||
public sealed class CommandLineTests
|
||||
{
|
||||
+10
-10
@@ -1,12 +1,12 @@
|
||||
using System.ComponentModel;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Protocol;
|
||||
using Titano.Testing;
|
||||
using Titano.Uploader.Server;
|
||||
using Titano.Uploader.Shell;
|
||||
using Titano.Uploader.Uploads;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Protocol;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Uploader.Server;
|
||||
using Chronos.Uploader.Shell;
|
||||
using Chronos.Uploader.Uploads;
|
||||
|
||||
namespace Titano.App.Tests.Uploader;
|
||||
namespace Chronos.App.Tests.Uploader;
|
||||
|
||||
/// <summary>
|
||||
/// The sign-in form puts each failure where DESIGN §4 wants it: a refused address or password marks that field
|
||||
@@ -53,13 +53,13 @@ public sealed class ConnectViewModelTests
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AServerThatIsNotTitanoMarksTheServerField()
|
||||
public void AServerThatIsNotChronosMarksTheServerField()
|
||||
{
|
||||
var form = Form(new FakeSession(SignInResult.NotTitano));
|
||||
var form = Form(new FakeSession(SignInResult.NotChronos));
|
||||
|
||||
form.SignInCommand.Execute(null);
|
||||
|
||||
Assert.Equal(Loc.L("Uploader.Connect.Error.NotTitano"), form.AddressError);
|
||||
Assert.Equal(Loc.L("Uploader.Connect.Error.NotChronos"), form.AddressError);
|
||||
Assert.Null(form.ErrorText);
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,9 +1,9 @@
|
||||
using System.IO;
|
||||
using Titano.Testing;
|
||||
using Titano.Uploader.Sources;
|
||||
using Titano.Uploader.Watching;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Uploader.Sources;
|
||||
using Chronos.Uploader.Watching;
|
||||
|
||||
namespace Titano.App.Tests.Uploader;
|
||||
namespace Chronos.App.Tests.Uploader;
|
||||
|
||||
public sealed class ProcessedFileMemoryTests(TestContext context)
|
||||
{
|
||||
+4
-4
@@ -1,14 +1,14 @@
|
||||
using Titano.Testing;
|
||||
using Titano.Uploader.Server;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Uploader.Server;
|
||||
|
||||
namespace Titano.App.Tests.Uploader;
|
||||
namespace Chronos.App.Tests.Uploader;
|
||||
|
||||
public sealed class ServerAddressTests
|
||||
{
|
||||
[Theory]
|
||||
[Case("nas.local:8443", "https://nas.local:8443/")]
|
||||
[Case("https://nas.local:8443", "https://nas.local:8443/")]
|
||||
[Case(" http://192.168.1.20:8080/titano ", "http://192.168.1.20:8080/titano/")]
|
||||
[Case(" http://192.168.1.20:8080/chronos ", "http://192.168.1.20:8080/chronos/")]
|
||||
[Case("https://nas.local/?x=1#y", "https://nas.local/")]
|
||||
public void ServerAddressesBecomeApiBases(string typed, string expected)
|
||||
{
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
using System.IO;
|
||||
using Titano.Testing;
|
||||
using Titano.Uploader.Sources;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Uploader.Sources;
|
||||
|
||||
namespace Titano.App.Tests.Uploader;
|
||||
namespace Chronos.App.Tests.Uploader;
|
||||
|
||||
public sealed class SessionGrouperTests
|
||||
{
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
namespace Titano.App.Tests.Uploader;
|
||||
namespace Chronos.App.Tests.Uploader;
|
||||
|
||||
/// <summary>Runs async test code on one thread, as the UI dispatcher does for the upload engine.</summary>
|
||||
internal sealed class SingleThreadedContext : SynchronizationContext
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
using Titano.Testing;
|
||||
using Titano.Uploader.Watching;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Uploader.Watching;
|
||||
|
||||
namespace Titano.App.Tests.Uploader;
|
||||
namespace Chronos.App.Tests.Uploader;
|
||||
|
||||
public sealed class StableFileTrackerTests
|
||||
{
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
using Titano.Testing;
|
||||
using Titano.Uploader.Infrastructure;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Uploader.Infrastructure;
|
||||
|
||||
namespace Titano.App.Tests.Uploader;
|
||||
namespace Chronos.App.Tests.Uploader;
|
||||
|
||||
public sealed class TokenProtectorTests
|
||||
{
|
||||
+6
-6
@@ -2,12 +2,12 @@ using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Security.Cryptography;
|
||||
using Titano.Protocol;
|
||||
using Titano.Protocol.Client;
|
||||
using Titano.Testing;
|
||||
using Titano.Uploader.Uploads;
|
||||
using Chronos.Protocol;
|
||||
using Chronos.Protocol.Client;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Uploader.Uploads;
|
||||
|
||||
namespace Titano.App.Tests.Uploader;
|
||||
namespace Chronos.App.Tests.Uploader;
|
||||
|
||||
public sealed class UploadEngineTests(TestContext context)
|
||||
{
|
||||
@@ -68,7 +68,7 @@ public sealed class UploadEngineTests(TestContext context)
|
||||
var transport = new FakeTransport
|
||||
{
|
||||
Respond = _ => ++attempts == 1
|
||||
? throw new TitanoApiException(HttpStatusCode.UnprocessableEntity, new ApiError("hash_mismatch", "Hash mismatch"))
|
||||
? throw new ChronosApiException(HttpStatusCode.UnprocessableEntity, new ApiError("hash_mismatch", "Hash mismatch"))
|
||||
: (UploadOutcome.Verified, Guid.CreateVersion7()),
|
||||
};
|
||||
using var engine = new UploadEngine(queue, transport, () => false, _time);
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
using System.IO;
|
||||
using Titano.Testing;
|
||||
using Titano.Uploader.Uploads;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Uploader.Uploads;
|
||||
|
||||
namespace Titano.App.Tests.Uploader;
|
||||
namespace Chronos.App.Tests.Uploader;
|
||||
|
||||
public sealed class UploadQueueTests(TestContext context)
|
||||
{
|
||||
+11
-11
@@ -5,17 +5,17 @@ using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
using Titano.App.Infrastructure;
|
||||
using Titano.App.Tests.Windows;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Testing;
|
||||
using Titano.Ui.Controls;
|
||||
using Titano.Ui.Theming;
|
||||
using Titano.Uploader.DesignTime;
|
||||
using Titano.Uploader.Shell;
|
||||
using Titano.Uploader.Uploads;
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.App.Tests.Windows;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Ui.Controls;
|
||||
using Chronos.Ui.Theming;
|
||||
using Chronos.Uploader.DesignTime;
|
||||
using Chronos.Uploader.Shell;
|
||||
using Chronos.Uploader.Uploads;
|
||||
|
||||
namespace Titano.App.Tests.Uploader;
|
||||
namespace Chronos.App.Tests.Uploader;
|
||||
|
||||
/// <summary>
|
||||
/// The uploader window on the <c>--capture</c> sample data, shown off screen: icon-only buttons and queue rows are
|
||||
@@ -146,7 +146,7 @@ public sealed class UploaderScreenSmokeTests
|
||||
});
|
||||
|
||||
/// <summary>A sign-in entry another program (Task Manager) can turn off.</summary>
|
||||
private sealed class SignInEntry : Titano.Uploader.Infrastructure.IStartupRegistration
|
||||
private sealed class SignInEntry : Chronos.Uploader.Infrastructure.IStartupRegistration
|
||||
{
|
||||
public bool IsEnabled { get; set; }
|
||||
|
||||
+4
-4
@@ -1,9 +1,9 @@
|
||||
using System.Globalization;
|
||||
using Titano.Testing;
|
||||
using Titano.Uploader.Text;
|
||||
using Titano.Uploader.Uploads;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Uploader.Text;
|
||||
using Chronos.Uploader.Uploads;
|
||||
|
||||
namespace Titano.App.Tests.Uploader;
|
||||
namespace Chronos.App.Tests.Uploader;
|
||||
|
||||
public sealed class UploaderTextTests
|
||||
{
|
||||
+5
-5
@@ -1,9 +1,9 @@
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Testing;
|
||||
using Titano.Uploader.Shell;
|
||||
using Titano.Uploader.Text;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Uploader.Shell;
|
||||
using Chronos.Uploader.Text;
|
||||
|
||||
namespace Titano.App.Tests.Uploader;
|
||||
namespace Chronos.App.Tests.Uploader;
|
||||
|
||||
/// <summary>A watch-folder chip shows the path (which it may shorten) and the interval apart; the tooltip carries the whole path.</summary>
|
||||
public sealed class WatchFolderViewModelTests
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
using Titano.Testing;
|
||||
using Titano.Ui.Visuals;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Ui.Visuals;
|
||||
|
||||
namespace Titano.App.Tests.Visuals;
|
||||
namespace Chronos.App.Tests.Visuals;
|
||||
|
||||
public sealed class CurveMathTests
|
||||
{
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
using Titano.Testing;
|
||||
using Titano.Ui.Visuals;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Ui.Visuals;
|
||||
|
||||
namespace Titano.App.Tests.Visuals;
|
||||
namespace Chronos.App.Tests.Visuals;
|
||||
|
||||
public sealed class LruCacheTests
|
||||
{
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
using Titano.Testing;
|
||||
using Titano.Ui.Visuals;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Ui.Visuals;
|
||||
|
||||
namespace Titano.App.Tests.Visuals;
|
||||
namespace Chronos.App.Tests.Visuals;
|
||||
|
||||
public sealed class MinMaxDecimatorTests
|
||||
{
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
using Titano.Testing;
|
||||
using Titano.Ui.Visuals;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Ui.Visuals;
|
||||
|
||||
namespace Titano.App.Tests.Visuals;
|
||||
namespace Chronos.App.Tests.Visuals;
|
||||
|
||||
public sealed class NiceScaleTests
|
||||
{
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
using Titano.Testing;
|
||||
using Titano.Ui.Visuals;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Ui.Visuals;
|
||||
|
||||
namespace Titano.App.Tests.Visuals;
|
||||
namespace Chronos.App.Tests.Visuals;
|
||||
|
||||
public sealed class PixelGridTests
|
||||
{
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
using Titano.Testing;
|
||||
using Titano.Ui.Visuals;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Ui.Visuals;
|
||||
|
||||
namespace Titano.App.Tests.Visuals;
|
||||
namespace Chronos.App.Tests.Visuals;
|
||||
|
||||
public sealed class StripLayoutTests
|
||||
{
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
using Titano.Testing;
|
||||
using Titano.Ui.Visuals;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Ui.Visuals;
|
||||
|
||||
namespace Titano.App.Tests.Visuals;
|
||||
namespace Chronos.App.Tests.Visuals;
|
||||
|
||||
public sealed class ViewportMathTests
|
||||
{
|
||||
+6
-6
@@ -8,13 +8,13 @@ using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Threading;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Testing;
|
||||
using Titano.Ui.Controls;
|
||||
using Titano.Ui.Theming;
|
||||
using Titano.Ui.Visuals;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Ui.Controls;
|
||||
using Chronos.Ui.Theming;
|
||||
using Chronos.Ui.Visuals;
|
||||
|
||||
namespace Titano.App.Tests.Visuals;
|
||||
namespace Chronos.App.Tests.Visuals;
|
||||
|
||||
/// <summary>
|
||||
/// Loads the real theme (Controls.xaml + Visuals.xaml) on an STA dispatcher and measures, arranges and renders
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
using Titano.Testing;
|
||||
using Titano.Ui.Visuals;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Ui.Visuals;
|
||||
|
||||
namespace Titano.App.Tests.Visuals;
|
||||
namespace Chronos.App.Tests.Visuals;
|
||||
|
||||
public sealed class WrapLayoutTests
|
||||
{
|
||||
+8
-8
@@ -1,11 +1,11 @@
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using Titano.App.Infrastructure;
|
||||
using Titano.App.Settings;
|
||||
using Titano.Core.Video;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.App.Settings;
|
||||
using Chronos.Core.Video;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Windows;
|
||||
namespace Chronos.App.Tests.Windows;
|
||||
|
||||
/// <summary>The desktop diagnostics bundle: every entry present, the saved server token and passwords never inside.</summary>
|
||||
[WindowsOnly]
|
||||
@@ -21,7 +21,7 @@ public sealed class DiagnosticsBundleTests(TestContext context)
|
||||
{
|
||||
var settings = new AppSettings { Language = "en", ServerUrl = "https://nas.local:8443", ServerUsername = "alice", ProtectedToken = Token };
|
||||
var services = new AppServices(environment, settings, () => { }, new NoDialogs()) { Encoders = new OneEncoder() };
|
||||
await File.WriteAllTextAsync(Path.Combine(environment.LogDirectory, "titano-20261002.log"), $"signed in with password={Token}\n");
|
||||
await File.WriteAllTextAsync(Path.Combine(environment.LogDirectory, "chronos-20261002.log"), $"signed in with password={Token}\n");
|
||||
|
||||
var path = await DiagnosticsBundle.CreateAsync(services, context.CreateTempDirectory(), ["Self-test H.264 Test: passed"]);
|
||||
|
||||
@@ -31,7 +31,7 @@ public sealed class DiagnosticsBundleTests(TestContext context)
|
||||
using var reader = new StreamReader(e.Open());
|
||||
return reader.ReadToEnd();
|
||||
});
|
||||
Assert.SequenceEqual(new[] { "codecs.txt", "environment.txt", "jobs-failed.json", "logs/titano-20261002.log", "settings.json" },
|
||||
Assert.SequenceEqual(new[] { "codecs.txt", "environment.txt", "jobs-failed.json", "logs/chronos-20261002.log", "settings.json" },
|
||||
texts.Keys.Order(StringComparer.Ordinal));
|
||||
foreach (var (name, text) in texts) Assert.False(text.Contains(Token, StringComparison.Ordinal), $"{name} leaks the token");
|
||||
Assert.Contains("Self-test H.264 Test: passed", texts["environment.txt"]);
|
||||
@@ -52,7 +52,7 @@ public sealed class DiagnosticsBundleTests(TestContext context)
|
||||
try
|
||||
{
|
||||
var services = new AppServices(environment, new AppSettings { Language = "en" }, () => { }, new NoDialogs()) { Encoders = new OneEncoder() };
|
||||
await File.WriteAllTextAsync(Path.Combine(environment.LogDirectory, "titano-20261002.log"), "started\n");
|
||||
await File.WriteAllTextAsync(Path.Combine(environment.LogDirectory, "chronos-20261002.log"), "started\n");
|
||||
var folder = context.CreateTempDirectory();
|
||||
|
||||
var first = await DiagnosticsBundle.CreateAsync(services, folder);
|
||||
+14
-14
@@ -6,21 +6,21 @@ using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
using Titano.App.Archiving;
|
||||
using Titano.App.Editor;
|
||||
using Titano.App.Infrastructure;
|
||||
using Titano.App.Library;
|
||||
using Titano.App.Sections;
|
||||
using Titano.App.Shell;
|
||||
using Titano.App.Tests.Editor;
|
||||
using Titano.Core.Export;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Data.Archiving;
|
||||
using Titano.Testing;
|
||||
using Titano.Ui.Controls;
|
||||
using Titano.Ui.Mvvm;
|
||||
using Chronos.App.Archiving;
|
||||
using Chronos.App.Editor;
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.App.Library;
|
||||
using Chronos.App.Sections;
|
||||
using Chronos.App.Shell;
|
||||
using Chronos.App.Tests.Editor;
|
||||
using Chronos.Core.Export;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Data.Archiving;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Ui.Controls;
|
||||
using Chronos.Ui.Mvvm;
|
||||
|
||||
namespace Titano.App.Tests.Windows;
|
||||
namespace Chronos.App.Tests.Windows;
|
||||
|
||||
/// <summary>
|
||||
/// The Edit section's picker (owner review 1, R7) on the capture sample: one list of this PC's and the server's
|
||||
+14
-14
@@ -9,20 +9,20 @@ using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Threading;
|
||||
using Titano.App.DesignTime;
|
||||
using Titano.App.Infrastructure;
|
||||
using Titano.App.Sections;
|
||||
using Titano.App.Server;
|
||||
using Titano.App.Settings;
|
||||
using Titano.App.Shell;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Testing;
|
||||
using Titano.Ui.Controls;
|
||||
using Titano.Ui.Mvvm;
|
||||
using Titano.Ui.Theming;
|
||||
using Titano.Ui.Visuals;
|
||||
using Chronos.App.DesignTime;
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.App.Sections;
|
||||
using Chronos.App.Server;
|
||||
using Chronos.App.Settings;
|
||||
using Chronos.App.Shell;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Ui.Controls;
|
||||
using Chronos.Ui.Mvvm;
|
||||
using Chronos.Ui.Theming;
|
||||
using Chronos.Ui.Visuals;
|
||||
|
||||
namespace Titano.App.Tests.Windows;
|
||||
namespace Chronos.App.Tests.Windows;
|
||||
|
||||
/// <summary>
|
||||
/// Shows the real main window off screen (section templates, client styles) on the sample data used by
|
||||
@@ -464,7 +464,7 @@ internal static class ScreenHost
|
||||
dispatcher.Invoke(() =>
|
||||
{
|
||||
// pack:// URIs parse only once an Application exists (it registers the scheme), so this one is built here.
|
||||
var sectionTemplates = new Uri("pack://application:,,,/Titano;component/Shell/SectionTemplates.xaml", UriKind.Absolute);
|
||||
var sectionTemplates = new Uri("pack://application:,,,/Chronos;component/Shell/SectionTemplates.xaml", UriKind.Absolute);
|
||||
var current = Application.Current;
|
||||
AppResources.Merge(current);
|
||||
if (!current.Resources.MergedDictionaries.Any(d => d.Source == sectionTemplates))
|
||||
+6
-6
@@ -1,10 +1,10 @@
|
||||
using Titano.App.DesignTime;
|
||||
using Titano.App.Infrastructure;
|
||||
using Titano.App.Shell;
|
||||
using Titano.Testing;
|
||||
using Titano.Ui.Theming;
|
||||
using Chronos.App.DesignTime;
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.App.Shell;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Ui.Theming;
|
||||
|
||||
namespace Titano.App.Tests.Windows;
|
||||
namespace Chronos.App.Tests.Windows;
|
||||
|
||||
/// <summary>What the shell stops when the app exits (App.OnExit disposes it before the services).</summary>
|
||||
[WindowsOnly]
|
||||
+19
-19
@@ -7,23 +7,23 @@ using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Shell;
|
||||
using System.Windows.Threading;
|
||||
using Titano.App.Editor;
|
||||
using Titano.App.Infrastructure;
|
||||
using Titano.App.Library;
|
||||
using Titano.App.Sections;
|
||||
using Titano.App.Settings;
|
||||
using Titano.App.Shell;
|
||||
using Titano.App.Tests.Editor;
|
||||
using Titano.Core.Export;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Data.Repositories;
|
||||
using Titano.Testing;
|
||||
using Titano.Ui.Controls;
|
||||
using Titano.Ui.Mvvm;
|
||||
using Titano.Ui.Visuals;
|
||||
using Chronos.App.Editor;
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.App.Library;
|
||||
using Chronos.App.Sections;
|
||||
using Chronos.App.Settings;
|
||||
using Chronos.App.Shell;
|
||||
using Chronos.App.Tests.Editor;
|
||||
using Chronos.Core.Export;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Data.Repositories;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Ui.Controls;
|
||||
using Chronos.Ui.Mvvm;
|
||||
using Chronos.Ui.Visuals;
|
||||
|
||||
namespace Titano.App.Tests.Windows;
|
||||
namespace Chronos.App.Tests.Windows;
|
||||
|
||||
/// <summary>
|
||||
/// The shell's ways of telling what happens outside the screen in front: the taskbar button (UI-05), Windows
|
||||
@@ -271,8 +271,8 @@ public sealed class ShellNotificationTests
|
||||
var auto = new Toast { Title = "EOS R5 card A inserted", Message = "Importing into the archive", ActionText = "Cancel" };
|
||||
Assert.Equal("Importing into the archive", OsNotifications.BalloonText(auto));
|
||||
|
||||
Assert.True(MainWindow.StartsMinimized(["Titano.exe", "--minimized"]));
|
||||
Assert.False(MainWindow.StartsMinimized(["Titano.exe"]));
|
||||
Assert.True(MainWindow.StartsMinimized(["Chronos.exe", "--minimized"]));
|
||||
Assert.False(MainWindow.StartsMinimized(["Chronos.exe"]));
|
||||
|
||||
await using var app = await ScreenSmokeTests.SampleApp.StartAsync();
|
||||
app.Shell.CompleteWelcome();
|
||||
@@ -420,7 +420,7 @@ public sealed class ShellNotificationTests
|
||||
Assert.NotNull(await shell.Services.Sync.RefreshAsync());
|
||||
await shell.Server.Sync.ReloadAsync();
|
||||
// The sample server holds one sequence whose settings changed on both sides.
|
||||
Assert.Equal(1, shell.Server.Sync.Chips.Single(c => c.Filter == Titano.App.Server.SyncFilter.Conflicts).Count);
|
||||
Assert.Equal(1, shell.Server.Sync.Chips.Single(c => c.Filter == Chronos.App.Server.SyncFilter.Conflicts).Count);
|
||||
Assert.Equal(1, shell.Server.Badge);
|
||||
});
|
||||
|
||||
+5
-5
@@ -1,12 +1,12 @@
|
||||
using System.IO;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Titano.App.Library;
|
||||
using Titano.Core.Imaging;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Testing;
|
||||
using Chronos.App.Library;
|
||||
using Chronos.Core.Imaging;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.App.Tests.Windows;
|
||||
namespace Chronos.App.Tests.Windows;
|
||||
|
||||
/// <summary>WIC decoding of thumbnails: embedded previews read by offset, decode-time scaling and Exif orientation.</summary>
|
||||
[WindowsOnly]
|
||||
+3
-3
@@ -1,12 +1,12 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
using Titano.Ui.Theming;
|
||||
using Chronos.Ui.Theming;
|
||||
|
||||
namespace Titano.App.Tests.Windows;
|
||||
namespace Chronos.App.Tests.Windows;
|
||||
|
||||
/// <summary>
|
||||
/// The process-wide WPF <see cref="Application"/> (only one may ever exist per process) on its own STA thread with
|
||||
/// the Titano theme. Every WPF test reaches it through here, whichever test happens to run first.
|
||||
/// the Chronos theme. Every WPF test reaches it through here, whichever test happens to run first.
|
||||
/// </summary>
|
||||
internal static class WpfApplication
|
||||
{
|
||||
+11
-11
@@ -3,16 +3,16 @@ using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Text.RegularExpressions;
|
||||
using Titano.Core.Advice;
|
||||
using Titano.Core.Analysis;
|
||||
using Titano.Core.Analysis.Deep;
|
||||
using Titano.Core.Diagnostics.Synthetic;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Core.Project;
|
||||
using Titano.Core.Tests.Analysis.Deep;
|
||||
using Titano.Testing;
|
||||
using Chronos.Core.Advice;
|
||||
using Chronos.Core.Analysis;
|
||||
using Chronos.Core.Analysis.Deep;
|
||||
using Chronos.Core.Diagnostics.Synthetic;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Core.Project;
|
||||
using Chronos.Core.Tests.Analysis.Deep;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.Core.Tests.Advice;
|
||||
namespace Chronos.Core.Tests.Advice;
|
||||
|
||||
|
||||
public sealed partial class AdvisorLocalizationTests(TestContext context)
|
||||
@@ -24,10 +24,10 @@ public sealed partial class AdvisorLocalizationTests(TestContext context)
|
||||
[Test]
|
||||
public void EveryAdvisorKeyHasEnglishAndItalianTextWithTheSamePlaceholders()
|
||||
{
|
||||
var manager = new ResourceManager("Titano.Core.i18n.Advisor", typeof(Loc).Assembly);
|
||||
var manager = new ResourceManager("Chronos.Core.i18n.Advisor", typeof(Loc).Assembly);
|
||||
var english = Entries(manager.GetResourceSet(CultureInfo.InvariantCulture, createIfNotExists: true, tryParents: false)!);
|
||||
var italian = Entries(manager.GetResourceSet(Italian, createIfNotExists: true, tryParents: false)!);
|
||||
// Job log lines (Advisor.Log.*) are written by the analysis job handlers in Titano.Data, not by the advisor itself.
|
||||
// Job log lines (Advisor.Log.*) are written by the analysis job handlers in Chronos.Data, not by the advisor itself.
|
||||
var keys = Keys(typeof(AdvisorKeys)).Concat(Keys(typeof(FindingKeys))).Concat(Keys(typeof(DeepFindingKeys)))
|
||||
.Concat(english.Keys.Where(k => k.StartsWith(LogPrefix, StringComparison.Ordinal))).ToList();
|
||||
Assert.Greater(keys.Count, 90);
|
||||
+11
-11
@@ -1,16 +1,16 @@
|
||||
using Titano.Core.Advice;
|
||||
using Titano.Core.Analysis;
|
||||
using Titano.Core.Analysis.Deep;
|
||||
using Titano.Core.Diagnostics.Synthetic;
|
||||
using Titano.Core.Mathematics;
|
||||
using Titano.Core.Project;
|
||||
using Titano.Core.Tests.Analysis.Deep;
|
||||
using Titano.Core.Video;
|
||||
using Titano.Testing;
|
||||
using Chronos.Core.Advice;
|
||||
using Chronos.Core.Analysis;
|
||||
using Chronos.Core.Analysis.Deep;
|
||||
using Chronos.Core.Diagnostics.Synthetic;
|
||||
using Chronos.Core.Mathematics;
|
||||
using Chronos.Core.Project;
|
||||
using Chronos.Core.Tests.Analysis.Deep;
|
||||
using Chronos.Core.Video;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Titano.Core.Tests.Advice;
|
||||
namespace Chronos.Core.Tests.Advice;
|
||||
|
||||
// The class shares its name with the namespace, which an enclosing Titano.Core.* namespace would resolve first.
|
||||
// The class shares its name with the namespace, which an enclosing Chronos.Core.* namespace would resolve first.
|
||||
|
||||
public sealed class AdvisorTests(TestContext context)
|
||||
{
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
using Titano.Core.Analysis;
|
||||
using Titano.Core.Diagnostics.Synthetic;
|
||||
using Titano.Core.Imaging;
|
||||
using Chronos.Core.Analysis;
|
||||
using Chronos.Core.Diagnostics.Synthetic;
|
||||
using Chronos.Core.Imaging;
|
||||
|
||||
namespace Titano.Core.Tests.Analysis;
|
||||
namespace Chronos.Core.Tests.Analysis;
|
||||
|
||||
/// <summary>Shared measurement helpers for the analysis tests.</summary>
|
||||
internal static class AnalysisFixtures
|
||||
Loaded 100 of 1799 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user