From 5dfb883f50e0041f70ccf79efb42639368d4114e Mon Sep 17 00:00:00 2001 From: Tomas Aparicio Date: Tue, 15 Sep 2015 21:30:32 +0100 Subject: [PATCH] feat(#52): add test case --- README.md | 1 + resize_test.go | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/README.md b/README.md index 8f0437c..53931be 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,7 @@ For platform specific installations, see [Mac OS](https://github.com/lovell/sha - Thumbnail - Extract area - Watermark (text-based) +- Gaussian blur effect - Custom output color space (RGB, grayscale...) - Format conversion (with additional quality/compression settings) - EXIF metadata (size, alpha channel, profile, orientation...) diff --git a/resize_test.go b/resize_test.go index c419b4a..c83ff39 100644 --- a/resize_test.go +++ b/resize_test.go @@ -151,6 +151,23 @@ func TestNoColorProfile(t *testing.T) { } } +func TestGaussianBlur(t *testing.T) { + options := Options{Width: 800, Height: 600, GaussianBlur: GaussianBlur{Sigma: 5}} + buf, _ := Read("fixtures/test.jpg") + + newImg, err := Resize(buf, options) + if err != nil { + t.Errorf("Resize(imgData, %#v) error: %#v", options, err) + } + + size, _ := Size(newImg) + if size.Height != options.Height || size.Width != options.Width { + t.Fatalf("Invalid image size: %dx%d", size.Width, size.Height) + } + + Write("fixtures/test_gaussian.jpg", newImg) +} + func TestConvert(t *testing.T) { width, height := 300, 240 formats := [3]ImageType{PNG, WEBP, JPEG}