fix(phase4): close the owner review 1 phase 4 findings
Routing sizes render jobs from the resolved preset, and the node wait applies the same routing as the claim, so a re-routed job neither keeps a stale size nor waits for a node that will never take it. Settings an older server cannot read stay on this side for the remote editor, archive sync and workspace push, and the reason is shown where it applies. A turn on one side and a framing on the other merge as one conflict. Orientation and framing fixes: an out-of-range crop turns with the content it shows, the aspect text transposes exactly, the Rotation row counts turns as shown on screen, and Reset framing undoes the orientation press by press, so keyframes and aspect stay on their content. The advisor places the horizon in the view as shown. A look at zero strength is cleared and no longer reaches the motion vectors. Preview changes: the middle button pans, a press inside a box with no slack pans while zoomed, the selected box shows a ring, and screen readers hear when the crop value changes. Tooltips in en and it updated; stale translations of changed tooltips removed so they fall back to English. Test changes: the pinned hash is OS-independent, and the tautological encoder and warning assertions became real checks. Added a non-screen test of the Straighten slider binding. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4e21aaa548
commit
eeaddc2d14
83 files changed
+823
-270
No files matched your search
@@ -2,6 +2,7 @@ using Chronos.Core.Advice;
|
||||
using Chronos.Core.Analysis;
|
||||
using Chronos.Core.Analysis.Deep;
|
||||
using Chronos.Core.Diagnostics.Synthetic;
|
||||
using Chronos.Core.Imaging.Geometry;
|
||||
using Chronos.Core.Mathematics;
|
||||
using Chronos.Core.Project;
|
||||
using Chronos.Core.Tests.Analysis.Deep;
|
||||
@@ -347,6 +348,30 @@ public sealed class AdvisorTests(TestContext context)
|
||||
Assert.Equal("9:16", project.Camera.Aspect.AutoValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The horizon framing places the decoded frame's horizon in the view as shown, as the preview draws it: a half turn or a
|
||||
/// flip shows it upside down, a straighten turns it about the centre and magnifies it by its cover zoom (10° on 3:2
|
||||
/// moves a horizon at 0.70 to about 0.745, which the framing must put on the third).
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TheHorizonIsPlacedInTheViewAsShown()
|
||||
{
|
||||
double[] horizon = [0.70, 0.70, 0.70, 0.70, 0.70];
|
||||
Assert.Approximately(0.70, AdvisorRules.ViewRow(FrameOrientation.Identity(6000, 4000), horizon), 1e-12);
|
||||
Assert.Approximately(0.30, AdvisorRules.ViewRow(FrameOrientation.Of(0, false, true, 0, 6000, 4000), horizon), 1e-9);
|
||||
Assert.Approximately(0.30, AdvisorRules.ViewRow(FrameOrientation.Of(180, false, false, 0, 6000, 4000), horizon), 1e-9);
|
||||
Assert.Approximately(0.70, AdvisorRules.ViewRow(FrameOrientation.Of(0, true, false, 0, 6000, 4000), horizon), 1e-9);
|
||||
|
||||
var straightened = FrameOrientation.Of(0, false, false, 10, 6000, 4000);
|
||||
var centre = (4000 - 1) / 2.0;
|
||||
var expected = (centre + straightened.CoverZoom * double.Cos(10 * double.Pi / 180) * (0.70 * 4000 - 0.5 - centre) + 0.5) / 4000;
|
||||
Assert.Approximately(expected, AdvisorRules.ViewRow(straightened, horizon), 1e-9);
|
||||
Assert.InRange(expected, 0.74, 0.75);
|
||||
|
||||
// The context carries the straighten, so the advice is worked out again for it.
|
||||
Assert.Equal(10.0, new SequenceContext().ForCamera(new CameraSettings { Straighten = 10 }).Straighten);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task RecommendationsAreDeterministic()
|
||||
{
|
||||
|
||||
@@ -57,6 +57,73 @@ public sealed class OrientationEditTests
|
||||
Assert.Equal(text, Framed.ToJson());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Values off the 12-decimal grid (a crop or keyframe centre an older Chronos, a hand or another program wrote) cannot
|
||||
/// come back bit for bit, as 1 − v drops bits of a v below ½: they land on the grid at the first press, no visible change,
|
||||
/// and from then on every net-zero sequence of presses gives back the same text.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void ValuesOffTheGridLandOnItOnceAndThenStay()
|
||||
{
|
||||
var legacy = new ProjectSettings
|
||||
{
|
||||
Camera = new CameraSettings { Crop = [1 / 3.0, 0.2, 0.25, 0.3], Keyframes = [new CameraKey(0, 0.47368421052631576, 1 / 7.0, 1.5, 0)] },
|
||||
};
|
||||
var once = legacy;
|
||||
for (var k = 0; k < 4; k++) once = OrientationEdit.Apply(once, OrientationOp.RotateRight);
|
||||
Assert.Approximately(1 / 3.0, once.Camera.Crop![0], 1e-12);
|
||||
Assert.Approximately(0.47368421052631576, once.Camera.Keyframes[0].CenterX, 1e-12);
|
||||
Assert.Approximately(1 / 7.0, once.Camera.Keyframes[0].CenterY, 1e-12);
|
||||
var text = once.ToJson();
|
||||
var turned = once;
|
||||
for (var k = 0; k < 4; k++) turned = OrientationEdit.Apply(turned, OrientationOp.RotateRight);
|
||||
Assert.Equal(text, turned.ToJson(), "four turns of gridded values");
|
||||
var mirrored = OrientationEdit.Apply(OrientationEdit.Apply(once, OrientationOp.Mirror), OrientationOp.Mirror);
|
||||
Assert.Equal(text, mirrored.ToJson(), "two mirrors of gridded values");
|
||||
foreach (var op in Ops)
|
||||
{
|
||||
var opposite = op switch
|
||||
{
|
||||
OrientationOp.RotateLeft => OrientationOp.RotateRight,
|
||||
OrientationOp.RotateRight => OrientationOp.RotateLeft,
|
||||
_ => op,
|
||||
};
|
||||
Assert.Equal(text, OrientationEdit.Apply(OrientationEdit.Apply(once, op), opposite).ToJson(), $"{op} undone");
|
||||
}
|
||||
// What the editor writes itself is on the grid already.
|
||||
Assert.Equal(0.473684210526, CropFrame.Grid(0.47368421052631576));
|
||||
}
|
||||
|
||||
/// <summary>A crop out of range turns with the content it shows (as it renders, clamped), not with its stored numbers.</summary>
|
||||
[Test]
|
||||
public void AnOutOfRangeCropTurnsWithTheContentItShows()
|
||||
{
|
||||
var camera = new CameraSettings { Crop = [0.5, 0, 0.7, 1] };
|
||||
Assert.Equal(new RectD(0.5, 0, 0.5, 1), CropFrame.Of(camera.Crop));
|
||||
var mirrored = OrientationEdit.Apply(camera, OrientationOp.Mirror);
|
||||
Assert.Equal(new RectD(0, 0, 0.5, 1), CropFrame.Of(mirrored.Crop), "the left half: the right half mirrored");
|
||||
var turned = OrientationEdit.Apply(camera, OrientationOp.RotateRight);
|
||||
Assert.Equal(new RectD(0, 0.5, 1, 0.5), CropFrame.Of(turned.Crop), "the right half turned clockwise is the bottom half");
|
||||
// A crop in range stays as stored.
|
||||
Assert.SequenceEqual([0.6, 0.2, 0.3, 0.4], OrientationEdit.Apply(new CameraSettings { Crop = [0.1, 0.2, 0.3, 0.4] }, OrientationOp.Mirror).Crop!);
|
||||
}
|
||||
|
||||
/// <summary>A turn transposes the aspect text as written, never reduced: turning back gives the stored text (21:9, not 7:3).</summary>
|
||||
[Test]
|
||||
public void TurningBackGivesTheStoredAspectText()
|
||||
{
|
||||
foreach (var aspect in new[] { "21:9", "1920:1080", "16:9", "4/5" })
|
||||
{
|
||||
var project = new ProjectSettings { Camera = new CameraSettings { Aspect = new Auto<string>().WithManual(aspect) } };
|
||||
var right = OrientationEdit.Apply(project, OrientationOp.RotateRight);
|
||||
Assert.True(AspectRatio.TryParse(right.Camera.Aspect.Manual, out var transposed));
|
||||
Assert.True(AspectRatio.TryParse(aspect, out var stored));
|
||||
Assert.Equal((stored.Height, stored.Width), (transposed.Width, transposed.Height));
|
||||
Assert.Equal(project.ToJson(), OrientationEdit.Apply(right, OrientationOp.RotateLeft).ToJson(), aspect);
|
||||
}
|
||||
Assert.Equal("9:21", OrientationEdit.Transposed(new Auto<string>().WithManual("21:9")).Manual);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MirrorMovesTheCropAndNegatesTheAngles()
|
||||
{
|
||||
|
||||
@@ -471,14 +471,17 @@ public sealed class ProjectSettingsTests
|
||||
Assert.Equal(10, s.BitDepth);
|
||||
}
|
||||
|
||||
/// <summary>SHA-256 of the default project's canonical text, as format-1 builds write it: none of phase 4's members, version 1.</summary>
|
||||
/// <summary>
|
||||
/// SHA-256 of the default project's canonical text, as format-1 builds write it: none of phase 4's members, version 1.
|
||||
/// The text is indented with the OS's line ends (CRLF on Windows, LF on Linux), so the pin is of the text with CRLF.
|
||||
/// </summary>
|
||||
private const string DefaultProjectHash = "df0b0f50b113475ece3753a80df0be05cc281cdaa1fa08a73a438ea9161358e0";
|
||||
|
||||
[Test]
|
||||
public void ProjectsWithoutTheNewMembersKeepTheirTextAndHash()
|
||||
{
|
||||
var defaults = new ProjectSettings().ToJson();
|
||||
Assert.Equal(DefaultProjectHash, ProjectContent.Hash(ProjectContent.Canonical(defaults)));
|
||||
Assert.Equal(DefaultProjectHash, ProjectContent.Hash(ProjectContent.Canonical(defaults).ReplaceLineEndings("\r\n")));
|
||||
Assert.Equal(OldBuild.Write(new OldProject()), defaults);
|
||||
Assert.Contains("\"version\": 1", defaults);
|
||||
foreach (var member in new[] { "rotate", "mirror", "flip", "straighten", "\"look\"" })
|
||||
|
||||
@@ -176,7 +176,7 @@ public sealed class RenderProcessingTests
|
||||
var project = With(camera: new CameraSettings { Aspect = On("9:16") });
|
||||
var (encode, result) = await CaptureAsync(Input(source, project), Preset("png-sequence", 96, 64), cancellationToken: _context.Cancellation);
|
||||
Assert.Equal((54, 96), (result.Width, result.Height));
|
||||
Assert.DoesNotContain("Export.Render.AspectFromPreset", result.Warnings.Select(w => w.Key));
|
||||
Assert.Empty(result.Warnings);
|
||||
using var expected = GeometryStage.Apply(reference, new GeometrySettings { Crop = new RectD(30, 0, 36, 64), OutputWidth = 54, OutputHeight = 96 });
|
||||
Assert.Greater(Psnr(expected, encode.Frames[2]), 60);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public sealed class SelfTestTests
|
||||
[Test]
|
||||
public async Task GeometryChecksPass()
|
||||
{
|
||||
string[] ids = ["proc.orient", "proc.straighten", "proc.portrait", "proc.aspect", "proc.crop"];
|
||||
string[] ids = ["proc.orient", "proc.straighten", "proc.portrait", "proc.aspect", "proc.crop", "proc.look"];
|
||||
var results = await SelfTest.RunAsync(new SelfTestOptions { WorkDirectory = _context.CreateTempDirectory(), Filters = ids }, cancellationToken: _context.Cancellation);
|
||||
foreach (var r in results) _context.Log($"{r.Id}: {r.Outcome} {r.Detail}");
|
||||
Assert.SequenceEqual(ids.Order(StringComparer.Ordinal), results.Select(r => r.Id).Order(StringComparer.Ordinal));
|
||||
|
||||
Reference in new issue
Block a user