Files
Dominik Schmidt 999ad6fb7c fix: answer the review from @orgaralf
Both builds and imagor now crop the same region, a gif is bounded by its
declared frames, the posted body by THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE and an
image extracted from a container by the configured input size. The s3 cache
reads a miss where minio reports it.

The push endpoint's HTTP behaviour is asserted in the parity suite now, where
imagor answers the same request, so 41 duplicated service specs are gone and
the 32 that remain are what a non-default config or a helper decides.
2026-10-19 14:57:36 +02:00

74 lines
2.8 KiB
Go

package parity
func formatGroup() parityGroup {
return parityGroup{
name: "format",
cases: []parityCase{
{
title: "png output from a jpeg source", path: "/unsafe/50x50/filters:format(png)/",
source: jpegSource(300, 200), want: "200 50x50 png",
},
{
title: "jpeg output from a png source", path: "/unsafe/50x50/filters:format(jpeg)/",
source: pngSource(300, 200), want: "200 50x50 jpeg",
},
{
title: "gif output from a png source", path: "/unsafe/50x50/filters:format(gif)/",
source: pngSource(300, 200), want: "200 50x50 gif",
},
{
title: "webp output from a png source", path: "/unsafe/50x50/filters:format(webp)/",
source: pngSource(300, 200), want: "200 50x50 webp",
generatorOverrides: map[string]override{
"imaging": {answers: "406", because: "the pure Go build has no webp encoder"},
},
},
{
title: "no format filter keeps a png a png", path: "/unsafe/50x50/filters:no_upscale()/",
source: pngSource(300, 200), want: "200 50x50 png",
},
{
title: "no format filter keeps a webp a webp", path: "/unsafe/50x50/",
source: webpSource(), want: "200 50x50 webp",
generatorOverrides: map[string]override{
"imaging": {answers: "200 50x50 jpeg", because: "the pure Go build reads webp but cannot write it, so it falls back to a jpeg the way imagor does for a format it cannot write either"},
},
},
{
title: "no format filter keeps a jpeg a jpeg", path: "/unsafe/50x50/",
source: jpegSource(300, 200), want: "200 50x50 jpeg",
},
{
title: "no format filter keeps a gif a gif", path: "/unsafe/50x50/filters:no_upscale()/",
source: animatedGIFSource(300, 200, 3), want: "200 50x50 gif frames=3",
},
{
title: "no filters segment at all", path: "/unsafe/50x50/",
source: pngSource(300, 200), want: "200 50x50 png",
},
{
title: "jpg, the name webdav sends for a jpeg", path: "/unsafe/50x50/filters:format(jpg)/",
source: pngSource(300, 200), want: "200 50x50 jpeg",
},
{
title: "a format it reads but cannot write becomes a jpeg", path: "/unsafe/50x50/",
source: bmpSource(300, 200), want: "200 50x50 jpeg",
},
{
title: "a format filter naming one this service does not write", path: "/unsafe/50x50/filters:format(tiff)/",
source: pngSource(300, 200), want: "400",
generatorOverrides: map[string]override{
"imagor": {answers: "200 50x50 tiff", because: "imagor writes tiff, this service has no tiff encoder and refuses the filter instead of answering in another format"},
},
},
{
title: "an unknown format name", path: "/unsafe/50x50/filters:format(bogus)/",
source: pngSource(300, 200), want: "400",
generatorOverrides: map[string]override{
"imagor": {answers: "200 50x50 png", because: "imagor drops a filter it does not know, the built-in refuses it"},
},
},
},
}
}