-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathutil.js
More file actions
28 lines (23 loc) · 771 Bytes
/
Copy pathutil.js
File metadata and controls
28 lines (23 loc) · 771 Bytes
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
let util = {
setLog(file) {
Log.setFile(file);
},
log() {
Log.log(arguments);
console.log(arguments);
},
click(tag) {
this.log('点击了控件:', tag);
Gesture.click(tag.bounds().left + Math.random() * tag.bounds().width(), tag.bounds().top + Math.random() * tag.bounds().height());
},
input(tag, text) {
tag.setText(text);
},
swipe() {
let bottom = Device.height() * (0.6 + Math.random() * 0.2);
let top = Device.height() * (0.2 + Math.random() * 0.2);
let left = Math.random() * Device.width() * 0.6 + Device.width() * 0.2;
Gesture.swipe(left, bottom, left + Device.width() * 0.1, top, 200 + 100 * Math.random());
}
}
module.exports = util;