photoprism/internal/thumb/open_jpeg_test.go

39 lines
662 B
Go
Raw Normal View History

package thumb
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestOpenJpeg(t *testing.T) {
t.Run("testdata/example.jpg", func(t *testing.T) {
img, err := OpenJpeg("testdata/example.jpg", 0)
if err != nil {
t.Fatal(err)
}
if img == nil {
t.Error("img must not be nil")
}
})
t.Run("testdata/broken.jpg", func(t *testing.T) {
img, err := OpenJpeg("testdata/broken.jpg", 0)
assert.Error(t, err)
assert.Nil(t, img)
})
t.Run("testdata/fixed.jpg", func(t *testing.T) {
img, err := OpenJpeg("testdata/fixed.jpg", 0)
if err != nil {
t.Fatal(err)
}
if img == nil {
t.Error("img must not be nil")
}
})
}