Move slow tests to *_slow_test.go #58
- Added a new make target: test-fast - To execute all test, you have to use -tags=slow
This commit is contained in:
parent
5e091f5c6c
commit
8063ba39ac
8
Makefile
8
Makefile
|
@ -37,14 +37,16 @@ start:
|
|||
migrate:
|
||||
$(GORUN) cmd/photoprism/photoprism.go migrate
|
||||
test:
|
||||
$(GOTEST) -tags=slow -timeout 20m -v ./internal/...
|
||||
test-fast:
|
||||
$(GOTEST) -timeout 20m -v ./internal/...
|
||||
test-race:
|
||||
$(GOTEST) -race -timeout 60m -v ./internal/...
|
||||
$(GOTEST) -tags=slow -race -timeout 60m -v ./internal/...
|
||||
test-codecov:
|
||||
$(GOTEST) -timeout 30m -coverprofile=coverage.txt -covermode=atomic -v ./internal/...
|
||||
$(GOTEST) -tags=slow -timeout 30m -coverprofile=coverage.txt -covermode=atomic -v ./internal/...
|
||||
scripts/codecov.sh
|
||||
test-coverage:
|
||||
$(GOTEST) -timeout 30m -coverprofile=coverage.txt -covermode=atomic -v ./internal/...
|
||||
$(GOTEST) -tags=slow -timeout 30m -coverprofile=coverage.txt -covermode=atomic -v ./internal/...
|
||||
$(GOTOOL) cover -html=coverage.txt -o coverage.html
|
||||
clean:
|
||||
$(GOCLEAN)
|
||||
|
|
39
internal/photoprism/colors_slow_test.go
Normal file
39
internal/photoprism/colors_slow_test.go
Normal file
|
@ -0,0 +1,39 @@
|
|||
// +build slow
|
||||
|
||||
package photoprism
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestMediaFile_GetColors_Slow(t *testing.T) {
|
||||
conf := NewTestConfig()
|
||||
|
||||
conf.InitializeTestData(t)
|
||||
|
||||
if mediaFile2, err := NewMediaFile(conf.GetImportPath() + "/iphone/IMG_6788.JPG"); err == nil {
|
||||
|
||||
names, vibrantHex, mutedHex := mediaFile2.GetColors()
|
||||
|
||||
t.Log(names, vibrantHex, mutedHex)
|
||||
|
||||
assert.Equal(t, "#3d85c3", vibrantHex)
|
||||
assert.Equal(t, "#988570", mutedHex)
|
||||
} else {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
if mediaFile3, err := NewMediaFile(conf.GetImportPath() + "/raw/20140717_154212_1EC48F8489.jpg"); err == nil {
|
||||
|
||||
names, vibrantHex, mutedHex := mediaFile3.GetColors()
|
||||
|
||||
t.Log(names, vibrantHex, mutedHex)
|
||||
|
||||
assert.Equal(t, "#d5d437", vibrantHex)
|
||||
assert.Equal(t, "#a69f55", mutedHex)
|
||||
} else {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
|
@ -22,28 +22,4 @@ func TestMediaFile_GetColors(t *testing.T) {
|
|||
} else {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
if mediaFile2, err := NewMediaFile(conf.GetImportPath() + "/iphone/IMG_6788.JPG"); err == nil {
|
||||
|
||||
names, vibrantHex, mutedHex := mediaFile2.GetColors()
|
||||
|
||||
t.Log(names, vibrantHex, mutedHex)
|
||||
|
||||
assert.Equal(t, "#3d85c3", vibrantHex)
|
||||
assert.Equal(t, "#988570", mutedHex)
|
||||
} else {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
if mediaFile3, err := NewMediaFile(conf.GetImportPath() + "/raw/20140717_154212_1EC48F8489.jpg"); err == nil {
|
||||
|
||||
names, vibrantHex, mutedHex := mediaFile3.GetColors()
|
||||
|
||||
t.Log(names, vibrantHex, mutedHex)
|
||||
|
||||
assert.Equal(t, "#d5d437", vibrantHex)
|
||||
assert.Equal(t, "#a69f55", mutedHex)
|
||||
} else {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
|
102
internal/photoprism/converter_slow_test.go
Normal file
102
internal/photoprism/converter_slow_test.go
Normal file
|
@ -0,0 +1,102 @@
|
|||
// +build slow
|
||||
|
||||
package photoprism
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestConverter_ConvertToJpeg(t *testing.T) {
|
||||
conf := NewTestConfig()
|
||||
|
||||
conf.InitializeTestData(t)
|
||||
|
||||
converter := NewConverter(conf.GetDarktableCli())
|
||||
|
||||
jpegFilename := conf.GetImportPath() + "/iphone/IMG_6788.JPG"
|
||||
|
||||
assert.Truef(t, fileExists(jpegFilename), "file does not exist: %s", jpegFilename)
|
||||
|
||||
t.Logf("Testing RAW to JPEG converter with %s", jpegFilename)
|
||||
|
||||
jpegMediaFile, err := NewMediaFile(jpegFilename)
|
||||
|
||||
assert.Nil(t, err)
|
||||
|
||||
imageJpeg, err := converter.ConvertToJpeg(jpegMediaFile)
|
||||
|
||||
assert.Empty(t, err, "ConvertToJpeg() failed")
|
||||
|
||||
infoJpeg, err := imageJpeg.GetExifData()
|
||||
|
||||
assert.Emptyf(t, err, "GetExifData() failed")
|
||||
|
||||
assert.Equal(t, jpegFilename, imageJpeg.filename)
|
||||
|
||||
assert.False(t, infoJpeg == nil || err != nil, "Could not read EXIF data of JPEG image")
|
||||
|
||||
assert.Equal(t, "iPhone SE", infoJpeg.CameraModel)
|
||||
|
||||
rawFilemame := conf.GetImportPath() + "/raw/IMG_1435.CR2"
|
||||
|
||||
t.Logf("Testing RAW to JPEG converter with %s", rawFilemame)
|
||||
|
||||
rawMediaFile, err := NewMediaFile(rawFilemame)
|
||||
|
||||
assert.Nil(t, err)
|
||||
|
||||
imageRaw, _ := converter.ConvertToJpeg(rawMediaFile)
|
||||
|
||||
assert.True(t, fileExists(conf.GetImportPath()+"/raw/IMG_1435.jpg"), "Jpeg file was not found - is Darktable installed?")
|
||||
|
||||
assert.NotEqual(t, rawFilemame, imageRaw.filename)
|
||||
|
||||
infoRaw, err := imageRaw.GetExifData()
|
||||
|
||||
assert.False(t, infoRaw == nil || err != nil, "Could not read EXIF data of RAW image")
|
||||
|
||||
assert.Equal(t, "Canon EOS M10", infoRaw.CameraModel)
|
||||
}
|
||||
|
||||
func TestConverter_ConvertAll(t *testing.T) {
|
||||
conf := NewTestConfig()
|
||||
|
||||
conf.InitializeTestData(t)
|
||||
|
||||
converter := NewConverter(conf.GetDarktableCli())
|
||||
|
||||
converter.ConvertAll(conf.GetImportPath())
|
||||
|
||||
jpegFilename := conf.GetImportPath() + "/raw/IMG_1435.jpg"
|
||||
|
||||
assert.True(t, fileExists(jpegFilename), "Jpeg file was not found - is Darktable installed?")
|
||||
|
||||
image, err := NewMediaFile(jpegFilename)
|
||||
|
||||
assert.Nil(t, err)
|
||||
|
||||
assert.Equal(t, jpegFilename, image.filename, "FileName must be the same")
|
||||
|
||||
infoRaw, err := image.GetExifData()
|
||||
|
||||
assert.False(t, infoRaw == nil || err != nil, "Could not read EXIF data of RAW image")
|
||||
|
||||
assert.Equal(t, "Canon EOS M10", infoRaw.CameraModel, "Camera model should be Canon EOS M10")
|
||||
|
||||
existingJpegFilename := conf.GetImportPath() + "/raw/20140717_154212_1EC48F8489.jpg"
|
||||
|
||||
oldHash := fileHash(existingJpegFilename)
|
||||
|
||||
os.Remove(existingJpegFilename)
|
||||
|
||||
converter.ConvertAll(conf.GetImportPath())
|
||||
|
||||
newHash := fileHash(existingJpegFilename)
|
||||
|
||||
assert.True(t, fileExists(existingJpegFilename), "Jpeg file was not found - is Darktable installed?")
|
||||
|
||||
assert.NotEqual(t, oldHash, newHash, "Fingerprint of old and new JPEG file must not be the same")
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package photoprism
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
@ -13,96 +12,4 @@ func TestNewConverter(t *testing.T) {
|
|||
converter := NewConverter(conf.GetDarktableCli())
|
||||
|
||||
assert.IsType(t, &Converter{}, converter)
|
||||
}
|
||||
|
||||
func TestConverter_ConvertToJpeg(t *testing.T) {
|
||||
conf := NewTestConfig()
|
||||
|
||||
conf.InitializeTestData(t)
|
||||
|
||||
converter := NewConverter(conf.GetDarktableCli())
|
||||
|
||||
jpegFilename := conf.GetImportPath() + "/iphone/IMG_6788.JPG"
|
||||
|
||||
assert.Truef(t, fileExists(jpegFilename), "file does not exist: %s", jpegFilename)
|
||||
|
||||
t.Logf("Testing RAW to JPEG converter with %s", jpegFilename)
|
||||
|
||||
jpegMediaFile, err := NewMediaFile(jpegFilename)
|
||||
|
||||
assert.Nil(t, err)
|
||||
|
||||
imageJpeg, err := converter.ConvertToJpeg(jpegMediaFile)
|
||||
|
||||
assert.Empty(t, err, "ConvertToJpeg() failed")
|
||||
|
||||
infoJpeg, err := imageJpeg.GetExifData()
|
||||
|
||||
assert.Emptyf(t, err, "GetExifData() failed")
|
||||
|
||||
assert.Equal(t, jpegFilename, imageJpeg.filename)
|
||||
|
||||
assert.False(t, infoJpeg == nil || err != nil, "Could not read EXIF data of JPEG image")
|
||||
|
||||
assert.Equal(t, "iPhone SE", infoJpeg.CameraModel)
|
||||
|
||||
rawFilemame := conf.GetImportPath() + "/raw/IMG_1435.CR2"
|
||||
|
||||
t.Logf("Testing RAW to JPEG converter with %s", rawFilemame)
|
||||
|
||||
rawMediaFile, err := NewMediaFile(rawFilemame)
|
||||
|
||||
assert.Nil(t, err)
|
||||
|
||||
imageRaw, _ := converter.ConvertToJpeg(rawMediaFile)
|
||||
|
||||
assert.True(t, fileExists(conf.GetImportPath()+"/raw/IMG_1435.jpg"), "Jpeg file was not found - is Darktable installed?")
|
||||
|
||||
assert.NotEqual(t, rawFilemame, imageRaw.filename)
|
||||
|
||||
infoRaw, err := imageRaw.GetExifData()
|
||||
|
||||
assert.False(t, infoRaw == nil || err != nil, "Could not read EXIF data of RAW image")
|
||||
|
||||
assert.Equal(t, "Canon EOS M10", infoRaw.CameraModel)
|
||||
}
|
||||
|
||||
func TestConverter_ConvertAll(t *testing.T) {
|
||||
conf := NewTestConfig()
|
||||
|
||||
conf.InitializeTestData(t)
|
||||
|
||||
converter := NewConverter(conf.GetDarktableCli())
|
||||
|
||||
converter.ConvertAll(conf.GetImportPath())
|
||||
|
||||
jpegFilename := conf.GetImportPath() + "/raw/IMG_1435.jpg"
|
||||
|
||||
assert.True(t, fileExists(jpegFilename), "Jpeg file was not found - is Darktable installed?")
|
||||
|
||||
image, err := NewMediaFile(jpegFilename)
|
||||
|
||||
assert.Nil(t, err)
|
||||
|
||||
assert.Equal(t, jpegFilename, image.filename, "FileName must be the same")
|
||||
|
||||
infoRaw, err := image.GetExifData()
|
||||
|
||||
assert.False(t, infoRaw == nil || err != nil, "Could not read EXIF data of RAW image")
|
||||
|
||||
assert.Equal(t, "Canon EOS M10", infoRaw.CameraModel, "Camera model should be Canon EOS M10")
|
||||
|
||||
existingJpegFilename := conf.GetImportPath() + "/raw/20140717_154212_1EC48F8489.jpg"
|
||||
|
||||
oldHash := fileHash(existingJpegFilename)
|
||||
|
||||
os.Remove(existingJpegFilename)
|
||||
|
||||
converter.ConvertAll(conf.GetImportPath())
|
||||
|
||||
newHash := fileHash(existingJpegFilename)
|
||||
|
||||
assert.True(t, fileExists(existingJpegFilename), "Jpeg file was not found - is Darktable installed?")
|
||||
|
||||
assert.NotEqual(t, oldHash, newHash, "Fingerprint of old and new JPEG file must not be the same")
|
||||
}
|
||||
}
|
27
internal/photoprism/exif_slow_test.go
Normal file
27
internal/photoprism/exif_slow_test.go
Normal file
|
@ -0,0 +1,27 @@
|
|||
// +build slow
|
||||
|
||||
package photoprism
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestMediaFile_GetExifData_Slow(t *testing.T) {
|
||||
conf := NewTestConfig()
|
||||
|
||||
conf.InitializeTestData(t)
|
||||
|
||||
image2, err := NewMediaFile(conf.GetImportPath() + "/raw/IMG_1435.CR2")
|
||||
|
||||
assert.Nil(t, err)
|
||||
|
||||
info, err := image2.GetExifData()
|
||||
|
||||
assert.Empty(t, err)
|
||||
|
||||
assert.IsType(t, &ExifData{}, info)
|
||||
|
||||
assert.Equal(t, "Canon EOS M10", info.CameraModel)
|
||||
}
|
|
@ -22,16 +22,4 @@ func TestMediaFile_GetExifData(t *testing.T) {
|
|||
assert.IsType(t, &ExifData{}, info)
|
||||
|
||||
assert.Equal(t, "iPhone SE", info.CameraModel)
|
||||
|
||||
image2, err := NewMediaFile(conf.GetImportPath() + "/raw/IMG_1435.CR2")
|
||||
|
||||
assert.Nil(t, err)
|
||||
|
||||
info, err = image2.GetExifData()
|
||||
|
||||
assert.Empty(t, err)
|
||||
|
||||
assert.IsType(t, &ExifData{}, info)
|
||||
|
||||
assert.Equal(t, "Canon EOS M10", info.CameraModel)
|
||||
}
|
||||
|
|
23
internal/photoprism/importer_slow_test.go
Normal file
23
internal/photoprism/importer_slow_test.go
Normal file
|
@ -0,0 +1,23 @@
|
|||
// +build slow
|
||||
|
||||
package photoprism
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestImporter_ImportPhotosFromDirectory(t *testing.T) {
|
||||
conf := NewTestConfig()
|
||||
|
||||
conf.InitializeTestData(t)
|
||||
|
||||
tensorFlow := NewTensorFlow(conf.GetTensorFlowModelPath())
|
||||
|
||||
indexer := NewIndexer(conf.GetOriginalsPath(), tensorFlow, conf.GetDb())
|
||||
|
||||
converter := NewConverter(conf.GetDarktableCli())
|
||||
|
||||
importer := NewImporter(conf.GetOriginalsPath(), indexer, converter)
|
||||
|
||||
importer.ImportPhotosFromDirectory(conf.GetImportPath())
|
||||
}
|
|
@ -20,22 +20,6 @@ func TestNewImporter(t *testing.T) {
|
|||
assert.IsType(t, &Importer{}, importer)
|
||||
}
|
||||
|
||||
func TestImporter_ImportPhotosFromDirectory(t *testing.T) {
|
||||
conf := NewTestConfig()
|
||||
|
||||
conf.InitializeTestData(t)
|
||||
|
||||
tensorFlow := NewTensorFlow(conf.GetTensorFlowModelPath())
|
||||
|
||||
indexer := NewIndexer(conf.GetOriginalsPath(), tensorFlow, conf.GetDb())
|
||||
|
||||
converter := NewConverter(conf.GetDarktableCli())
|
||||
|
||||
importer := NewImporter(conf.GetOriginalsPath(), indexer, converter)
|
||||
|
||||
importer.ImportPhotosFromDirectory(conf.GetImportPath())
|
||||
}
|
||||
|
||||
func TestImporter_GetDestinationFilename(t *testing.T) {
|
||||
conf := NewTestConfig()
|
||||
conf.InitializeTestData(t)
|
||||
|
|
41
internal/photoprism/mediafile_slow_test.go
Normal file
41
internal/photoprism/mediafile_slow_test.go
Normal file
|
@ -0,0 +1,41 @@
|
|||
// +build slow
|
||||
|
||||
package photoprism
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestMediaFile_GetPerceptiveHash_Slow(t *testing.T) {
|
||||
conf := NewTestConfig()
|
||||
|
||||
conf.InitializeTestData(t)
|
||||
|
||||
mediaFile1, err := NewMediaFile(conf.GetImportPath() + "/20130203_193332_0AE340D280.jpg")
|
||||
assert.Nil(t, err)
|
||||
hash1, _ := mediaFile1.GetPerceptualHash()
|
||||
|
||||
assert.Equal(t, "ef95", hash1)
|
||||
|
||||
mediaFile2, err := NewMediaFile(conf.GetImportPath() + "/20130203_193332_0AE340D280_V2.jpg")
|
||||
assert.Nil(t, err)
|
||||
hash2, _ := mediaFile2.GetPerceptualHash()
|
||||
|
||||
assert.Equal(t, "6f95", hash2)
|
||||
|
||||
distance, _ := mediaFile1.GetPerceptualDistance(hash2)
|
||||
|
||||
assert.Equal(t, 1, distance)
|
||||
|
||||
mediaFile3, err := NewMediaFile(conf.GetImportPath() + "/iphone/IMG_6788.JPG")
|
||||
assert.Nil(t, err)
|
||||
hash3, _ := mediaFile3.GetPerceptualHash()
|
||||
|
||||
assert.Equal(t, "ad73", hash3)
|
||||
|
||||
distance, _ = mediaFile1.GetPerceptualDistance(hash3)
|
||||
|
||||
assert.Equal(t, 7, distance)
|
||||
}
|
|
@ -88,25 +88,9 @@ func TestMediaFile_GetPerceptiveHash(t *testing.T) {
|
|||
|
||||
assert.Equal(t, "ef95", hash1)
|
||||
|
||||
mediaFile2, err := NewMediaFile(conf.GetImportPath() + "/20130203_193332_0AE340D280_V2.jpg")
|
||||
assert.Nil(t, err)
|
||||
hash2, _ := mediaFile2.GetPerceptualHash()
|
||||
|
||||
assert.Equal(t, "6f95", hash2)
|
||||
|
||||
distance, _ := mediaFile1.GetPerceptualDistance(hash2)
|
||||
distance, _ := mediaFile1.GetPerceptualDistance("6f95")
|
||||
|
||||
assert.Equal(t, 1, distance)
|
||||
|
||||
mediaFile3, err := NewMediaFile(conf.GetImportPath() + "/iphone/IMG_6788.JPG")
|
||||
assert.Nil(t, err)
|
||||
hash3, _ := mediaFile3.GetPerceptualHash()
|
||||
|
||||
assert.Equal(t, "ad73", hash3)
|
||||
|
||||
distance, _ = mediaFile1.GetPerceptualDistance(hash3)
|
||||
|
||||
assert.Equal(t, 7, distance)
|
||||
}
|
||||
|
||||
func TestMediaFile_GetMimeType(t *testing.T) {
|
||||
|
|
34
internal/photoprism/tensorflow_slow_test.go
Normal file
34
internal/photoprism/tensorflow_slow_test.go
Normal file
|
@ -0,0 +1,34 @@
|
|||
// +build slow
|
||||
|
||||
package photoprism
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestTensorFlow_GetImageTags(t *testing.T) {
|
||||
conf := NewTestConfig()
|
||||
|
||||
conf.InitializeTestData(t)
|
||||
|
||||
tensorFlow := NewTensorFlow(conf.GetTensorFlowModelPath())
|
||||
|
||||
if imageBuffer, err := ioutil.ReadFile(conf.GetImportPath() + "/iphone/IMG_6788.JPG"); err != nil {
|
||||
t.Error(err)
|
||||
} else {
|
||||
result, err := tensorFlow.GetImageTags(string(imageBuffer))
|
||||
|
||||
assert.NotNil(t, result)
|
||||
assert.Nil(t, err)
|
||||
assert.IsType(t, []TensorFlowLabel{}, result)
|
||||
assert.Equal(t, 5, len(result))
|
||||
|
||||
assert.Equal(t, "tabby", result[0].Label)
|
||||
assert.Equal(t, "tiger cat", result[1].Label)
|
||||
|
||||
assert.Equal(t, float32(0.1648176), result[1].Probability)
|
||||
}
|
||||
}
|
|
@ -1,36 +1,11 @@
|
|||
package photoprism
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestTensorFlow_GetImageTags(t *testing.T) {
|
||||
conf := NewTestConfig()
|
||||
|
||||
conf.InitializeTestData(t)
|
||||
|
||||
tensorFlow := NewTensorFlow(conf.GetTensorFlowModelPath())
|
||||
|
||||
if imageBuffer, err := ioutil.ReadFile(conf.GetImportPath() + "/iphone/IMG_6788.JPG"); err != nil {
|
||||
t.Error(err)
|
||||
} else {
|
||||
result, err := tensorFlow.GetImageTags(string(imageBuffer))
|
||||
|
||||
assert.NotNil(t, result)
|
||||
assert.Nil(t, err)
|
||||
assert.IsType(t, []TensorFlowLabel{}, result)
|
||||
assert.Equal(t, 5, len(result))
|
||||
|
||||
assert.Equal(t, "tabby", result[0].Label)
|
||||
assert.Equal(t, "tiger cat", result[1].Label)
|
||||
|
||||
assert.Equal(t, float32(0.1648176), result[1].Probability)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTensorFlow_GetImageTagsFromFile(t *testing.T) {
|
||||
conf := NewTestConfig()
|
||||
|
||||
|
|
29
internal/photoprism/thumbnails_slow_test.go
Normal file
29
internal/photoprism/thumbnails_slow_test.go
Normal file
|
@ -0,0 +1,29 @@
|
|||
// +build slow
|
||||
|
||||
package photoprism
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCreateThumbnailsFromOriginals(t *testing.T) {
|
||||
conf := NewTestConfig()
|
||||
|
||||
conf.CreateDirectories()
|
||||
|
||||
conf.InitializeTestData(t)
|
||||
|
||||
tensorFlow := NewTensorFlow(conf.GetTensorFlowModelPath())
|
||||
|
||||
indexer := NewIndexer(conf.GetOriginalsPath(), tensorFlow, conf.GetDb())
|
||||
|
||||
converter := NewConverter(conf.GetDarktableCli())
|
||||
|
||||
importer := NewImporter(conf.GetOriginalsPath(), indexer, converter)
|
||||
|
||||
importer.ImportPhotosFromDirectory(conf.GetImportPath())
|
||||
|
||||
CreateThumbnailsFromOriginals(conf.GetOriginalsPath(), conf.GetThumbnailsPath(), 600, false)
|
||||
|
||||
CreateThumbnailsFromOriginals(conf.GetOriginalsPath(), conf.GetThumbnailsPath(), 300, true)
|
||||
}
|
|
@ -38,26 +38,4 @@ func TestMediaFile_GetSquareThumbnail(t *testing.T) {
|
|||
assert.Empty(t, err)
|
||||
|
||||
assert.IsType(t, &MediaFile{}, thumbnail1)
|
||||
}
|
||||
|
||||
func TestCreateThumbnailsFromOriginals(t *testing.T) {
|
||||
conf := NewTestConfig()
|
||||
|
||||
conf.CreateDirectories()
|
||||
|
||||
conf.InitializeTestData(t)
|
||||
|
||||
tensorFlow := NewTensorFlow(conf.GetTensorFlowModelPath())
|
||||
|
||||
indexer := NewIndexer(conf.GetOriginalsPath(), tensorFlow, conf.GetDb())
|
||||
|
||||
converter := NewConverter(conf.GetDarktableCli())
|
||||
|
||||
importer := NewImporter(conf.GetOriginalsPath(), indexer, converter)
|
||||
|
||||
importer.ImportPhotosFromDirectory(conf.GetImportPath())
|
||||
|
||||
CreateThumbnailsFromOriginals(conf.GetOriginalsPath(), conf.GetThumbnailsPath(), 600, false)
|
||||
|
||||
CreateThumbnailsFromOriginals(conf.GetOriginalsPath(), conf.GetThumbnailsPath(), 300, true)
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue