mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-05-30 22:13:54 +00:00
add more test code and update go tt mod
This commit is contained in:
parent
e7ab665c51
commit
593e3ed9f9
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,6 +3,7 @@
|
||||
.vscode
|
||||
.idea
|
||||
|
||||
robot_test.png
|
||||
# Examples
|
||||
examples/screen/screen
|
||||
examples/screen/saveCapture.png
|
||||
|
2
go.mod
2
go.mod
@ -10,7 +10,7 @@ require (
|
||||
github.com/robotn/xgbutil v0.0.0-20190912154524-c861d6f87770
|
||||
github.com/vcaesar/gops v0.0.0-20200120141635-c9dda03b64e2
|
||||
github.com/vcaesar/imgo v0.0.0-20191008162304-a83ea7753bc8
|
||||
github.com/vcaesar/tt v0.0.0-20191220180712-e14ab9e55f21
|
||||
github.com/vcaesar/tt v0.0.0-20200124150044-d4f30cc912c1
|
||||
golang.org/x/image v0.0.0-20200119044424-58c23975cae1
|
||||
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80 // indirect
|
||||
golang.org/x/sys v0.0.0-20200120150407-c1edf535530b // indirect
|
||||
|
4
go.sum
4
go.sum
@ -39,8 +39,8 @@ github.com/vcaesar/gops v0.0.0-20200120141635-c9dda03b64e2 h1:9CzTc16j5h8olRz5yw
|
||||
github.com/vcaesar/gops v0.0.0-20200120141635-c9dda03b64e2/go.mod h1:HDKiKqHeRYwEhBUTjgBHWT/PkwvLusticopFNbGO/eY=
|
||||
github.com/vcaesar/imgo v0.0.0-20191008162304-a83ea7753bc8 h1:9Y+hoKBYa+UtzGqkODfs8c0Q6gp2UfniVNsHQWghPi0=
|
||||
github.com/vcaesar/imgo v0.0.0-20191008162304-a83ea7753bc8/go.mod h1:52+3yYrTNjWKh+CkQozNRCLWCE/X666yAWPGbYC3DZI=
|
||||
github.com/vcaesar/tt v0.0.0-20191220180712-e14ab9e55f21 h1:YDchwpwXTW8FVAgVfBx4s8DPNAEAok+Jt0H3iVOOAlc=
|
||||
github.com/vcaesar/tt v0.0.0-20191220180712-e14ab9e55f21/go.mod h1:GHPxQYhn+7OgKakRusH7KJ0M5MhywoeLb8Fcffs/Gtg=
|
||||
github.com/vcaesar/tt v0.0.0-20200124150044-d4f30cc912c1 h1:PE/qEgWfcvG00gC5SXIzUv4AAsDPw8u4QSotok0jrU0=
|
||||
github.com/vcaesar/tt v0.0.0-20200124150044-d4f30cc912c1/go.mod h1:GHPxQYhn+7OgKakRusH7KJ0M5MhywoeLb8Fcffs/Gtg=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/image v0.0.0-20190910094157-69e4b8554b2a h1:gHevYm0pO4QUbwy8Dmdr01R5r1BuKtfYqRqF0h/Cbh0=
|
||||
golang.org/x/image v0.0.0-20190910094157-69e4b8554b2a/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
|
@ -51,3 +51,34 @@ func TestScrollMouse(t *testing.T) {
|
||||
|
||||
Scroll(210, 210)
|
||||
}
|
||||
|
||||
func TestMoveRelative(t *testing.T) {
|
||||
Move(200, 200)
|
||||
MilliSleep(10)
|
||||
|
||||
MoveRelative(10, -10)
|
||||
MilliSleep(10)
|
||||
|
||||
x, y := GetMousePos()
|
||||
tt.Equal(t, 210, x)
|
||||
tt.Equal(t, 190, y)
|
||||
}
|
||||
|
||||
func TestMoveSmoothRelative(t *testing.T) {
|
||||
Move(200, 200)
|
||||
MilliSleep(10)
|
||||
|
||||
MoveSmoothRelative(10, -10)
|
||||
MilliSleep(10)
|
||||
|
||||
x, y := GetMousePos()
|
||||
tt.Equal(t, 210, x)
|
||||
tt.Equal(t, 190, y)
|
||||
}
|
||||
|
||||
func TestBitmap(t *testing.T) {
|
||||
bit := CaptureScreen()
|
||||
tt.NotNil(t, bit)
|
||||
e := SaveBitmap(bit, "robot_test.png")
|
||||
tt.Empty(t, e)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user