feat(editor): visual crop, rotate/mirror/flip/straighten, colour looks (owner review 1 phase 4) (#26)
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

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>
This commit was merged in pull request #26.
This commit is contained in:
Alby96andClaude Opus 5.5 authored and Alby96 committed 2026-11-05 01:09:09 +01:00
1 parent db389a54f2
commit 188b2c2e55
355 files changed
+10549 -1061

No files matched your search

@@ -131,7 +131,7 @@ public sealed class ProjectContentTests
Assert.Equal(saved, ProjectContent.Rebind(saved, Frames(Photo(7))));
Assert.False(ProjectContent.SameChoices(saved, current, Frames(Photo(7))));
// A newer Chronos's settings are its own to rename.
var newer = """{ "version": 2, "pendingFrames": [ { "size": 1001, "capturedAt": "2026-09-28T18:00:10", "excluded": true } ] }""";
var newer = """{ "version": 3, "pendingFrames": [ { "size": 1001, "capturedAt": "2026-09-28T18:00:10", "excluded": true } ] }""";
Assert.Equal(newer, ProjectContent.Rebind(newer, now));
}
@@ -329,12 +329,12 @@ public sealed class ProjectContentTests
[Test]
public void SettingsOfANewerFormatAreReadOnlyAndKeptAsTheyAre()
{
var newer = """{ "version": 2, "excludedFrames": [1], "exposure": { "exposureOffsetEv": 1.5 }, "grade": { "look": "film" } }""";
var newer = """{ "version": 3, "excludedFrames": [1], "exposure": { "exposureOffsetEv": 1.5 }, "grade": { "look": "film" } }""";
Assert.Throws<InvalidDataException>(() => ProjectSettings.FromJson(newer));
var read = ProjectSettings.FromJson(newer, allowNewer: true);
Assert.True(read.IsNewerFormat);
Assert.Equal(1.5, read.Exposure.ExposureOffsetEv);
Assert.Equal(2, ProjectContent.FormatOf(newer));
Assert.Equal(3, ProjectContent.FormatOf(newer));
Assert.Equal(1, ProjectContent.FormatOf("""{ "exposure": {} }"""));
// Its positions are a newer Chronos's to translate: only the text is made canonical.
@@ -344,6 +344,42 @@ public sealed class ProjectContentTests
Assert.Equal(portable, ProjectContent.Place(portable, Frames(Photo(2))));
}
[Test]
public void TheTextAndItsHashAreTheSameOnEveryOs()
{
// Built with explicit "\r\n", not Environment.NewLine, so the test fails without the fix on Linux too.
var frames = Frames(Photo(1), Photo(2), Photo(3));
var lf = ProjectContent.ToPortable(Positions([1], 2, 0), frames);
var crlf = lf.Replace("\n", "\r\n", StringComparison.Ordinal);
// Every writer of project text names LF itself: on Linux Environment.NewLine is LF already, so only these fail there.
Assert.Equal("\n", ProjectJson.Default.Options.NewLine);
Assert.Equal("\n", ProjectSettings.IndentedJson.NewLine);
Assert.False(lf.Contains('\r', StringComparison.Ordinal), "portable");
Assert.False(new ProjectSettings().ToJson().Contains('\r', StringComparison.Ordinal), "ToJson");
Assert.Equal(lf, ProjectContent.Canonical(crlf));
Assert.Equal(lf, ProjectContent.ToPortable(crlf, NoFrames()));
// A version stored by a Windows build before (CRLF text, CRLF hash) holds what the LF text holds.
foreach (var photos in new[] { frames, NoFrames() })
{
Assert.True(ProjectContent.SameChoices(crlf, lf, photos));
Assert.True(ProjectContent.SameChoices(lf, crlf, photos));
}
Assert.True(ProjectContent.MatchesHash(lf, ProjectContent.Hash(crlf)));
Assert.True(ProjectContent.MatchesHash(crlf, ProjectContent.Hash(lf)));
Assert.True(ProjectContent.MatchesHash(lf, ProjectContent.Hash(lf).ToUpperInvariant()));
Assert.False(ProjectContent.MatchesHash(lf, ProjectContent.Hash(ProjectContent.ToPortable(Positions([2], 2, 0), frames))));
Assert.False(ProjectContent.MatchesHash(lf, null));
Assert.False(ProjectContent.MatchesHash(lf, "abc"));
// The integrity check stays exact.
Assert.True(ProjectContent.Verifies(crlf, ProjectContent.Hash(crlf)));
Assert.False(ProjectContent.Verifies(lf, ProjectContent.Hash(crlf)));
// Other choices are still other choices.
Assert.False(ProjectContent.SameChoices(crlf, ProjectContent.ToPortable(Positions([2], 2, 0), frames), frames));
}
private static FramePhotos NoFrames() => new([]);
[Test]
public void TextThatIsNoProjectIsRefused()
{