Skip to content

Commit

Permalink
fix(tests): add libvips 8.10 exception
Browse files Browse the repository at this point in the history
  • Loading branch information
h2non committed Aug 12, 2020
1 parent 83cc123 commit eb05f06
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
11 changes: 8 additions & 3 deletions image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,17 +346,22 @@ func TestImageRotate(t *testing.T) {
}

func TestImageAutoRotate(t *testing.T) {
if VipsMajorVersion <= 8 && VipsMinorVersion < 10 {
t.Skip("Skip test in libvips < 8.10")
return
}

tests := []struct {
file string
orientation int
}{
{"exif/Landscape_1.jpg", 1},
{"exif/Landscape_2.jpg", 2},
{"exif/Landscape_2.jpg", 1},
{"exif/Landscape_3.jpg", 1},
{"exif/Landscape_4.jpg", 4},
{"exif/Landscape_4.jpg", 1},
{"exif/Landscape_5.jpg", 5},
{"exif/Landscape_6.jpg", 1},
{"exif/Landscape_7.jpg", 7},
{"exif/Landscape_7.jpg", 1},
}

for index, test := range tests {
Expand Down
1 change: 1 addition & 0 deletions metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package bimg
*/
import "C"

// Common EXIF fields for data extraction
const (
Make = "exif-ifd0-Make"
Model = "exif-ifd0-Model"
Expand Down
10 changes: 7 additions & 3 deletions metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ func TestMetadata(t *testing.T) {
if err != nil {
t.Fatalf("Cannot read the image: %s -> %s", file.name, err)
}

if metadata.Type != file.format {
t.Fatalf("Unexpected image format: %s", file.format)
}
Expand Down Expand Up @@ -90,6 +89,11 @@ func TestImageInterpretation(t *testing.T) {
}

func TestEXIF(t *testing.T) {
if VipsMajorVersion <= 8 && VipsMinorVersion < 10 {
t.Skip("Skip test in libvips < 8.10")
return
}

files := map[string]EXIF {
"test.jpg": {},
"exif/Landscape_1.jpg": {
Expand All @@ -104,8 +108,8 @@ func TestEXIF(t *testing.T) {
"test_exif.jpg": {
Make: "Jolla",
Model: "Jolla",
XResolution: "25400/1000",
YResolution: "25400/1000",
XResolution: "72/1",
YResolution: "72/1",
ResolutionUnit: 2,
Orientation: 1,
Datetime: "2014:09:21 16:00:56",
Expand Down
7 changes: 6 additions & 1 deletion vips_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,19 @@ func TestVipsRotate(t *testing.T) {
}

func TestVipsAutoRotate(t *testing.T) {
if VipsMajorVersion <= 8 && VipsMinorVersion < 10 {
t.Skip("Skip test in libvips < 8.10")
return
}

files := []struct {
name string
orientation int
}{
{"test.jpg", 0},
{"test_exif.jpg", 0},
{"exif/Landscape_1.jpg", 0},
{"exif/Landscape_2.jpg", 2},
{"exif/Landscape_2.jpg", 0},
{"exif/Landscape_3.jpg", 0},
{"exif/Landscape_4.jpg", 4},
{"exif/Landscape_5.jpg", 5},
Expand Down

0 comments on commit eb05f06

Please sign in to comment.