-
Notifications
You must be signed in to change notification settings - Fork 5
/
touch_test.go
54 lines (40 loc) · 1.13 KB
/
touch_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package gwda_ext_opencv
import (
"github.com/electricbubble/gwda"
"testing"
)
func TestDriverExt_ForceTouch(t *testing.T) {
driver, err := gwda.NewUSBDriver(nil)
checkErr(t, err)
driverExt, err := Extend(driver, 0.95)
checkErr(t, err)
pathSearch := "/Users/hero/Documents/temp/2020-05/opencv/IMG_ft.png"
err = driverExt.ForceTouch(pathSearch, 0.5, 3)
checkErr(t, err)
// err = driverExt.ForceTouchOffset(pathSearch, 0.5, 0.1, 0.9)
// checkErr(t, err)
// err = driverExt.ForceTouchOffset(pathSearch, 0.2, 1.1, -1)
// checkErr(t, err)
}
func TestDriverExt_TouchAndHold(t *testing.T) {
driver, err := gwda.NewUSBDriver(nil)
checkErr(t, err)
driverExt, err := Extend(driver, 0.95)
checkErr(t, err)
pathSearch := "/Users/hero/Documents/temp/2020-05/opencv/IMG_ft.png"
// err = driverExt.TouchAndHold(pathSearch)
// checkErr(t, err)
// err = driverExt.TouchAndHold(pathSearch, 3)
// checkErr(t, err)
err = driverExt.TouchAndHoldOffset(pathSearch, 0.8, 0.1)
checkErr(t, err)
}
func checkErr(t *testing.T, err error, msg ...string) {
if err != nil {
if len(msg) == 0 {
t.Fatal(err)
} else {
t.Fatal(msg, err)
}
}
}