| 263 | } |
| 264 | |
| 265 | func TestEmbedExtendColor(t *testing.T) { |
| 266 | options := Options{Width: 400, Height: 600, Crop: false, Embed: true, Extend: ExtendWhite, Background: Color{255, 20, 10}} |
| 267 | buf, _ := Read("testdata/test_issue.jpg") |
| 268 | |
| 269 | newImg, err := Resize(buf, options) |
| 270 | if err != nil { |
| 271 | t.Errorf("Resize(imgData, %#v) error: %#v", options, err) |
| 272 | } |
| 273 | |
| 274 | size, _ := Size(newImg) |
| 275 | if size.Height != options.Height || size.Width != options.Width { |
| 276 | t.Fatalf("Invalid image size: %dx%d", size.Width, size.Height) |
| 277 | } |
| 278 | |
| 279 | Write("testdata/test_extend_white_out.jpg", newImg) |
| 280 | } |
| 281 | |
| 282 | func TestEmbedExtendWithCustomColor(t *testing.T) { |
| 283 | options := Options{Width: 400, Height: 600, Crop: false, Embed: true, Extend: 5, Background: Color{255, 20, 10}} |