Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
8bef1dc0
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
8bef1dc0
编写于
8月 20, 2022
作者:
Q
quanli
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
location update~
Signed-off-by:
N
quanli
<
quanli1@huawei.com
>
上级
ac95ec71
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
509 addition
and
380 deletion
+509
-380
location/geolocation_standard/src/main/js/default/test/GeocoderTest.test.js
...on_standard/src/main/js/default/test/GeocoderTest.test.js
+328
-221
location/geolocation_standard/src/main/js/default/test/GetCountryCode.test.js
..._standard/src/main/js/default/test/GetCountryCode.test.js
+6
-6
location/geolocation_standard/src/main/js/default/test/LocationTest.test.js
...on_standard/src/main/js/default/test/LocationTest.test.js
+166
-138
location/geolocation_standard/src/main/js/default/test/SystemLocation.test.js
..._standard/src/main/js/default/test/SystemLocation.test.js
+9
-15
未找到文件。
location/geolocation_standard/src/main/js/default/test/GeocoderTest.test.js
浏览文件 @
8bef1dc0
...
...
@@ -101,14 +101,14 @@ describe('geolocationTest_geo1', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_Geo_0
001
* @tc.number SUB_HSS_LocationSystem_Geo_0
100
* @tc.name testIsGeoServiceAvailable
* @tc.desc Check whether address resolution and reverse address resolution are supported.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_Geo_0
001
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_0
100
'
,
0
,
async
function
(
done
)
{
geolocation
.
isGeoServiceAvailable
(
async
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
info
(
'
[lbs_js] getGeoServiceState err is :
'
+
JSON
.
stringify
(
err
));
...
...
@@ -124,14 +124,14 @@ describe('geolocationTest_geo1', function () {
});
/**
* @tc.number SUB_HSS_LocationSystem_Geo_0
002
* @tc.number SUB_HSS_LocationSystem_Geo_0
200
* @tc.name TestisGeoServiceAvailable
* @tc.desc Check whether address resolution and reverse address resolution are supported.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_Geo_0
002
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_0
200
'
,
0
,
async
function
(
done
)
{
await
geolocation
.
isGeoServiceAvailable
().
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] isGeoServiceAvailable1 promise result:
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] not support now
'
);
...
...
@@ -144,14 +144,14 @@ describe('geolocationTest_geo1', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_Geo_0
003
* @tc.number SUB_HSS_LocationSystem_Geo_0
300
* @tc.name TestgetAddressesFromLocation
* @tc.desc Address Resolution Test.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_Geo_0
003
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_0
300
'
,
0
,
async
function
(
done
)
{
let
reverseGeocodeRequest
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
1
,
"
locale
"
:
"
zh
"
};
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
geolocation
.
getAddressesFromLocation
(
reverseGeocodeRequest
,
(
err
,
data
)
=>
{
...
...
@@ -168,14 +168,14 @@ describe('geolocationTest_geo1', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_Geo_0
004
* @tc.number SUB_HSS_LocationSystem_Geo_0
400
* @tc.name TestgetAddressesFromLocation
* @tc.desc Address Resolution Test.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_Geo_0
004
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_0
400
'
,
0
,
async
function
(
done
)
{
let
reverseGeocodeRequest
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
1
};
await
geolocation
.
getAddressesFromLocation
(
reverseGeocodeRequest
).
then
((
data
)
=>
{
console
.
info
(
'
[lbs_js] getAddressesFromLocation04 promise:
'
+
JSON
.
stringify
(
data
));
...
...
@@ -199,14 +199,14 @@ describe('geolocationTest_geo1', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_Geo_0
005
* @tc.number SUB_HSS_LocationSystem_Geo_0
500
* @tc.name TestgetAddressesFromLocation
* @tc.desc Obtaining Multiple Addresses Using the Address Resolution Function.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_Geo_0
005
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_0
500
'
,
0
,
async
function
(
done
)
{
let
reverseGeocodeRequest
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
5
};
await
geolocation
.
getAddressesFromLocation
(
reverseGeocodeRequest
).
then
((
data
)
=>
{
console
.
info
(
'
[lbs_js] getAddressesFromLocation05 promise:
'
+
JSON
.
stringify
(
data
));
...
...
@@ -221,14 +221,14 @@ describe('geolocationTest_geo1', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_Geo_0
006
* @tc.number SUB_HSS_LocationSystem_Geo_0
600
* @tc.name TestgetAddressesFromLocation
* @tc.desc Input parameter boundary test of the address resolution function
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_Geo_0
006
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_0
600
'
,
0
,
async
function
(
done
)
{
let
reverseGeocodeRequest1
=
{
"
latitude
"
:
90
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
1
};
await
geolocation
.
getAddressesFromLocation
(
reverseGeocodeRequest1
).
then
((
data
)
=>
{
console
.
info
(
'
[lbs_js] getAddressesFromLocation0601 promise:
'
+
JSON
.
stringify
(
data
));
...
...
@@ -267,14 +267,14 @@ describe('geolocationTest_geo1', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_Geo_0
007
* @tc.number SUB_HSS_LocationSystem_Geo_0
700
* @tc.name TestgetAddressesFromLocation
* @tc.desc Input parameter boundary test of the address resolution function
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_Geo_0
007
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_0
700
'
,
0
,
async
function
(
done
)
{
let
reverseGeocodeRequest
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
180
,
"
maxItems
"
:
1
};
await
geolocation
.
getAddressesFromLocation
(
reverseGeocodeRequest
).
then
((
data
)
=>
{
console
.
info
(
'
[lbs_js] getAddressesFromLocation0701 promise:
'
+
JSON
.
stringify
(
data
));
...
...
@@ -313,14 +313,14 @@ describe('geolocationTest_geo1', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_Geo_0
008
* @tc.number SUB_HSS_LocationSystem_Geo_0
800
* @tc.name TestgetAddressesFromLocation
* @tc.desc Reverse address resolution test.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_Geo_0
008
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_0
800
'
,
0
,
async
function
(
done
)
{
let
geocodeRequest
=
{
"
description
"
:
"
上海市浦东新区金穗路1800号
"
,
"
maxItems
"
:
1
,
...
...
@@ -330,56 +330,62 @@ describe('geolocationTest_geo1', function () {
"
maxLatitude
"
:
""
,
"
maxLongitude
"
:
""
};
geolocation
.
getAddressesFromLocationName
(
geocodeRequest
,
(
err
,
data
)
=>
{
if
(
err
)
{
switch
(
err
)
{
case
100
:
console
.
info
(
"
NOT_SUPPORTED:
"
+
JSON
.
stringify
(
err
));
break
;
case
101
:
console
.
info
(
"
INPUT_PARAMS_ERROR:
"
+
JSON
.
stringify
(
err
));
break
;
case
102
:
console
.
info
(
"
REVERSE_GEOCODE_ERROR:
"
+
JSON
.
stringify
(
err
));
break
;
case
103
:
console
.
info
(
"
GEOCODE_ERROR:
"
+
JSON
.
stringify
(
err
));
break
;
case
104
:
console
.
info
(
"
LOCATOR_ERROR:
"
+
JSON
.
stringify
(
err
));
break
;
case
105
:
console
.
info
(
"
LOCATION_SWITCH_ERROR:
"
+
JSON
.
stringify
(
err
));
break
;
case
106
:
console
.
info
(
"
LAST_KNOWN_LOCATION_ERROR:
"
+
JSON
.
stringify
(
err
));
break
;
case
107
:
console
.
info
(
"
LOCATION_REQUEST_TIMEOUT_ERROR:
"
+
JSON
.
stringify
(
err
));
break
;
case
108
:
console
.
info
(
"
QUERY_COUNTRY_CODE_ERROR:
"
+
JSON
.
stringify
(
err
));
break
;
default
:
console
.
info
(
'
[lbs_js] getAddressesFromLocationName callback err is :
'
+
JSON
.
stringify
(
err
));
try
{
geolocation
.
getAddressesFromLocationName
(
geocodeRequest
,
(
err
,
data
)
=>
{
if
(
err
)
{
switch
(
err
)
{
case
100
:
console
.
info
(
"
NOT_SUPPORTED:
"
+
JSON
.
stringify
(
err
));
break
;
case
101
:
console
.
info
(
"
INPUT_PARAMS_ERROR:
"
+
JSON
.
stringify
(
err
));
break
;
case
102
:
console
.
info
(
"
REVERSE_GEOCODE_ERROR:
"
+
JSON
.
stringify
(
err
));
break
;
case
103
:
console
.
info
(
"
GEOCODE_ERROR:
"
+
JSON
.
stringify
(
err
));
break
;
case
104
:
console
.
info
(
"
LOCATOR_ERROR:
"
+
JSON
.
stringify
(
err
));
break
;
case
105
:
console
.
info
(
"
LOCATION_SWITCH_ERROR:
"
+
JSON
.
stringify
(
err
));
break
;
case
106
:
console
.
info
(
"
LAST_KNOWN_LOCATION_ERROR:
"
+
JSON
.
stringify
(
err
));
break
;
case
107
:
console
.
info
(
"
LOCATION_REQUEST_TIMEOUT_ERROR:
"
+
JSON
.
stringify
(
err
));
break
;
case
108
:
console
.
info
(
"
QUERY_COUNTRY_CODE_ERROR:
"
+
JSON
.
stringify
(
err
));
break
;
default
:
console
.
info
(
'
getAddressesFromLocationName callback err:
'
+
JSON
.
stringify
(
err
));
}
}
else
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName08 callback data is:
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
data
))
!=
null
);
}
}
else
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName08 callback data is:
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
data
))
!=
null
);
}
done
();
});
done
();
});
}
catch
(
error
){
console
.
info
(
"
[lbs_js] getAddressesFromLocationName message.
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
done
();
})
/**
* @tc.number SUB_HSS_LocationSystem_Geo_0
009
* @tc.number SUB_HSS_LocationSystem_Geo_0
900
* @tc.name TestgetAddressesFromLocation
* @tc.desc Reverse address resolution test.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_Geo_0
009
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_0
900
'
,
0
,
async
function
(
done
)
{
let
geocodeRequest
=
{
"
description
"
:
"
上海市浦东新区金穗路1800号
"
,
"
maxItems
"
:
1
};
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation callback data is:
"
+
JSON
.
stringify
(
result
));
...
...
@@ -392,14 +398,14 @@ describe('geolocationTest_geo1', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_Geo_
001
0
* @tc.number SUB_HSS_LocationSystem_Geo_
100
0
* @tc.name TestgetAddressesFromLocation
* @tc.desc Obtaining Multiple Locations Using the Reverse Address Resolution Function.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_Geo_
001
0
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_
100
0
'
,
0
,
async
function
(
done
)
{
let
geocodeRequest
=
{
"
description
"
:
"
上海市浦东新区金穗路1800号
"
,
"
maxItems
"
:
5
};
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation m callback data is:
"
+
JSON
.
stringify
(
result
));
...
...
@@ -413,44 +419,54 @@ describe('geolocationTest_geo1', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_Geo_
0011
* @tc.number SUB_HSS_LocationSystem_Geo_
1100
* @tc.name TestgetAddressesFromLocation
* @tc.desc Invalid parameter input test for the reverse address resolution function.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_Geo_0011
'
,
0
,
async
function
(
done
)
{
let
geocodeRequest
=
{
"
description
"
:
""
,
"
maxItems
"
:
1
};
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation promise data is:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
it
(
'
SUB_HSS_LocationSystem_Geo_1100
'
,
0
,
async
function
(
done
)
{
try
{
let
geocodeRequest
=
{
"
description
"
:
""
,
"
maxItems
"
:
1
};
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation promise data is:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
}
catch
(
error
){
console
.
info
(
"
[lbs_js] getAddressesFromLocationName message.
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
let
geocodeRequest1
=
{
"
description
"
:
null
,
"
maxItems
"
:
1
};
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest1
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation promise data is:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
try
{
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest1
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation callback data is:
"
+
JSON
.
stringify
(
result
));
expect
(
result
.
length
==
0
).
assertTrue
();
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
});
}
catch
(
error
){
console
.
info
(
"
[lbs_js] getAddressesFromLocationName message.
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
done
();
})
/**
* @tc.number SUB_HSS_LocationSystem_Geo_
0012
* @tc.number SUB_HSS_LocationSystem_Geo_
1200
* @tc.name TestgetAddressesFromLocation
* @tc.desc Test the reverse address resolution function in the specified range..
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_Geo_
0012
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_
1200
'
,
0
,
async
function
(
done
)
{
let
geocodeRequest
=
{
"
description
"
:
"
上海金穗路1800号
"
,
"
maxItems
"
:
1
,
...
...
@@ -471,7 +487,7 @@ describe('geolocationTest_geo1', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_Geo_
0013
* @tc.number SUB_HSS_LocationSystem_Geo_
1300
* @tc.name TestgetAddressesFromLocation
* @tc.desc Invalid input parameter test for the reverse address resolution function in the specified range
* -Invalid location name.
...
...
@@ -479,7 +495,7 @@ describe('geolocationTest_geo1', function () {
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_Geo_
0013
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_
1300
'
,
0
,
async
function
(
done
)
{
let
geocodeRequest
=
{
"
description
"
:
""
,
"
maxItems
"
:
1
,
...
...
@@ -488,13 +504,18 @@ describe('geolocationTest_geo1', function () {
"
maxLatitude
"
:
31.1537977881
,
"
maxLongitude
"
:
121.8026736943
};
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation callback data is:
"
+
JSON
.
stringify
(
result
));
expect
(
result
.
length
==
0
).
assertTrue
();
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
});
try
{
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation callback data is:
"
+
JSON
.
stringify
(
result
));
expect
(
result
.
length
==
0
).
assertTrue
();
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
});
}
catch
(
error
){
console
.
info
(
"
[lbs_js] getAddressesFromLocationName message.
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
let
geocodeRequest1
=
{
"
description
"
:
null
,
"
maxItems
"
:
1
,
...
...
@@ -503,18 +524,23 @@ describe('geolocationTest_geo1', function () {
"
maxLatitude
"
:
31.1537977881
,
"
maxLongitude
"
:
121.8026736943
};
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest1
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation callback data is:
"
+
JSON
.
stringify
(
result
));
expect
(
result
.
length
==
0
).
assertTrue
();
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
});
try
{
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest1
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation callback data is:
"
+
JSON
.
stringify
(
result
));
expect
(
result
.
length
==
0
).
assertTrue
();
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
});
}
catch
(
error
){
console
.
info
(
"
[lbs_js] getAddressesFromLocationName message.
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
done
();
})
/**
* @tc.number SUB_HSS_LocationSystem_Geo_
0014
* @tc.number SUB_HSS_LocationSystem_Geo_
1400
* @tc.name TestgetAddressesFromLocation
* @tc.desc Invalid input parameter test for the reverse address resolution function in the specified range
* - the address is not in the range.
...
...
@@ -522,7 +548,7 @@ describe('geolocationTest_geo1', function () {
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_Geo_
0014
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_
1400
'
,
0
,
async
function
(
done
)
{
let
geocodeRequest
=
{
"
description
"
:
"
北京天安门
"
,
"
maxItems
"
:
1
,
...
...
@@ -543,7 +569,7 @@ describe('geolocationTest_geo1', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_Geo_
0015
* @tc.number SUB_HSS_LocationSystem_Geo_
1500
* @tc.name TestgetAddressesFromLocation
* @tc.desc Invalid longitude and latitude entered for the reverse address resolution
* function in the specified range. The longitude and latitude range boundary is inverted..
...
...
@@ -551,7 +577,7 @@ describe('geolocationTest_geo1', function () {
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_Geo_
0015
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_
1500
'
,
0
,
async
function
(
done
)
{
let
geocodeRequest
=
{
"
description
"
:
"
北京天安门
"
,
"
maxItems
"
:
1
,
...
...
@@ -572,14 +598,14 @@ describe('geolocationTest_geo1', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_Geo_
0016
* @tc.number SUB_HSS_LocationSystem_Geo_
1600
* @tc.name TestgetAddressesFromLocation
* @tc.desc Input parameter boundary test for the reverse address resolution function in a specified range.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_Geo_
0016
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_
1600
'
,
0
,
async
function
(
done
)
{
let
geocodeRequest1
=
{
"
description
"
:
"
上海金穗路1800号
"
,
"
maxItems
"
:
1
,
...
...
@@ -588,14 +614,19 @@ describe('geolocationTest_geo1', function () {
"
maxLatitude
"
:
31.1537977881
,
"
maxLongitude
"
:
121.8026736943
};
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest1
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js]getAddressesFromLocation promise1:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
try
{
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest1
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js]getAddressesFromLocation promise1:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
}
catch
(
error
){
console
.
info
(
"
[lbs_js] getAddressesFromLocationName message.
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
let
geocodeRequest2
=
{
"
description
"
:
"
上海金穗路1800号
"
,
"
maxItems
"
:
1
,
...
...
@@ -604,14 +635,19 @@ describe('geolocationTest_geo1', function () {
"
maxLatitude
"
:
31.1537977881
,
"
maxLongitude
"
:
121.8026736943
};
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest2
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js]getAddressesFromLocation promise2:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
try
{
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest2
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js]getAddressesFromLocation promise2:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
}
catch
(
error
){
console
.
info
(
"
[lbs_js] getAddressesFromLocationName message.
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
let
geocodeRequest3
=
{
"
description
"
:
"
上海金穗路1800号
"
,
"
maxItems
"
:
1
,
...
...
@@ -620,13 +656,18 @@ describe('geolocationTest_geo1', function () {
"
maxLatitude
"
:
31.1537977881
,
"
maxLongitude
"
:
121.8026736943
};
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest3
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js]getAddressesFromLocation promise3:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
==
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
});
try
{
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest3
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js]getAddressesFromLocation promise3:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
==
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
});
}
catch
(
error
){
console
.
info
(
"
[lbs_js] getAddressesFromLocationName message.
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
let
geocodeRequest4
=
{
"
description
"
:
"
上海金穗路1800号
"
,
"
maxItems
"
:
1
,
...
...
@@ -635,14 +676,19 @@ describe('geolocationTest_geo1', function () {
"
maxLatitude
"
:
31.1537977881
,
"
maxLongitude
"
:
121.8026736943
};
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest4
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js]getAddressesFromLocation promise4:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
});
try
{
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest4
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js]getAddressesFromLocation promise4:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
});
}
catch
(
error
){
console
.
info
(
"
[lbs_js] getAddressesFromLocationName message.
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
let
geocodeRequest5
=
{
"
description
"
:
"
上海金穗路1800号
"
,
"
maxItems
"
:
1
,
...
...
@@ -651,14 +697,19 @@ describe('geolocationTest_geo1', function () {
"
maxLatitude
"
:
-
90
,
"
maxLongitude
"
:
121.8026736943
};
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest5
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js]getAddressesFromLocation promise5:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
try
{
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest5
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js]getAddressesFromLocation promise5:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
}
catch
(
error
){
console
.
info
(
"
[lbs_js] getAddressesFromLocationName message.
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
let
geocodeRequest6
=
{
"
description
"
:
"
上海金穗路1800号
"
,
"
maxItems
"
:
1
,
...
...
@@ -667,14 +718,19 @@ describe('geolocationTest_geo1', function () {
"
maxLatitude
"
:
90
,
"
maxLongitude
"
:
121.8026736943
};
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest6
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js]getAddressesFromLocation promise6:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
try
{
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest6
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js]getAddressesFromLocation promise6:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
}
catch
(
error
){
console
.
info
(
"
[lbs_js] getAddressesFromLocationName message.
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
let
geocodeRequest7
=
{
"
description
"
:
"
上海金穗路1800号
"
,
"
maxItems
"
:
1
,
...
...
@@ -683,13 +739,18 @@ describe('geolocationTest_geo1', function () {
"
maxLatitude
"
:
-
90.1
,
"
maxLongitude
"
:
121.8026736943
};
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest7
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js]getAddressesFromLocation promise7:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
==
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
});
try
{
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest7
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js]getAddressesFromLocation promise7:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
==
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
});
}
catch
(
error
){
console
.
info
(
"
[lbs_js] getAddressesFromLocationName message.
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
let
geocodeRequest8
=
{
"
description
"
:
"
上海金穗路1800号
"
,
"
maxItems
"
:
1
,
...
...
@@ -698,25 +759,30 @@ describe('geolocationTest_geo1', function () {
"
maxLatitude
"
:
90.1
,
"
maxLongitude
"
:
121.8026736943
};
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest8
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js]getAddressesFromLocation promise8:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
==
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
});
try
{
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest8
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js]getAddressesFromLocation promise8:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
==
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
});
}
catch
(
error
){
console
.
info
(
"
[lbs_js] getAddressesFromLocationName message.
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
done
()
})
/**
* @tc.number SUB_HSS_LocationSystem_Geo_
0017
* @tc.number SUB_HSS_LocationSystem_Geo_
1700
* @tc.name TestgetAddressesFromLocation
* @tc.desc Longitude input parameter boundary test for the reverse address resolution function in a specified range
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_Geo_
0017
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_
1700
'
,
0
,
async
function
(
done
)
{
let
geocodeRequest1
=
{
"
description
"
:
"
北京天安门
"
,
"
maxItems
"
:
1
,
...
...
@@ -725,14 +791,19 @@ describe('geolocationTest_geo1', function () {
"
maxLatitude
"
:
39.95
,
"
maxLongitude
"
:
116.45
};
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest1
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js]getAddressesFromLocation promise1:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
try
{
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest1
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js]getAddressesFromLocation promise1:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
}
catch
(
error
){
console
.
info
(
"
[lbs_js] getAddressesFromLocationName message.
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
let
geocodeRequest2
=
{
"
description
"
:
"
北京天安门
"
,
"
maxItems
"
:
1
,
...
...
@@ -741,13 +812,18 @@ describe('geolocationTest_geo1', function () {
"
maxLatitude
"
:
39.95
,
"
maxLongitude
"
:
116.45
};
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest2
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js]getAddressesFromLocation promise2:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
error
.
length
!=
0
).
assertTrue
();
});
try
{
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest2
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js]getAddressesFromLocation promise2:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
error
.
length
!=
0
).
assertTrue
();
});
}
catch
(
error
){
console
.
info
(
"
[lbs_js] getAddressesFromLocationName message.
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
let
geocodeRequest3
=
{
"
description
"
:
"
北京天安门
"
,
"
maxItems
"
:
1
,
...
...
@@ -756,13 +832,18 @@ describe('geolocationTest_geo1', function () {
"
maxLatitude
"
:
39.95
,
"
maxLongitude
"
:
116.45
};
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest3
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js]getAddressesFromLocation promise3:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
error
.
length
!=
0
).
assertTrue
();
});
try
{
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest3
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js]getAddressesFromLocation promise3:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
error
.
length
!=
0
).
assertTrue
();
});
}
catch
(
error
){
console
.
info
(
"
[lbs_js] getAddressesFromLocationName message.
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
let
geocodeRequest4
=
{
"
description
"
:
"
北京天安门
"
,
"
maxItems
"
:
1
,
...
...
@@ -771,13 +852,18 @@ describe('geolocationTest_geo1', function () {
"
maxLatitude
"
:
39.95
,
"
maxLongitude
"
:
116.45
};
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest4
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js]getAddressesFromLocation promise4:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
error
.
length
!=
0
).
assertTrue
();
});
try
{
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest4
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js]getAddressesFromLocation promise4:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
error
.
length
!=
0
).
assertTrue
();
});
}
catch
(
error
){
console
.
info
(
"
[lbs_js] getAddressesFromLocationName message.
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
let
geocodeRequest5
=
{
"
description
"
:
"
北京天安门
"
,
"
maxItems
"
:
1
,
...
...
@@ -786,13 +872,18 @@ describe('geolocationTest_geo1', function () {
"
maxLatitude
"
:
39.95
,
"
maxLongitude
"
:
-
180
};
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest5
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js]getAddressesFromLocation promise5:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
error
.
length
!=
0
).
assertTrue
();
});
try
{
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest5
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js]getAddressesFromLocation promise5:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
error
.
length
!=
0
).
assertTrue
();
});
}
catch
(
error
){
console
.
info
(
"
[lbs_js] getAddressesFromLocationName message.
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
let
geocodeRequest6
=
{
"
description
"
:
"
北京天安门
"
,
"
maxItems
"
:
1
,
...
...
@@ -801,13 +892,18 @@ describe('geolocationTest_geo1', function () {
"
maxLatitude
"
:
39.95
,
"
maxLongitude
"
:
180
};
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest6
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js]getAddressesFromLocation promise6:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
error
.
length
!=
0
).
assertTrue
();
});
try
{
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest6
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js]getAddressesFromLocation promise6:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
error
.
length
!=
0
).
assertTrue
();
});
}
catch
(
error
){
console
.
info
(
"
[lbs_js] getAddressesFromLocationName message.
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
let
geocodeRequest7
=
{
"
description
"
:
"
北京天安门
"
,
"
maxItems
"
:
1
,
...
...
@@ -816,13 +912,18 @@ describe('geolocationTest_geo1', function () {
"
maxLatitude
"
:
39.95
,
"
maxLongitude
"
:
-
180.1
};
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest7
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js]getAddressesFromLocation promise7:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
error
.
length
!=
0
).
assertTrue
();
});
try
{
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest7
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js]getAddressesFromLocation promise7:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
error
.
length
!=
0
).
assertTrue
();
});
}
catch
(
error
){
console
.
info
(
"
[lbs_js] getAddressesFromLocationName message.
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
let
geocodeRequest8
=
{
"
description
"
:
"
北京天安门
"
,
"
maxItems
"
:
1
,
...
...
@@ -831,13 +932,19 @@ describe('geolocationTest_geo1', function () {
"
maxLatitude
"
:
39.95
,
"
maxLongitude
"
:
180.1
};
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest8
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js]getAddressesFromLocation promise8:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
error
.
length
!=
0
).
assertTrue
();
});
try
{
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest8
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js]getAddressesFromLocation promise8:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
error
.
length
!=
0
).
assertTrue
();
});
}
catch
(
error
){
console
.
info
(
"
[lbs_js] getAddressesFromLocationName message.
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
done
();
})
})
location/geolocation_standard/src/main/js/default/test/GetCountryCode.test.js
浏览文件 @
8bef1dc0
...
...
@@ -90,13 +90,13 @@ describe('geolocationTest_4', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_CountryCode_0
001
* @tc.number SUB_HSS_LocationSystem_CountryCode_0
100
* @tc.name Test getCountryCode
* @tc.desc Obtaining Country Code Information
* @tc.type Function
* @tc.level since 9
*/
it
(
'
SUB_HSS_LocationSystem_CountryCode_0
001
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_CountryCode_0
100
'
,
0
,
async
function
(
done
)
{
await
geolocation
.
getCountryCode
().
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] getCountryCode promise result:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[lbs_js] country :
"
+
result
.
country
);
...
...
@@ -113,13 +113,13 @@ describe('geolocationTest_4', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_CountryCode_0
002
* @tc.number SUB_HSS_LocationSystem_CountryCode_0
200
* @tc.name Test getCountryCode
* @tc.desc Obtaining Country Code Information
* @tc.type Function
* @tc.level since 9
*/
it
(
'
SUB_HSS_LocationSystem_CountryCode_0
002
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_CountryCode_0
200
'
,
0
,
async
function
(
done
)
{
function
getCountryCodeCallback
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
geolocation
.
getCountryCode
((
err
)
=>
{
...
...
@@ -137,13 +137,13 @@ describe('geolocationTest_4', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_CountryCode_0
003
* @tc.number SUB_HSS_LocationSystem_CountryCode_0
300
* @tc.name getCountryCode_on_off
* @tc.desc The interception country code is changed.
* @tc.type Function
* @tc.level since 9
*/
it
(
'
SUB_HSS_LocationSystem_CountryCode_0
003
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_CountryCode_0
300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
[lbs_js]countryCodeChange
"
);
geolocation
.
on
(
'
countryCodeChange
'
,
function
(
data
)
{
console
.
info
(
'
[lbs_js] countryCodeChange
'
+
JSON
.
stringify
(
data
)
);
...
...
location/geolocation_standard/src/main/js/default/test/LocationTest.test.js
浏览文件 @
8bef1dc0
...
...
@@ -111,14 +111,14 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number
LocSwitch_0003
* @tc.name
SUB_HSS_LocationSystem_LocSwitch_0003
* @tc.desc
Test requestrequestEnableLocation api .
* @tc.number
SUB_HSS_LocationSystem_LocSwitch_0300
* @tc.name
Test requestrequestEnableLocation api
* @tc.desc
Enabling the Location Service Function for a Third-Party App - Callback
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_LocSwitch_0
003
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_LocSwitch_0
300
'
,
0
,
async
function
(
done
)
{
geolocation
.
isLocationEnabled
(
async
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
info
(
'
[lbs_js] getLocationSwitchState callback err is :
'
+
JSON
.
stringify
(
err
));
...
...
@@ -132,14 +132,14 @@ describe('geolocationTest_geo3', function () {
});
/**
* @tc.number LocSwitch_0
004
* @tc.name
SUB_HSS_LocationSystem_LocSwitch_0004
* @tc.desc
Test requestrequestEnableLocation api .
* @tc.number LocSwitch_0
400
* @tc.name
Test requestrequestEnableLocation api.
* @tc.desc
Enabling the Location Service Function for a Third-Party Application -Promise Mode
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_LocSwitch_0
004
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_LocSwitch_0
400
'
,
0
,
async
function
(
done
)
{
await
geolocation
.
isLocationEnabled
().
then
((
result1
)
=>
{
console
.
info
(
'
[lbs_js] getLocationSwitchStateLocSwitch_0004 result:
'
+
JSON
.
stringify
(
result1
));
expect
(
result1
).
assertTrue
();
...
...
@@ -150,14 +150,14 @@ describe('geolocationTest_geo3', function () {
});
/**
* @tc.number
LocSwitch_0005
* @tc.name
SUB_HSS_LocationSystem_LocSwitch_0005
* @tc.desc
Test locationServiceState api
.
* @tc.number
SUB_HSS_LocationSystem_LocSwitch_0500
* @tc.name
Test locationServiceState api .
* @tc.desc
Subscribe to the location service status change
.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_LocSwitch_0
005
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_LocSwitch_0
500
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
just for overwriting,locationServiceState test need system api
'
);
var
locationServiceState
=
(
state
)
=>
{
console
.
log
(
'
locationServiceState: state:
'
+
JSON
.
stringify
(
state
));
...
...
@@ -168,14 +168,14 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_SingleLoc_0
001
* @tc.number SUB_HSS_LocationSystem_SingleLoc_0
100
* @tc.name Test getCurrentLocation
* @tc.desc Initiate a single location request in a specified scenario and set the navigation scenario..
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0
001
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0
100
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
0
};
function
getCurrentLocationCallback
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
...
...
@@ -193,24 +193,25 @@ describe('geolocationTest_geo3', function () {
})
}
console
.
info
(
'
getCurrentLocationCallback start
'
);
await
getCurrentLocationCallback
().
then
(()
=>
{
console
.
info
(
'
getCurrentLocationCallback resolve
'
);
},
()
=>
{
console
.
info
(
'
getCurrentLocationCallback reject
'
);
});
console
.
info
(
'
getCurrentLocationCallback end
'
);
await
geolocation
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
console
.
info
(
"
getCurrentLocation callback_0003, result:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
(
result
!=
null
);
}).
catch
(
error
=>
{
console
.
info
(
'
getCurrentLocation callback_0003:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
})
done
();
})
/**
* @tc.number SUB_HSS_LocationSystem_SingleLoc_0
002
* @tc.number SUB_HSS_LocationSystem_SingleLoc_0
200
* @tc.name Test getCurrentLocation
* @tc.desc Initiate a single location request in a specified scenario and set the navigation scenario..
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0
002
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0
200
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x203
,
"
scenario
"
:
0x301
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
0
};
await
geolocation
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise result
'
+
JSON
.
stringify
(
result
));
...
...
@@ -223,14 +224,14 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_SingleLoc_0
003
* @tc.number SUB_HSS_LocationSystem_SingleLoc_0
300
* @tc.name Test getCurrentLocation
* @tc.desc Initiate a single location request in a specified scenario and set the track tracing scenario.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0
003
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0
300
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x302
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
10
};
function
getCurrentLocationCallback
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
...
...
@@ -248,24 +249,25 @@ describe('geolocationTest_geo3', function () {
})
}
console
.
info
(
'
getCurrentLocationCallback start
'
);
await
getCurrentLocationCallback
().
then
(()
=>
{
console
.
info
(
'
getCurrentLocationCallback resolve
'
);
},
()
=>
{
console
.
info
(
'
getCurrentLocationCallback reject
'
);
});
console
.
info
(
'
getCurrentLocationCallback end
'
);
await
geolocation
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
console
.
info
(
"
getCurrentLocation callback_0003, result:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
(
result
!=
null
);
}).
catch
(
error
=>
{
console
.
info
(
'
getCurrentLocation callback_0003:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
})
done
();
})
/**
* @tc.number SUB_HSS_LocationSystem_SingleLoc_0
004
* @tc.number SUB_HSS_LocationSystem_SingleLoc_0
400
* @tc.name Test getCurrentLocation
* @tc.desc Initiate a single location request in a specified scenario and set a car-sharing scenario.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0
004
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0
400
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x303
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
10
};
await
geolocation
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise result004
'
+
JSON
.
stringify
(
result
));
...
...
@@ -278,14 +280,14 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_SingleLoc_0
005
* @tc.number SUB_HSS_LocationSystem_SingleLoc_0
500
* @tc.name Test getCurrentLocation
* @tc.desc Initiate a single location request in a specified scenario and set the life service scenario..
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0
005
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0
500
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x304
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
0
};
await
geolocation
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise result005
'
+
JSON
.
stringify
(
result
));
...
...
@@ -298,7 +300,7 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_SingleLoc_0
006
* @tc.number SUB_HSS_LocationSystem_SingleLoc_0
600
* @tc.name Test getCurrentLocation
* @tc.desc Initiate a single location request in a specified scenario
* and set the scenario with no power consumption.
...
...
@@ -306,7 +308,7 @@ describe('geolocationTest_geo3', function () {
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0
006
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0
600
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest1
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x305
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
10
};
let
currentLocationRequest2
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
10
};
await
geolocation
.
getCurrentLocation
(
currentLocationRequest1
).
then
((
result
)
=>
{
...
...
@@ -326,14 +328,14 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_SingleLoc_0
007
* @tc.number SUB_HSS_LocationSystem_SingleLoc_0
700
* @tc.name Test getCurrentLocation
* @tc.desc Initiate a single location request with the parameter set to high-precision priority location request.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0
007
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0
700
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x0201
,
"
scenario
"
:
0x0300
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
10
};
await
geolocation
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise result007
'
+
JSON
.
stringify
(
result
));
...
...
@@ -346,14 +348,14 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_SingleLoc_0
008
* @tc.number SUB_HSS_LocationSystem_SingleLoc_0
800
* @tc.name Test getCurrentLocation
* @tc.desc Initiate a single location request with parameters set to fast location and priority location request.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0
008
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0
800
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x0203
,
"
scenario
"
:
0x0300
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
10
};
await
geolocation
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise result010
'
+
JSON
.
stringify
(
result
));
...
...
@@ -366,14 +368,14 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_SingleLoc_0
009
* @tc.number SUB_HSS_LocationSystem_SingleLoc_0
900
* @tc.name Test getCurrentLocation
* @tc.desc Initiate a single location request with parameters set to low power consumption.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0
009
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0
900
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x0202
,
"
scenario
"
:
0x0300
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
0
};
await
geolocation
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise result009
'
+
JSON
.
stringify
(
result
));
...
...
@@ -386,14 +388,14 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_SingleLoc_0
01
0
* @tc.number SUB_HSS_LocationSystem_SingleLoc_0
10
0
* @tc.name Test getCurrentLocation
* @tc.desc Initiate a single location request and set the location reporting precision.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0
01
0
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0
10
0
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x0200
,
"
scenario
"
:
0x0300
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
5
};
let
currentLocationRequest1
=
{
"
priority
"
:
0x0200
,
"
scenario
"
:
0x0300
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
2
};
await
geolocation
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
...
...
@@ -412,7 +414,7 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_SingleLoc_
0011
* @tc.number SUB_HSS_LocationSystem_SingleLoc_
1100
* @tc.name Test getCurrentLocation
* @tc.desc Initiate a single location request for specific configuration
* and set the reporting precision of abnormal location.
...
...
@@ -420,7 +422,7 @@ describe('geolocationTest_geo3', function () {
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_SingleLoc_
0011
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_
1100
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x0201
,
"
scenario
"
:
0x0300
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
0
};
let
currentLocationRequest1
=
{
"
priority
"
:
0x0201
,
"
scenario
"
:
0x0300
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
-
1
};
await
geolocation
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
...
...
@@ -440,14 +442,14 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_SingleLoc_
0012
* @tc.number SUB_HSS_LocationSystem_SingleLoc_
1200
* @tc.name Test getCurrentLocation
* @tc.desc Initiate a single location request and set the location timeout interval.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_SingleLoc_
0012
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_
1200
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x0201
,
"
scenario
"
:
0x0301
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
0
};
let
currentLocationRequest1
=
{
"
priority
"
:
0x0201
,
"
scenario
"
:
0x0301
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
0
};
await
geolocation
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
...
...
@@ -467,14 +469,14 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_SingleLoc_
0013
* @tc.number SUB_HSS_LocationSystem_SingleLoc_
1300
* @tc.name Test getCurrentLocation
* @tc.desc Initiate a specified single location request and set the exception location timeout interval.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_SingleLoc_
0013
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_
1300
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x0201
,
"
scenario
"
:
0x0302
,
"
timeoutMs
"
:
0
,
"
maxAccuracy
"
:
0
};
let
currentLocationRequest1
=
{
"
priority
"
:
0x0201
,
"
scenario
"
:
0x0302
,
"
timeoutMs
"
:
-
1000
,
"
maxAccuracy
"
:
0
};
await
geolocation
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
...
...
@@ -496,14 +498,14 @@ describe('geolocationTest_geo3', function () {
/**
* @tc.number SUB_HSS_SendCommand_
callback
* @tc.number SUB_HSS_SendCommand_
0100
* @tc.name Test sendCommand
* @tc.desc Test sendCommand api .
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_SendCommand_
callback
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_SendCommand_
0100
'
,
0
,
async
function
(
done
)
{
let
requestInfo
=
{
'
scenairo
'
:
0x301
,
'
command
'
:
"
command_1
"
};
await
geolocation
.
sendCommand
(
requestInfo
,
(
err
,
result
)
=>
{
if
(
err
)
{
...
...
@@ -516,14 +518,14 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number SUB_HSS_SendCommand_
promise
* @tc.number SUB_HSS_SendCommand_
0200
* @tc.name Test sendCommand
* @tc.desc Test sendCommand1 api .
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_SendCommand_
promise
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_SendCommand_
0200
'
,
0
,
async
function
(
done
)
{
let
requestInfo
=
{
'
scenairo
'
:
0x301
,
'
command
'
:
"
command_1
"
};
geolocation
.
sendCommand
(
requestInfo
).
then
((
result
)
=>
{
console
.
info
(
'
sendCommand promise result:
'
+
result
);
...
...
@@ -536,14 +538,14 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_LocRequest_0
001
* @tc.number SUB_HSS_LocationSystem_LocRequest_0
100
* @tc.name Test locationChange
* @tc.desc Initiate a request for continuous positioning in a specified scenario and set the navigation scenario.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_LocRequest_0
001
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_LocRequest_0
100
'
,
0
,
async
function
(
done
)
{
enableLocationSwitch
();
let
requestInfo
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeInterval
"
:
5
,
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
0
};
...
...
@@ -557,14 +559,14 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_LocRequest_0
002
* @tc.number SUB_HSS_LocationSystem_LocRequest_0
200
* @tc.name Test locationChange
* @tc.desc Initiate a request for continuous positioning in a specified scenario and set a track tracing scenario.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_LocRequest_0
002
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_LocRequest_0
200
'
,
0
,
async
function
(
done
)
{
enableLocationSwitch
();
let
requestInfo
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x302
,
"
timeInterval
"
:
1
,
"
distanceInterval
"
:
5
,
"
maxAccuracy
"
:
10
};
...
...
@@ -578,14 +580,14 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_LocRequest_0
003
* @tc.number SUB_HSS_LocationSystem_LocRequest_0
300
* @tc.name Test locationChange
* @tc.desc Initiate a continuous location request in a specified scenario and set a car-sharing scenario.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_LocRequest_0
003
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_LocRequest_0
300
'
,
0
,
async
function
(
done
)
{
enableLocationSwitch
();
let
requestInfo
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x303
,
"
timeInterval
"
:
5
,
"
distanceInterval
"
:
5
,
"
maxAccuracy
"
:
10
};
...
...
@@ -599,14 +601,14 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_LocRequest_0
004
* @tc.number SUB_HSS_LocationSystem_LocRequest_0
400
* @tc.name Test locationChange
* @tc.desc Initiate a continuous location request in a specified scenario and set a life service scenario.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_LocRequest_0
004
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_LocRequest_0
400
'
,
0
,
async
function
(
done
)
{
enableLocationSwitch
();
let
requestInfo
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x303
,
"
timeInterval
"
:
1
,
"
distanceInterval
"
:
5
,
"
maxAccuracy
"
:
0
};
...
...
@@ -620,7 +622,7 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_LocRequest_0
005
* @tc.number SUB_HSS_LocationSystem_LocRequest_0
500
* @tc.name Test locationChange
* @tc.desc Initiate a continuous location request in a specified scenario
* and set the scenario with no power consumption.
...
...
@@ -628,7 +630,7 @@ describe('geolocationTest_geo3', function () {
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_LocRequest_0
005
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_LocRequest_0
500
'
,
0
,
async
function
(
done
)
{
enableLocationSwitch
();
let
requestInfo
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x305
,
"
timeInterval
"
:
1
,
"
distanceInterval
"
:
5
,
"
maxAccuracy
"
:
10
};
...
...
@@ -648,7 +650,7 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_LocRequest_0
007
* @tc.number SUB_HSS_LocationSystem_LocRequest_0
700
* @tc.name Test locationChange
* @tc.desc Initiate a specified continuous positioning request and
* set the parameter to high-precision priority positioning request.
...
...
@@ -656,7 +658,7 @@ describe('geolocationTest_geo3', function () {
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_LocRequest_0
007
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_LocRequest_0
700
'
,
0
,
async
function
(
done
)
{
enableLocationSwitch
();
let
requestInfo
=
{
"
priority
"
:
0x201
,
"
scenario
"
:
0x300
,
"
timeInterval
"
:
1
,
"
distanceInterval
"
:
5
,
"
maxAccuracy
"
:
10
};
...
...
@@ -670,7 +672,7 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_LocRequest_0
008
* @tc.number SUB_HSS_LocationSystem_LocRequest_0
800
* @tc.name Test locationChange
* @tc.desc Initiate a specified continuous positioning request with the parameter
* set to fast positioning and priority positioning request.
...
...
@@ -678,7 +680,7 @@ describe('geolocationTest_geo3', function () {
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_LocRequest_0
008
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_LocRequest_0
800
'
,
0
,
async
function
(
done
)
{
enableLocationSwitch
();
let
requestInfo
=
{
"
priority
"
:
0x203
,
"
scenario
"
:
0x300
,
"
timeInterval
"
:
5
,
"
distanceInterval
"
:
5
,
"
maxAccuracy
"
:
10
};
...
...
@@ -692,7 +694,7 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_LocRequest_0
009
* @tc.number SUB_HSS_LocationSystem_LocRequest_0
900
* @tc.name Test locationChange
* @tc.desc Initiate a specified continuous positioning request with the parameter
* set to low power consumption type.
...
...
@@ -700,7 +702,7 @@ describe('geolocationTest_geo3', function () {
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_LocRequest_0
009
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_LocRequest_0
900
'
,
0
,
async
function
(
done
)
{
enableLocationSwitch
();
let
requestInfo
=
{
"
priority
"
:
0x202
,
"
scenario
"
:
0x300
,
"
timeInterval
"
:
1
,
"
distanceInterval
"
:
5
,
"
maxAccuracy
"
:
10
}
...
...
@@ -714,14 +716,14 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_LocRequest_0
01
0
* @tc.number SUB_HSS_LocationSystem_LocRequest_0
10
0
* @tc.name Test locationChange
* @tc.desc Initiate a specified continuous location request and set the reporting interval.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_LocRequest_0
01
0
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_LocRequest_0
10
0
'
,
0
,
async
function
(
done
)
{
enableLocationSwitch
();
let
requestInfo
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeInterval
"
:
3
,
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
0
};
...
...
@@ -735,14 +737,14 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_LocRequest_
0011
* @tc.number SUB_HSS_LocationSystem_LocRequest_
1100
* @tc.name Test locationChange
* @tc.desc Initiate a specified continuous location request and set the location reporting interval.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_LocRequest_
0011
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_LocRequest_
1100
'
,
0
,
async
function
(
done
)
{
enableLocationSwitch
();
let
requestInfo
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeInterval
"
:
5
,
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
0
};
...
...
@@ -756,14 +758,14 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_LocRequest_
0012
* @tc.number SUB_HSS_LocationSystem_LocRequest_
1200
* @tc.name Test locationChange
* @tc.desc Initiate a specified continuous location request and set the interval for reporting exceptions.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_LocRequest_
0012
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_LocRequest_
1200
'
,
0
,
async
function
(
done
)
{
enableLocationSwitch
();
let
requestInfo
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeInterval
"
:
0
,
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
0
};
...
...
@@ -777,14 +779,14 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_LocRequest_
0013
* @tc.number SUB_HSS_LocationSystem_LocRequest_
1300
* @tc.name Test locationChange
* @tc.desc Initiate a specified continuous location request and set the interval for reporting abnormal locations.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_LocRequest_
0013
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_LocRequest_
1300
'
,
0
,
async
function
(
done
)
{
enableLocationSwitch
();
let
requestInfo1
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeInterval
"
:
0
,
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
0
};
...
...
@@ -806,14 +808,14 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_LocRequest_
0014
* @tc.number SUB_HSS_LocationSystem_LocRequest_
1400
* @tc.name Test locationChange
* @tc.desc Initiate a specified continuous positioning request and set the positioning reporting precision.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_LocRequest_
0014
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_LocRequest_
1400
'
,
0
,
async
function
(
done
)
{
enableLocationSwitch
();
let
requestInfo1
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeInterval
"
:
0
,
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
5
};
...
...
@@ -835,14 +837,14 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_LocRequest_
0015
* @tc.number SUB_HSS_LocationSystem_LocRequest_
1500
* @tc.name Test locationChange
* @tc.desc Initiate a specified continuous location request and set the reporting precision of abnormal location.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_LocRequest_
0015
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_LocRequest_
1500
'
,
0
,
async
function
(
done
)
{
enableLocationSwitch
();
let
requestInfo1
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeInterval
"
:
0
,
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
0
};
...
...
@@ -864,14 +866,14 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_LastLoc_0
001
* @tc.number SUB_HSS_LocationSystem_LastLoc_0
100
* @tc.name Test getLastLocation
* @tc.desc Obtain the last location after a single location.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_LastLoc_0
001
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_LastLoc_0
100
'
,
0
,
async
function
(
done
)
{
enableLocationSwitch
();
let
requestInfo
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeInterval
"
:
0
,
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
0
};
...
...
@@ -889,7 +891,7 @@ describe('geolocationTest_geo3', function () {
+
'
accuracy:
'
+
result
.
accuracy
+
'
speed:
'
+
result
.
speed
+
'
timeStamp:
'
+
result
.
timeStamp
+
'
direction:
'
+
result
.
direction
+
'
timeSinceBoot:
'
+
result
.
timeSinceBoot
+
'
additions:
'
+
result
.
additions
+
'
additionSize
'
+
result
.
additionSize
+
'
isFromMock
'
+
result
.
isFromMock
);
+
'
isFromMock
'
+
result
.
isFromMock
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getLastLocation promise then error:
"
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] not support now
'
);
...
...
@@ -899,14 +901,14 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_LastLoc_0
002
* @tc.number SUB_HSS_LocationSystem_LastLoc_0
200
* @tc.name Test getLastLocation
* @tc.desc Obtain the last location after continuous positioning.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_LastLoc_0
002
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_LastLoc_0
200
'
,
0
,
async
function
(
done
)
{
enableLocationSwitch
();
let
requestInfo
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeInterval
"
:
0
,
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
0
};
...
...
@@ -916,27 +918,34 @@ describe('geolocationTest_geo3', function () {
};
geolocation
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
geolocation
.
off
(
'
locationChange
'
,
locationChange
);
geolocation
.
getLastLocation
(
async
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
info
(
'
[LastLoc_0002] getLastLocation callback err is :
'
+
JSON
.
stringify
(
err
));
}
else
{
console
.
info
(
'
[LastLoc_0002] getLastLocation callback result:
'
+
JSON
.
stringify
(
data
));
expect
(
data
).
assertTrue
();
}
done
()
})
function
getLastLocationCallback
(){
return
new
Promise
((
resolve
,
reject
)
=>
{
geolocation
.
getLastLocation
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
info
(
'
[LastLoc_0002] getLastLocation callback err is :
'
+
JSON
.
stringify
(
err
));
expect
(
true
).
assertEqual
(
err
!=
null
);
}
else
{
console
.
info
(
'
[LastLoc_0002] getLastLocation callback result:
'
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
data
!=
null
);
}
resolve
();
});
})
}
await
getLastLocationCallback
();
done
();
})
/**
* @tc.number SUB_HSS_LocationSystem_Gnss_0
001
* @tc.number SUB_HSS_LocationSystem_Gnss_0
100
* @tc.name Test gnssStatusChange
* @tc.desc Monitoring Satellite Information Reporting
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_Gnss_0
001
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Gnss_0
100
'
,
0
,
async
function
(
done
)
{
await
changedLocationMode
();
var
gnssStatusCb
=
(
satelliteStatusInfo
)
=>
{
console
.
info
(
'
gnssStatusChange:
'
+
satelliteStatusInfo
);
...
...
@@ -961,14 +970,14 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_Gnss_0
002
* @tc.number SUB_HSS_LocationSystem_Gnss_0
200
* @tc.name Test nmeaMessageChange
* @tc.desc Monitoring NMEA Information Reporting
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_Gnss_0
002
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Gnss_0
200
'
,
0
,
async
function
(
done
)
{
await
changedLocationMode
();
let
requestInfo
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeInterval
"
:
0
,
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
0
};
...
...
@@ -987,14 +996,14 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_Batching_0
001
* @tc.number SUB_HSS_LocationSystem_Batching_0
100
* @tc.name Test cachedGnssLocationsReporting
* @tc.desc Setting the Gnss Batching Reporting Interval
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_Batching_0
001
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Batching_0
100
'
,
0
,
async
function
(
done
)
{
var
cachedLocationsCb1
=
(
locations
)
=>
{
console
.
log
(
'
cachedGnssLocationsReporting: locations:
'
+
JSON
.
stringify
(
locations
));
expect
(
true
).
assertEqual
(
locations
!=
null
);
...
...
@@ -1013,14 +1022,14 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_Batching_0
002
* @tc.number SUB_HSS_LocationSystem_Batching_0
200
* @tc.name Test cachedGnssLocationsReporting
* @tc.desc Setting the Gnss Batching Cache Queue to Be Reported When the Gnss Batching Cache Queue Is Full
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_Batching_0
002
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Batching_0
200
'
,
0
,
async
function
(
done
)
{
var
cachedLocationsCb
=
(
locations
)
=>
{
console
.
log
(
'
cachedGnssLocationsReporting: locations:
'
+
JSON
.
stringify
(
locations
));
expect
(
true
).
assertEqual
(
locations
!=
null
);
...
...
@@ -1034,14 +1043,14 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_Batching_0
003
* @tc.number SUB_HSS_LocationSystem_Batching_0
300
* @tc.name Test getCachedGnssLocationsSize
* @tc.desc Obtains the number of GNSS data records in the batching process.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_Batching_0
003
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Batching_0
300
'
,
0
,
async
function
(
done
)
{
var
cachedLocationsCb
=
(
locations
)
=>
{
console
.
log
(
'
cachedGnssLocationsReporting: locations:
'
+
JSON
.
stringify
(
locations
));
expect
(
true
).
assertEqual
(
locations
!=
null
);
...
...
@@ -1051,29 +1060,44 @@ describe('geolocationTest_geo3', function () {
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
0
};
geolocation
.
on
(
'
cachedGnssLocationsReporting
'
,
CachedGnssLoactionsRequest
,
cachedLocationsCb
);
geolocation
.
off
(
'
cachedGnssLocationsReporting
'
,
cachedLocationsCb
);
geolocation
.
getCachedGnssLocationsSize
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
info
(
'
[lbs_js] getCachedGnssLocationsSize callback err is :
'
+
err
);
expect
(
true
).
assertTrue
(
err
!=
null
);
done
();
}
else
{
console
.
info
(
"
[lbs_js] getCachedGnssLocationsSize callback data is:
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertTrue
(
data
!=
null
);
done
()
}
});
// geolocation.getCachedGnssLocationsSize((err, data) => {
// if (err) {
// console.info('[lbs_js] getCachedGnssLocationsSize callback err is : ' + err);
// expect(true).assertTrue(err != null);
// done();
// }else {
// console.info("[lbs_js] getCachedGnssLocationsSize callback data is: " + JSON.stringify(data));
// expect(true).assertTrue(data != null);
// done()
// }
// });
function
getCachedGnssLocationsSizeCallback
(){
return
new
Promise
((
resolve
,
reject
)
=>
{
geolocation
.
getCachedGnssLocationsSize
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
info
(
'
[lbs_js] getCachedGnssLocationsSize callback err is :
'
+
JSON
.
stringify
(
err
));
expect
(
true
).
assertTrue
(
err
!=
null
);
}
else
{
console
.
info
(
"
[lbs_js] getCachedGnssLocationsSize callback data is:
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertTrue
(
data
!=
null
);
}
resolve
();
});
})
}
await
getCachedGnssLocationsSizeCallback
();
done
();
})
/**
* @tc.number SUB_HSS_LocationSystem_Batching_0
004
* @tc.number SUB_HSS_LocationSystem_Batching_0
400
* @tc.name Test getCachedGnssLocationsSize
* @tc.desc Obtains the number of GNSS data records in the batching process.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_Batching_0
004
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Batching_0
400
'
,
0
,
async
function
(
done
)
{
var
cachedLocationsCb
=
(
locations
)
=>
{
console
.
log
(
'
cachedGnssLocationsReporting: locations:
'
+
JSON
.
stringify
(
locations
));
expect
(
true
).
assertEqual
(
locations
!=
null
);
...
...
@@ -1095,14 +1119,14 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_Batching_0
005
* @tc.number SUB_HSS_LocationSystem_Batching_0
500
* @tc.name Test flushCachedGnssLocations
* @tc.desc Obtains the GNSS data of the current batching.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_Batching_0
005
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Batching_0
500
'
,
0
,
async
function
(
done
)
{
var
cachedLocationsCb
=
(
locations
)
=>
{
console
.
log
(
'
cachedGnssLocationsReporting: locations:
'
+
JSON
.
stringify
(
locations
));
expect
(
true
).
assertEqual
(
locations
!=
null
);
...
...
@@ -1112,29 +1136,33 @@ describe('geolocationTest_geo3', function () {
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
0
};
geolocation
.
on
(
'
cachedGnssLocationsReporting
'
,
CachedGnssLoactionsRequest
,
cachedLocationsCb
);
geolocation
.
off
(
'
cachedGnssLocationsReporting
'
,
cachedLocationsCb
);
geolocation
.
flushCachedGnssLocations
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
info
(
'
[lbs_js] flushCachedGnssLocations callback err is :
'
+
err
);
expect
(
true
).
assertTrue
(
err
!=
null
);
done
();
}
else
{
console
.
info
(
"
[lbs_js] flushCachedGnssLocations callback data is:
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertTrue
(
data
);
done
();
}
});
function
flushCachedGnssLocationsCallback
(){
return
new
Promise
((
resolve
,
reject
)
=>
{
geolocation
.
flushCachedGnssLocations
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
info
(
'
[lbs_js] flushCachedGnssLocations callback err is :
'
+
JSON
.
stringify
(
err
));
expect
(
true
).
assertTrue
(
err
!=
null
);
}
else
{
console
.
info
(
"
[lbs_js] flushCachedGnssLocations callback data is:
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertTrue
(
data
);
}
resolve
();
});
})
}
await
flushCachedGnssLocationsCallback
();
done
();
})
/**
* @tc.number SUB_HSS_LocationSystem_Batching_0
006
* @tc.number SUB_HSS_LocationSystem_Batching_0
600
* @tc.name Test flushCachedGnssLocations
* @tc.desc Obtain the GNSS data of the current batching.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_Batching_0
006
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Batching_0
600
'
,
0
,
async
function
(
done
)
{
var
cachedLocationsCb
=
(
locations
)
=>
{
console
.
log
(
'
cachedGnssLocationsReporting: locations:
'
+
JSON
.
stringify
(
locations
));
expect
(
true
).
assertEqual
(
locations
!=
null
);
...
...
@@ -1157,14 +1185,14 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_GeoFence_0
001
* @tc.number SUB_HSS_LocationSystem_GeoFence_0
100
* @tc.name Test fenceStatusChange
* @tc.desc Gnss fence function test
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 1
*/
it
(
'
SUB_HSS_LocationSystem_GeoFence_0
001
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_GeoFence_0
100
'
,
0
,
async
function
(
done
)
{
await
changedLocationMode
();
let
geofence
=
{
"
latitude
"
:
31.12
,
"
longitude
"
:
121.11
,
"
radius
"
:
1
,
"
expiration
"
:
""
};
let
geofenceRequest
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
geofence
"
:
geofence
};
...
...
@@ -1194,14 +1222,14 @@ describe('geolocationTest_geo3', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_GeoFence_0
005
* @tc.number SUB_HSS_LocationSystem_GeoFence_0
500
* @tc.name Test fenceStatusChange
* @tc.desc Test the function of locating the validity period of the fence.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 1
*/
it
(
'
SUB_HSS_LocationSystem_GeoFence_0
005
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_GeoFence_0
500
'
,
0
,
async
function
(
done
)
{
await
changedLocationMode
();
let
geofence
=
{
"
latitude
"
:
31.12
,
"
longitude
"
:
121.11
,
"
radius
"
:
1
,
"
expiration
"
:
""
};
let
geofenceRequest
=
{
"
priority
"
:
0x203
,
"
scenario
"
:
0x301
,
"
geofence
"
:
geofence
};
...
...
location/geolocation_standard/src/main/js/default/test/SystemLocation.test.js
浏览文件 @
8bef1dc0
...
...
@@ -81,16 +81,16 @@ describe('geolocationTest_geo2', function () {
})
afterEach
(
function
()
{
})
/**
* @tc.number SUB_HSS_LocationSystem_systemapi_0
001
* @tc.number SUB_HSS_LocationSystem_systemapi_0
100
* @tc.name Test getLocation
* @tc.desc Obtains the geographical location of a device..
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_systemapi_0
001
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_systemapi_0
100
'
,
0
,
async
function
(
done
)
{
geolocations
.
getLocation
({
timeout
:
30000
,
coordType
:
'
wgs84
'
,
...
...
@@ -127,14 +127,14 @@ describe('geolocationTest_geo2', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_systemapi_0
002
* @tc.number SUB_HSS_LocationSystem_systemapi_0
200
* @tc.name Test subscribe and unsubscribe
* @tc.desc Test subscribe api .
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_systemapi_0
002
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_systemapi_0
200
'
,
0
,
async
function
(
done
)
{
geolocations
.
subscribe
({
coordType
:
'
wgs84
'
,
success
:
function
(
data
)
{
...
...
@@ -152,14 +152,14 @@ describe('geolocationTest_geo2', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_systemapi_0
003
* @tc.number SUB_HSS_LocationSystem_systemapi_0
300
* @tc.name test getLocationType
* @tc.desc Subscribing to geographical location information .
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_systemapi_0
003
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_systemapi_0
300
'
,
0
,
async
function
(
done
)
{
geolocations
.
getLocationType
({
success
:
function
(
data
)
{
console
.
log
(
'
success get location type:
'
+
JSON
.
stringify
(
data
));
...
...
@@ -178,14 +178,14 @@ describe('geolocationTest_geo2', function () {
})
/**
* @tc.number SUB_HSS_LocationSystem_systemapi_0
004
* @tc.number SUB_HSS_LocationSystem_systemapi_0
400
* @tc.name Test getSupportedCoordTypes
* @tc.desc Obtains the geographical location of a device..
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_HSS_LocationSystem_systemapi_0
004
'
,
0
,
function
()
{
it
(
'
SUB_HSS_LocationSystem_systemapi_0
400
'
,
0
,
function
()
{
let
types
=
geolocations
.
getSupportedCoordTypes
();
console
.
info
(
'
[lbs_js] getSupportedCoordTypes result:
'
+
JSON
.
stringify
(
types
));
expect
(
true
).
assertEqual
(
types
.
length
!=
0
);
...
...
@@ -196,9 +196,3 @@ describe('geolocationTest_geo2', function () {
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录