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>
55 lines
2.2 KiB
C#
55 lines
2.2 KiB
C#
using Chronos.Core.Imaging.Geometry;
|
|
using Chronos.Testing;
|
|
|
|
namespace Chronos.Core.Tests.Geometry;
|
|
|
|
public sealed class AspectRatioTests
|
|
{
|
|
[Theory]
|
|
[Case(1920.0, 1080.0, 1, 1, 420.0, 0.0, 1080.0, 1080.0)]
|
|
[Case(1920.0, 1080.0, 9, 16, 656.25, 0.0, 607.5, 1080.0)]
|
|
[Case(4000.0, 3000.0, 16, 9, 0.0, 375.0, 4000.0, 2250.0)]
|
|
[Case(6000.0, 4000.0, 3, 2, 0.0, 0.0, 6000.0, 4000.0)]
|
|
[Case(1080.0, 1920.0, 4, 5, 0.0, 285.0, 1080.0, 1350.0)]
|
|
[Case(3840.0, 2160.0, 21, 9, 0.0, 257.142857142857, 3840.0, 1645.71428571429)]
|
|
public void FitCropCentresTheLargestCrop(double bw, double bh, int w, int h, double x, double y, double cw, double ch)
|
|
{
|
|
var crop = AspectRatio.FitCrop(RectD.FromSize(bw, bh), AspectRatio.Custom(w, h).Resolve(bw, bh));
|
|
Assert.Approximately(x, crop.X, 1e-9);
|
|
Assert.Approximately(y, crop.Y, 1e-9);
|
|
Assert.Approximately(cw, crop.Width, 1e-9);
|
|
Assert.Approximately(ch, crop.Height, 1e-9);
|
|
}
|
|
|
|
[Theory]
|
|
[Case(-1.0, 100.0)]
|
|
[Case(0.0, 280.0)]
|
|
[Case(1.0, 460.0)]
|
|
[Case(5.0, 460.0)]
|
|
[Case(-0.5, 190.0)]
|
|
public void FitCropOffsetMovesWithinTheSlack(double offset, double expectedX)
|
|
{
|
|
var crop = AspectRatio.FitCrop(new RectD(100, 50, 720, 360), 1.0, offset, offset);
|
|
Assert.Approximately(expectedX, crop.X, 1e-9);
|
|
Assert.Approximately(50, crop.Y, 1e-9);
|
|
Assert.Approximately(360, crop.Width, 1e-9);
|
|
}
|
|
|
|
[Test]
|
|
public void PresetsAndParsing()
|
|
{
|
|
Assert.Equal(AspectRatio.Widescreen, AspectRatio.Custom(32, 18));
|
|
Assert.Equal("16:9", AspectRatio.Widescreen.ToString());
|
|
Assert.Equal("9:16", AspectRatio.Vertical.ToString());
|
|
Assert.Equal(8, AspectRatio.Presets.Count);
|
|
Assert.Approximately(1.5, AspectRatio.Source.Resolve(6000, 4000), 1e-15);
|
|
Assert.Approximately(21.0 / 9, AspectRatio.Cinema.Resolve(6000, 4000), 1e-15);
|
|
Assert.True(AspectRatio.TryParse("4/5", out var portrait));
|
|
Assert.Equal(AspectRatio.Portrait, portrait);
|
|
Assert.True(AspectRatio.TryParse("source", out var source));
|
|
Assert.True(source.IsSource);
|
|
Assert.False(AspectRatio.TryParse("16:0", out _));
|
|
Assert.False(AspectRatio.TryParse("wide", out _));
|
|
}
|
|
}
|