HEIC: Add iPhone 15 Pro file samples and update related tests #3852

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer 2023-10-31 12:39:36 +01:00
parent 948417f97e
commit b07609c213
8 changed files with 442 additions and 108 deletions

Binary file not shown.

View file

@ -0,0 +1,153 @@
[{
"SourceFile": "iphone_15_pro.heic",
"ExifToolVersion": 12.40,
"FileName": "iphone_15_pro.heic",
"Directory": ".",
"FileSize": 886825,
"FileModifyDate": "2023:10:31 11:48:48+01:00",
"FileAccessDate": "2023:10:31 11:51:22+01:00",
"FileInodeChangeDate": "2023:10:31 11:50:11+01:00",
"FilePermissions": 100664,
"FileType": "HEIC",
"FileTypeExtension": "HEIC",
"MIMEType": "image/heic",
"MajorBrand": "heic",
"MinorVersion": "0.0.0",
"CompatibleBrands": ["mif1","MiHE","MiPr","miaf","MiHB","heic"],
"HandlerType": "pict",
"PrimaryItemReference": 49,
"MetaImageSize": "0 1287 4032 3024",
"XMPToolkit": "XMP Core 6.0.0",
"HDRGainMapHeadroom": 3.847906,
"HDRGainMapVersion": 131072,
"ExifByteOrder": "MM",
"Make": "Apple",
"Model": "iPhone 15 Pro",
"Orientation": 6,
"XResolution": 72,
"YResolution": 72,
"ResolutionUnit": 2,
"Software": 17.1,
"ModifyDate": "2023:10:31 11:44:43",
"HostComputer": "iPhone 15 Pro",
"ExposureTime": 0.01666666667,
"FNumber": 2.2,
"ExposureProgram": 2,
"ISO": 400,
"ExifVersion": "0232",
"DateTimeOriginal": "2023:10:31 11:44:43",
"CreateDate": "2023:10:31 11:44:43",
"OffsetTime": "+01:00",
"OffsetTimeOriginal": "+01:00",
"OffsetTimeDigitized": "+01:00",
"ShutterSpeedValue": 0.0165679999782223,
"ApertureValue": 2.20000000038133,
"BrightnessValue": 2.15000162,
"ExposureCompensation": 0,
"MeteringMode": 5,
"Flash": 16,
"FocalLength": 2.22,
"SubjectArea": "2015 1511 2323 1330",
"RunTimeFlags": 1,
"RunTimeValue": 154455128730208,
"RunTimeScale": 1000000000,
"RunTimeEpoch": 0,
"AccelerationVector": "-0.004213878416 -1.002046108 -0.01470538881",
"Warning": "[minor] Bad format (16) for MakerNotes entry 10",
"SubSecTimeOriginal": 432,
"SubSecTimeDigitized": 432,
"ColorSpace": 65535,
"ExifImageWidth": 4032,
"ExifImageHeight": 3024,
"SensingMethod": 2,
"SceneType": 1,
"ExposureMode": 0,
"WhiteBalance": 0,
"FocalLengthIn35mmFormat": 14,
"LensInfo": "2.22 9 1.779999971 2.8",
"LensMake": "Apple",
"LensModel": "iPhone 15 Pro back triple camera 2.22mm f/2.2",
"CompositeImage": 2,
"GPSLatitudeRef": "N",
"GPSLongitudeRef": "E",
"GPSAltitudeRef": 0,
"GPSTimeStamp": "10:44:43",
"GPSSpeedRef": "K",
"GPSSpeed": 0,
"GPSImgDirectionRef": "T",
"GPSImgDirection": 101.3112946,
"GPSDestBearingRef": "T",
"GPSDestBearing": 101.3112946,
"GPSDateStamp": "2023:10:31",
"GPSHPositioningError": 14.275587,
"ProfileCMMType": "appl",
"ProfileVersion": 1024,
"ProfileClass": "mntr",
"ColorSpaceData": "RGB ",
"ProfileConnectionSpace": "XYZ ",
"ProfileDateTime": "2022:01:01 00:00:00",
"ProfileFileSignature": "acsp",
"PrimaryPlatform": "APPL",
"CMMFlags": 0,
"DeviceManufacturer": "APPL",
"DeviceModel": "",
"DeviceAttributes": "0 0",
"RenderingIntent": 0,
"ConnectionSpaceIlluminant": "0.9642 1 0.82491",
"ProfileCreator": "appl",
"ProfileID": "236 253 163 142 56 133 71 195 109 180 189 79 122 218 24 47",
"ProfileDescription": "Display P3",
"ProfileCopyright": "Copyright Apple Inc., 2022",
"MediaWhitePoint": "0.96419 1 0.82489",
"RedMatrixColumn": "0.51512 0.2412 -0.00105",
"GreenMatrixColumn": "0.29198 0.69225 0.04189",
"BlueMatrixColumn": "0.1571 0.06657 0.78407",
"RedTRC": "(Binary data 32 bytes, use -b option to extract)",
"ChromaticAdaptation": "1.04788 0.02292 -0.0502 0.02959 0.99048 -0.01706 -0.00923 0.01508 0.75168",
"BlueTRC": "(Binary data 32 bytes, use -b option to extract)",
"GreenTRC": "(Binary data 32 bytes, use -b option to extract)",
"HEVCConfigurationVersion": 1,
"GeneralProfileSpace": 0,
"GeneralTierFlag": 0,
"GeneralProfileIDC": 3,
"GenProfileCompatibilityFlags": 1879048192,
"ConstraintIndicatorFlags": "176 0 0 0 0 0",
"GeneralLevelIDC": 90,
"MinSpatialSegmentationIDC": 0,
"ParallelismType": 0,
"ChromaFormat": 1,
"BitDepthLuma": 8,
"BitDepthChroma": 8,
"AverageFrameRate": 0,
"ConstantFrameRate": 0,
"NumTemporalLayers": 1,
"TemporalIDNested": 0,
"ImageWidth": 4032,
"ImageHeight": 3024,
"ImageSpatialExtent": "4032 3024",
"Rotation": 270,
"ImagePixelDepth": 8,
"AuxiliaryImageType": "urn:com:apple:photo:2020:aux:hdrgainmap",
"MediaDataSize": 882139,
"MediaDataOffset": 4686,
"RunTimeSincePowerUp": 154455.128730208,
"Aperture": 2.2,
"ImageSize": "4032 3024",
"Megapixels": 12.192768,
"ScaleFactor35efl": 6.30630630630631,
"ShutterSpeed": 0.01666666667,
"SubSecCreateDate": "2023:10:31 11:44:43.432+01:00",
"SubSecDateTimeOriginal": "2023:10:31 11:44:43.432+01:00",
"SubSecModifyDate": "2023:10:31 11:44:43+01:00",
"GPSAltitude": 50.15664187,
"GPSDateTime": "2023:10:31 10:44:43Z",
"GPSLatitude": 52.4596055555556,
"GPSLongitude": 13.3218416666667,
"CircleOfConfusion": "0.00476447847114884",
"FOV": 104.250120754113,
"FocalLength35efl": 14,
"GPSPosition": "52.4596055555556 13.3218416666667",
"HyperfocalDistance": 0.470184057236731,
"LightValue": 6.18189764281985,
"LensID": "iPhone 15 Pro back triple camera 2.22mm f/2.2"
}]

View file

@ -11,11 +11,11 @@ import (
)
func TestConvert_ToJson(t *testing.T) {
conf := config.TestConfig()
convert := NewConvert(conf)
c := config.TestConfig()
convert := NewConvert(c)
t.Run("gopher-video.mp4", func(t *testing.T) {
fileName := filepath.Join(conf.ExamplesPath(), "gopher-video.mp4")
fileName := filepath.Join(c.ExamplesPath(), "gopher-video.mp4")
assert.Truef(t, fs.FileExists(fileName), "input file does not exist: %s", fileName)
@ -41,7 +41,7 @@ func TestConvert_ToJson(t *testing.T) {
})
t.Run("IMG_4120.JPG", func(t *testing.T) {
fileName := filepath.Join(conf.ExamplesPath(), "IMG_4120.JPG")
fileName := filepath.Join(c.ExamplesPath(), "IMG_4120.JPG")
assert.Truef(t, fs.FileExists(fileName), "input file does not exist: %s", fileName)
mf, err := NewMediaFile(fileName)
@ -66,7 +66,33 @@ func TestConvert_ToJson(t *testing.T) {
})
t.Run("iphone_7.heic", func(t *testing.T) {
fileName := conf.ExamplesPath() + "/iphone_7.heic"
fileName := c.ExamplesPath() + "/iphone_7.heic"
assert.True(t, fs.FileExists(fileName))
mf, err := NewMediaFile(fileName)
if err != nil {
t.Fatal(err)
}
jsonName, err := convert.ToJson(mf, false)
if err != nil {
t.Fatal(err)
}
if jsonName == "" {
t.Fatal("json file name should not be empty")
}
assert.FileExists(t, jsonName)
_ = os.Remove(jsonName)
})
t.Run("iphone_15_pro.heic", func(t *testing.T) {
fileName := c.ExamplesPath() + "/iphone_15_pro.heic"
assert.True(t, fs.FileExists(fileName))

View file

@ -10,10 +10,10 @@ import (
)
func TestMediaFile_Location(t *testing.T) {
t.Run("iphone_7.heic", func(t *testing.T) {
conf := config.TestConfig()
c := config.TestConfig()
mediaFile, err := NewMediaFile(conf.ExamplesPath() + "/iphone_7.heic")
t.Run("iphone_7.heic", func(t *testing.T) {
mediaFile, err := NewMediaFile(c.ExamplesPath() + "/iphone_7.heic")
if err != nil {
t.Fatal(err)
@ -47,10 +47,45 @@ func TestMediaFile_Location(t *testing.T) {
assert.Equal(t, "姫路市", location2.City())
assert.Equal(t, "兵庫県", location2.State())
})
t.Run("cat_brown.jpg", func(t *testing.T) {
conf := config.TestConfig()
t.Run("iphone_15_pro.heic", func(t *testing.T) {
mediaFile, err := NewMediaFile(c.ExamplesPath() + "/iphone_15_pro.heic")
f, err := NewMediaFile(conf.ExamplesPath() + "/cat_brown.jpg")
if err != nil {
t.Fatal(err)
}
location, err := mediaFile.Location()
if err != nil {
t.Fatal(err)
}
if err = location.Find("places"); err != nil {
t.Fatal(err)
}
assert.Equal(t, "Berlin", location.City())
assert.Equal(t, "Berlin", location.State())
assert.Equal(t, "Steglitz", location.District())
assert.Equal(t, "Zimmermannstraße", location.Street())
assert.Equal(t, "Germany", location.CountryName())
assert.Equal(t, "", location.Category())
location2, err := mediaFile.Location()
if err != nil {
t.Fatal(err)
}
if err = location.Find("places"); err != nil {
t.Fatal(err)
}
assert.Equal(t, "Berlin", location2.City())
assert.Equal(t, "Berlin", location2.State())
})
t.Run("cat_brown.jpg", func(t *testing.T) {
f, err := NewMediaFile(c.ExamplesPath() + "/cat_brown.jpg")
if err != nil {
t.Fatal(err)
@ -72,9 +107,7 @@ func TestMediaFile_Location(t *testing.T) {
assert.True(t, strings.HasPrefix(loc.ID, s2.TokenPrefix+"4799e4a5"))
})
t.Run("dog_orange.jpg", func(t *testing.T) {
conf := config.TestConfig()
mediaFile, err := NewMediaFile(conf.ExamplesPath() + "/dog_orange.jpg")
mediaFile, err := NewMediaFile(c.ExamplesPath() + "/dog_orange.jpg")
if err != nil {
t.Fatal(err)
@ -87,9 +120,7 @@ func TestMediaFile_Location(t *testing.T) {
}
})
t.Run("Random.docx", func(t *testing.T) {
conf := config.TestConfig()
mediaFile, err := NewMediaFile(conf.ExamplesPath() + "/Random.docx")
mediaFile, err := NewMediaFile(c.ExamplesPath() + "/Random.docx")
if err != nil {
t.Fatal(err)

View file

@ -0,0 +1,149 @@
package photoprism
import (
"os"
"path/filepath"
"testing"
"github.com/stretchr/testify/assert"
"github.com/photoprism/photoprism/internal/config"
"github.com/photoprism/photoprism/internal/meta"
)
func TestMediaFile_HEIC(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode.")
}
c := config.TestConfig()
t.Run("iphone_7.heic", func(t *testing.T) {
img, err := NewMediaFile(filepath.Join(conf.ExamplesPath(), "iphone_7.heic"))
if err != nil {
t.Fatal(err)
}
info := img.MetaData()
assert.IsType(t, meta.Data{}, info)
convert := NewConvert(conf)
// Create JPEG image.
jpeg, err := convert.ToImage(img, false)
if err != nil {
t.Fatal(err)
}
// Replace JPEG image.
jpeg, err = convert.ToImage(img, true)
if err != nil {
t.Fatal(err)
}
t.Logf("JPEG FILENAME: %s", jpeg.FileName())
assert.Nil(t, err)
jpegInfo := jpeg.MetaData()
assert.IsType(t, meta.Data{}, jpegInfo)
assert.Nil(t, err)
assert.Equal(t, "", jpegInfo.DocumentID)
assert.Equal(t, "2018-09-10 03:16:13 +0000 UTC", jpegInfo.TakenAt.String())
assert.Equal(t, "2018-09-10 12:16:13 +0000 UTC", jpegInfo.TakenAtLocal.String())
// KNOWN ISSUE: Orientation 6 would be correct instead (or the image should already be rotated),
// see https://github.com/strukturag/libheif/issues/227#issuecomment-1532842570
assert.Equal(t, 1, jpegInfo.Orientation)
assert.Equal(t, "iPhone 7", jpegInfo.CameraModel)
assert.Equal(t, "Apple", jpegInfo.CameraMake)
assert.Equal(t, "iPhone 7 back camera 3.99mm f/1.8", jpegInfo.LensModel)
assert.Equal(t, "Apple", jpegInfo.LensMake)
assert.Equal(t, "Asia/Tokyo", jpegInfo.TimeZone)
assert.Equal(t, "", jpegInfo.Artist)
assert.Equal(t, 74, jpegInfo.FocalLength)
assert.Equal(t, "1/4000", jpegInfo.Exposure)
assert.Equal(t, float32(1.696), jpegInfo.Aperture)
assert.Equal(t, 20, jpegInfo.Iso)
assert.Equal(t, float32(34.79745), jpegInfo.Lat)
assert.Equal(t, float32(134.76463), jpegInfo.Lng)
assert.Equal(t, 0.0, jpegInfo.Altitude)
assert.Equal(t, 4032, jpegInfo.Width)
assert.Equal(t, 3024, jpegInfo.Height)
assert.Equal(t, false, jpegInfo.Flash)
assert.Equal(t, "", jpegInfo.Description)
if err = os.Remove(filepath.Join(conf.SidecarPath(), conf.ExamplesPath(), "iphone_7.heic.jpg")); err != nil {
t.Error(err)
}
})
t.Run("iphone_15_pro.heic", func(t *testing.T) {
img, err := NewMediaFile(filepath.Join(c.ExamplesPath(), "iphone_15_pro.heic"))
if err != nil {
t.Fatal(err)
}
info := img.MetaData()
assert.IsType(t, meta.Data{}, info)
convert := NewConvert(c)
// Create JPEG image.
jpeg, err := convert.ToImage(img, false)
if err != nil {
t.Fatal(err)
}
// Replace JPEG image.
jpeg, err = convert.ToImage(img, true)
if err != nil {
t.Fatal(err)
}
t.Logf("JPEG FILENAME: %s", jpeg.FileName())
assert.Nil(t, err)
jpegInfo := jpeg.MetaData()
assert.IsType(t, meta.Data{}, jpegInfo)
assert.Nil(t, err)
assert.Equal(t, "", jpegInfo.DocumentID)
assert.Equal(t, "2023-10-31 10:44:43 +0000 UTC", jpegInfo.TakenAt.String())
assert.Equal(t, "2023-10-31 11:44:43 +0000 UTC", jpegInfo.TakenAtLocal.String())
assert.Equal(t, 1, jpegInfo.Orientation)
assert.Equal(t, "iPhone 15 Pro", jpegInfo.CameraModel)
assert.Equal(t, "Apple", jpegInfo.CameraMake)
assert.Equal(t, "iPhone 15 Pro back triple camera 2.22mm f/2.2", jpegInfo.LensModel)
assert.Equal(t, "Apple", jpegInfo.LensMake)
assert.Equal(t, "Europe/Berlin", jpegInfo.TimeZone)
assert.Equal(t, "", jpegInfo.Artist)
assert.Equal(t, 14, jpegInfo.FocalLength)
assert.Equal(t, "1/60", jpegInfo.Exposure)
assert.Equal(t, float32(2.275), jpegInfo.Aperture)
assert.Equal(t, 400, jpegInfo.Iso)
assert.Equal(t, float32(52.459606), jpegInfo.Lat)
assert.Equal(t, float32(13.321841), jpegInfo.Lng)
assert.Equal(t, 50.0, jpegInfo.Altitude)
assert.Equal(t, 4032, jpegInfo.Width)
assert.Equal(t, 3024, jpegInfo.Height)
assert.Equal(t, false, jpegInfo.Flash)
assert.Equal(t, "", jpegInfo.Description)
if err = os.Remove(filepath.Join(c.SidecarPath(), c.ExamplesPath(), "iphone_15_pro.heic.jpg")); err != nil {
t.Error(err)
}
})
}

View file

@ -17,10 +17,10 @@ import (
)
func TestMediaFile_HasSidecarJson(t *testing.T) {
t.Run("false", func(t *testing.T) {
conf := config.TestConfig()
c := config.TestConfig()
mediaFile, err := NewMediaFile(conf.ExamplesPath() + "/beach_wood.jpg")
t.Run("false", func(t *testing.T) {
mediaFile, err := NewMediaFile(c.ExamplesPath() + "/beach_wood.jpg")
if err != nil {
t.Fatal(err)
@ -29,9 +29,7 @@ func TestMediaFile_HasSidecarJson(t *testing.T) {
assert.False(t, mediaFile.HasSidecarJson())
})
t.Run("true", func(t *testing.T) {
conf := config.TestConfig()
mediaFile, err := NewMediaFile(conf.ExamplesPath() + "/blue-go-video.mp4")
mediaFile, err := NewMediaFile(c.ExamplesPath() + "/blue-go-video.mp4")
if err != nil {
t.Fatal(err)
@ -40,9 +38,7 @@ func TestMediaFile_HasSidecarJson(t *testing.T) {
assert.True(t, mediaFile.HasSidecarJson())
})
t.Run("true", func(t *testing.T) {
conf := config.TestConfig()
mediaFile, err := NewMediaFile(conf.ExamplesPath() + "/blue-go-video.mp4.json")
mediaFile, err := NewMediaFile(c.ExamplesPath() + "/blue-go-video.mp4.json")
if err != nil {
t.Fatal(err)
@ -53,10 +49,10 @@ func TestMediaFile_HasSidecarJson(t *testing.T) {
}
func TestMediaFile_SidecarJsonName(t *testing.T) {
t.Run("false", func(t *testing.T) {
conf := config.TestConfig()
c := config.TestConfig()
mediaFile, err := NewMediaFile(conf.ExamplesPath() + "/beach_sand.jpg")
t.Run("false", func(t *testing.T) {
mediaFile, err := NewMediaFile(c.ExamplesPath() + "/beach_sand.jpg")
if err != nil {
t.Fatal(err)
@ -65,9 +61,7 @@ func TestMediaFile_SidecarJsonName(t *testing.T) {
assert.Equal(t, "", mediaFile.SidecarJsonName())
})
t.Run("true", func(t *testing.T) {
conf := config.TestConfig()
mediaFile, err := NewMediaFile(conf.ExamplesPath() + "/blue-go-video.mp4")
mediaFile, err := NewMediaFile(c.ExamplesPath() + "/blue-go-video.mp4")
if err != nil {
t.Fatal(err)
@ -368,76 +362,6 @@ func TestMediaFile_Exif_DNG(t *testing.T) {
assert.NotEmpty(t, info.Height)
}
func TestMediaFile_Exif_HEIC(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode.")
}
conf := config.TestConfig()
img, err := NewMediaFile(filepath.Join(conf.ExamplesPath(), "iphone_7.heic"))
if err != nil {
t.Fatal(err)
}
info := img.MetaData()
assert.IsType(t, meta.Data{}, info)
convert := NewConvert(conf)
// Create JPEG image.
jpeg, err := convert.ToImage(img, false)
if err != nil {
t.Fatal(err)
}
// Replace JPEG image.
jpeg, err = convert.ToImage(img, true)
if err != nil {
t.Fatal(err)
}
t.Logf("JPEG FILENAME: %s", jpeg.FileName())
assert.Nil(t, err)
jpegInfo := jpeg.MetaData()
assert.IsType(t, meta.Data{}, jpegInfo)
assert.Nil(t, err)
assert.Equal(t, "", jpegInfo.DocumentID)
assert.Equal(t, "2018-09-10 03:16:13 +0000 UTC", jpegInfo.TakenAt.String())
assert.Equal(t, "2018-09-10 12:16:13 +0000 UTC", jpegInfo.TakenAtLocal.String())
assert.Equal(t, 6, jpegInfo.Orientation)
assert.Equal(t, "iPhone 7", jpegInfo.CameraModel)
assert.Equal(t, "Apple", jpegInfo.CameraMake)
assert.Equal(t, "iPhone 7 back camera 3.99mm f/1.8", jpegInfo.LensModel)
assert.Equal(t, "Apple", jpegInfo.LensMake)
assert.Equal(t, "Asia/Tokyo", jpegInfo.TimeZone)
assert.Equal(t, "", jpegInfo.Artist)
assert.Equal(t, 74, jpegInfo.FocalLength)
assert.Equal(t, "1/4000", jpegInfo.Exposure)
assert.Equal(t, float32(1.696), jpegInfo.Aperture)
assert.Equal(t, 20, jpegInfo.Iso)
assert.Equal(t, float32(34.79745), jpegInfo.Lat)
assert.Equal(t, float32(134.76463), jpegInfo.Lng)
assert.Equal(t, 0.0, jpegInfo.Altitude)
assert.Equal(t, 4032, jpegInfo.Width)
assert.Equal(t, 3024, jpegInfo.Height)
assert.Equal(t, false, jpegInfo.Flash)
assert.Equal(t, "", jpegInfo.Description)
if err := os.Remove(filepath.Join(conf.SidecarPath(), conf.ExamplesPath(), "iphone_7.heic.jpg")); err != nil {
t.Error(err)
}
}
func TestMediaFile_VideoInfo(t *testing.T) {
c := config.TestConfig()
t.Run(

View file

@ -113,6 +113,38 @@ func TestMediaFile_RelatedFiles(t *testing.T) {
}
})
t.Run("iphone_15_pro.heic", func(t *testing.T) {
mediaFile, err := NewMediaFile(c.ExamplesPath() + "/iphone_15_pro.heic")
if err != nil {
t.Fatal(err)
}
expectedBaseFilename := c.ExamplesPath() + "/iphone_15_pro"
related, err := mediaFile.RelatedFiles(true)
if err != nil {
t.Fatal(err)
}
assert.GreaterOrEqual(t, len(related.Files), 2)
for _, result := range related.Files {
t.Logf("FileName: %s", result.FileName())
filename := result.FileName()
extension := result.Extension()
baseFilename := filename[0 : len(filename)-len(extension)]
if result.IsJpeg() {
assert.Contains(t, expectedBaseFilename, "examples/iphone_15_pro")
} else {
assert.Equal(t, expectedBaseFilename, baseFilename)
}
}
})
t.Run("2015-02-04.jpg", func(t *testing.T) {
mediaFile, err := NewMediaFile("testdata/2015-02-04.jpg")

View file

@ -77,6 +77,15 @@ func TestMediaFile_DateCreated(t *testing.T) {
date := mediaFile.DateCreated().UTC()
assert.Equal(t, "2018-09-10 03:16:13 +0000 UTC", date.String())
})
t.Run("iphone_15_pro.heic", func(t *testing.T) {
mediaFile, err := NewMediaFile(conf.ExamplesPath() + "/iphone_15_pro.heic")
if err != nil {
t.Fatal(err)
}
date := mediaFile.DateCreated().UTC()
assert.Equal(t, "2023-10-31 10:44:43 +0000 UTC", date.String())
assert.Equal(t, "2023-10-31 10:44:43 +0000 UTC", mediaFile.DateCreated().String())
})
t.Run("canon_eos_6d.dng", func(t *testing.T) {
mediaFile, err := NewMediaFile(conf.ExamplesPath() + "/canon_eos_6d.dng")
if err != nil {
@ -1946,22 +1955,32 @@ func TestMediaFile_AspectRatio(t *testing.T) {
}
func TestMediaFile_Orientation(t *testing.T) {
t.Run("iphone_7.heic", func(t *testing.T) {
conf := config.TestConfig()
c := config.TestConfig()
mediaFile, err := NewMediaFile(conf.ExamplesPath() + "/iphone_7.heic")
t.Run("iphone_7.heic", func(t *testing.T) {
mediaFile, err := NewMediaFile(c.ExamplesPath() + "/iphone_7.heic")
if err != nil {
t.Fatal(err)
}
orientation := mediaFile.Orientation()
assert.Equal(t, 6, orientation)
})
t.Run("iphone_15_pro.heic", func(t *testing.T) {
mediaFile, err := NewMediaFile(c.ExamplesPath() + "/iphone_15_pro.heic")
if err != nil {
t.Fatal(err)
}
orientation := mediaFile.Orientation()
assert.Equal(t, 6, orientation)
})
t.Run("turtle_brown_blue.jpg", func(t *testing.T) {
conf := config.TestConfig()
mediaFile, err := NewMediaFile(conf.ExamplesPath() + "/turtle_brown_blue.jpg")
mediaFile, err := NewMediaFile(c.ExamplesPath() + "/turtle_brown_blue.jpg")
if err != nil {
t.Fatal(err)