mirror of
https://github.com/photoprism/photoprism.git
synced 2026-01-23 02:24:24 +00:00
* Address Issue #4714 with change to existing iphone_7.heic test and new iphone_xr.heic test * Resize image and change to jpg so that GPS information can be read by GO.
This commit is contained in:
parent
d35bd7d797
commit
6c98df501e
2 changed files with 41 additions and 2 deletions
BIN
assets/examples/iphone_xr.jpg
Normal file
BIN
assets/examples/iphone_xr.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 155 KiB |
|
|
@ -29,7 +29,10 @@ func TestMediaFile_Location(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
assert.Equal(t, "高砂市", location.City())
|
||||
// nominatim and photon disagree on Himeji (姫路市) and Takasago (高砂市), but both contain Shi.
|
||||
// The photo is within 90m of the boundary of the two cities.
|
||||
// And as this test is to validate Unicode, it's ok.
|
||||
assert.Contains(t, location.City(), "市")
|
||||
assert.Equal(t, "兵庫県", location.State())
|
||||
assert.Equal(t, "Japan", location.CountryName())
|
||||
assert.Equal(t, "", location.Category())
|
||||
|
|
@ -44,7 +47,7 @@ func TestMediaFile_Location(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
assert.Equal(t, "高砂市", location2.City())
|
||||
assert.Contains(t, location2.City(), "市")
|
||||
assert.Equal(t, "兵庫県", location2.State())
|
||||
})
|
||||
t.Run("iphone_15_pro.heic", func(t *testing.T) {
|
||||
|
|
@ -84,6 +87,42 @@ func TestMediaFile_Location(t *testing.T) {
|
|||
assert.Equal(t, "Berlin", location2.City())
|
||||
assert.Equal(t, "Berlin", location2.State())
|
||||
})
|
||||
t.Run("iphone_xr.jpg", func(t *testing.T) {
|
||||
mediaFile, err := NewMediaFile(c.ExamplesPath() + "/iphone_xr.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)
|
||||
}
|
||||
|
||||
// Test Unicode and City is correct.
|
||||
assert.Equal(t, "白川村", location.City())
|
||||
assert.Equal(t, "岐阜県", location.State())
|
||||
assert.Equal(t, "Japan", location.CountryName())
|
||||
assert.Equal(t, "visitor center", location.Category())
|
||||
assert.True(t, strings.HasPrefix(location.ID, s2.TokenPrefix+"5ff871bf"))
|
||||
location2, err := mediaFile.Location()
|
||||
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if err = location.Find("places"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
assert.Equal(t, "白川村", location2.City())
|
||||
assert.Equal(t, "岐阜県", location2.State())
|
||||
})
|
||||
t.Run("cat_brown.jpg", func(t *testing.T) {
|
||||
f, err := NewMediaFile(c.ExamplesPath() + "/cat_brown.jpg")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue