Files
Chronos/tests/Chronos.Core.Tests/Render/RenderRulesTests.cs
T
Alby96andClaude Opus 5.5 e4364c4f25 feat(project): settle phase 4 contracts: conditional settings format, transforms, look, output size
Groundwork for owner review 1, phase 4, so the parallel packages build on
fixed contracts and strings.

- Settings: camera rotate/mirror/flip/straighten and a look, declared after
  the existing members and omitted at default. ToJson writes the lowest
  format that renders the same (2 only while a transform or look is used),
  so projects without them keep byte-identical text and hash; an old-build
  simulation test proves the order survives an older build's round trip.
- RenderSize and RenderRules: proportions win over a fixed preset box, and
  the routing format a job needs.
- FrameOrientation, CropFrame, OrientationEdit, LookFilter (identity) and
  FrameFinish (look, then knee) wired into the render pipeline and preview;
  RenderGeometry gains view-frame members equivalent to today.
- Protocol trailing members for node, job and server formats; SyncText keys;
  EditPath counts transforms and the look as hand values.
- New en/it strings and tooltips, five icons, test fixtures moved to v3 as
  the first unread format, and the 18 DECISIONS rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 19:10:12 +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() });
}