diff --git a/image_test.go b/image_test.go index 4915d64..aef4b59 100644 --- a/image_test.go +++ b/image_test.go @@ -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 { diff --git a/metadata.go b/metadata.go index 9bd97e3..3bc7516 100644 --- a/metadata.go +++ b/metadata.go @@ -6,6 +6,7 @@ package bimg */ import "C" +// Common EXIF fields for data extraction const ( Make = "exif-ifd0-Make" Model = "exif-ifd0-Model" diff --git a/metadata_test.go b/metadata_test.go index b18bc18..72ce69f 100644 --- a/metadata_test.go +++ b/metadata_test.go @@ -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) } @@ -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": { @@ -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", diff --git a/vips_test.go b/vips_test.go index 5a696f2..b4fb2f2 100644 --- a/vips_test.go +++ b/vips_test.go @@ -83,6 +83,11 @@ 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 @@ -90,7 +95,7 @@ func TestVipsAutoRotate(t *testing.T) { {"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},