mirror of
https://github.com/willnorris/imageproxy.git
synced 2026-05-23 19:05:22 +02:00
add test for trimEdges function with single color image
This commit is contained in:
parent
a54d7831fa
commit
b1b53c0773
1 changed files with 16 additions and 0 deletions
|
|
@ -394,3 +394,19 @@ func TestTrimBordersOfSameColor(t *testing.T) {
|
||||||
t.Errorf("trimEdges() = %v, want %v", got, want)
|
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())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue