Metadata: Revert tests after upgrading go-exif #431

Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
Michael Mayer 2020-08-07 10:38:40 +02:00
parent d2eccd00c0
commit 3ffe74a7d6
6 changed files with 33 additions and 40 deletions

8
go.mod
View file

@ -6,15 +6,15 @@ require (
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
github.com/disintegration/imaging v1.6.2
github.com/djherbis/times v1.2.0
github.com/dsoprea/go-exif/v2 v2.0.0-20200731080332-74a1612f2042 // indirect
github.com/dsoprea/go-exif/v3 v3.0.0-20200731080332-74a1612f2042
github.com/dsoprea/go-exif/v2 v2.0.0-20200807075213-089aa48c91e6 // indirect
github.com/dsoprea/go-exif/v3 v3.0.0-20200807075213-089aa48c91e6
github.com/dsoprea/go-heic-exif-extractor v0.0.0-20200717090456-b3d9dcddffd1
github.com/dsoprea/go-iptc v0.0.0-20200610044640-bc9ca208b413 // indirect
github.com/dsoprea/go-jpeg-image-structure v0.0.0-20200722150319-963817537a6c
github.com/dsoprea/go-logging v0.0.0-20200710184922-b02d349568dd // indirect
github.com/dsoprea/go-photoshop-info-format v0.0.0-20200610045659-121dd752914d // indirect
github.com/dsoprea/go-png-image-structure v0.0.0-20200717084940-ebc583cbd8bd
github.com/dsoprea/go-tiff-image-structure v0.0.0-20200717073440-8ac81ec8b423
github.com/dsoprea/go-png-image-structure v0.0.0-20200807080309-a98d4e94ac82
github.com/dsoprea/go-tiff-image-structure v0.0.0-20200807080429-5631a803a91b
github.com/dsoprea/go-utility v0.0.0-20200717064901-2fccff4aa15e // indirect
github.com/dustin/go-humanize v1.0.0
github.com/gin-gonic/gin v1.6.3

8
go.sum
View file

@ -48,9 +48,13 @@ github.com/dsoprea/go-exif/v2 v2.0.0-20200520183328-015129a9efd5/go.mod h1:9EXlP
github.com/dsoprea/go-exif/v2 v2.0.0-20200604193436-ca8584a0e1c4/go.mod h1:9EXlPeHfblFFnwu5UOqmP2eoZfJyAZ2Ri/Vki33ajO0=
github.com/dsoprea/go-exif/v2 v2.0.0-20200731080332-74a1612f2042 h1:FcMmwRzpaLe+hhQ/413BoF55E1wFZs+J5PgQYN8sF1o=
github.com/dsoprea/go-exif/v2 v2.0.0-20200731080332-74a1612f2042/go.mod h1:oKrjk2kb3rAR5NbtSTLUMvMSbc+k8ZosI3MaVH47noc=
github.com/dsoprea/go-exif/v2 v2.0.0-20200807075213-089aa48c91e6 h1:jkmCBceHmez4ArDFqcIrjFhPTTIV2IlWiF/QTeubgOs=
github.com/dsoprea/go-exif/v2 v2.0.0-20200807075213-089aa48c91e6/go.mod h1:oKrjk2kb3rAR5NbtSTLUMvMSbc+k8ZosI3MaVH47noc=
github.com/dsoprea/go-exif/v3 v3.0.0-20200717053412-08f1b6708903/go.mod h1:0nsO1ce0mh5czxGeLo4+OCZ/C6Eo6ZlMWsz7rH/Gxv8=
github.com/dsoprea/go-exif/v3 v3.0.0-20200731080332-74a1612f2042 h1:CtHLMdsG3DQ0Xriz60+KNI6Tq8AjuYFZwtZkG+2SNzw=
github.com/dsoprea/go-exif/v3 v3.0.0-20200731080332-74a1612f2042/go.mod h1:cg5SNYKHMmzxsr9X6ZeLh/nfBRHHp5PngtEPcujONtk=
github.com/dsoprea/go-exif/v3 v3.0.0-20200807075213-089aa48c91e6 h1:AWLaaemM6TvO4DVwMtXibJKpWWfyw+tiZwYUiueLPzE=
github.com/dsoprea/go-exif/v3 v3.0.0-20200807075213-089aa48c91e6/go.mod h1:cg5SNYKHMmzxsr9X6ZeLh/nfBRHHp5PngtEPcujONtk=
github.com/dsoprea/go-heic-exif-extractor v0.0.0-20200717090456-b3d9dcddffd1 h1:R/EEzpxqQxeEcJ/z0EFTI1U6XsuOnepyp5o1uZg5c2E=
github.com/dsoprea/go-heic-exif-extractor v0.0.0-20200717090456-b3d9dcddffd1/go.mod h1:UwRKreeVikXn5OarSnt4OqovcEjsIgZVuc5svj7G5w4=
github.com/dsoprea/go-iptc v0.0.0-20200609062250-162ae6b44feb h1:gwjJjUr6FY7zAWVEueFPrcRHhd9+IK81TcItbqw2du4=
@ -71,8 +75,12 @@ github.com/dsoprea/go-photoshop-info-format v0.0.0-20200610045659-121dd752914d h
github.com/dsoprea/go-photoshop-info-format v0.0.0-20200610045659-121dd752914d/go.mod h1:pqKB+ijp27cEcrHxhXVgUUMlSDRuGJJp1E+20Lj5H0E=
github.com/dsoprea/go-png-image-structure v0.0.0-20200717084940-ebc583cbd8bd h1:6CCSfUqW085rOMWxSqal7/KR8SQcziqolKmZooqiD1s=
github.com/dsoprea/go-png-image-structure v0.0.0-20200717084940-ebc583cbd8bd/go.mod h1:aDYQkL/5gfRNZkoxiLTSWU4Y8/gV/4MVsy/MU9uwTak=
github.com/dsoprea/go-png-image-structure v0.0.0-20200807080309-a98d4e94ac82 h1:RdwKOEEe2ND/JmoKh6I/EQlR9idKJTDOMffPFK6vN2M=
github.com/dsoprea/go-png-image-structure v0.0.0-20200807080309-a98d4e94ac82/go.mod h1:aDYQkL/5gfRNZkoxiLTSWU4Y8/gV/4MVsy/MU9uwTak=
github.com/dsoprea/go-tiff-image-structure v0.0.0-20200717073440-8ac81ec8b423 h1:aIXEGtyKFKqeNW2rc4cx3J2TLxQ9F5fwWPSbq6p6Fq8=
github.com/dsoprea/go-tiff-image-structure v0.0.0-20200717073440-8ac81ec8b423/go.mod h1:we+M+yrq8ifsA33a7C7p8E1ztBbdDYjMIC8RMm8KPL8=
github.com/dsoprea/go-tiff-image-structure v0.0.0-20200807080429-5631a803a91b h1:0RmQug1S1/hpzATPKJzTj1NBG93aFxzYZFKPIXjNkGU=
github.com/dsoprea/go-tiff-image-structure v0.0.0-20200807080429-5631a803a91b/go.mod h1:we+M+yrq8ifsA33a7C7p8E1ztBbdDYjMIC8RMm8KPL8=
github.com/dsoprea/go-utility v0.0.0-20200512094054-1abbbc781176 h1:CfXezFYb2STGOd1+n1HshvE191zVx+QX3A1nML5xxME=
github.com/dsoprea/go-utility v0.0.0-20200512094054-1abbbc781176/go.mod h1:95+K3z2L0mqsVYd6yveIv1lmtT3tcQQ3dVakPySffW8=
github.com/dsoprea/go-utility v0.0.0-20200711062821-fab8125e9bdf h1:/w4QxepU4AHh3AuO6/g8y/YIIHH5+aKP3Bj8sg5cqhU=

View file

@ -18,28 +18,21 @@ func TestExif(t *testing.T) {
// t.Logf("all: %+v", data.All)
assert.Equal(t, "Michael Mayer", data.Artist)
// Expected: 2020-01-01T16:28:23Z
assert.Equal(t, "2020-01-07T10:56:29Z", data.TakenAt.Format("2006-01-02T15:04:05Z"))
// Expected: 2020-01-01T17:28:23Z
assert.Equal(t, "2020-01-07T10:56:29Z", data.TakenAtLocal.Format("2006-01-02T15:04:05Z"))
assert.Equal(t, "2020-01-01T16:28:23Z", data.TakenAt.Format("2006-01-02T15:04:05Z"))
assert.Equal(t, "2020-01-01T17:28:23Z", data.TakenAtLocal.Format("2006-01-02T15:04:05Z"))
assert.Equal(t, "Example file for development", data.Description)
assert.Equal(t, "This is a legal notice", data.Copyright)
// Expected: 540
assert.Equal(t, 2736, data.Height)
// Expected: 720
assert.Equal(t, 3648, data.Width)
// Expected: 52.45969
assert.Equal(t, float32(0), data.Lat)
// Expected: 13.321832
assert.Equal(t, float32(0), data.Lng)
assert.Equal(t, 540, data.Height)
assert.Equal(t, 720, data.Width)
assert.Equal(t, float32(52.45969), data.Lat)
assert.Equal(t, float32(13.321832), data.Lng)
assert.Equal(t, 0, data.Altitude)
// Expected: 1/50
assert.Equal(t, "", data.Exposure)
assert.Equal(t, "1/50", data.Exposure)
assert.Equal(t, "HUAWEI", data.CameraMake)
assert.Equal(t, "ELE-L29", data.CameraModel)
assert.Equal(t, "", data.CameraOwner)
assert.Equal(t, "", data.CameraSerial)
assert.Equal(t, 0, data.FocalLength)
assert.Equal(t, 27, data.FocalLength)
assert.Equal(t, 1, int(data.Orientation))
// TODO: Values are empty - why?
@ -192,10 +185,10 @@ func TestExif(t *testing.T) {
assert.Equal(t, float32(0), data.Lat)
assert.Equal(t, float32(0), data.Lng)
assert.Equal(t, 0, data.Altitude)
assert.Equal(t, "1/1111", data.Exposure)
assert.Equal(t, "1/1100", data.Exposure)
assert.Equal(t, "SAMSUNG", data.CameraMake)
assert.Equal(t, "GT-I9000", data.CameraModel)
assert.Equal(t, 0, data.FocalLength)
assert.Equal(t, 3, data.FocalLength)
assert.Equal(t, 1, data.Orientation)
assert.Equal(t, "", data.LensMake)
assert.Equal(t, "", data.LensModel)

View file

@ -50,30 +50,26 @@ func TestMediaFile_Location(t *testing.T) {
t.Run("cat_brown.jpg", func(t *testing.T) {
conf := config.TestConfig()
mediaFile, err := NewMediaFile(conf.ExamplesPath() + "/cat_brown.jpg")
f, err := NewMediaFile(conf.ExamplesPath() + "/cat_brown.jpg")
if err != nil {
t.Fatal(err)
}
_, err = mediaFile.Location()
loc, err := f.Location()
assert.Error(t, err)
/*
if err != nil {
t.Fatal(err)
}
if err = location.Find("places"); err != nil {
if err = loc.Find("places"); err != nil {
t.Fatal(err)
}
assert.Equal(t, "Tübingen", location.City())
assert.Equal(t, "de", location.CountryCode())
assert.Equal(t, "Germany", location.CountryName())
assert.True(t, strings.HasPrefix(location.ID, s2.TokenPrefix+"4799e4a5"))
*/
assert.Equal(t, "Tübingen", loc.City())
assert.Equal(t, "de", loc.CountryCode())
assert.Equal(t, "Germany", loc.CountryName())
assert.True(t, strings.HasPrefix(loc.ID, s2.TokenPrefix+"4799e4a5"))
})
t.Run("dog_orange.jpg", func(t *testing.T) {
conf := config.TestConfig()

View file

@ -230,8 +230,7 @@ func TestMediaFile_LensModel(t *testing.T) {
t.Fatal(err)
}
assert.Equal(t, "", mediaFile.LensModel())
// Expected: assert.Equal(t, "EF24-105mm f/4L IS USM", mediaFile.LensModel())
assert.Equal(t, "EF24-105mm f/4L IS USM", mediaFile.LensModel())
})
}

View file

@ -155,14 +155,11 @@ func TestMediaFile_Exif_DNG(t *testing.T) {
assert.Equal(t, 1, info.Orientation)
assert.Equal(t, "Canon EOS 6D", info.CameraModel)
assert.Equal(t, "Canon", info.CameraMake)
// Expected: EF24-105mm f/4L IS USM
assert.Equal(t, "", info.LensModel)
assert.Equal(t, "EF24-105mm f/4L IS USM", info.LensModel)
assert.Equal(t, "", info.Artist)
// Expected: 65
assert.Equal(t, 0, info.FocalLength)
assert.Equal(t, 65, info.FocalLength)
assert.Equal(t, "1/60", info.Exposure)
// Expected: float32(4.971)
assert.Equal(t, float32(0), info.Aperture)
assert.Equal(t, float32(4.971), info.Aperture)
assert.Equal(t, 1000, info.Iso)
assert.Equal(t, float32(0), info.Lat)
assert.Equal(t, float32(0), info.Lng)