style: apply whitespace formatting to motion tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-02 10:02:33 +00:00
1 parent 63d1855f82
commit ec6e43d531
6 files changed
+31 -31

No files matched your search

@@ -44,8 +44,8 @@ public sealed class GeometryStageTests
{
using var ramp = new ImageBuffer(64, 64, 1);
for (var y = 0; y < 64; y++)
for (var x = 0; x < 64; x++)
ramp[0, x, y] = 0.01f * x + 0.005f * y;
for (var x = 0; x < 64; x++)
ramp[0, x, y] = 0.01f * x + 0.005f * y;
using var output = new ImageBuffer(64, 64, 1);
var map = Affine2D.About(Affine2D.Similarity(0.8, 0.2, 0, 0), 32, 32);
GeometryStage.Warp(ramp, output, map);
@@ -110,13 +110,13 @@ public sealed class GeometryStageTests
{
using var checker = new ImageBuffer(256, 256, 1);
for (var y = 0; y < 256; y++)
for (var x = 0; x < 256; x++)
checker[0, x, y] = (x + y) % 2 == 0 ? 1f : 0f;
for (var x = 0; x < 256; x++)
checker[0, x, y] = (x + y) % 2 == 0 ? 1f : 0f;
using var small = GeometryStage.Apply(checker, new GeometrySettings { OutputWidth = 64 });
Assert.Equal(64, small.Height);
for (var y = 2; y < 62; y++)
for (var x = 2; x < 62; x++)
Assert.Approximately(0.5, small[0, x, y], 0.02);
for (var x = 2; x < 62; x++)
Assert.Approximately(0.5, small[0, x, y], 0.02);
}
[Test]
@@ -74,13 +74,13 @@ public sealed class MotionBlurTests
using var source = Texture();
using var motion = new MotionField(Size, Size, 2);
for (var j = 0; j < motion.Rows; j++)
for (var i = 0; i < motion.Columns; i++)
{
// A smooth swirl: magnitude up to ~6 px.
var k = j * motion.Columns + i;
motion.U[k] = (float)(6 * double.Sin(j * 0.1));
motion.V[k] = (float)(4 * double.Cos(i * 0.08));
}
for (var i = 0; i < motion.Columns; i++)
{
// A smooth swirl: magnitude up to ~6 px.
var k = j * motion.Columns + i;
motion.U[k] = (float)(6 * double.Sin(j * 0.1));
motion.V[k] = (float)(4 * double.Cos(i * 0.08));
}
using var output = new ImageBuffer(Size, Size);
new MotionBlurRenderer().Render(source, motion, 1.0, output);
for (var c = 0; c < 3; c++)
@@ -98,11 +98,11 @@ public sealed class MotionBlurTests
double sum = 0;
var n = 0;
for (var y = margin; y < Size - margin; y++)
for (var x = margin; x < Size - margin; x++)
{
sum += plane[y * Size + x];
n++;
}
for (var x = margin; x < Size - margin; x++)
{
sum += plane[y * Size + x];
n++;
}
return sum / n;
}
@@ -85,11 +85,11 @@ public sealed class OpticalFlowTests
Assert.Equal(3, field.Columns);
Assert.Equal(2, field.Rows);
for (var j = 0; j < field.Rows; j++)
for (var i = 0; i < field.Columns; i++)
{
field.U[j * field.Columns + i] = i;
field.V[j * field.Columns + i] = 2 * j;
}
for (var i = 0; i < field.Columns; i++)
{
field.U[j * field.Columns + i] = i;
field.V[j * field.Columns + i] = 2 * j;
}
var (u, v) = field.Sample(6, 2);
Assert.Approximately(1.5, u, 1e-6);
Assert.Approximately(1, v, 1e-6);
@@ -22,8 +22,8 @@ public sealed class PlaneOpsTests
{
var window = new List<float>();
for (var dy = -radius; dy <= radius; dy++)
for (var dx = -radius; dx <= radius; dx++)
window.Add(source[int.Clamp(y + dy, 0, Height - 1) * Width + int.Clamp(x + dx, 0, Width - 1)]);
for (var dx = -radius; dx <= radius; dx++)
window.Add(source[int.Clamp(y + dy, 0, Height - 1) * Width + int.Clamp(x + dx, 0, Width - 1)]);
window.Sort();
Assert.Equal(window[window.Count / 2], output[y * Width + x]);
}
@@ -44,8 +44,8 @@ public sealed class PlaneOpsTests
{
double sum = 0;
for (var dy = -radius; dy <= radius; dy++)
for (var dx = -radius; dx <= radius; dx++)
sum += source[int.Clamp(y + dy, 0, Height - 1) * Width + int.Clamp(x + dx, 0, Width - 1)];
for (var dx = -radius; dx <= radius; dx++)
sum += source[int.Clamp(y + dy, 0, Height - 1) * Width + int.Clamp(x + dx, 0, Width - 1)];
Assert.Approximately(sum / ((2 * radius + 1) * (2 * radius + 1)), output[y * Width + x], 1e-5);
}
}
@@ -158,8 +158,8 @@ public sealed class StabilizerTests
private static IEnumerable<(double X, double Y)> GridPoints()
{
for (var j = 1; j <= 3; j++)
for (var i = 1; i <= 3; i++)
yield return (Width * i / 4.0, Height * j / 4.0);
for (var i = 1; i <= 3; i++)
yield return (Width * i / 4.0, Height * j / 4.0);
}
private static double Gaussian(Random random)
@@ -76,8 +76,8 @@ public sealed class TemporalStackerTests
{
// An aircraft light streak crossing one frame.
for (var c = 0; c < 3; c++)
for (var x = 10; x < 80; x++)
frame[c, x, 40 + x / 8] = 5f;
for (var x = 10; x < 80; x++)
frame[c, x, 40 + x / 8] = 5f;
}
stacker.Push(frame);
}