photoprism/thumbnails_test.go

57 lines
1.2 KiB
Go
Raw Normal View History

2018-06-17 12:56:02 +02:00
package photoprism
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestMediaFile_GetThumbnail(t *testing.T) {
conf := NewTestConfig()
conf.CreateDirectories()
conf.InitializeTestData(t)
image1 := NewMediaFile(conf.ImportPath + "/iphone/IMG_6788.JPG")
thumbnail1, err := image1.GetThumbnail(conf.ThumbnailsPath, 350)
assert.Empty(t, err)
assert.IsType(t, &MediaFile{}, thumbnail1)
}
func TestMediaFile_GetSquareThumbnail(t *testing.T) {
conf := NewTestConfig()
conf.CreateDirectories()
conf.InitializeTestData(t)
image1 := NewMediaFile(conf.ImportPath + "/iphone/IMG_6788.JPG")
thumbnail1, err := image1.GetSquareThumbnail(conf.ThumbnailsPath, 350)
assert.Empty(t, err)
assert.IsType(t, &MediaFile{}, thumbnail1)
}
func TestCreateThumbnailsFromOriginals(t *testing.T) {
conf := NewTestConfig()
conf.CreateDirectories()
conf.InitializeTestData(t)
2018-07-20 10:54:31 +02:00
indexer := NewIndexer(conf.OriginalsPath, conf.GetDb())
importer := NewImporter(conf.OriginalsPath, indexer)
2018-06-17 12:56:02 +02:00
importer.ImportPhotosFromDirectory(conf.ImportPath)
CreateThumbnailsFromOriginals(conf.OriginalsPath, conf.ThumbnailsPath, 600, false)
CreateThumbnailsFromOriginals(conf.OriginalsPath, conf.ThumbnailsPath, 300, true)
2018-07-18 15:17:56 +02:00
}