Skip to content

Commit

Permalink
resources: Regenerate image golden testdata
Browse files Browse the repository at this point in the history
Keep this as a separate commit as this isn't because the files have changed. The filenames have changed due to cache busting of PNG and Webp images.

See #8729
  • Loading branch information
bep committed Jul 7, 2021
1 parent 8f40f34 commit 30eea39
Show file tree
Hide file tree
Showing 61 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion resources/image_extended_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ func TestImageResizeWebP(t *testing.T) {
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.RelPermalink(), qt.Equals, "/a/sunset_hu36ee0b61ba924719ad36da960c273f96_59826_123x0_resize_q68_h2_linear_2.webp")
c.Assert(resized.Width(), qt.Equals, 123)
}
6 changes: 3 additions & 3 deletions resources/image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ func TestImageResize8BitPNG(t *testing.T) {
resized, err := image.Resize("800x")
c.Assert(err, qt.IsNil)
c.Assert(resized.MediaType().Type(), qt.Equals, "image/png")
c.Assert(resized.RelPermalink(), qt.Equals, "/a/gohugoio_hu0e1b9e4a4be4d6f86c7b37b9ccce3fbc_73886_800x0_resize_linear_2.png")
c.Assert(resized.RelPermalink(), qt.Equals, "/a/gohugoio_hu0e1b9e4a4be4d6f86c7b37b9ccce3fbc_73886_800x0_resize_linear_3.png")
c.Assert(resized.Width(), qt.Equals, 800)
}

Expand All @@ -381,7 +381,7 @@ func TestImageResizeInSubPath(t *testing.T) {
resized, err := image.Resize("101x101")
c.Assert(err, qt.IsNil)
c.Assert(resized.MediaType().Type(), qt.Equals, "image/png")
c.Assert(resized.RelPermalink(), qt.Equals, "/a/sub/gohugoio2_hu0e1b9e4a4be4d6f86c7b37b9ccce3fbc_73886_101x101_resize_linear_2.png")
c.Assert(resized.RelPermalink(), qt.Equals, "/a/sub/gohugoio2_hu0e1b9e4a4be4d6f86c7b37b9ccce3fbc_73886_101x101_resize_linear_3.png")
c.Assert(resized.Width(), qt.Equals, 101)
c.Assert(resized.Exif(), qt.IsNil)

Expand All @@ -397,7 +397,7 @@ func TestImageResizeInSubPath(t *testing.T) {

resizedAgain, err := image.Resize("101x101")
c.Assert(err, qt.IsNil)
c.Assert(resizedAgain.RelPermalink(), qt.Equals, "/a/sub/gohugoio2_hu0e1b9e4a4be4d6f86c7b37b9ccce3fbc_73886_101x101_resize_linear_2.png")
c.Assert(resizedAgain.RelPermalink(), qt.Equals, "/a/sub/gohugoio2_hu0e1b9e4a4be4d6f86c7b37b9ccce3fbc_73886_101x101_resize_linear_3.png")
c.Assert(resizedAgain.Width(), qt.Equals, 101)
assertImageFile(c, image.(specProvider).getSpec().BaseFs.PublishFs, publishedImageFilename, 101, 101)
}
Expand Down
3 changes: 2 additions & 1 deletion resources/images/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ var (
// Add or increment if changes to an image format's processing requires
// re-generation.
imageFormatsVersions = map[Format]int{
PNG: 2, // Floyd Steinberg dithering
PNG: 3, // Fix transparency issue with 32 bit images.
WEBP: 2, // Fix transparency issue with 32 bit images.
}

// Increment to mark all processed images as stale. Only use when absolutely needed.
Expand Down
10 changes: 5 additions & 5 deletions resources/transform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,22 +371,22 @@ func TestTransform(t *testing.T) {
resizedPublished1, err := img.Resize("40x40")
c.Assert(err, qt.IsNil)
c.Assert(resizedPublished1.Height(), qt.Equals, 40)
c.Assert(resizedPublished1.RelPermalink(), qt.Equals, "/gopher.changed_hu2e827f5a78333ebc04166dd643235dea_1462_40x40_resize_linear_2.png")
assertShouldExist(c, spec, "public/gopher.changed_hu2e827f5a78333ebc04166dd643235dea_1462_40x40_resize_linear_2.png", true)
c.Assert(resizedPublished1.RelPermalink(), qt.Equals, "/gopher.changed_hu2e827f5a78333ebc04166dd643235dea_1462_40x40_resize_linear_3.png")
assertShouldExist(c, spec, "public/gopher.changed_hu2e827f5a78333ebc04166dd643235dea_1462_40x40_resize_linear_3.png", true)

// Permalink called.
resizedPublished2, err := img.Resize("30x30")
c.Assert(err, qt.IsNil)
c.Assert(resizedPublished2.Height(), qt.Equals, 30)
c.Assert(resizedPublished2.Permalink(), qt.Equals, "https://example.com/gopher.changed_hu2e827f5a78333ebc04166dd643235dea_1462_30x30_resize_linear_2.png")
assertShouldExist(c, spec, "public/gopher.changed_hu2e827f5a78333ebc04166dd643235dea_1462_30x30_resize_linear_2.png", true)
c.Assert(resizedPublished2.Permalink(), qt.Equals, "https://example.com/gopher.changed_hu2e827f5a78333ebc04166dd643235dea_1462_30x30_resize_linear_3.png")
assertShouldExist(c, spec, "public/gopher.changed_hu2e827f5a78333ebc04166dd643235dea_1462_30x30_resize_linear_3.png", true)

// Not published because none of RelPermalink or Permalink was called.
resizedNotPublished, err := img.Resize("50x50")
c.Assert(err, qt.IsNil)
c.Assert(resizedNotPublished.Height(), qt.Equals, 50)
// c.Assert(resized.RelPermalink(), qt.Equals, "/gopher.changed_hu2e827f5a78333ebc04166dd643235dea_1462_50x50_resize_linear_2.png")
assertShouldExist(c, spec, "public/gopher.changed_hu2e827f5a78333ebc04166dd643235dea_1462_50x50_resize_linear_2.png", false)
assertShouldExist(c, spec, "public/gopher.changed_hu2e827f5a78333ebc04166dd643235dea_1462_50x50_resize_linear_3.png", false)

assertNoDuplicateWrites(c, spec)
})
Expand Down

0 comments on commit 30eea39

Please sign in to comment.