mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-11-27 10:34:42 -05:00
A cropping resize now carries imagor's smart segment, which is how the libvips build and a real imagor keep the region that carries the image, the way main cropped before the generator moved out. A build without libvips answers the same request with a centre crop, and the parity suite records that.
61 lines
2.3 KiB
Go
61 lines
2.3 KiB
Go
package parity
|
|
|
|
// 300x200 is 3:2 and the boxes are not, so cropping and inscribing cannot be
|
|
// confused.
|
|
func resizeGroup() parityGroup {
|
|
src := func() source { return pngSource(300, 200) }
|
|
|
|
return parityGroup{
|
|
name: "resize",
|
|
cases: []parityCase{
|
|
{
|
|
title: "fill downscales to the exact box", path: "/unsafe/100x100/filters:format(png)/",
|
|
source: src(), want: "200 100x100 png",
|
|
},
|
|
{
|
|
title: "fill upscales a small source to the exact box", path: "/unsafe/600x600/filters:format(png)/",
|
|
source: src(), want: "200 600x600 png",
|
|
},
|
|
{
|
|
title: "fill with no_upscale leaves a small source alone", path: "/unsafe/600x600/filters:no_upscale():format(png)/",
|
|
source: src(), want: "200 300x200 png",
|
|
},
|
|
{
|
|
title: "fit-in inscribes into the box", path: "/unsafe/fit-in/100x100/filters:format(png)/",
|
|
source: src(), want: "200 100x67 png",
|
|
},
|
|
// imagor only upscales fit-in with the upscale() filter
|
|
{
|
|
title: "fit-in never upscales", path: "/unsafe/fit-in/600x600/filters:format(png)/",
|
|
source: src(), want: "200 300x200 png",
|
|
},
|
|
{
|
|
title: "fit-in with no_upscale leaves a small source alone", path: "/unsafe/fit-in/600x600/filters:no_upscale():format(png)/",
|
|
source: src(), want: "200 300x200 png",
|
|
},
|
|
{
|
|
title: "stretch hits the box exactly", path: "/unsafe/stretch/100x400/filters:format(png)/",
|
|
source: src(), want: "200 100x400 png",
|
|
},
|
|
{
|
|
title: "fill crops the centre of a landscape source", path: "/unsafe/100x100/filters:format(png)/",
|
|
source: markedPNGSource(300, 100), want: "200 100x100 png drops-marker",
|
|
probe: cropProbe,
|
|
},
|
|
{
|
|
title: "stretch keeps the whole source, marker included", path: "/unsafe/stretch/100x100/filters:format(png)/",
|
|
source: markedPNGSource(300, 100), want: "200 100x100 png keeps-marker",
|
|
probe: cropProbe,
|
|
},
|
|
{
|
|
title: "the smart segment crops to the region that carries the image", path: "/unsafe/100x100/smart/filters:format(png)/",
|
|
source: markedPNGSource(300, 100), want: "200 100x100 png keeps-marker",
|
|
probe: cropProbe,
|
|
generatorOverrides: map[string]override{
|
|
"imaging": {answers: "200 100x100 png drops-marker", because: "an attention crop is libvips work; this build takes the segment and crops the centre, which is what the thumbnails service has always done without libvips"},
|
|
},
|
|
},
|
|
},
|
|
}
|
|
}
|