From b1b53c0773c2a600d10e3df224ea7995868875da Mon Sep 17 00:00:00 2001 From: Vetle Leinonen-Roeim Date: Sun, 30 Mar 2025 17:07:16 +0200 Subject: [PATCH] add test for trimEdges function with single color image --- transform_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/transform_test.go b/transform_test.go index b130ea4..2c0625e 100644 --- a/transform_test.go +++ b/transform_test.go @@ -394,3 +394,19 @@ func TestTrimBordersOfSameColor(t *testing.T) { t.Errorf("trimEdges() = %v, want %v", got, want) } } + +func TestTrimEdgesSingleColorImage(t *testing.T) { + // Create a 4x4 image filled with a single color (white) + src := newImage(4, 4, color.NRGBA{255, 255, 255, 255}) + + // The expected result should be the same as the source image + want := src + + // Apply the trimEdges function + got := trimEdges(src) + + // Check if the result matches the expected image + if !reflect.DeepEqual(got, want) { + t.Errorf("trimEdges() = %v, want %v", got.Bounds(), want.Bounds()) + } +}