Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package mediamdl
import (
"path/filepath"
"testing"
"github.com/stretchr/testify/assert"
)
func Test_compressImage(t *testing.T) {
inputPath := "../testingdata/testData/mediamdl/image/sample.bmp"
inputPath, _ = filepath.Abs(inputPath)
outputPath := "../testingdata/testData/mediamdl/image/sample-compress-image.jpg"
outputPath, _ = filepath.Abs(outputPath)
err := compressImage(inputPath, outputPath)
// fmt.Println("err: ", err)
assert.NoError(t, err, "This will not thrown an error.")
}
func Test1_compressImage(t *testing.T) {
inputPath := "../testingdata/testData/mediamdl/image/path with spaces/sample.bmp"
inputPath, _ = filepath.Abs(inputPath)
outputPath := "../testingdata/testData/mediamdl/image/path with spaces/sample-compress-image.jpg"
outputPath, _ = filepath.Abs(outputPath)
err := compressImage(inputPath, outputPath)
// fmt.Println("err: ", err)
assert.NoError(t, err, "This will not thrown an error.")
}
func Test_resizeImage(t *testing.T) {
inputPath := "../testingdata/testData/mediamdl/image/sample.bmp"
outputPath := "../testingdata/testData/mediamdl/image/sample-resized-image.bmp"
err := resizeImage(inputPath, outputPath, "100")
assert.NoError(t, err, "This will not throw error")
}
func Test_resizeImageWithoutAspectRatio(t *testing.T) {
inputPath := "../testingdata/testData/mediamdl/image/sample.bmp"
outputPath := "../testingdata/testData/mediamdl/image/sample-resize-wo-aspect-image.bmp"
err := resizeImageWithoutAspectRatio(inputPath, outputPath, "100", "100")
assert.NoError(t, err, "This will not throw error")
}
func Test_smartCropImage(t *testing.T) {
err := smartCropImage()
assert.Error(t, err, "This will not throw error")