-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmouse_state_test.go
63 lines (50 loc) · 1.1 KB
/
mouse_state_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
package washeet
import "testing"
func TestMouseDefaultState(t *testing.T) {
state := defaultMouseState()
if state.isLeftDown() || state.isRightDown() {
t.Error("Wrong default mouse state : ", state)
}
}
func TestMouseLeftButtonState(t *testing.T) {
state := defaultMouseState()
state.setLeftDown()
state.setRightUp()
if !state.isLeftDown() {
t.Error("Left button not down")
}
state.setRightDown()
if !state.isLeftDown() {
t.Error("Left button not down")
}
state.setLeftUp()
state.setRightDown()
if state.isLeftDown() {
t.Error("Left button not up")
}
state.setRightUp()
if state.isLeftDown() {
t.Error("Left button not up")
}
}
func TestMouseRightButtonState(t *testing.T) {
state := defaultMouseState()
state.setRightDown()
state.setLeftUp()
if !state.isRightDown() {
t.Error("Right button not down")
}
state.setLeftDown()
if !state.isRightDown() {
t.Error("Right button not down")
}
state.setRightUp()
state.setLeftDown()
if state.isRightDown() {
t.Error("Right button not up")
}
state.setLeftUp()
if state.isRightDown() {
t.Error("Right button not up")
}
}