Lays down every contract the later parcels of owner review 1 phase 5 build on, so they compile against shared types without touching each other's files. - Settings format 3: export.playback (direction, loops, fades, hold), omitted at its default and member by member; RequiredFormat is 3 only while used. - OutputProgram public API with a forward-only body; still-frame job parameters (StillFrame, StillPhoto) routed to format-3 nodes only. - Render.Sha256/Kind, RenderCopy, RenderKind; JobKind.VideoCopy = 24. - Migration 0010 (sqlite, postgres): renders.sha256/kind, ix_renders_created, render_copies without a foreign key. - Videos protocol DTOs, client calls, ServerCapabilities.Videos (declared, not announced yet), ServerSettingsDto.VideosPath. - IVideoLibrary with a NotImplemented stub registered on the server; TrashKind.Videos, VideoTrashNames, VideoErrors. - en and it strings for the whole phase, five icons, decisions 1-22 and the open-question defaults; tests that used format 3 as "newer" now use 4. Refs #21 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
55 lines
3.3 KiB
C#
55 lines
3.3 KiB
C#
using Chronos.Core.Diagnostics.Synthetic;
|
|
using Chronos.Core.Localization;
|
|
using Chronos.Core.Project;
|
|
using Chronos.Data.Archiving;
|
|
using Chronos.Data.Processing;
|
|
using Chronos.Testing;
|
|
|
|
namespace Chronos.Data.Tests.Processing;
|
|
|
|
/// <summary>
|
|
/// The project of a sequence as the engine reads and writes it (owner review 1, phase 4): a format-1 project stays format 1
|
|
/// through every edit that uses nothing newer, a transform raises it to 2 and its removal brings it back, and settings of
|
|
/// a newer Chronos are refused saying so in the user's language.
|
|
/// </summary>
|
|
[Category("processing")]
|
|
public sealed class ProjectStoreTests(TestContext context)
|
|
{
|
|
[Test]
|
|
public async Task AnEditNeverRaisesTheFormatOfAProjectThatUsesNothingNewer()
|
|
{
|
|
await using var fixture = await ProcessingFixture.CreateAsync(context);
|
|
var sequence = await fixture.AddAsync(SyntheticSequence.Create(new SyntheticSequenceOptions { Width = 64, Height = 48, FrameCount = 4 }));
|
|
var store = new ProjectStore(fixture.Db, new SequenceWriter(new ArchiveServiceOptions { Owner = "test", LeaseWait = TimeSpan.FromSeconds(20) }));
|
|
async Task<int> StoredFormatAsync()
|
|
{
|
|
var row = (await fixture.Db.Sequences.GetAsync(sequence.Id, fixture.Ct))!;
|
|
var file = await File.ReadAllTextAsync(fixture.Folder(sequence).ProjectPath, fixture.Ct);
|
|
Assert.Equal(row.SettingsJson, file, "the index and project.json hold the same text");
|
|
return ProjectContent.FormatOf(file);
|
|
}
|
|
|
|
Assert.True(await store.UpdateAsync(fixture.Archive.Paths, sequence, p => p with { Exposure = p.Exposure with { ExposureOffsetEv = 0.5 } }, fixture.Ct));
|
|
Assert.Equal(ProjectSettings.BaseVersion, await StoredFormatAsync());
|
|
// A read project of the base format is never stamped higher, even when it says the highest this Chronos reads.
|
|
Assert.True(await store.UpdateAsync(fixture.Archive.Paths, sequence, p => p with { Version = ProjectSettings.CurrentVersion, HeroFrame = 2 }, fixture.Ct));
|
|
Assert.Equal(ProjectSettings.BaseVersion, await StoredFormatAsync());
|
|
|
|
Assert.True(await store.UpdateAsync(fixture.Archive.Paths, sequence, p => p with { Camera = p.Camera with { Rotate = 90 } }, fixture.Ct));
|
|
Assert.Equal(2, await StoredFormatAsync());
|
|
Assert.True(await store.UpdateAsync(fixture.Archive.Paths, sequence, p => p with { Camera = p.Camera with { Rotate = 0 } }, fixture.Ct));
|
|
Assert.Equal(ProjectSettings.BaseVersion, await StoredFormatAsync());
|
|
Assert.False(await store.UpdateAsync(fixture.Archive.Paths, sequence, p => p with { Version = ProjectSettings.BaseVersion }, fixture.Ct), "nothing changed");
|
|
}
|
|
|
|
[Test]
|
|
public void SettingsOfANewerChronosAreRefusedSayingSo()
|
|
{
|
|
var refused = Assert.Throws<InvalidDataException>(() => ProjectStore.Parse("""{"version":4,"camera":{"rotate":90}}"""));
|
|
Assert.Equal(Loc.L("Errors.Render.NewerSettings"), refused.Message);
|
|
Assert.Equal(90, ProjectStore.Parse("""{"version":2,"camera":{"rotate":90}}""").Camera.Rotate);
|
|
// Text that is not a project keeps its own reason.
|
|
Assert.NotEqual(Loc.L("Errors.Render.NewerSettings"), Assert.Throws<InvalidDataException>(() => ProjectStore.Parse("[1]")).Message);
|
|
}
|
|
}
|