mirror of
https://github.com/prashantgupta24/automatic-mouse-mover.git
synced 2024-12-23 08:54:10 +00:00
21 lines
417 B
Go
21 lines
417 B
Go
|
package mousemover
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"math"
|
||
|
"testing"
|
||
|
|
||
|
"github.com/go-vgo/robotgo"
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
)
|
||
|
|
||
|
func TestMouseMove(t *testing.T) {
|
||
|
fmt.Println("starting test")
|
||
|
movePixel := 10
|
||
|
currentX, _ := robotgo.GetMousePos()
|
||
|
commCh := make(chan bool, 1)
|
||
|
moveMouse(movePixel, commCh)
|
||
|
movedX, _ := robotgo.GetMousePos()
|
||
|
assert.Equal(t, float64(movePixel), math.Abs(float64(movedX-currentX)))
|
||
|
}
|