mirror of
https://github.com/photoprism/photoprism.git
synced 2026-07-17 16:49:04 +00:00
Metadata: Preset time zone in rating normalization tests #713
This commit is contained in:
parent
6b7cb25b8c
commit
ed10ffb686
1 changed files with 5 additions and 3 deletions
|
|
@ -4,6 +4,8 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/photoprism/photoprism/pkg/time/tz"
|
||||
)
|
||||
|
||||
func TestPhoto_SetRating(t *testing.T) {
|
||||
|
|
@ -74,19 +76,19 @@ func TestPhoto_SetRating(t *testing.T) {
|
|||
|
||||
func TestPhoto_NormalizeRating(t *testing.T) {
|
||||
t.Run("ClampAboveMax", func(t *testing.T) {
|
||||
m := Photo{PhotoRating: 9}
|
||||
m := Photo{TimeZone: tz.Local, PhotoRating: 9}
|
||||
|
||||
assert.True(t, m.NormalizeValues())
|
||||
assert.Equal(t, 5, m.PhotoRating)
|
||||
})
|
||||
t.Run("ClampBelowMin", func(t *testing.T) {
|
||||
m := Photo{PhotoRating: -3}
|
||||
m := Photo{TimeZone: tz.Local, PhotoRating: -3}
|
||||
|
||||
assert.True(t, m.NormalizeValues())
|
||||
assert.Equal(t, 0, m.PhotoRating)
|
||||
})
|
||||
t.Run("InRangeUnchanged", func(t *testing.T) {
|
||||
m := Photo{PhotoRating: 5}
|
||||
m := Photo{TimeZone: tz.Local, PhotoRating: 5}
|
||||
|
||||
assert.False(t, m.NormalizeValues())
|
||||
assert.Equal(t, 5, m.PhotoRating)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue