From 493fe180d3dd009f20b58c1a72d471a2271d7df1 Mon Sep 17 00:00:00 2001 From: Vetle Leinonen-Roeim Date: Sun, 30 Mar 2025 18:36:14 +0200 Subject: [PATCH] add test for trimEdges function with empty image --- transform_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/transform_test.go b/transform_test.go index 014e842..253c69b 100644 --- a/transform_test.go +++ b/transform_test.go @@ -539,3 +539,19 @@ func TestTrimEdgesUneven(t *testing.T) { t.Errorf("trimEdges() pixel data does not match expected result") } } + +func TestTrimEdgesEmptyImage(t *testing.T) { + // Create an empty image (0x0 dimensions) + src := newImage(0, 0) + + // The expected result should also be an empty image + want := src + + // Apply the trimEdges function + got := trimEdges(src) + + // Compare pixel data + if !compareImages(got, want) { + t.Errorf("trimEdges() for empty image returned %v, want %v", got.Bounds(), want.Bounds()) + } +}