mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-13 09:20:29 -07:00
Adding a test, verifying both ways of enabling SmartCrop work
This commit is contained in:
parent
855de7ca55
commit
33bf9bdff6
4 changed files with 63 additions and 13 deletions
|
|
@ -456,20 +456,23 @@ func TestFluentInterface(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestImageSmartCrop(t *testing.T) {
|
||||
if VipsMajorVersion >= 8 && VipsMinorVersion > 4 {
|
||||
i := initImage("northern_cardinal_bird.jpg")
|
||||
buf, err := i.SmartCrop(300, 300)
|
||||
if err != nil {
|
||||
t.Errorf("Cannot process the image: %#v", err)
|
||||
}
|
||||
|
||||
err = assertSize(buf, 300, 300)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
Write("fixtures/test_smart_crop.jpg", buf)
|
||||
if !(VipsMajorVersion >= 8 && VipsMinorVersion > 4) {
|
||||
t.Skipf("Skipping this test, libvips doesn't meet version requirement %s > 8.4", VipsVersion)
|
||||
}
|
||||
|
||||
i := initImage("northern_cardinal_bird.jpg")
|
||||
buf, err := i.SmartCrop(300, 300)
|
||||
if err != nil {
|
||||
t.Errorf("Cannot process the image: %#v", err)
|
||||
}
|
||||
|
||||
err = assertSize(buf, 300, 300)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
Write("fixtures/test_smart_crop.jpg", buf)
|
||||
}
|
||||
|
||||
func initImage(file string) *Image {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue