MCPcopy
hub / github.com/h2non/bimg / TestEmbedExtendWithCustomColor

Function TestEmbedExtendWithCustomColor

resizer_test.go:282–297  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

280}
281
282func TestEmbedExtendWithCustomColor(t *testing.T) {
283 options := Options{Width: 400, Height: 600, Crop: false, Embed: true, Extend: 5, Background: Color{255, 20, 10}}
284 buf, _ := Read("testdata/test_issue.jpg")
285
286 newImg, err := Resize(buf, options)
287 if err != nil {
288 t.Errorf("Resize(imgData, %#v) error: %#v", options, err)
289 }
290
291 size, _ := Size(newImg)
292 if size.Height != options.Height || size.Width != options.Width {
293 t.Fatalf("Invalid image size: %dx%d", size.Width, size.Height)
294 }
295
296 Write("testdata/test_extend_background_out.jpg", newImg)
297}
298
299func TestGaussianBlur(t *testing.T) {
300 options := Options{Width: 800, Height: 600, GaussianBlur: GaussianBlur{Sigma: 5}}

Callers

nothing calls this directly

Calls 4

ReadFunction · 0.85
SizeFunction · 0.85
WriteFunction · 0.85
ResizeFunction · 0.70

Tested by

no test coverage detected