(t *testing.T)
| 43 | } |
| 44 | |
| 45 | func TestResizeParams(t *testing.T) { |
| 46 | src := image.NewNRGBA(image.Rect(0, 0, 64, 128)) |
| 47 | tests := []struct { |
| 48 | opt Options |
| 49 | w, h int |
| 50 | resize bool |
| 51 | }{ |
| 52 | {Options{Width: 0.5}, 32, 0, true}, |
| 53 | {Options{Height: 0.5}, 0, 64, true}, |
| 54 | {Options{Width: 0.5, Height: 0.5}, 32, 64, true}, |
| 55 | {Options{Width: 100, Height: 200}, 0, 0, false}, |
| 56 | {Options{Width: 100, Height: 200, ScaleUp: true}, 100, 200, true}, |
| 57 | {Options{Width: 64}, 0, 0, false}, |
| 58 | {Options{Height: 128}, 0, 0, false}, |
| 59 | } |
| 60 | for _, tt := range tests { |
| 61 | w, h, resize := resizeParams(src, tt.opt) |
| 62 | if w != tt.w || h != tt.h || resize != tt.resize { |
| 63 | t.Errorf("resizeParams(%v) returned (%d,%d,%t), want (%d,%d,%t)", tt.opt, w, h, resize, tt.w, tt.h, tt.resize) |
| 64 | } |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | func TestCropParams(t *testing.T) { |
| 69 | src := image.NewNRGBA(image.Rect(0, 0, 64, 128)) |
nothing calls this directly
no test coverage detected