mirror of
https://github.com/willnorris/imageproxy.git
synced 2026-04-29 06:46:23 +02:00
simplify data.go and tests
remove unecessary string casting, and simplify duplicate tests. Also don't use struct literals for test values.
This commit is contained in:
parent
3b850734af
commit
c0a97f6742
2 changed files with 16 additions and 26 deletions
14
data.go
14
data.go
|
|
@ -99,7 +99,7 @@ func (o Options) String() string {
|
|||
opts = append(opts, optFit)
|
||||
}
|
||||
if o.Rotate != 0 {
|
||||
opts = append(opts, fmt.Sprintf("%s%d", string(optRotatePrefix), o.Rotate))
|
||||
opts = append(opts, fmt.Sprintf("%s%d", optRotatePrefix, o.Rotate))
|
||||
}
|
||||
if o.FlipVertical {
|
||||
opts = append(opts, optFlipVertical)
|
||||
|
|
@ -108,10 +108,10 @@ func (o Options) String() string {
|
|||
opts = append(opts, optFlipHorizontal)
|
||||
}
|
||||
if o.Quality != 0 {
|
||||
opts = append(opts, fmt.Sprintf("%s%d", string(optQualityPrefix), o.Quality))
|
||||
opts = append(opts, fmt.Sprintf("%s%d", optQualityPrefix, o.Quality))
|
||||
}
|
||||
if o.Signature != "" {
|
||||
opts = append(opts, fmt.Sprintf("%s%s", string(optSignaturePrefix), o.Signature))
|
||||
opts = append(opts, fmt.Sprintf("%s%s", optSignaturePrefix, o.Signature))
|
||||
}
|
||||
if o.ScaleUp {
|
||||
opts = append(opts, optScaleUp)
|
||||
|
|
@ -120,16 +120,16 @@ func (o Options) String() string {
|
|||
opts = append(opts, o.Format)
|
||||
}
|
||||
if o.CropX != 0 {
|
||||
opts = append(opts, fmt.Sprintf("%s%v", string(optCropX), o.CropX))
|
||||
opts = append(opts, fmt.Sprintf("%s%v", optCropX, o.CropX))
|
||||
}
|
||||
if o.CropY != 0 {
|
||||
opts = append(opts, fmt.Sprintf("%s%v", string(optCropY), o.CropY))
|
||||
opts = append(opts, fmt.Sprintf("%s%v", optCropY, o.CropY))
|
||||
}
|
||||
if o.CropWidth != 0 {
|
||||
opts = append(opts, fmt.Sprintf("%s%v", string(optCropWidth), o.CropWidth))
|
||||
opts = append(opts, fmt.Sprintf("%s%v", optCropWidth, o.CropWidth))
|
||||
}
|
||||
if o.CropHeight != 0 {
|
||||
opts = append(opts, fmt.Sprintf("%s%v", string(optCropHeight), o.CropHeight))
|
||||
opts = append(opts, fmt.Sprintf("%s%v", optCropHeight, o.CropHeight))
|
||||
}
|
||||
if o.SmartCrop {
|
||||
opts = append(opts, optSmartCrop)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue