mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 00:34:13 +01:00
Indexer: Don't optimize merged photos
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
@@ -53,23 +53,30 @@ func TestPhoto_EstimateCountry(t *testing.T) {
|
||||
func TestPhoto_Optimize(t *testing.T) {
|
||||
t.Run("update", func(t *testing.T) {
|
||||
photo := PhotoFixtures.Get("Photo19")
|
||||
if updated, err := photo.Optimize(true, true); err != nil {
|
||||
if updated, merged, err := photo.Optimize(false, false); err != nil {
|
||||
t.Fatal(err)
|
||||
} else if !updated {
|
||||
t.Error("photo should be updated")
|
||||
} else if len(merged) > 0 {
|
||||
t.Error("no photos should be merged")
|
||||
}
|
||||
|
||||
if updated, err := photo.Optimize(false, false); err != nil {
|
||||
if updated, merged, err := photo.Optimize(false, false); err != nil {
|
||||
t.Fatal(err)
|
||||
} else if updated {
|
||||
t.Error("photo should NOT be updated")
|
||||
} else if len(merged) > 0 {
|
||||
t.Error("no photos should be merged")
|
||||
}
|
||||
})
|
||||
t.Run("photo without id", func(t *testing.T) {
|
||||
photo := Photo{}
|
||||
bool, err := photo.Optimize(false, false)
|
||||
bool, merged, err := photo.Optimize(false, false)
|
||||
assert.Error(t, err)
|
||||
assert.False(t, bool)
|
||||
|
||||
if len(merged) > 0 {
|
||||
t.Error("no photos should be merged")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user