mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-15 20:44:01 +02:00
@@ -20,22 +20,28 @@ import (
|
||||
"testing"
|
||||
|
||||
qt "github.com/frankban/quicktest"
|
||||
"github.com/gohugoio/hugo/htesting/hqt"
|
||||
"github.com/gohugoio/hugo/media"
|
||||
)
|
||||
|
||||
func TestImageResizeWebP(t *testing.T) {
|
||||
c := qt.New(t)
|
||||
|
||||
_, image := fetchImage(c, "sunset.webp")
|
||||
_, image := fetchImage(c, "sunrise.webp")
|
||||
|
||||
c.Assert(image.MediaType(), qt.Equals, media.Builtin.WEBPType)
|
||||
c.Assert(image.RelPermalink(), qt.Equals, "/a/sunset.webp")
|
||||
c.Assert(image.RelPermalink(), qt.Equals, "/a/sunrise.webp")
|
||||
c.Assert(image.ResourceType(), qt.Equals, "image")
|
||||
c.Assert(image.Exif(), qt.IsNil)
|
||||
exif := image.Exif()
|
||||
c.Assert(exif, qt.Not(qt.IsNil))
|
||||
c.Assert(exif.Tags["Copyright"], qt.Equals, "Bjørn Erik Pedersen")
|
||||
c.Assert(exif.Lat, hqt.IsSameFloat64, 36.59744166666667)
|
||||
c.Assert(exif.Long, hqt.IsSameFloat64, -4.50846)
|
||||
c.Assert(exif.Date.IsZero(), qt.Equals, false)
|
||||
|
||||
resized, err := image.Resize("123x")
|
||||
c.Assert(err, qt.IsNil)
|
||||
c.Assert(image.MediaType(), qt.Equals, media.Builtin.WEBPType)
|
||||
c.Assert(resized.RelPermalink(), qt.Equals, "/a/sunset_hu36ee0b61ba924719ad36da960c273f96_59826_123x0_resize_q68_h2_linear_2.webp")
|
||||
c.Assert(resized.RelPermalink(), qt.Equals, "/a/sunrise_hu6ad68bcbae1b79cbc2f6b451894deaf6_95652_123x0_resize_q68_h2_linear_2.webp")
|
||||
c.Assert(resized.Width(), qt.Equals, 123)
|
||||
}
|
||||
|
Reference in New Issue
Block a user