refactor!: rename Titano to Chronos and move CI and releases to Gitea (#6)
CI / Build and test (push) Successful in 8m14s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 7s
Release / Build, test and publish (push) Successful in 13m19s
CI / PostgreSQL 16 integration (push) Successful in 4m49s
CI / PostgreSQL 17 integration (push) Successful in 5m28s
CI / Docker image (push) Successful in 53s
Release / Server image (push) Failing after 10s

The owner renamed the product and moved the repository to the self-hosted
Gitea (https://gitea.encke-hake.ts.net/BalboSoft/Chronos) for more control,
and asked for Actions and a first automatic release with the server package
and the Windows exe (docs/requests/2026-10-23-chronos-gitea.md).

- Chronos everywhere: a byte-exact rename of contents and paths, then a
  per-language review of the forms the old name's ending had dictated.
- Gitea instead of GitHub: the update check, licence, issue and support
  links read ChronosReleasesUrl; the update check takes the highest stable
  version, offers a pre-release build its final release and reports a
  repository it cannot see as a failed check. EULA, security policy and
  Gitea issue forms live at the repository root.
- Gitea Actions for the Linux act_runner (.gitea/workflows): CI, release,
  nightly image and performance gates in the .NET SDK container with git
  checkout and the system SQLite. The release cross-compiles the Windows
  programs, checks their icon, version and DPI manifest, packs installers
  and zips, publishes the Gitea release and pushes the server image
  (REGISTRY_TOKEN). Windows-only tests run in an opt-in job on a Windows
  runner (WINDOWS_RUNNER).
- New Chronos.Tools commands: zip, gitea-release, postgres-ci (replaces the
  docker-exec script, which Gitea's service containers do not allow; the
  throw-away server runs without durability) and pe-check.
- Timed tests take their budget from TestTiming (CHRONOS_TEST_TIME_FACTOR,
  3 on the shared runner; the weekly performance gates keep theirs).

BREAKING CHANGE: programs, settings, data folders, file types, environment
variables and the Docker image use the new name; nothing is migrated from
Titano, which never had a release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
This commit was merged in pull request #6.
This commit is contained in:
Alby96andClaude Opus 5.5 authored and Alby96 committed 2026-10-23 12:45:18 +02:00
1 parent c99842cc86
commit f2b58522b9
1801 files changed
+11804 -10676

No files matched your search

@@ -0,0 +1,156 @@
using System.Diagnostics;
using Chronos.Core.Imaging;
using Chronos.Testing;
namespace Chronos.Core.Tests.Imaging;
public sealed class ResamplerTests(TestContext context)
{
private static ImageBuffer Filled(int w, int h, Func<int, int, int, float> value, int channels = 3)
{
var image = new ImageBuffer(w, h, channels);
for (var c = 0; c < channels; c++)
{
for (var y = 0; y < h; y++)
{
for (var x = 0; x < w; x++) image[c, x, y] = value(c, x, y);
}
}
return image;
}
[Theory]
[Case(ResampleFilter.Lanczos3, 97, 31)]
[Case(ResampleFilter.Lanczos3, 400, 260)]
[Case(ResampleFilter.CatmullRom, 400, 260)]
[Case(ResampleFilter.CatmullRom, 20, 15)]
[Case(ResampleFilter.Box, 37, 23)]
[Case(ResampleFilter.Box, 333, 211)]
[Case(ResampleFilter.Auto, 300, 40)]
public void ConstantImageStaysConstant(ResampleFilter filter, int width, int height)
{
using var source = Filled(150, 100, (c, _, _) => 0.25f + 0.25f * c);
using var result = Resampler.Resize(source, width, height, filter);
Assert.Equal(width, result.Width);
Assert.Equal(height, result.Height);
for (var c = 0; c < 3; c++)
{
foreach (var v in result.Plane(c)) Assert.Approximately(0.25 + 0.25 * c, v, 1e-5);
}
}
[Theory]
[Case(ResampleFilter.Lanczos3)]
[Case(ResampleFilter.Box)]
[Case(ResampleFilter.CatmullRom)]
public void DownscalePreservesEnergy(ResampleFilter filter)
{
var rng = new Random(4);
using var source = Filled(640, 480, (_, x, y) => (float)(rng.NextDouble() * 0.5 + 0.4 * Math.Sin(x * 0.05) * Math.Cos(y * 0.07) + 0.4), 1);
using var result = Resampler.Resize(source, 213, 157, filter);
double Mean(ImageBuffer b) => b.Plane(0).ToArray().Average(v => (double)v);
var ratio = Mean(result) / Mean(source);
context.Log($"{filter}: mean ratio {ratio:F5}");
Assert.Approximately(1, ratio, 0.005);
}
[Theory]
[Case(ResampleFilter.Lanczos3, 0.3)]
[Case(ResampleFilter.Lanczos3, 2.7)]
[Case(ResampleFilter.CatmullRom, 3.0)]
[Case(ResampleFilter.CatmullRom, 0.45)]
[Case(ResampleFilter.Box, 0.3)]
public void StepRingingStaysWithinKernelBounds(ResampleFilter filter, double scale)
{
const int w = 200;
using var step = Filled(w, 4, (_, x, _) => x < w / 2 + 0.3 ? 0f : 1f, 1);
using var result = Resampler.Resize(step, (int)(w * scale), 4, filter);
var values = result.Row(0, 1).ToArray();
var bound = StepBound(filter, scale);
context.Log($"{filter} ×{scale}: range [{values.Min():F4}, {values.Max():F4}], bound {bound:F4}");
Assert.GreaterOrEqual(values.Min(), -bound - 1e-4);
Assert.LessOrEqual(values.Max(), 1 + bound + 1e-4);
if (filter == ResampleFilter.Box)
{
Assert.GreaterOrEqual(values.Min(), 0);
Assert.LessOrEqual(values.Max(), 1 + 1e-6);
}
Assert.Approximately(0, values[0], 1e-5);
Assert.Approximately(1, values[^1], 1e-5);
}
/// <summary>
/// The "Lanczos bound" for a step at this scale: every output sample is a normalised sum of kernel taps spaced
/// 1/stretch apart, so on a step it equals a partial sum of those taps. The bound is the largest excursion
/// outside [0, 1] of any partial sum, over all sub-pixel phases.
/// </summary>
private static double StepBound(ResampleFilter filter, double scale)
{
if (filter == ResampleFilter.Box) return 0;
var radius = filter == ResampleFilter.Lanczos3 ? 3.0 : 2.0;
var stretch = Math.Max(1, 1 / scale);
var reach = (int)Math.Ceiling(radius * stretch) + 1;
var worst = 0.0;
for (var phase = 0.0; phase < 1; phase += 1 / 512.0)
{
var taps = new List<double>();
for (var k = -reach; k <= reach; k++) taps.Add(Kernel(filter, (k + phase) / stretch));
var total = taps.Sum();
var running = 0.0;
foreach (var t in taps)
{
running += t / total;
worst = Math.Max(worst, Math.Max(running - 1, -running));
}
}
return worst;
}
private static double Kernel(ResampleFilter filter, double x)
{
var a = Math.Abs(x);
if (filter == ResampleFilter.Lanczos3) return a < 1e-12 ? 1 : a >= 3 ? 0 : 3 * Math.Sin(Math.PI * a) * Math.Sin(Math.PI * a / 3) / (Math.PI * Math.PI * a * a);
return a < 1 ? (1.5 * a - 2.5) * a * a + 1 : a < 2 ? ((-0.5 * a + 2.5) * a - 4) * a + 2 : 0;
}
[Test]
public void ThumbnailFitsAndAveragesAreas()
{
using var source = Filled(1200, 800, (c, x, _) => x % 2 == 0 ? 1f : 0f);
using var thumb = Resampler.Thumbnail(source, 300);
Assert.Equal(300, thumb.Width);
Assert.Equal(200, thumb.Height);
foreach (var v in thumb.Plane(1)) Assert.Approximately(0.5, v, 1e-5);
Assert.Equal((300, 200), Resampler.FitWithin(1200, 800, 300));
Assert.Equal((10, 20), Resampler.FitWithin(10, 20, 300));
using var small = Resampler.Thumbnail(thumb, 1000);
Assert.Equal(300, small.Width);
}
[Test]
public void UpscaleInterpolatesThroughSamples()
{
using var source = Filled(16, 16, (_, x, y) => x * 0.05f + y * 0.01f, 1);
using var up = Resampler.Resize(source, 64, 64, ResampleFilter.CatmullRom);
// Catmull-Rom reproduces linear ramps exactly away from the edges.
for (var x = 8; x < 56; x++)
{
var sx = (x + 0.5) / 4 - 0.5;
Assert.Approximately(sx * 0.05 + ((20 + 0.5) / 4 - 0.5) * 0.01, up[0, x, 20], 1e-4);
}
}
[Test]
public void TwentyFourMegapixelThumbnailIsFast()
{
using var source = new ImageBuffer(6000, 4000, 3, clear: true);
var sw = Stopwatch.StartNew();
using var thumb = Resampler.Thumbnail(source, 320);
var box = sw.Elapsed;
sw.Restart();
using var lanczos = Resampler.Resize(source, 1920, 1280);
context.Log($"24 MP → 320 px box {box.TotalMilliseconds:F0} ms; → 1920 px Lanczos3 {sw.Elapsed.TotalMilliseconds:F0} ms");
Assert.Equal(320, thumb.Width);
Assert.Less(box.TotalSeconds, TestTiming.Budget(2.5));
}
}