summaryrefslogtreecommitdiffstats
path: root/resource/image_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'resource/image_test.go')
-rw-r--r--resource/image_test.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/resource/image_test.go b/resource/image_test.go
index e981a208f..1a937d56b 100644
--- a/resource/image_test.go
+++ b/resource/image_test.go
@@ -19,6 +19,8 @@ import (
"strconv"
"testing"
+ "github.com/disintegration/imaging"
+
"sync"
"github.com/stretchr/testify/require"
@@ -258,6 +260,24 @@ func TestImageWithMetadata(t *testing.T) {
}
+func TestImageResize8BitPNG(t *testing.T) {
+
+ assert := require.New(t)
+
+ image := fetchImage(assert, "gohugoio.png")
+
+ assert.Equal(imaging.PNG, image.format)
+ assert.Equal("/a/gohugoio.png", image.RelPermalink())
+ assert.Equal("image", image.ResourceType())
+
+ resized, err := image.Resize("800x")
+ assert.NoError(err)
+ assert.Equal(imaging.PNG, resized.format)
+ assert.Equal("/a/gohugoio_hu0e1b9e4a4be4d6f86c7b37b9ccce3fbc_73886_800x0_resize_linear_1.png", resized.RelPermalink())
+ assert.Equal(800, resized.Width())
+
+}
+
func BenchmarkResizeParallel(b *testing.B) {
assert := require.New(b)
img := fetchSunset(assert)