mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-07 21:48:13 -08:00
add more exif data to metadata
This commit is contained in:
parent
9b82aecec1
commit
b38ffd41d1
6 changed files with 118 additions and 6 deletions
|
|
@ -89,6 +89,44 @@ func TestImageInterpretation(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestEXIF(t *testing.T) {
|
||||
files := []struct {
|
||||
name string
|
||||
make string
|
||||
model string
|
||||
orientation int
|
||||
software string
|
||||
datetime string
|
||||
}{
|
||||
{"test.jpg", "", "", 0, "", ""},
|
||||
{"exif/Landscape_1.jpg", "", "", 1, "", ""},
|
||||
{"test_exif.jpg", "Jolla", "Jolla", 1, "", "2014:09:21 16:00:56"},
|
||||
{"test_exif_canon.jpg", "Canon", "Canon EOS 40D", 1, "GIMP 2.4.5", "2008:07:31 10:38:11"},
|
||||
}
|
||||
|
||||
for _, file := range files {
|
||||
metadata, err := Metadata(readFile(file.name))
|
||||
if err != nil {
|
||||
t.Fatalf("Cannot read the image: %s -> %s", file.name, err)
|
||||
}
|
||||
if metadata.EXIF.Make != file.make {
|
||||
t.Fatalf("Unexpected image exif make: %s != %s", metadata.EXIF.Make, file.make)
|
||||
}
|
||||
if metadata.EXIF.Model != file.model {
|
||||
t.Fatalf("Unexpected image exif model: %s != %s", metadata.EXIF.Model, file.model)
|
||||
}
|
||||
if metadata.EXIF.Orientation != file.orientation {
|
||||
t.Fatalf("Unexpected image exif orientation: %d != %d", metadata.EXIF.Orientation, file.orientation)
|
||||
}
|
||||
if metadata.EXIF.Software != file.software {
|
||||
t.Fatalf("Unexpected image exif software: %s != %s", metadata.EXIF.Software, file.software)
|
||||
}
|
||||
if metadata.EXIF.Datetime != file.datetime {
|
||||
t.Fatalf("Unexpected image exif datetime: %s != %s", metadata.EXIF.Datetime, file.datetime)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestColourspaceIsSupported(t *testing.T) {
|
||||
files := []struct {
|
||||
name string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue