hybridgroup.gobot/platforms/opencv/window_driver_test.go

42 lines
930 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-06-14 04:45:50 +08:00
"github.com/hybridgroup/gobot"
"github.com/hybridgroup/gobot/gobottest"
cv "github.com/lazywei/go-opencv/opencv"
)
var _ gobot.Driver = (*WindowDriver)(nil)
2014-06-14 07:01:39 +08:00
func initTestWindowDriver() *WindowDriver {
2014-07-24 07:54:39 +08:00
d := NewWindowDriver("bot")
return d
2014-06-14 04:45:50 +08:00
}
2014-12-20 03:57:35 +08:00
func TestWindowDriver(t *testing.T) {
d := initTestWindowDriver()
gobottest.Assert(t, d.Name(), "bot")
gobottest.Assert(t, d.Connection(), (gobot.Connection)(nil))
2014-12-20 03:57:35 +08:00
}
2014-06-14 07:01:39 +08:00
func TestWindowDriverStart(t *testing.T) {
d := initTestWindowDriver()
gobottest.Assert(t, len(d.Start()), 0)
2014-06-14 04:45:50 +08:00
}
2014-06-14 07:01:39 +08:00
func TestWindowDriverHalt(t *testing.T) {
d := initTestWindowDriver()
gobottest.Assert(t, len(d.Halt()), 0)
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
}