MCPcopy
hub / github.com/willnorris/imageproxy / TestOptions_String

Function TestOptions_String

data_test.go:14–46  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

12var emptyOptions = Options{}
13
14func TestOptions_String(t *testing.T) {
15 tests := []struct {
16 Options Options
17 String string
18 }{
19 {
20 emptyOptions,
21 "0x0",
22 },
23 {
24 Options{Width: 1, Height: 2, Fit: true, Rotate: 90, FlipVertical: true, FlipHorizontal: true, Quality: 80},
25 "1x2,fh,fit,fv,q80,r90",
26 },
27 {
28 Options{Width: 0.15, Height: 1.3, Rotate: 45, Quality: 95, Signature: "c0ffee", Format: "png"},
29 "0.15x1.3,png,q95,r45,sc0ffee",
30 },
31 {
32 Options{Width: 0.15, Height: 1.3, CropX: 100, CropY: 200},
33 "0.15x1.3,cx100,cy200",
34 },
35 {
36 Options{ScaleUp: true, CropX: 100, CropY: 200, CropWidth: 300, CropHeight: 400, SmartCrop: true},
37 "0x0,ch400,cw300,cx100,cy200,sc,scaleUp",
38 },
39 }
40
41 for i, tt := range tests {
42 if got, want := tt.Options.String(), tt.String; got != want {
43 t.Errorf("%d. Options.String returned %v, want %v", i, got, want)
44 }
45 }
46}
47
48func TestParseOptions(t *testing.T) {
49 tests := []struct {

Callers

nothing calls this directly

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected