mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-07 21:48:13 -08:00
Adding trim operation.
Closes #22 Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
This commit is contained in:
parent
b35675c245
commit
c1f2667c0f
8 changed files with 64 additions and 5 deletions
|
|
@ -457,8 +457,8 @@ func TestFluentInterface(t *testing.T) {
|
|||
|
||||
func TestImageSmartCrop(t *testing.T) {
|
||||
|
||||
if !(VipsMajorVersion >= 8 && VipsMinorVersion > 4) {
|
||||
t.Skipf("Skipping this test, libvips doesn't meet version requirement %s > 8.4", VipsVersion)
|
||||
if !(VipsMajorVersion >= 8 && VipsMinorVersion >= 5) {
|
||||
t.Skipf("Skipping this test, libvips doesn't meet version requirement %s >= 8.5", VipsVersion)
|
||||
}
|
||||
|
||||
i := initImage("northern_cardinal_bird.jpg")
|
||||
|
|
@ -475,6 +475,26 @@ func TestImageSmartCrop(t *testing.T) {
|
|||
Write("fixtures/test_smart_crop.jpg", buf)
|
||||
}
|
||||
|
||||
func TestImageTrim(t *testing.T) {
|
||||
|
||||
if !(VipsMajorVersion >= 8 && VipsMinorVersion >= 6) {
|
||||
t.Skipf("Skipping this test, libvips doesn't meet version requirement %s >= 8.6", VipsVersion)
|
||||
}
|
||||
|
||||
i := initImage("transparent.png")
|
||||
buf, err := i.Trim()
|
||||
if err != nil {
|
||||
t.Errorf("Cannot process the image: %#v", err)
|
||||
}
|
||||
|
||||
err = assertSize(buf, 250, 208)
|
||||
if err != nil {
|
||||
t.Errorf("The image wasn't trimmed.")
|
||||
}
|
||||
|
||||
Write("fixtures/transparent_trim.png", buf)
|
||||
}
|
||||
|
||||
func TestImageLength(t *testing.T) {
|
||||
i := initImage("test.jpg")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue