Files
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

53 lines
2.8 KiB
C#

using System.Text.Json;
using Chronos.App.Library;
using Chronos.Core.Localization;
using Chronos.Core.Model;
using Chronos.Core.Project;
using Chronos.Protocol;
using Chronos.Testing;
namespace Chronos.App.Tests.Library;
/// <summary>
/// The Library's Render on a remote card is held to the editor's rule (owner review 1, phase 4): settings or proportions a
/// server of an older settings format would render otherwise are not posted to it.
/// </summary>
public sealed class LibraryRenderGateTests
{
private static ExportSettings Uhd() => new() { Preset = new Auto<string>().WithManual("4k-h264") };
[Test]
public void AnOlderServerIsNotSentARenderItWouldGetWrong()
{
var plain = new ProjectSettings { Export = Uhd() };
var turned = plain with { Camera = new CameraSettings { Rotate = 90 } };
var portrait = plain with { Camera = new CameraSettings { Aspect = new Auto<string>().WithManual("9:16") } };
var newer = Loc.L("Tooltips.Server.NeedsNewerServer");
Assert.Null(LibraryActions.ServerCannotRender(plain, plain.Export, 6000, 4000, ProjectSettings.BaseVersion));
Assert.Equal(newer, LibraryActions.ServerCannotRender(turned, turned.Export, 6000, 4000, ProjectSettings.BaseVersion));
Assert.Equal(newer, LibraryActions.ServerCannotRender(portrait, portrait.Export, 6000, 4000, ProjectSettings.BaseVersion), "the proportions win only on a newer server");
Assert.Null(LibraryActions.ServerCannotRender(turned, turned.Export, 6000, 4000, ProjectSettings.CurrentVersion));
Assert.Null(LibraryActions.ServerCannotRender(portrait, portrait.Export, 6000, 4000, ProjectSettings.CurrentVersion));
}
/// <summary>
/// The remote card's render is sized on the project just read (the card's copy may be older: here 16:9 against 9:16) and
/// does not embed it, so the server renders the sequence's settings as they are when a node takes the job.
/// </summary>
[Test]
public void ARemoteRenderIsSizedOnTheProjectReadAndRendersTheServersSettings()
{
var project = new ProjectSettings { Export = Uhd(), Camera = new CameraSettings { Aspect = new Auto<string>().WithManual("9:16") } };
var card = new Sequence { Id = Guid.NewGuid(), ArchiveId = Guid.NewGuid(), Folder = "harbour", SettingsJson = new ProjectSettings { Export = Uhd() }.ToJson() };
var request = LibraryActions.ServerRender(card, project, project.Export, 6000, 4000);
Assert.Equal(card.Id, request.Target.Single());
var parameters = JsonSerializer.Deserialize(request.ParametersJson!, ProtocolJson.Default.RenderJobParameters)!;
Assert.Equal((2160, 3840), (parameters.Width, parameters.Height));
Assert.Null(parameters.SettingsJson);
Assert.Equal(2, parameters.RequiredSettingsFormat);
}
}