fix(tests): add libvips 8.10 exception

This commit is contained in:
Tomas 2020-08-12 16:26:29 +02:00
parent 83cc123eb2
commit eb05f0644e
4 changed files with 22 additions and 7 deletions

View file

@ -346,17 +346,22 @@ func TestImageRotate(t *testing.T) {
} }
func TestImageAutoRotate(t *testing.T) { func TestImageAutoRotate(t *testing.T) {
if VipsMajorVersion <= 8 && VipsMinorVersion < 10 {
t.Skip("Skip test in libvips < 8.10")
return
}
tests := []struct { tests := []struct {
file string file string
orientation int orientation int
}{ }{
{"exif/Landscape_1.jpg", 1}, {"exif/Landscape_1.jpg", 1},
{"exif/Landscape_2.jpg", 2}, {"exif/Landscape_2.jpg", 1},
{"exif/Landscape_3.jpg", 1}, {"exif/Landscape_3.jpg", 1},
{"exif/Landscape_4.jpg", 4}, {"exif/Landscape_4.jpg", 1},
{"exif/Landscape_5.jpg", 5}, {"exif/Landscape_5.jpg", 5},
{"exif/Landscape_6.jpg", 1}, {"exif/Landscape_6.jpg", 1},
{"exif/Landscape_7.jpg", 7}, {"exif/Landscape_7.jpg", 1},
} }
for index, test := range tests { for index, test := range tests {

View file

@ -6,6 +6,7 @@ package bimg
*/ */
import "C" import "C"
// Common EXIF fields for data extraction
const ( const (
Make = "exif-ifd0-Make" Make = "exif-ifd0-Make"
Model = "exif-ifd0-Model" Model = "exif-ifd0-Model"

View file

@ -49,7 +49,6 @@ func TestMetadata(t *testing.T) {
if err != nil { if err != nil {
t.Fatalf("Cannot read the image: %s -> %s", file.name, err) t.Fatalf("Cannot read the image: %s -> %s", file.name, err)
} }
if metadata.Type != file.format { if metadata.Type != file.format {
t.Fatalf("Unexpected image format: %s", file.format) t.Fatalf("Unexpected image format: %s", file.format)
} }
@ -90,6 +89,11 @@ func TestImageInterpretation(t *testing.T) {
} }
func TestEXIF(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 { files := map[string]EXIF {
"test.jpg": {}, "test.jpg": {},
"exif/Landscape_1.jpg": { "exif/Landscape_1.jpg": {
@ -104,8 +108,8 @@ func TestEXIF(t *testing.T) {
"test_exif.jpg": { "test_exif.jpg": {
Make: "Jolla", Make: "Jolla",
Model: "Jolla", Model: "Jolla",
XResolution: "25400/1000", XResolution: "72/1",
YResolution: "25400/1000", YResolution: "72/1",
ResolutionUnit: 2, ResolutionUnit: 2,
Orientation: 1, Orientation: 1,
Datetime: "2014:09:21 16:00:56", Datetime: "2014:09:21 16:00:56",

View file

@ -83,6 +83,11 @@ func TestVipsRotate(t *testing.T) {
} }
func TestVipsAutoRotate(t *testing.T) { func TestVipsAutoRotate(t *testing.T) {
if VipsMajorVersion <= 8 && VipsMinorVersion < 10 {
t.Skip("Skip test in libvips < 8.10")
return
}
files := []struct { files := []struct {
name string name string
orientation int orientation int
@ -90,7 +95,7 @@ func TestVipsAutoRotate(t *testing.T) {
{"test.jpg", 0}, {"test.jpg", 0},
{"test_exif.jpg", 0}, {"test_exif.jpg", 0},
{"exif/Landscape_1.jpg", 0}, {"exif/Landscape_1.jpg", 0},
{"exif/Landscape_2.jpg", 2}, {"exif/Landscape_2.jpg", 0},
{"exif/Landscape_3.jpg", 0}, {"exif/Landscape_3.jpg", 0},
{"exif/Landscape_4.jpg", 4}, {"exif/Landscape_4.jpg", 4},
{"exif/Landscape_5.jpg", 5}, {"exif/Landscape_5.jpg", 5},