Files
Chronos/tests/Chronos.Core.Tests/Render/OutputProgramTests.cs
T
Alby96andClaude Opus 5.5 728ffa35cb
CI / Build and test (push) Successful in 9m41s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 9s
Release / Build, test and publish (push) Successful in 14m49s
CI / PostgreSQL 16 integration (push) Successful in 8m51s
CI / PostgreSQL 17 integration (push) Successful in 9m48s
CI / Docker image (push) Successful in 54s
Release / Server image (push) Successful in 1m39s
feat: export panel and Render menu, playback options, videos library (owner review 1 phase 5) (#27)
Owner review 1 R3, R8, R9. A grouped Export step and Render menu; encoding, playback (reverse, boomerang, loops, fades, hold) and still frames; one videos library on the desktop and the server with a verified trash and copies to a videos folder.

Closes #21

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
2026-11-05 09:18:40 +01:00

65 lines
2.5 KiB
C#

using Chronos.Core.Model;
using Chronos.Core.Project;
using Chronos.Core.Render;
using Chronos.Core.Video;
using Chronos.Testing;
namespace Chronos.Core.Tests.Render;
public sealed class OutputProgramTests
{
private static readonly Rational Fps25 = new(25, 1);
[Test]
public void TheDefaultPlaybackEmitsThePlanAsItIs()
{
var frames = Frames(3600, 3600, 7200);
foreach (var playback in new[] { null, new PlaybackSettings() })
{
var program = OutputProgram.Build(frames, playback, Fps25);
Assert.SequenceEqual([new ProgramEntry(0, 3600, 1), new ProgramEntry(1, 3600, 1), new ProgramEntry(2, 7200, 1)], program.Entries);
Assert.Equal((3, 14400L), (program.Count, program.Duration90k));
Assert.Approximately(0.16, program.DurationSeconds, 1e-12);
Assert.Equal(0, program.Warnings.Count);
}
Assert.Equal(0, OutputProgram.Build([], null, Fps25).Count);
}
[Test]
public void AnUnknownDirectionPlaysForwardWithAWarning()
{
var program = OutputProgram.Build(Frames(3600, 3600), new PlaybackSettings { Direction = "pingpong" }, Fps25);
Assert.SequenceEqual([0, 1], program.Entries.Select(e => e.PlanIndex));
Assert.Count(1, program.Warnings);
var warning = program.Warnings[0];
Assert.Equal(OutputProgram.DirectionUnknownWarning, warning.Key);
Assert.SequenceEqual(["pingpong"], warning.Args);
}
[Test]
public void ARateThatIsNotPositiveIsRefused() =>
Assert.Throws<ArgumentOutOfRangeException>(() => OutputProgram.Build(Frames(3600), null, new Rational(0, 1)));
[Test]
public void TheKindOfARenderFollowsItsColumnElseItsCodec()
{
Assert.Equal(RenderKind.Still, RenderKind.Of("still", "png-sequence"));
Assert.Equal(RenderKind.Sequence, RenderKind.Of(null, "png-sequence"));
Assert.Equal(RenderKind.Sequence, RenderKind.Of(null, "Tiff16Sequence"));
Assert.Equal(RenderKind.Video, RenderKind.Of(null, "h264"));
Assert.Equal(RenderKind.Video, RenderKind.Of(null, null));
}
private static PlannedFrame[] Frames(params long[] durations)
{
var frames = new PlannedFrame[durations.Length];
long start = 0;
for (var i = 0; i < durations.Length; i++)
{
frames[i] = new PlannedFrame(i, i, i, 0, start, durations[i], i, 1, 1, PlannedFrameFlags.None);
start += durations[i];
}
return frames;
}
}