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,128 @@
|
||||
using Chronos.Core.Imaging;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Chronos.Core.Tests.Imaging;
|
||||
|
||||
public sealed class PixelConvertTests
|
||||
{
|
||||
[Theory]
|
||||
[Case(1)]
|
||||
[Case(2)]
|
||||
[Case(3)]
|
||||
[Case(4)]
|
||||
public void EightBitRoundTripIsExact(int channels)
|
||||
{
|
||||
const int w = 19, h = 7;
|
||||
var pixels = new byte[w * h * channels];
|
||||
new Random(channels).NextBytes(pixels);
|
||||
var keepAlpha = channels is 2 or 4;
|
||||
using var image = PixelConvert.FromInterleaved8(pixels, w, h, channels, outputChannels: keepAlpha ? 4 : 0);
|
||||
Assert.Equal(keepAlpha ? 4 : channels == 1 ? 1 : 3, image.Channels);
|
||||
var back = PixelConvert.ToInterleaved8(image, channels);
|
||||
Assert.SequenceEqual(pixels, back);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SixteenBitRoundTripWithinOneCode()
|
||||
{
|
||||
var samples = Enumerable.Range(0, 3 * 4096).Select(i => (ushort)(i * 16 % 65536)).ToArray();
|
||||
using var image = PixelConvert.FromInterleaved16(samples, 64, 64, 3);
|
||||
var back = PixelConvert.ToInterleaved16(image, 3);
|
||||
for (var i = 0; i < samples.Length; i++) Assert.InRange(back[i], samples[i] - 1, samples[i] + 1);
|
||||
using var linear = PixelConvert.FromInterleaved16(samples, 64, 64, 3, TransferFunction.Linear);
|
||||
Assert.SequenceEqual(samples, PixelConvert.ToInterleaved16(linear, 3, TransferFunction.Linear));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CustomMaximumScalesTwelveBitData()
|
||||
{
|
||||
ushort[] samples = [0, 2048, 4095];
|
||||
using var image = PixelConvert.FromInterleaved16(samples, 3, 1, 1, TransferFunction.Linear, maxValue: 4095);
|
||||
Assert.Approximately(2048 / 4095.0, image[0, 1, 0], 1e-6);
|
||||
Assert.Equal(1f, image[0, 2, 0]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GrayRgbConversions()
|
||||
{
|
||||
using var gray = PixelConvert.FromInterleaved8([0, 128, 255], 3, 1, 1);
|
||||
using var rgb = PixelConvert.GrayToRgb(gray);
|
||||
Assert.Equal(3, rgb.Channels);
|
||||
Assert.Equal(gray[0, 1, 0], rgb[2, 1, 0]);
|
||||
using var back = PixelConvert.RgbToGray(rgb);
|
||||
Assert.Approximately(gray[0, 1, 0], back[0, 1, 0], 1e-6);
|
||||
using var colour = PixelConvert.FromInterleaved8([255, 0, 0], 1, 1, 3, TransferFunction.Linear);
|
||||
Assert.Equal((byte)Math.Round(ColorSpace.LinearToSrgb(ColorSpace.LumaR) * 255), PixelConvert.ToInterleaved8(colour, 1)[0]);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[Case(1)]
|
||||
[Case(2)]
|
||||
[Case(3)]
|
||||
[Case(4)]
|
||||
[Case(5)]
|
||||
[Case(6)]
|
||||
[Case(7)]
|
||||
[Case(8)]
|
||||
public void OrientationMatchesExifDefinition(int orientation)
|
||||
{
|
||||
// A 3×2 image with unique values; Exif row 0 / column 0 placement per orientation (CIPA DC-008 table).
|
||||
using var source = new ImageBuffer(3, 2, 1);
|
||||
for (var i = 0; i < 6; i++) source.Plane(0)[i] = i;
|
||||
using var result = PixelConvert.ApplyOrientation(source, orientation);
|
||||
float[] expected = orientation switch
|
||||
{
|
||||
1 => [0, 1, 2, 3, 4, 5],
|
||||
2 => [2, 1, 0, 5, 4, 3],
|
||||
3 => [5, 4, 3, 2, 1, 0],
|
||||
4 => [3, 4, 5, 0, 1, 2],
|
||||
5 => [0, 3, 1, 4, 2, 5],
|
||||
6 => [3, 0, 4, 1, 5, 2],
|
||||
7 => [5, 2, 4, 1, 3, 0],
|
||||
_ => [2, 5, 1, 4, 0, 3],
|
||||
};
|
||||
Assert.Equal(orientation >= 5 ? 2 : 3, result.Width);
|
||||
Assert.SequenceEqual(expected, result.Plane(0).ToArray());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void LargeOrientationUsesTilesCorrectly()
|
||||
{
|
||||
using var source = new ImageBuffer(301, 157, 3);
|
||||
for (var i = 0; i < source.Data.Length; i++) source.Data[i] = i;
|
||||
using var rotated = PixelConvert.ApplyOrientation(source, 6);
|
||||
using var back = PixelConvert.ApplyOrientation(rotated, 8);
|
||||
Assert.SequenceEqual(source.Data.ToArray(), back.Data.ToArray());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ClampHandlesNaNAndRange()
|
||||
{
|
||||
var values = Enumerable.Range(0, 37).Select(i => i % 5 == 0 ? float.NaN : i / 10f - 1f).ToArray();
|
||||
PixelConvert.Clamp(values);
|
||||
for (var i = 0; i < values.Length; i++) Assert.InRange(values[i], 0, 1);
|
||||
Assert.Equal(0f, values[5]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DitherBreaksBandingButKeepsTheMean()
|
||||
{
|
||||
using var ramp = new ImageBuffer(256, 64, 1);
|
||||
for (var y = 0; y < 64; y++)
|
||||
{
|
||||
for (var x = 0; x < 256; x++) ramp[0, x, y] = (float)ColorSpace.SrgbToLinear((100 + x / 64.0) / 255);
|
||||
}
|
||||
var plain = PixelConvert.ToInterleaved8(ramp, 1);
|
||||
var dithered = PixelConvert.ToInterleaved8(ramp, 1, dither: true);
|
||||
Assert.True(plain.Distinct().Count() <= 5, "a 4-code ramp quantises to few levels");
|
||||
for (var x0 = 0; x0 < 256; x0 += 64)
|
||||
{
|
||||
var mean = 0.0;
|
||||
for (var y = 0; y < 64; y++)
|
||||
{
|
||||
for (var x = x0; x < x0 + 64; x++) mean += dithered[y * 256 + x];
|
||||
}
|
||||
Assert.Approximately(100 + (x0 + 31.5) / 64.0, mean / (64 * 64), 0.15);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user