-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotification_test.go
58 lines (43 loc) · 1.82 KB
/
notification_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
package maa
import (
"testing"
"github.com/stretchr/testify/require"
)
type testNotificationHandlerOnRawNotification struct {
}
func (t *testNotificationHandlerOnRawNotification) OnControllerAction(notifyType NotificationType, detail ControllerActionDetail) {
}
func (t *testNotificationHandlerOnRawNotification) OnResourceLoading(notifyType NotificationType, detail ResourceLoadingDetail) {
}
func (t *testNotificationHandlerOnRawNotification) OnTaskAction(notifyType NotificationType, detail NodeActionDetail) {
}
func (t *testNotificationHandlerOnRawNotification) OnTaskNextList(notifyType NotificationType, detail NodeNextListDetail) {
}
func (t *testNotificationHandlerOnRawNotification) OnTaskRecognition(notifyType NotificationType, detail NodeRecognitionDetail) {
}
func (t *testNotificationHandlerOnRawNotification) OnTaskerTask(notifyType NotificationType, detail TaskerTaskDetail) {
}
func (t *testNotificationHandlerOnRawNotification) OnUnknownNotification(msg string, detailsJSON string) {
}
func newTestNotificationHandlerOnRawNotification() Notification {
return &testNotificationHandlerOnRawNotification{}
}
func TestNotificationHandler_OnRawNotification(t *testing.T) {
ctrl := createDbgController(t, newTestNotificationHandlerOnRawNotification())
defer ctrl.Destroy()
isConnected := ctrl.PostConnect().Wait().Success()
require.True(t, isConnected)
res := createResource(t, newTestNotificationHandlerOnRawNotification())
defer res.Destroy()
tasker := createTasker(t, newTestNotificationHandlerOnRawNotification())
defer tasker.Destroy()
taskerBind(t, tasker, ctrl, res)
got := tasker.PostTask("TestNotificationHandler_OnRawNotification", J{
"TestNotificationHandler_OnRawNotification": J{
"action": "Click",
"target": []int{100, 200, 100, 100},
"focus": true,
},
}).Wait().Success()
require.True(t, got)
}