aboutsummaryrefslogtreecommitdiffhomepage
path: root/resources/image_extended_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2021-04-07 16:49:34 +0200
committerBjørn Erik Pedersen <[email protected]>2021-04-15 17:22:55 +0200
commit33d5f805923eb50dfb309d024f6555c59a339846 (patch)
treecba8fde34849640bc09bd68d85c5d7a6ba042add /resources/image_extended_test.go
parent509d39fa6ddbba106c127b7923a41b0dcaea9381 (diff)
downloadhugo-33d5f805923eb50dfb309d024f6555c59a339846.tar.gz
hugo-33d5f805923eb50dfb309d024f6555c59a339846.zip
Add webp image encoding support
Fixes #5924
Diffstat (limited to 'resources/image_extended_test.go')
-rw-r--r--resources/image_extended_test.go41
1 files changed, 41 insertions, 0 deletions
diff --git a/resources/image_extended_test.go b/resources/image_extended_test.go
new file mode 100644
index 000000000..9fd9304d9
--- /dev/null
+++ b/resources/image_extended_test.go
@@ -0,0 +1,41 @@
+// Copyright 2019 The Hugo Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// +build extended
+
+package resources
+
+import (
+ "testing"
+
+ "github.com/gohugoio/hugo/media"
+
+ qt "github.com/frankban/quicktest"
+)
+
+func TestImageResizeWebP(t *testing.T) {
+ c := qt.New(t)
+
+ image := fetchImage(c, "sunset.webp")
+
+ c.Assert(image.MediaType(), qt.Equals, media.WEBPType)
+ c.Assert(image.RelPermalink(), qt.Equals, "/a/sunset.webp")
+ c.Assert(image.ResourceType(), qt.Equals, "image")
+ c.Assert(image.Exif(), qt.IsNil)
+
+ resized, err := image.Resize("123x")
+ c.Assert(err, qt.IsNil)
+ c.Assert(image.MediaType(), qt.Equals, media.WEBPType)
+ c.Assert(resized.RelPermalink(), qt.Equals, "/a/sunset_hu36ee0b61ba924719ad36da960c273f96_59826_123x0_resize_q68_h2_linear.webp")
+ c.Assert(resized.Width(), qt.Equals, 123)
+}