Three reports from the creator, plus two bugs the real clip exposed. 1. A video layer was INVISIBLE in the preview. The pane's per-layer Image is Collapsed by default and switched on by a whitelist of DataTriggers; MediaSource matched none, so the clip decoded into a bitmap that nothing displayed. Same defect the alert box hit on 2026-09-26 and the scoreboard after it — now recorded at the top of docs/ai/ui-surface.md with a test that asserts the bound Image is Visible (`MediaPreviewDisplayTests`). 2. Play is no longer tied to Loop: the button is always enabled (creator ruling — Loop must not toggle Play). Loop still restarts a finished clip, which is the behaviour that was broken. 3. Geometry is now the LAST section of the properties list for every draggable element, with opacity at the top; the web source's duplicate geometry block is gone (it now uses the shared one, which had been sitting above the media panel). 4. The physical mouse-drag test is deleted. It injected real cursor movement, hijacked whatever machine ran it, and failed whenever the desktop was busy. The arithmetic it covered now lives in `Helpers/DragReorderMath.cs` — pure, and covered by `DragReorderMathTests` (threshold, up/down moves, no-op and out-of-range). The two persistence tests were already synthetic. 5. Real-clip check (creator's `test_greenscreen_moving_subject.mp4`, 1920×1080): the detector REJECTED it — a fully saturated green sits at value 1.0 and the detector's 0.98 brightness ceiling threw it away. White highlights are excluded by the saturation floor, which is the property that actually separates them, so the ceiling is gone. With it fixed, the clip is detected as green (high confidence), and keyed through our own pipe 97.8% of pixels go transparent. Measured: keying with the canonical #00B140 keys 0.0% of this clip — which is why the key colour comes from the measured screen. Tests: 567 passed, 0 failed, clean build 0 warnings. The gate's scope check flags `Assets/Videos/test_greenscreen_moving_subject.mp4` — the creator's working copy, deliberately not committed; the fixture lives under ytLive.Tests/Fixtures.
71 lines
2.2 KiB
C#
71 lines
2.2 KiB
C#
using System.Collections;
|
|
using Xunit;
|
|
using ytLive.Helpers;
|
|
|
|
namespace ytLive.Tests;
|
|
|
|
/// <summary>
|
|
/// The layer-list drag arithmetic, tested without a mouse. It replaced a test that injected REAL
|
|
/// cursor movement into the desktop — which hijacked the machine and failed whenever it was busy
|
|
/// (deleted 2026-11-05). Same behaviour covered here, in microseconds, with no input device.
|
|
/// </summary>
|
|
public class DragReorderMathTests
|
|
{
|
|
[Theory]
|
|
[InlineData(0, 0, false)] // a click, not a drag
|
|
[InlineData(3, 2, false)] // inside both thresholds (4 px is WPF's default)
|
|
[InlineData(4, 0, true)] // exactly the threshold counts — WPF's own rule
|
|
[InlineData(0, 4, true)]
|
|
[InlineData(-9, 1, true)] // direction is irrelevant
|
|
public void Threshold_DecidesDragVersusClick(double dx, double dy, bool dragging)
|
|
=> Assert.Equal(dragging, DragReorderMath.ExceededThreshold(dx, dy, 4, 4));
|
|
|
|
[Fact]
|
|
public void MovingDown_LandsOnTheTargetsIndex()
|
|
{
|
|
var items = new ArrayList { "A", "B", "C" };
|
|
|
|
var landed = DragReorderMath.TryMove(items, 0, 2);
|
|
|
|
Assert.Equal(2, landed);
|
|
Assert.Equal(new[] { "B", "C", "A" }, items.Cast<string>());
|
|
}
|
|
|
|
[Fact]
|
|
public void MovingUp_LandsOnTheTargetsIndex()
|
|
{
|
|
var items = new ArrayList { "A", "B", "C" };
|
|
|
|
var landed = DragReorderMath.TryMove(items, 2, 0);
|
|
|
|
Assert.Equal(0, landed);
|
|
Assert.Equal(new[] { "C", "A", "B" }, items.Cast<string>());
|
|
}
|
|
|
|
[Fact]
|
|
public void DraggingOntoItself_IsANoOp()
|
|
{
|
|
var items = new ArrayList { "A", "B", "C" };
|
|
|
|
Assert.Equal(-1, DragReorderMath.TryMove(items, 1, 1));
|
|
Assert.Equal(new[] { "A", "B", "C" }, items.Cast<string>());
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(-1, 0)]
|
|
[InlineData(0, -1)]
|
|
[InlineData(3, 0)]
|
|
[InlineData(0, 3)]
|
|
public void OutOfRangeIndices_ChangeNothing(int from, int to)
|
|
{
|
|
var items = new ArrayList { "A", "B", "C" };
|
|
|
|
Assert.Equal(-1, DragReorderMath.TryMove(items, from, to));
|
|
Assert.Equal(new[] { "A", "B", "C" }, items.Cast<string>());
|
|
}
|
|
|
|
[Fact]
|
|
public void EmptyList_IsSafe()
|
|
=> Assert.Equal(-1, DragReorderMath.TryMove(new ArrayList(), 0, 0));
|
|
}
|