The new package internal/imagerequest holds the request type, its two parts Source and Transform, the Format and Fit types, the dimension and fit checks, the /v1/image/ path parsing and the variant key; it imports no other package of pixa. imgcache.ParsedURL, imgcache.ImageRequest, signature.Request, imageprocessor.Request, the second Size, format and fit types and the conversions between them are gone. The image processor takes a Transform only. encurl keeps a private struct with the token's CBOR field names, so tokens made before still decode. VariantKey moves with the function that makes it. Tests follow the moved code; the tests of the removed conversions go with them. Model: opus-5-5
This commit is contained in:
@@ -11,6 +11,8 @@ import (
|
||||
"testing"
|
||||
"testing/iotest"
|
||||
"time"
|
||||
|
||||
"sneak.berlin/go/pixa/internal/imagerequest"
|
||||
)
|
||||
|
||||
// errTestReadFailed is the error the unreadable test input returns.
|
||||
@@ -77,12 +79,12 @@ func (r *gatedReader) Read(p []byte) (int, error) {
|
||||
}
|
||||
|
||||
// smallJPEGRequest asks for a 5x5 JPEG.
|
||||
func smallJPEGRequest() *Request {
|
||||
return &Request{
|
||||
Size: Size{Width: 5, Height: 5},
|
||||
Format: FormatJPEG,
|
||||
func smallJPEGRequest() *imagerequest.Transform {
|
||||
return &imagerequest.Transform{
|
||||
Size: imagerequest.Size{Width: 5, Height: 5},
|
||||
Format: imagerequest.FormatJPEG,
|
||||
Quality: 85,
|
||||
FitMode: FitCover,
|
||||
FitMode: imagerequest.FitCover,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,7 +271,7 @@ func TestProcessReleasesSlotOnError(t *testing.T) {
|
||||
cases := []struct {
|
||||
name string
|
||||
input io.Reader
|
||||
req *Request
|
||||
req *imagerequest.Transform
|
||||
// want is the error Process must return; nil means any error.
|
||||
want error
|
||||
}{
|
||||
|
||||
Reference in New Issue
Block a user