Skip to content
Permalink
Browse files

Add some CMYK and CIELAB TIFF test images.

  • Loading branch information...
aaron42net committed Dec 30, 2018
1 parent 52ae524 commit d600526fffec7dbb5cb0e3643cc682f42c47ced1
@@ -2,5 +2,5 @@ package main

const (
// FotomatVersion is updated by git-hooks/pre-commit
FotomatVersion = "2.9.259"
FotomatVersion = "2.9.262"
)
BIN +350 Bytes (220%) testdata/2px.tiff
Binary file not shown.
BIN +290 Bytes testdata/cielab.tiff
Binary file not shown.
BIN +308 Bytes testdata/cmyk.tiff
Binary file not shown.
@@ -35,9 +35,15 @@ func TestValidation(t *testing.T) {
// Load a 2x2 pixel image.
assert.Nil(t, tryNew("2px.png"))

// Load a CMYK image.
// Load a CMYK JPEG.
assert.Nil(t, tryNew("cmyk.jpg"))

// Load a CMYK ZIP TIFF.
assert.Nil(t, tryNew("cmyk.tiff"))

// Load a big-endian CIELAB LZW TIFF.
assert.Nil(t, tryNew("cielab.tiff"))

// Return ErrTooBig on a 34000x16 PNG image.
assert.Equal(t, tryNew("34000px.png"), ErrTooBig)

@@ -188,8 +194,11 @@ func TestConversion(t *testing.T) {
{"2px.gif", format.Gif, format.Png},
{"2px.png", format.Png, format.Png},
{"2px.jpg", format.Jpeg, format.Jpeg},
{"cmyk.jpg", format.Jpeg, format.Jpeg},
{"2px.webp", format.Webp, format.Png},
{"2px.tiff", format.Tiff, format.Png},
{"cmyk.tiff", format.Tiff, format.Png},
{"cielab.tiff", format.Tiff, format.Png},
{"2px.pdf", format.Pdf, format.Png},
{"2px.svg", format.Svg, format.Png},
}
@@ -210,6 +219,13 @@ func TestConversion(t *testing.T) {
assert.Nil(t, isSize(thumb, of, 2, 3, alpha), "formats: %s -> %s", f.in, of)
}
}

// If we ask for lossless, it should match the outLossless format.
thumb, err := Thumbnail(img, Options{Width: 1024, Height: 1024, Save: format.SaveOptions{Lossless: true}})
if assert.Nil(t, err, "lossless: %s", f.in) {
alpha := f.in == format.Svg
assert.Nil(t, isSize(thumb, f.outLossless, 2, 3, alpha), "lossless: %s", f.in)
}
}

}

0 comments on commit d600526

Please sign in to comment.
You can’t perform that action at this time.