CI / Build and test (push) Successful in 8m19s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 7s
Release / Build, test and publish (push) Successful in 12m9s
CI / PostgreSQL 16 integration (push) Successful in 7m49s
CI / PostgreSQL 17 integration (push) Successful in 7m19s
CI / Docker image (push) Successful in 46s
Release / Server image (push) Successful in 1m14s
Owner review 1 R5 + R6. Camera rotation, mirror, flip, straighten and crop handles locked to the output; an Exposure Look group; Export output size ("proportions win"); settings format 2 with older-node gates. Also fixes project text and hashes differing between Windows and Linux.
Closes #19
Closes #20
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
83 lines
4.6 KiB
C#
83 lines
4.6 KiB
C#
using Chronos.Core.Imaging;
|
|
using Chronos.Core.Imaging.Color;
|
|
using Chronos.Core.Project;
|
|
using Chronos.Core.Render;
|
|
using Chronos.Testing;
|
|
using static Chronos.Core.Tests.Render.RenderFixture;
|
|
|
|
namespace Chronos.Core.Tests.Render;
|
|
|
|
/// <summary>The colour look in renders (owner review 1, R6): once per output frame, after stacking, before the knee.</summary>
|
|
public sealed class LookRenderTests(TestContext context)
|
|
{
|
|
private static ProjectSettings With(LookSettings? look, double? knee = null, StackSettings? stack = null) =>
|
|
Plain with { Look = look, Exposure = new ExposureSettings { HighlightKnee = knee }, Stack = stack ?? new StackSettings() };
|
|
|
|
private static void SameFrames(IReadOnlyList<ImageBuffer> expected, IReadOnlyList<ImageBuffer> actual)
|
|
{
|
|
Assert.Equal(expected.Count, actual.Count);
|
|
for (var i = 0; i < expected.Count; i++) Assert.True(expected[i].Data.SequenceEqual(actual[i].Data), $"frame {i}");
|
|
}
|
|
|
|
[Test]
|
|
public async Task TheIdentityLooksRenderTheSameBytesAsNoLook()
|
|
{
|
|
var (plain, _) = await CaptureAsync(Input(Source(4), With(null)), cancellationToken: context.Cancellation);
|
|
foreach (var look in new[] { new LookSettings { Filter = LookFilter.None }, new LookSettings { Filter = "vivid", Strength = 0 } })
|
|
{
|
|
var (encode, result) = await CaptureAsync(Input(Source(4), With(look)), cancellationToken: context.Cancellation);
|
|
SameFrames(plain.Frames, encode.Frames);
|
|
Assert.Empty(result.Warnings);
|
|
}
|
|
}
|
|
|
|
[Test]
|
|
public async Task AnUnknownLookRendersAsNoneWithAWarning()
|
|
{
|
|
var (plain, _) = await CaptureAsync(Input(Source(4), With(null)), cancellationToken: context.Cancellation);
|
|
var (encode, result) = await CaptureAsync(Input(Source(4), With(new LookSettings { Filter = "technicolor" })), cancellationToken: context.Cancellation);
|
|
SameFrames(plain.Frames, encode.Frames);
|
|
Assert.Contains(result.Warnings, w => w.Key == "Export.Render.LookIgnored" && w.Args.SequenceEqual(["technicolor"]));
|
|
}
|
|
|
|
[Test]
|
|
public async Task ACaptureWithALookIsTheFinishOfThePlainCapture()
|
|
{
|
|
// The look comes before the knee: the plain render has no knee, so the finish adds both in its own order.
|
|
var look = new LookSettings { Filter = "sepia", Strength = 0.7 };
|
|
var source = Source(6, configure: o => o with { StartEv = 1, EndEv = 2 });
|
|
var (plain, _) = await CaptureAsync(Input(source, With(null)), cancellationToken: context.Cancellation);
|
|
var (encode, result) = await CaptureAsync(Input(source, With(look, knee: 0.85)), cancellationToken: context.Cancellation);
|
|
Assert.Empty(result.Warnings);
|
|
foreach (var frame in plain.Frames) FrameFinish.Apply(frame, look, 0.85);
|
|
SameFrames(plain.Frames, encode.Frames);
|
|
Assert.Less(encode.Frames.Max(f => f.Data.ToArray().Max()), 1);
|
|
}
|
|
|
|
[Test]
|
|
public async Task AMedianStackWithMonoIsMonoOfTheMedian()
|
|
{
|
|
var stack = new StackSettings { Mode = StackSetting.Median, Length = 5 };
|
|
var source = Source(9, motion: i => (0.5 * i, 0));
|
|
var (median, _) = await CaptureAsync(Input(source, With(null, stack: stack)), cancellationToken: context.Cancellation);
|
|
var (mono, _) = await CaptureAsync(Input(source, With(new LookSettings { Filter = "mono" }, stack: stack)), cancellationToken: context.Cancellation);
|
|
foreach (var frame in median.Frames) LookFilter.Apply(frame, "mono", 1);
|
|
SameFrames(median.Frames, mono.Frames);
|
|
Assert.True(mono.Frames.All(f => f.Plane(0).SequenceEqual(f.Plane(1)) && f.Plane(1).SequenceEqual(f.Plane(2))));
|
|
}
|
|
|
|
[Test]
|
|
public async Task PngOutputWithALookIsByteIdenticalAcrossRuns()
|
|
{
|
|
var dir = context.CreateTempDirectory();
|
|
var project = With(new LookSettings { Filter = "fade", Strength = 0.8 }, knee: 0.9);
|
|
var first = await Pipeline().RenderAsync(Input(Source(5), project), Target(dir, Preset("png-sequence") with { BitDepth = 16 }, "a"), cancellationToken: context.Cancellation);
|
|
var second = await Pipeline().RenderAsync(Input(Source(5), project), Target(dir, Preset("png-sequence") with { BitDepth = 16 }, "b"), cancellationToken: context.Cancellation);
|
|
var a = Directory.GetFiles(first.OutputPath).Order(StringComparer.Ordinal).ToArray();
|
|
var b = Directory.GetFiles(second.OutputPath).Order(StringComparer.Ordinal).ToArray();
|
|
Assert.Equal(5, a.Length);
|
|
Assert.Equal(a.Length, b.Length);
|
|
for (var i = 0; i < a.Length; i++) Assert.BytesEqual(File.ReadAllBytes(a[i]), File.ReadAllBytes(b[i]));
|
|
}
|
|
}
|