CI / Build and test (pull_request) Failing after 2m3s
CI / PostgreSQL 16 integration (pull_request) Skipped
CI / PostgreSQL 17 integration (pull_request) Skipped
CI / Docker image (pull_request) Skipped
CI / Windows tests and installer (pull_request) Skipped
CI / YAML check (pull_request) Successful in 4s
The owner renamed the product and moved the repository to the self-hosted Gitea (https://gitea.encke-hake.ts.net/BalboSoft/Chronos) for more control, and asked for Actions and a first automatic release with the server package and the Windows exe (docs/requests/2026-10-23-chronos-gitea.md). - Chronos everywhere: a byte-exact rename of contents and paths, then a per-language review of the forms the old name's ending had dictated. - Gitea instead of GitHub: the update check, licence, issue and support links read ChronosReleasesUrl; the update check takes the highest stable version, offers a pre-release build its final release and reports a repository it cannot see as a failed check. EULA, security policy and Gitea issue forms live at the repository root. - Gitea Actions for the Linux act_runner (.gitea/workflows): CI, release, nightly image and performance gates in the .NET SDK container with git checkout. The release cross-compiles the Windows programs, checks their icon, version and DPI manifest, packs installers and zips, publishes the Gitea release and pushes the server image (REGISTRY_TOKEN). Windows-only tests run in an opt-in job on a Windows runner (WINDOWS_RUNNER). - New Chronos.Tools commands: zip, gitea-release, postgres-ci (replaces the docker-exec script, which Gitea's service containers do not allow) and pe-check. BREAKING CHANGE: programs, settings, data folders, file types, environment variables and the Docker image use the new name; nothing is migrated from Titano, which never had a release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
94 lines
4.4 KiB
C#
94 lines
4.4 KiB
C#
using Chronos.App.Editor;
|
|
using Chronos.Core.Advice;
|
|
using Chronos.Core.Export;
|
|
using Chronos.Core.Project;
|
|
using Chronos.Core.Video;
|
|
using Chronos.Core.Video.Managed;
|
|
using Chronos.Testing;
|
|
|
|
namespace Chronos.App.Tests.Editor;
|
|
|
|
public sealed class ExportPlannerTests
|
|
{
|
|
private static readonly SequenceContent Content = EditorFixture.Content(EditorFixture.Sunset);
|
|
|
|
private static ExportPlanner Planner(EncoderHost host = EncoderHost.Client) => new(Content, [new ManagedEncoderProvider()], host);
|
|
|
|
[Test]
|
|
public void TheListHasSequencePresetsFirstThenEveryBuiltInPreset()
|
|
{
|
|
var context = SequenceContext.FromFrames(Content.Frames);
|
|
var advice = Advisor.Recommend(Content.Light, Content.Deep, context);
|
|
var presets = SequencePresets.Generate(Content.Light, Content.Deep, context);
|
|
var choices = ExportPlanner.Choices(presets, advice);
|
|
|
|
Assert.Equal(presets.Count + ExportPresets.BuiltIn.Count, choices.Count);
|
|
Assert.True(choices.Take(presets.Count).All(c => c.Sequence is not null));
|
|
Assert.SequenceEqual(ExportPresets.BuiltIn.Select(p => p.Id), choices.Skip(presets.Count).Select(c => c.Id));
|
|
var recommended = Assert.Contains(choices, c => c.IsRecommended);
|
|
Assert.Equal(advice.Find(AdvisorParameters.ExportPreset)!.Value, recommended.ExportPresetId);
|
|
Assert.NotNull(recommended.Reason);
|
|
Assert.True(choices.All(c => c.Name.Length > 0 && !c.Name.StartsWith("Export.", StringComparison.Ordinal)), "names are localised");
|
|
}
|
|
|
|
[Test]
|
|
public void AnImageSequenceIsEstimatedAndNamedAsAFolder()
|
|
{
|
|
var project = new ProjectSettings();
|
|
project = project with { Export = project.Export with { Preset = project.Export.Preset.WithManual("png-sequence"), NameTemplate = "{title} {width}x{height} {codec}" } };
|
|
var plan = Planner().Plan(project);
|
|
Assert.NotNull(plan);
|
|
Assert.True(plan!.Setup.Encoder.IsReady);
|
|
Assert.Equal(96, plan.Setup.Encoder.Settings.Width);
|
|
Assert.Equal("Harbour sunset 96x64 PNG", plan.FileName, "no extension: a folder of frames");
|
|
Assert.Null(plan.NameError);
|
|
var workload = plan.Setup.Workload();
|
|
Assert.Equal(ExportEstimator.EstimateBytes(plan.Export with { Codec = VideoCodec.PngSequence }, workload), plan.Estimate.Bytes);
|
|
Assert.Greater(plan.Estimate.Bytes, 0);
|
|
Assert.Greater(plan.Estimate.Time.TotalSeconds, 0);
|
|
}
|
|
|
|
[Test]
|
|
public void ExcludedFramesShortenTheEstimate()
|
|
{
|
|
var project = new ProjectSettings();
|
|
project = project with { Export = project.Export with { Preset = project.Export.Preset.WithManual("jpeg-sequence") } };
|
|
var all = Planner().Plan(project)!;
|
|
var fewer = Planner().Plan(project with { ExcludedFrames = [.. Enumerable.Range(0, 36)] })!;
|
|
Assert.Equal(Content.Count, all.Setup.Plan.Frames.Count);
|
|
Assert.Less(fewer.Estimate.Bytes, all.Estimate.Bytes);
|
|
}
|
|
|
|
[Test]
|
|
public void VideoWithoutAnEncoderExplainsWhy()
|
|
{
|
|
var plan = Planner().Plan(new ProjectSettings())!;
|
|
Assert.False(plan.Setup.Encoder.IsReady, "only managed encoders here; H.264 needs Media Foundation or a render node");
|
|
Assert.Contains(plan.Setup.Encoder.Notices, n => n.Key == EncoderNotices.NoEncoder);
|
|
|
|
var server = Planner(EncoderHost.Server).Plan(new ProjectSettings())!;
|
|
Assert.Equal(EncoderSelectionStatus.NeedsRenderNode, server.Setup.Encoder.Status);
|
|
}
|
|
|
|
[Test]
|
|
public void ABrokenTemplateIsExplainedAndStillNamesTheFile()
|
|
{
|
|
var project = new ProjectSettings();
|
|
project = project with { Export = project.Export with { Preset = project.Export.Preset.WithManual("gif-preview"), NameTemplate = "{title} {nope}" } };
|
|
var plan = Planner().Plan(project)!;
|
|
Assert.Equal("Unknown token “nope” at position 9.", plan.NameError);
|
|
Assert.Equal("Harbour sunset.gif", plan.FileName);
|
|
}
|
|
|
|
[Test]
|
|
public void EditingAValueMakesThePresetCustom()
|
|
{
|
|
var project = new ProjectSettings();
|
|
project = project with { Export = project.Export with { Preset = project.Export.Preset.WithManual("png-sequence"), Overrides = new ExportOverrides { Width = 48 } } };
|
|
var plan = Planner().Plan(project)!;
|
|
Assert.True(plan.Export.IsCustom);
|
|
Assert.Equal("Custom", plan.PresetName);
|
|
Assert.Equal(48, plan.Setup.Encoder.Settings.Width);
|
|
}
|
|
}
|