test(app): editor history, saver retry, merge, preview re-solve and capture scenes
- Tests for undo after adopted changes, run ending, saver retries and stop, the local source refusing unsaved writes, re-solves without decoding and equal to a fresh preparation, 1:1 pictures, waveform, crop margins and the values of the Optimise toast; the Windows smoke test checks Render, Batch, the waveform, 1:1, the window title and the hidden idle job bar. - The capture sample has a manual value and camera keyframes; the capture adds the overlays, the waveform, the Optimise toast and Export.html's tool state. - Crop margins live in a WPF-free class; a discarded change stops retrying. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
15 files changed
+462
-53
No files matched your search
@@ -12,15 +12,6 @@ using Titano.Ui.Visuals;
|
||||
|
||||
namespace Titano.App.Editor;
|
||||
|
||||
/// <summary>Margins of the free crop, in the order of <c>CameraTab.Margins</c> (opposites differ in the lowest bit).</summary>
|
||||
public enum CropSide
|
||||
{
|
||||
Left,
|
||||
Right,
|
||||
Top,
|
||||
Bottom,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Camera (BRIEF §12.3): the free crop of the frame (margins), the output aspect and its placement inside the crop, and
|
||||
/// virtual-camera keyframes edited as a zoom curve over the sequence (X = frame, Y = zoom) with the selected keyframe's
|
||||
@@ -31,11 +22,6 @@ public sealed class CameraTab : EditorTab
|
||||
/// <summary>Zoom at the top of the curve editor.</summary>
|
||||
public const double MaxZoom = 4;
|
||||
|
||||
/// <summary>Largest crop margin; opposite margins together leave at least <see cref="MinCropSize"/> of the frame.</summary>
|
||||
public const double MaxCropMargin = 0.45;
|
||||
|
||||
public const double MinCropSize = 0.1;
|
||||
|
||||
private int _selectedKey = -1;
|
||||
|
||||
public CameraTab(EditorViewModel editor)
|
||||
@@ -169,25 +155,10 @@ public sealed class CameraTab : EditorTab
|
||||
OnPropertyChanged(nameof(RemoveKeyToolTip));
|
||||
}
|
||||
|
||||
/// <summary>A margin of the free crop (<see cref="CameraSettings.Crop"/>, normalised x, y, width, height); all zero = the whole frame.</summary>
|
||||
/// <summary>A margin of the free crop (<see cref="CropMargins"/>); all zero = the whole frame.</summary>
|
||||
private static NumberRow CropRow(EditorSession session, CropSide side, string headerKey) => new(session, headerKey, "Tooltips.Editor.Camera.Crop", 0,
|
||||
MaxCropMargin, 0.01, p => Margins(p.Camera.Crop)[(int)side], (p, v) => p with { Camera = p.Camera with { Crop = WithMargin(p.Camera.Crop, side, v) } },
|
||||
v => Formatting.Percent(v));
|
||||
|
||||
/// <summary>Left, right, top and bottom margins of a crop rectangle.</summary>
|
||||
private static double[] Margins(double[]? crop) => crop is [var x, var y, var w, var h] && new[] { x, y, w, h }.All(double.IsFinite)
|
||||
? [double.Clamp(x, 0, 1), double.Clamp(1 - x - w, 0, 1), double.Clamp(y, 0, 1), double.Clamp(1 - y - h, 0, 1)]
|
||||
: [0, 0, 0, 0];
|
||||
|
||||
private static double[]? WithMargin(double[]? crop, CropSide side, double value)
|
||||
{
|
||||
var margins = Margins(crop);
|
||||
var opposite = (int)side ^ 1;
|
||||
margins[(int)side] = double.Clamp(value, 0, double.Min(MaxCropMargin, 1 - MinCropSize - margins[opposite]));
|
||||
if (margins.All(m => m == 0)) return null;
|
||||
var (left, right, top, bottom) = (margins[0], margins[1], margins[2], margins[3]);
|
||||
return [left, top, 1 - left - right, 1 - top - bottom];
|
||||
}
|
||||
CropMargins.MaxMargin, 0.01, p => CropMargins.Of(p.Camera.Crop)[(int)side],
|
||||
(p, v) => p with { Camera = p.Camera with { Crop = CropMargins.With(p.Camera.Crop, side, v) } }, v => Formatting.Percent(v));
|
||||
|
||||
private Point ToPoint(CameraKey key) => new(Editor.FrameCount > 1 ? (double)key.Frame / (Editor.FrameCount - 1) : 0, (key.Zoom - 1) / (MaxZoom - 1));
|
||||
|
||||
|
||||
Reference in new issue
Block a user