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
@@ -37,6 +37,21 @@ public sealed class CameraTabTests
|
||||
foreach (var row in rows) row.Refresh();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TheRotationRowCountsTheTurnsAsShown()
|
||||
{
|
||||
var camera = new CameraSettings();
|
||||
foreach (var op in new[] { OrientationOp.Mirror, OrientationOp.RotateRight, OrientationOp.RotateRight, OrientationOp.Flip, OrientationOp.RotateRight })
|
||||
{
|
||||
var before = CameraTab.ShownTurns(camera);
|
||||
camera = OrientationEdit.Apply(camera, op);
|
||||
var expected = op == OrientationOp.RotateRight ? (before + 1) % 4 : (4 - before) % 4;
|
||||
Assert.Equal(expected, CameraTab.ShownTurns(camera), $"after {op}");
|
||||
}
|
||||
Assert.Equal(3, CameraTab.ShownTurns(new CameraSettings { Rotate = 90, Mirror = true }));
|
||||
Assert.Equal(1, CameraTab.ShownTurns(new CameraSettings { Rotate = 90, Mirror = true, Flip = true }));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task CropSizeAndPlaceMoveTheBoxLockedToTheAspect()
|
||||
{
|
||||
@@ -226,6 +241,9 @@ public sealed class CameraTabTests
|
||||
Assert.Equal("60 %", strength.DisplayValue);
|
||||
strength.Value = 1;
|
||||
Assert.Null(session.Project.Look!.Strength);
|
||||
// 0 % would be a look that changes nothing yet changes the text: None is the one way there.
|
||||
Assert.Equal(ExposureTab.MinimumStrength, strength.Minimum);
|
||||
Assert.Null(ExposureTab.WithLook(session.Project, "sepia", 0).Look, "the identity is written as no look");
|
||||
|
||||
Refresh(rows);
|
||||
filter.Selected = filter.Options.Single(o => Equals(o.Value, "none"));
|
||||
|
||||
@@ -220,6 +220,10 @@ public sealed class EditPathTests
|
||||
Assert.Equal(Loc.L("Editor.Step.Edited"), State(EditPath.Exposure, content, project: project with { Look = new LookSettings { Filter = "sepia" } }).Text,
|
||||
"a look");
|
||||
Assert.Equal(Loc.L("Common.Auto"), State(EditPath.Exposure, content, project: project with { Look = null }).Text, "no look");
|
||||
Assert.Equal(Loc.L("Common.Auto"), State(EditPath.Exposure, content, project: project with { Look = new LookSettings { Filter = "sepia", Strength = 0 } }).Text,
|
||||
"a look at 0 % changes no pixel");
|
||||
Assert.Equal(Loc.L("Common.Auto"), State(EditPath.Exposure, content, project: project with { Look = new LookSettings { Filter = "grain" } }).Text,
|
||||
"a filter this Chronos does not know renders as none");
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -536,7 +536,7 @@ public sealed class EditorSessionTests
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task ResetFramingClearsTheCropAndTheOrientationAndKeepsTheKeyframes()
|
||||
public async Task ResetFramingClearsTheCropAndTheOrientationAndKeepsTheKeyframesOnTheirContent()
|
||||
{
|
||||
var framed = WithAspect("9:16", [0.2, 0, 0.3, 1]);
|
||||
var key = new CameraKey(3, 0.4, 0.5, 2, 0);
|
||||
@@ -553,8 +553,11 @@ public sealed class EditorSessionTests
|
||||
var camera = session.Project.Camera;
|
||||
Assert.Null(camera.Crop);
|
||||
Assert.True(camera is { OffsetX: 0, OffsetY: 0, Rotate: 0, Mirror: false, Flip: false, Straighten: 0 });
|
||||
Assert.SequenceEqual([key], camera.Keyframes, "keyframes stay");
|
||||
Assert.Equal("9:16", camera.Aspect.Manual, "the aspect is not framing");
|
||||
var back = OrientationEdit.Apply(OrientationEdit.Apply(OrientationEdit.Apply(OrientationEdit.Apply(OrientationEdit.Apply(framed,
|
||||
OrientationOp.Flip), OrientationOp.Mirror), OrientationOp.RotateLeft), OrientationOp.RotateLeft), OrientationOp.RotateLeft);
|
||||
Assert.SequenceEqual(back.Camera.Keyframes, camera.Keyframes, "keyframes stay on the content they framed");
|
||||
Assert.Equal(1, camera.Keyframes.Count);
|
||||
Assert.Equal("16:9", camera.Aspect.Manual, "the aspect turns back with the picture");
|
||||
Assert.Equal("sepia", session.Project.Look?.Filter, "nor the look");
|
||||
Assert.False(EditorSession.HasFraming(camera));
|
||||
Assert.False(session.ResetFraming(), "nothing left to clear");
|
||||
@@ -563,6 +566,21 @@ public sealed class EditorSessionTests
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ResetFramingTurnsAKeyframeBackWithThePicture()
|
||||
{
|
||||
var turned = new ProjectSettings();
|
||||
turned = turned with { Camera = turned.Camera with { Rotate = 90, Aspect = turned.Camera.Aspect.WithManual("9:16"), Keyframes = [new CameraKey(2, 0.2, 0.3, 1.5, 0)] } };
|
||||
var reset = EditorSession.WithoutFraming(turned);
|
||||
var (x, y) = OrientationEdit.MapPoint(0.2, 0.3, OrientationOp.RotateLeft);
|
||||
Assert.True(reset.Camera.Keyframes[0] is { CenterX: var cx, CenterY: var cy } && cx == x && cy == y, "moved as the picture turns back");
|
||||
Assert.True((x, y) != (0.2, 0.3));
|
||||
Assert.Equal("16:9", reset.Camera.Aspect.Manual);
|
||||
var again = OrientationEdit.Apply(reset, OrientationOp.RotateRight);
|
||||
Assert.True(again.Camera is { Rotate: 90 } && again.Camera.Keyframes[0] is { CenterX: 0.2, CenterY: 0.3 }, "turning again puts it where it was");
|
||||
Assert.Equal("9:16", again.Camera.Aspect.Manual);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task ASequencePresetKeepsTheOrientationAndTheLook()
|
||||
{
|
||||
|
||||
@@ -512,7 +512,10 @@ public sealed class EditorSmokeTests
|
||||
var ratio = editor.CropLockRatio;
|
||||
editor.Session.Edit(p => p with { Camera = p.Camera with { Rotate = 90, Crop = null } });
|
||||
Assert.Equal(ratio, editor.CropLockRatio, "the box of the picture on screen until the turned one comes");
|
||||
Assert.False(editor.CropEditable, "and it cannot be dragged meanwhile: it would land in the turned frame");
|
||||
Assert.False(editor.CommitCropCommand.CanExecute(editor.EditCrop));
|
||||
Assert.True(await editor.WhenIdleAsync(TimeSpan.FromSeconds(60)));
|
||||
Assert.True(editor.CropEditable, "the turned picture is on screen");
|
||||
var picture = (System.Windows.Media.Imaging.BitmapSource)editor.PreviewImage!;
|
||||
Assert.Less(picture.PixelWidth, picture.PixelHeight, "the landscape source shows turned");
|
||||
Assert.Equal(Geometry().LockRatio, editor.CropLockRatio);
|
||||
|
||||
@@ -77,6 +77,11 @@ public sealed class PreviewRendererTests
|
||||
using var last = await renderer.RenderAsync(new PreviewRequest(EditorFixture.Sunset.Count - 1, new ProjectSettings(), 96, PreviewFraming.Source, true),
|
||||
null, CancellationToken.None);
|
||||
Assert.Empty(last!.Vectors);
|
||||
|
||||
// The flow sees the frames as the render's does, before the look (owner review 1, phase 4): the same vectors with Vivid.
|
||||
var vivid = new ProjectSettings { Look = new LookSettings { Filter = "vivid" } };
|
||||
using var looked = await renderer.RenderAsync(new PreviewRequest(10, vivid, 96, PreviewFraming.Source, Vectors: true), null, CancellationToken.None);
|
||||
Assert.SequenceEqual(frame.Vectors, looked!.Vectors);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -65,6 +65,30 @@ public sealed class RemoteSequenceSourceTests(TestContext context)
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Owner review 1, phase 4: an older server (format 1) stores whatever settings it is sent and then fails every render of
|
||||
/// them, so a turn or a look is never sent to it; an edit of the base format still is.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public async Task SettingsAnOlderServerCannotReadAreNotSent()
|
||||
{
|
||||
var (source, api, _) = Open(serverFormat: ProjectSettings.BaseVersion);
|
||||
await using (source)
|
||||
{
|
||||
var content = await source.LoadAsync(context.Cancellation);
|
||||
var turned = content.Project with { Camera = content.Project.Camera with { Rotate = 90 } };
|
||||
var refused = await Assert.ThrowsAsync<EditorException>(() => source.SaveProjectAsync(turned, content.Project, context.Cancellation));
|
||||
Assert.Equal(Loc.L("Tooltips.Server.NeedsNewerServer"), refused.Message);
|
||||
var look = content.Project with { Look = new LookSettings { Filter = "sepia" } };
|
||||
await Assert.ThrowsAsync<EditorException>(() => source.SaveProjectAsync(look, content.Project, context.Cancellation));
|
||||
Assert.Empty(api.Edits);
|
||||
|
||||
var brighter = content.Project with { Exposure = content.Project.Exposure with { ExposureOffsetEv = 0.5 } };
|
||||
await source.SaveProjectAsync(brighter, content.Project, context.Cancellation);
|
||||
Assert.Count(1, api.Edits);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task SavesSendTheVersionTheyWereMadeFrom()
|
||||
{
|
||||
@@ -574,12 +598,12 @@ public sealed class RemoteSequenceSourceTests(TestContext context)
|
||||
}
|
||||
|
||||
private (RemoteSequenceSource Source, FakeRemoteSequenceApi Api, RemoteSequence Remote) Open(int frames = 6, int cached = int.MaxValue,
|
||||
bool readOnly = false) =>
|
||||
Open(EditorFixture.Sequence(frames), cached, readOnly);
|
||||
bool readOnly = false, int serverFormat = ProjectSettings.CurrentVersion) =>
|
||||
Open(EditorFixture.Sequence(frames), cached, readOnly, serverFormat);
|
||||
|
||||
/// <summary>A server sequence whose first <paramref name="cached"/> proxies are on this PC (synthetic JPEGs).</summary>
|
||||
private (RemoteSequenceSource Source, FakeRemoteSequenceApi Api, RemoteSequence Remote) Open(SyntheticSequence sunset, int cached = int.MaxValue,
|
||||
bool readOnly = false)
|
||||
bool readOnly = false, int serverFormat = ProjectSettings.CurrentVersion)
|
||||
{
|
||||
var folder = context.CreateTempDirectory("proxies");
|
||||
var sequence = new Sequence
|
||||
@@ -603,7 +627,7 @@ public sealed class RemoteSequenceSourceTests(TestContext context)
|
||||
}
|
||||
var remote = new RemoteSequence(Server, sequence, frames, files);
|
||||
var api = new FakeRemoteSequenceApi(sequence, [.. frames.Select(f => f.Id)]) { SettingsJson = new ProjectSettings().ToJson() };
|
||||
return (new RemoteSequenceSource(remote, api, DecoderFactory.CreateClient(null), readOnly), api, remote);
|
||||
return (new RemoteSequenceSource(remote, api, DecoderFactory.CreateClient(null), readOnly, serverFormat), api, remote);
|
||||
}
|
||||
|
||||
/// <summary>Someone on the server sets the exposure offset to 0.3 and moves the framing.</summary>
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using Chronos.App.Editor;
|
||||
using Chronos.App.Shell;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Chronos.App.Tests.Editor;
|
||||
|
||||
/// <summary>
|
||||
/// The Camera step's Straighten slider reports its use to the editor (owner review 1, R6): the NumberRow template of
|
||||
/// <c>Editor/EditorPanels.xaml</c> turns <see cref="SliderActivity"/> on for the row that shows the grid, and binds its
|
||||
/// <see cref="SliderActivity.IsActiveProperty"/> one way to the source <c>Editor.IsStraightening</c> of the step. Built off
|
||||
/// screen on the test dispatcher (no window): the slider's activity is set as <see cref="SliderActivity"/> sets it when the
|
||||
/// slider takes the focus or the mouse capture.
|
||||
/// </summary>
|
||||
[WindowsOnly]
|
||||
[Serial]
|
||||
public sealed class StraightenGridBindingTests
|
||||
{
|
||||
[Test]
|
||||
public async Task UsingTheStraightenSliderTellsTheEditor()
|
||||
{
|
||||
var content = EditorFixture.Content(EditorFixture.Sunset);
|
||||
var session = new EditorSession(new FakeSequenceSource(EditorFixture.Sunset, content), content, [], TimeSpan.FromMilliseconds(20));
|
||||
await using (session)
|
||||
{
|
||||
var rows = CameraTab.FramingRows(session);
|
||||
Windows.WpfApplication.Dispatcher.Invoke(() =>
|
||||
{
|
||||
AppResources.Merge(Application.Current);
|
||||
var step = new FakeStep();
|
||||
var items = new ItemsControl { ItemsSource = rows, DataContext = step };
|
||||
items.Resources.MergedDictionaries.Add(new ResourceDictionary
|
||||
{
|
||||
Source = new Uri("pack://application:,,,/Chronos;component/Editor/EditorPanels.xaml", UriKind.Absolute),
|
||||
});
|
||||
var host = new Border { Child = items };
|
||||
host.Measure(new Size(320, 2000));
|
||||
host.Arrange(new Rect(0, 0, 320, 2000));
|
||||
host.UpdateLayout();
|
||||
|
||||
var sliders = Descendants<Slider>(host).ToList();
|
||||
Assert.Equal(rows.OfType<NumberRow>().Count(), sliders.Count);
|
||||
var straighten = Assert.NotNull(sliders.SingleOrDefault(s => s.DataContext is NumberRow { ShowsGrid: true }));
|
||||
Assert.Equal(Loc.L("Editor.Camera.Straighten"), ((NumberRow)straighten.DataContext).Header);
|
||||
Assert.True(SliderActivity.GetTracks(straighten), "the Straighten slider is tracked");
|
||||
Assert.False(sliders.Where(s => !ReferenceEquals(s, straighten)).Any(SliderActivity.GetTracks), "no other slider is");
|
||||
|
||||
Assert.False(step.Editor.IsStraightening);
|
||||
straighten.SetCurrentValue(SliderActivity.IsActiveProperty, true);
|
||||
Assert.True(step.Editor.IsStraightening, "focused or dragged: the editor shows the grid");
|
||||
straighten.SetCurrentValue(SliderActivity.IsActiveProperty, false);
|
||||
Assert.False(step.Editor.IsStraightening, "let go: the grid goes");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static IEnumerable<T> Descendants<T>(DependencyObject root)
|
||||
where T : DependencyObject
|
||||
{
|
||||
for (var i = 0; i < VisualTreeHelper.GetChildrenCount(root); i++)
|
||||
{
|
||||
var child = VisualTreeHelper.GetChild(root, i);
|
||||
if (child is T match) yield return match;
|
||||
foreach (var nested in Descendants<T>(child)) yield return nested;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The step's data context as the template reads it: <c>Editor.IsStraightening</c>.</summary>
|
||||
public sealed class FakeStep
|
||||
{
|
||||
public FakeEditor Editor { get; } = new();
|
||||
}
|
||||
|
||||
public sealed class FakeEditor
|
||||
{
|
||||
public bool IsStraightening { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -360,6 +360,19 @@ public sealed class VisualsSmokeTests
|
||||
Assert.Equal(PreviewViewport.DragMode.Pan, Take(new Rect(nx - 0.03, 0.44, 0.06, 0.12), At(preview, nx + 0.06, 0.5).X), $"{label}: outside");
|
||||
}
|
||||
|
||||
// A box that spans the view both ways (no crop) cannot move: zoomed in, a press inside pans; the middle button pans
|
||||
// anywhere, inside a box that can move too.
|
||||
preview.IsCompareEnabled = false;
|
||||
preview.Zoom = 2;
|
||||
preview.EditCrop = new Rect(0, 0, 1, 1);
|
||||
preview.Press(At(preview, 0.5, 0.5));
|
||||
Assert.Equal(PreviewViewport.DragMode.Pan, preview.Dragging, "zoomed, the whole view: pan");
|
||||
preview.EndDrag(commit: false);
|
||||
preview.EditCrop = new Rect(0.4, 0.4, 0.2, 0.2);
|
||||
preview.PressPan(At(preview, 0.5, 0.5));
|
||||
Assert.Equal(PreviewViewport.DragMode.Pan, preview.Dragging, "middle button inside a box");
|
||||
preview.EndDrag(commit: false);
|
||||
|
||||
// Not editable: no handle and no box to take, the divider and pan only.
|
||||
preview.CropEditable = false;
|
||||
preview.EditCrop = new Rect(0.4, 0.4, 0.2, 0.2);
|
||||
|
||||
@@ -286,6 +286,22 @@ public sealed class ServerHomeTests(TestContext context)
|
||||
await menu.SyncAsync();
|
||||
Assert.Equal(before, host.Store.Find(projectId)!.ReadBundle().Workspace!.Base!.VersionId, "nothing was sent");
|
||||
|
||||
// Saved as a version with the turn, then turned back: the working state is of the base format, but the version
|
||||
// waiting to be sent is not. Sync stays disabled, and the workspace itself never sends it (Send first, Delete,
|
||||
// Resolve reach the host without the menu's gate), saying why.
|
||||
await host.SaveVersionAsync(projectId, null, bed.Ct);
|
||||
Assert.True(session.Edit(p => p with { Camera = p.Camera with { Rotate = 0 } }));
|
||||
Assert.True(await session.FlushAsync());
|
||||
await menu.RefreshAsync();
|
||||
Assert.Equal(ProjectSettings.BaseVersion, session.Project.WrittenFormat);
|
||||
Assert.Equal(2, menu.Status!.UnpushedFormat);
|
||||
Assert.Equal(Loc.L("Tooltips.Server.NeedsNewerServer"), menu.PushBlockedReason);
|
||||
Assert.False(menu.SyncCommand.CanExecute(null));
|
||||
var refused = await Assert.ThrowsAsync<WorkspaceSyncException>(() => host.SyncAsync(projectId, bed.Ct));
|
||||
Assert.True(refused.HomeReadsOlderFormat);
|
||||
Assert.Equal(Loc.L("Tooltips.Server.NeedsNewerServer"), WorkspaceText.Failure(refused, server: true));
|
||||
Assert.Equal(before, host.Store.Find(projectId)!.ReadBundle().Workspace!.Base!.VersionId, "nothing was sent");
|
||||
|
||||
// A server of this format takes it.
|
||||
server.SettingsFormat = ProjectSettings.CurrentVersion;
|
||||
Assert.Null(menu.PushBlockedReason);
|
||||
|
||||
Reference in new issue
Block a user