Files
Chronos/tests/Chronos.Core.Tests/Render/RenderRulesTests.cs
T
Alby96andClaude Opus 5.5 188b2c2e55
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
feat(editor): visual crop, rotate/mirror/flip/straighten, colour looks (owner review 1 phase 4) (#26)
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>
2026-11-05 01:09:09 +01:00

31 lines
1.6 KiB
C#

using Chronos.Core.Export;
using Chronos.Core.Project;
using Chronos.Core.Render;
using Chronos.Testing;
namespace Chronos.Core.Tests.Render;
public sealed class RenderRulesTests
{
[Test]
public void AMismatchedFixedPresetNeedsFormatTwo()
{
var project = new ProjectSettings { Camera = Camera("9:16") };
Assert.Equal(2, RenderRules.RequiredFormat(project, Export("4k-h264"), 6000, 4000));
// The same proportions as the preset, "source" or a free-size preset change nothing an older build would render.
Assert.Equal(1, RenderRules.RequiredFormat(project with { Camera = Camera("16:9") }, Export("4k-h264"), 6000, 4000));
Assert.Equal(1, RenderRules.RequiredFormat(new ProjectSettings(), Export("4k-h264"), 6000, 4000));
Assert.Equal(1, RenderRules.RequiredFormat(project, Export("png-sequence"), 6000, 4000));
// The settings' own format counts too.
var turned = new ProjectSettings { Camera = new CameraSettings { Rotate = 90 } };
Assert.Equal(2, RenderRules.RequiredFormat(turned, Export("png-sequence"), 6000, 4000));
var newer = ProjectSettings.FromJson("""{ "version": 3 }""", allowNewer: true);
Assert.Equal(3, RenderRules.RequiredFormat(newer, Export("4k-h264"), 6000, 4000));
}
private static CameraSettings Camera(string aspect) => new() { Aspect = new Auto<string>().WithManual(aspect) };
private static ResolvedExport Export(string preset, ExportOverrides? overrides = null) =>
ExportResolver.Resolve(new ExportSettings { Preset = new Auto<string>().WithManual(preset), Overrides = overrides ?? new ExportOverrides() });
}