Improve crop editor and copy publish output to dist
Add resize handles, zoom, view brightness, and a multi-frame still strip. Keep the crop box on mouse-up, and copy AmiReel.exe to dist.
This commit is contained in:
@@ -57,6 +57,19 @@ public class SourceCropSelectionTests
|
||||
Assert.AreEqual(30, insets.Bottom);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ToInsets_KeepsTheDraggedWidthAndHeight()
|
||||
{
|
||||
// Act
|
||||
PixelInsets insets = SourceCropSelection.ToInsets(3840, 2160, 768, 432, 100, 50, 200, 120);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(500, insets.Left);
|
||||
Assert.AreEqual(250, insets.Top);
|
||||
Assert.AreEqual(1000, 3840 - insets.Left - insets.Right);
|
||||
Assert.AreEqual(600, 2160 - insets.Top - insets.Bottom);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ToInsets_DraggedUpAndLeft_NormalizesTheRectangle()
|
||||
{
|
||||
@@ -97,4 +110,106 @@ public class SourceCropSelectionTests
|
||||
Assert.AreEqual(0, x);
|
||||
Assert.AreEqual(60, y);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void HitTest_OnNorthWestHandle_ReturnsNorthWest()
|
||||
{
|
||||
// Act
|
||||
CropHit hit = SourceCropSelection.HitTest(20, 30, 80, 40, 20, 30, 12);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(CropHit.NorthWest, hit);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void HitTest_InsideRectangle_ReturnsMove()
|
||||
{
|
||||
// Act
|
||||
CropHit hit = SourceCropSelection.HitTest(20, 30, 80, 40, 50, 50, 12);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(CropHit.Move, hit);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void HitTest_OutsideRectangle_ReturnsNone()
|
||||
{
|
||||
// Act
|
||||
CropHit hit = SourceCropSelection.HitTest(20, 30, 80, 40, 2, 2, 12);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(CropHit.None, hit);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AdjustRect_Move_KeepsSizeAndClamps()
|
||||
{
|
||||
// Act
|
||||
(double x, double y, double width, double height) =
|
||||
SourceCropSelection.AdjustRect(10, 10, 40, 20, CropHit.Move, 100, -4, 80, 60);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(40, x);
|
||||
Assert.AreEqual(6, y);
|
||||
Assert.AreEqual(40, width);
|
||||
Assert.AreEqual(20, height);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AdjustRect_EastHandle_ChangesWidthOnly()
|
||||
{
|
||||
// Act
|
||||
(double x, double y, double width, double height) =
|
||||
SourceCropSelection.AdjustRect(10, 10, 40, 20, CropHit.East, 8, 5, 80, 60);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(10, x);
|
||||
Assert.AreEqual(10, y);
|
||||
Assert.AreEqual(48, width);
|
||||
Assert.AreEqual(20, height);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AdjustRect_WestHandle_MovesLeftEdge()
|
||||
{
|
||||
// Act
|
||||
(double x, _, double width, _) =
|
||||
SourceCropSelection.AdjustRect(20, 10, 40, 20, CropHit.West, 6, 0, 80, 60);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(26, x);
|
||||
Assert.AreEqual(34, width);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Nudge_MovesBoxWithoutChangingSize()
|
||||
{
|
||||
// Arrange
|
||||
PixelInsets start = new(10, 20, 8, 12);
|
||||
|
||||
// Act
|
||||
PixelInsets moved = SourceCropSelection.Nudge(start, 100, 80, 4, 0);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(14, moved.Left);
|
||||
Assert.AreEqual(16, moved.Right);
|
||||
Assert.AreEqual(8, moved.Top);
|
||||
Assert.AreEqual(12, moved.Bottom);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void NudgeEdge_GrowsRightSide()
|
||||
{
|
||||
// Arrange
|
||||
PixelInsets start = new(10, 20, 8, 12);
|
||||
|
||||
// Act
|
||||
PixelInsets grown = SourceCropSelection.NudgeEdge(start, 100, 80, 0, 0, -4, 0);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(10, grown.Left);
|
||||
Assert.AreEqual(16, grown.Right);
|
||||
Assert.AreEqual(8, grown.Top);
|
||||
Assert.AreEqual(12, grown.Bottom);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -483,6 +483,39 @@ public class ShortsPipelineTests
|
||||
CollectionAssert.Contains(args, "in.mp4");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CropPreviewOffsets_SpreadsFramesAcrossDuration()
|
||||
{
|
||||
// Act
|
||||
IReadOnlyList<double> offsets = ShortsPipeline.CropPreviewOffsets(30, 5);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(5, offsets.Count);
|
||||
Assert.AreEqual(0, offsets[0]);
|
||||
Assert.AreEqual(29.85, offsets[^1]);
|
||||
Assert.AreEqual(14.925, offsets[2]);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CropPreviewOffsets_WithZeroDuration_ReturnsStartOnly()
|
||||
{
|
||||
// Act
|
||||
IReadOnlyList<double> offsets = ShortsPipeline.CropPreviewOffsets(0);
|
||||
|
||||
// Assert
|
||||
CollectionAssert.AreEqual(new[] { 0d }, offsets.ToArray());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void FormatPreviewOffsetLabel_UnderOneHour_UsesMinutesAndSeconds()
|
||||
{
|
||||
// Act
|
||||
string label = ShortsPipeline.FormatPreviewOffsetLabel(75);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual("1:15", label);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void BuildExtractFrameArguments_SeeksToStartAndWritesOnePng()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user