forked from electricbubble/gidevice
-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
simulatelocation_test.go
48 lines (37 loc) · 1.29 KB
/
simulatelocation_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
package giDevice
import "testing"
var simulateLocationSrv SimulateLocation
func setupSimulateLocationSrv(t *testing.T) {
setupLockdownSrv(t)
var err error
if lockdownSrv, err = dev.lockdownService(); err != nil {
t.Fatal(err)
}
if simulateLocationSrv, err = lockdownSrv.SimulateLocationService(); err != nil {
t.Fatal(err)
}
}
func Test_simulateLocation_Update(t *testing.T) {
setupSimulateLocationSrv(t)
// https://api.map.baidu.com/lbsapi/getpoint/index.html
// if err := dev.SimulateLocationUpdate(116.024067, 40.362639, CoordinateSystemBD09); err != nil {
if err := simulateLocationSrv.Update(116.024067, 40.362639, CoordinateSystemBD09); err != nil {
t.Fatal(err)
}
// https://developer.amap.com/tools/picker
// https://lbs.qq.com/tool/getpoint/index.html
// if err := simulateLocationSrv.Update(120.116979,30.252876, CoordinateSystemGCJ02); err != nil {
// t.Fatal(err)
// }
if err := simulateLocationSrv.Update(121.499763, 31.239580); err != nil {
// if err := simulateLocationSrv.Update(121.499763, 31.239580, CoordinateSystemWGS84); err != nil {
t.Fatal(err)
}
}
func Test_simulateLocation_Recover(t *testing.T) {
setupSimulateLocationSrv(t)
// if err := dev.SimulateLocationRecover(); err != nil {
if err := simulateLocationSrv.Recover(); err != nil {
t.Fatal(err)
}
}