-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtouchpad_test.go
87 lines (72 loc) · 1.8 KB
/
touchpad_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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package uinput
import (
"testing"
)
func TestTouchPadCreation(t *testing.T) {
touchPad, err := CreateTouchPad(0, 1079, 0, 719)
if err != nil {
t.Fatal("Failed to create virtual touchpad")
}
err = touchPad.Close()
if err != nil {
t.Fatal("Failed to close virtual touchpad device")
}
}
func TestVirtualTouchPadLeftPressAndRelease(t *testing.T) {
touchPad, err := CreateTouchPad(0, 1079, 0, 719)
if err != nil {
t.Fatal("Failed to create virtual touchpad")
}
err = touchPad.LeftPress()
if err != nil {
t.Fatal("Failed to emit left button press")
}
err = touchPad.LeftRelease()
if err != nil {
t.Fatal("Failed to emit left button release")
}
}
func TestVirtualTouchPadRightPressAndRelease(t *testing.T) {
touchPad, err := CreateTouchPad(0, 1079, 0, 719)
if err != nil {
t.Fatal("Failed to create virtual touchpad")
}
err = touchPad.RightPress()
if err != nil {
t.Fatal("Failed to emit right button press")
}
err = touchPad.RightRelease()
if err != nil {
t.Fatal("Failed to emit right button release")
}
}
func TestVirtualTouchPadLeftClick(t *testing.T) {
touchPad, err := CreateTouchPad(0, 1079, 0, 719)
if err != nil {
t.Fatal("Failed to create virtual touchpad")
}
err = touchPad.LeftClick()
if err != nil {
t.Fatal("Failed to emit left button click")
}
}
func TestVirtualTouchPadRightClick(t *testing.T) {
touchPad, err := CreateTouchPad(0, 1079, 0, 719)
if err != nil {
t.Fatal("Failed to create virtual touchpad")
}
err = touchPad.RightClick()
if err != nil {
t.Fatal("Failed to emit right button click")
}
}
func TestVirtualTouchPadMoveTo(t *testing.T) {
touchPad, err := CreateTouchPad(0, 1079, 0, 719)
if err != nil {
t.Fatal("Failed to create virtual touchpad")
}
err = touchPad.MoveTo(100, 200)
if err != nil {
t.Fatal("Failed to emit move to event")
}
}