hybridgroup.gobot/platforms/opencv/window_driver_test.go

37 lines
731 B
Go
Raw Normal View History

2014-04-28 07:58:34 +08:00
package opencv
import (
2014-07-24 07:38:46 +08:00
"path"
"runtime"
"testing"
2014-07-17 05:37:58 +08:00
cv "github.com/hybridgroup/go-opencv/opencv"
2014-06-14 04:45:50 +08:00
"github.com/hybridgroup/gobot"
)
2014-06-14 07:01:39 +08:00
func initTestWindowDriver() *WindowDriver {
2014-07-24 07:54:39 +08:00
d := NewWindowDriver("bot")
d.start = func(w *WindowDriver) {
w.window = &testWindow{}
}
return d
2014-06-14 04:45:50 +08:00
}
2014-06-14 07:01:39 +08:00
func TestWindowDriverStart(t *testing.T) {
d := initTestWindowDriver()
gobot.Assert(t, d.Start(), nil)
2014-06-14 04:45:50 +08:00
}
2014-06-14 07:01:39 +08:00
func TestWindowDriverHalt(t *testing.T) {
d := initTestWindowDriver()
gobot.Assert(t, d.Halt(), nil)
2014-06-14 04:45:50 +08:00
}
2014-07-17 05:37:58 +08:00
func TestWindowDriverShowImage(t *testing.T) {
d := initTestWindowDriver()
2014-07-24 07:38:46 +08:00
_, currentfile, _, _ := runtime.Caller(0)
image := cv.LoadImage(path.Join(path.Dir(currentfile), "lena-256x256.jpg"))
d.Start()
d.ShowImage(image)
2014-07-17 05:37:58 +08:00
}