36 lines
785 B
Go
36 lines
785 B
Go
package commands
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/rogeecn/fabfile"
|
|
. "github.com/smartystreets/goconvey/convey"
|
|
)
|
|
|
|
func Test_getVideoSize(t *testing.T) {
|
|
Convey("getVideoSize", t, func() {
|
|
Convey("test getVideoSize", func() {
|
|
file := fabfile.MustFind("fixtures/camera.mp4")
|
|
width, height, err := getVideoSize(file)
|
|
So(err, ShouldBeNil)
|
|
So(width, ShouldEqual, 1924)
|
|
So(height, ShouldEqual, 1080)
|
|
})
|
|
})
|
|
}
|
|
|
|
func Test_compressVideo(t *testing.T) {
|
|
Convey("compressVideo", t, func() {
|
|
Convey("test compressVideo", func() {
|
|
srcFile := fabfile.MustFind("fixtures/camera.mp4")
|
|
dstFile := filepath.Join(os.TempDir(), "camera.mp4")
|
|
t.Log("dstFile", dstFile)
|
|
|
|
err := compressVideo(srcFile, dstFile)
|
|
So(err, ShouldBeNil)
|
|
})
|
|
})
|
|
}
|