Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
fe530e18
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看板
未验证
提交
fe530e18
编写于
11月 25, 2022
作者:
O
openharmony_ci
提交者:
Gitee
11月 25, 2022
浏览文件
操作
浏览文件
下载
差异文件
!6688 【location】d.ts整改用例适配
Merge pull request !6688 from 权力/myfeature
上级
7d3957e3
39705b4e
变更
9
展开全部
显示空白变更内容
内联
并排
Showing
9 changed file
with
2602 addition
and
224 deletion
+2602
-224
location/geolocation_standard/src/main/config.json
location/geolocation_standard/src/main/config.json
+129
-118
location/geolocation_standard/src/main/js/default/test/GeocoderMTest.test.js
...n_standard/src/main/js/default/test/GeocoderMTest.test.js
+959
-0
location/geolocation_standard/src/main/js/default/test/GeocoderTest.test.js
...on_standard/src/main/js/default/test/GeocoderTest.test.js
+124
-76
location/geolocation_standard/src/main/js/default/test/GetCountryCode.test.js
..._standard/src/main/js/default/test/GetCountryCode.test.js
+3
-7
location/geolocation_standard/src/main/js/default/test/GetCountryCodeM.test.js
...standard/src/main/js/default/test/GetCountryCodeM.test.js
+164
-0
location/geolocation_standard/src/main/js/default/test/List.test.js
...eolocation_standard/src/main/js/default/test/List.test.js
+4
-1
location/geolocation_standard/src/main/js/default/test/LocationMTest.test.js
...n_standard/src/main/js/default/test/LocationMTest.test.js
+1183
-0
location/geolocation_standard/src/main/js/default/test/LocationTest.test.js
...on_standard/src/main/js/default/test/LocationTest.test.js
+34
-21
location/geolocation_standard/src/main/js/default/test/SystemLocation.test.js
..._standard/src/main/js/default/test/SystemLocation.test.js
+2
-1
未找到文件。
location/geolocation_standard/src/main/config.json
浏览文件 @
fe530e18
...
@@ -69,6 +69,16 @@
...
@@ -69,6 +69,16 @@
"when"
:
"inuse"
"when"
:
"inuse"
}
}
},
},
{
"name"
:
"ohos.permission.APPROXIMATELY_LOCATION"
,
"reason"
:
"need use ohos.permission.APPROXIMATELY_LOCATION"
,
"usedScene"
:
{
"ability"
:
[
"ohos.acts.location.geolocation.function.MainAbility"
],
"when"
:
"inuse"
}
},
{
{
"name"
:
"ohos.permission.LOCATION_IN_BACKGROUND"
,
"name"
:
"ohos.permission.LOCATION_IN_BACKGROUND"
,
"reason"
:
"need use ohos.permission.LOCATION_IN_BACKGROUND"
,
"reason"
:
"need use ohos.permission.LOCATION_IN_BACKGROUND"
,
...
@@ -118,3 +128,4 @@
...
@@ -118,3 +128,4 @@
]
]
}
}
}
}
location/geolocation_standard/src/main/js/default/test/GeocoderMTest.test.js
0 → 100644
浏览文件 @
fe530e18
此差异已折叠。
点击以展开。
location/geolocation_standard/src/main/js/default/test/GeocoderTest.test.js
浏览文件 @
fe530e18
...
@@ -119,7 +119,7 @@ describe('geolocationTest_geo1', function () {
...
@@ -119,7 +119,7 @@ describe('geolocationTest_geo1', function () {
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
data
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
data
)
!=
null
);
done
();
done
();
}
}
done
()
done
()
;
})
})
});
});
...
@@ -132,14 +132,18 @@ describe('geolocationTest_geo1', function () {
...
@@ -132,14 +132,18 @@ describe('geolocationTest_geo1', function () {
* @tc.level Level 2
* @tc.level Level 2
*/
*/
it
(
'
SUB_HSS_LocationSystem_Geo_0200
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_0200
'
,
0
,
async
function
(
done
)
{
try
{
await
geolocation
.
isGeoServiceAvailable
().
then
((
result
)
=>
{
await
geolocation
.
isGeoServiceAvailable
().
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] isGeoServiceAvailable1
promise result:
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] isGeoServiceAvailable
promise result:
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] not support now
'
);
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
result
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
result
)
!=
null
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[lbs_js] promise then error.
"
+
JSON
.
stringify
(
error
));
expect
().
assertFail
();
expect
().
assertFail
();
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] isGeoServiceAvailable error.
"
+
JSON
.
stringify
(
error
));
}
done
();
done
();
})
})
...
@@ -161,7 +165,7 @@ describe('geolocationTest_geo1', function () {
...
@@ -161,7 +165,7 @@ describe('geolocationTest_geo1', function () {
console
.
info
(
"
[lbs_js] getAddressesFromLocation callback data is:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
[lbs_js] getAddressesFromLocation callback data is:
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
data
))
!=
null
);
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
data
))
!=
null
);
}
}
resolve
()
resolve
()
;
});
});
})
})
await
promise
.
then
(
done
)
await
promise
.
then
(
done
)
...
@@ -231,15 +235,22 @@ describe('geolocationTest_geo1', function () {
...
@@ -231,15 +235,22 @@ describe('geolocationTest_geo1', function () {
*/
*/
it
(
'
SUB_HSS_LocationSystem_Geo_0600
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_0600
'
,
0
,
async
function
(
done
)
{
let
reverseGeocodeRequest1
=
{
"
latitude
"
:
90
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
1
};
let
reverseGeocodeRequest1
=
{
"
latitude
"
:
90
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
1
};
try
{
await
geolocation
.
getAddressesFromLocation
(
reverseGeocodeRequest1
).
then
((
data
)
=>
{
await
geolocation
.
getAddressesFromLocation
(
reverseGeocodeRequest1
).
then
((
data
)
=>
{
console
.
info
(
'
[lbs_js] getAddressesFromLocation0601 promise:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
[lbs_js] getAddressesFromLocation0601 promise:
'
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
data
))
!=
null
);
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
data
))
!=
null
);
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation0601 promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[lbs_js] getAddressesFromLocation0601 promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
console
.
info
(
'
[lbs_js] not support now
'
);
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation message.
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
let
reverseGeocodeRequest2
=
{
"
latitude
"
:
90.1
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
1
};
let
reverseGeocodeRequest2
=
{
"
latitude
"
:
90.1
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
1
};
try
{
await
geolocation
.
getAddressesFromLocation
(
reverseGeocodeRequest2
).
then
((
data
)
=>
{
await
geolocation
.
getAddressesFromLocation
(
reverseGeocodeRequest2
).
then
((
data
)
=>
{
console
.
info
(
'
[lbs_js] getAddressesFromLocation promise:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
[lbs_js] getAddressesFromLocation promise:
'
+
JSON
.
stringify
(
data
));
expect
(
data
.
length
).
assertEqual
(
0
);
expect
(
data
.
length
).
assertEqual
(
0
);
...
@@ -247,7 +258,13 @@ describe('geolocationTest_geo1', function () {
...
@@ -247,7 +258,13 @@ describe('geolocationTest_geo1', function () {
console
.
info
(
"
[lbs_js] getAddressesFromLocation0602 promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[lbs_js] getAddressesFromLocation0602 promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation message.
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
let
reverseGeocodeRequest3
=
{
"
latitude
"
:
-
90
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
1
};
let
reverseGeocodeRequest3
=
{
"
latitude
"
:
-
90
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
1
};
try
{
await
geolocation
.
getAddressesFromLocation
(
reverseGeocodeRequest3
).
then
((
data
)
=>
{
await
geolocation
.
getAddressesFromLocation
(
reverseGeocodeRequest3
).
then
((
data
)
=>
{
console
.
info
(
'
[lbs_js] getAddressesFromLocation0603 promise:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
[lbs_js] getAddressesFromLocation0603 promise:
'
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
data
))
!=
null
);
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
data
))
!=
null
);
...
@@ -256,7 +273,13 @@ describe('geolocationTest_geo1', function () {
...
@@ -256,7 +273,13 @@ describe('geolocationTest_geo1', function () {
console
.
info
(
'
[lbs_js] not support now
'
);
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation message.
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
let
reverseGeocodeRequest4
=
{
"
latitude
"
:
-
90.1
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
1
};
let
reverseGeocodeRequest4
=
{
"
latitude
"
:
-
90.1
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
1
};
try
{
await
geolocation
.
getAddressesFromLocation
(
reverseGeocodeRequest4
).
then
((
data
)
=>
{
await
geolocation
.
getAddressesFromLocation
(
reverseGeocodeRequest4
).
then
((
data
)
=>
{
console
.
info
(
'
[lbs_js] getAddressesFromLocation0604 promise:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
[lbs_js] getAddressesFromLocation0604 promise:
'
+
JSON
.
stringify
(
data
));
expect
(
data
.
length
).
assertEqual
(
0
);
expect
(
data
.
length
).
assertEqual
(
0
);
...
@@ -264,7 +287,11 @@ describe('geolocationTest_geo1', function () {
...
@@ -264,7 +287,11 @@ describe('geolocationTest_geo1', function () {
console
.
info
(
"
[lbs_js] getAddressesFromLocation0604 promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[lbs_js] getAddressesFromLocation0604 promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
});
});
done
()
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation message.
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
done
();
})
})
/**
/**
...
@@ -277,6 +304,7 @@ describe('geolocationTest_geo1', function () {
...
@@ -277,6 +304,7 @@ describe('geolocationTest_geo1', function () {
*/
*/
it
(
'
SUB_HSS_LocationSystem_Geo_0700
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_0700
'
,
0
,
async
function
(
done
)
{
let
reverseGeocodeRequest
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
180
,
"
maxItems
"
:
1
};
let
reverseGeocodeRequest
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
180
,
"
maxItems
"
:
1
};
try
{
await
geolocation
.
getAddressesFromLocation
(
reverseGeocodeRequest
).
then
((
data
)
=>
{
await
geolocation
.
getAddressesFromLocation
(
reverseGeocodeRequest
).
then
((
data
)
=>
{
console
.
info
(
'
[lbs_js] getAddressesFromLocation0701 promise:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
[lbs_js] getAddressesFromLocation0701 promise:
'
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
data
))
!=
null
);
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
data
))
!=
null
);
...
@@ -285,7 +313,12 @@ describe('geolocationTest_geo1', function () {
...
@@ -285,7 +313,12 @@ describe('geolocationTest_geo1', function () {
console
.
info
(
'
[lbs_js] not support now
'
);
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation message.
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
let
reverseGeocodeRequest1
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
-
180.1
,
"
maxItems
"
:
1
};
let
reverseGeocodeRequest1
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
-
180.1
,
"
maxItems
"
:
1
};
try
{
await
geolocation
.
getAddressesFromLocation
(
reverseGeocodeRequest1
).
then
((
data
)
=>
{
await
geolocation
.
getAddressesFromLocation
(
reverseGeocodeRequest1
).
then
((
data
)
=>
{
console
.
info
(
'
[lbs_js] getAddressesFromLocation0702 promise:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
[lbs_js] getAddressesFromLocation0702 promise:
'
+
JSON
.
stringify
(
data
));
expect
(
data
.
length
).
assertEqual
(
0
);
expect
(
data
.
length
).
assertEqual
(
0
);
...
@@ -293,7 +326,12 @@ describe('geolocationTest_geo1', function () {
...
@@ -293,7 +326,12 @@ describe('geolocationTest_geo1', function () {
console
.
info
(
"
[lbs_js] getAddressesFromLocation0702 promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[lbs_js] getAddressesFromLocation0702 promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation message.
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
let
reverseGeocodeRequest2
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
180
,
"
maxItems
"
:
1
};
let
reverseGeocodeRequest2
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
180
,
"
maxItems
"
:
1
};
try
{
await
geolocation
.
getAddressesFromLocation
(
reverseGeocodeRequest2
).
then
((
data
)
=>
{
await
geolocation
.
getAddressesFromLocation
(
reverseGeocodeRequest2
).
then
((
data
)
=>
{
console
.
info
(
'
[lbs_js] getAddressesFromLocation0703 promise:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
[lbs_js] getAddressesFromLocation0703 promise:
'
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
data
))
!=
null
);
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
data
))
!=
null
);
...
@@ -302,7 +340,12 @@ describe('geolocationTest_geo1', function () {
...
@@ -302,7 +340,12 @@ describe('geolocationTest_geo1', function () {
console
.
info
(
'
[lbs_js] not support now
'
);
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation message.
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
let
reverseGeocodeRequest3
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
180.1
,
"
maxItems
"
:
1
};
let
reverseGeocodeRequest3
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
180.1
,
"
maxItems
"
:
1
};
try
{
await
geolocation
.
getAddressesFromLocation
(
reverseGeocodeRequest3
).
then
((
data
)
=>
{
await
geolocation
.
getAddressesFromLocation
(
reverseGeocodeRequest3
).
then
((
data
)
=>
{
console
.
info
(
'
[lbs_js] getAddressesFromLocation0704 promise:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
[lbs_js] getAddressesFromLocation0704 promise:
'
+
JSON
.
stringify
(
data
));
expect
(
data
.
length
).
assertEqual
(
0
);
expect
(
data
.
length
).
assertEqual
(
0
);
...
@@ -310,7 +353,11 @@ describe('geolocationTest_geo1', function () {
...
@@ -310,7 +353,11 @@ describe('geolocationTest_geo1', function () {
console
.
info
(
"
[lbs_js] getAddressesFromLocation0704 promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[lbs_js] getAddressesFromLocation0704 promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
});
});
done
()
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation message.
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
done
();
})
})
/**
/**
...
@@ -429,7 +476,6 @@ describe('geolocationTest_geo1', function () {
...
@@ -429,7 +476,6 @@ describe('geolocationTest_geo1', function () {
*/
*/
it
(
'
SUB_HSS_LocationSystem_Geo_1100
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_1100
'
,
0
,
async
function
(
done
)
{
try
{
try
{
let
geocodeRequest
=
{
"
description
"
:
""
,
"
maxItems
"
:
1
};
let
geocodeRequest
=
{
"
description
"
:
""
,
"
maxItems
"
:
1
};
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation promise data is:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[lbs_js] getAddressesFromLocation promise data is:
"
+
JSON
.
stringify
(
result
));
...
@@ -566,7 +612,7 @@ describe('geolocationTest_geo1', function () {
...
@@ -566,7 +612,7 @@ describe('geolocationTest_geo1', function () {
console
.
info
(
'
[lbs_js] not support now
'
);
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
});
done
()
done
()
;
})
})
/**
/**
...
@@ -595,7 +641,7 @@ describe('geolocationTest_geo1', function () {
...
@@ -595,7 +641,7 @@ describe('geolocationTest_geo1', function () {
console
.
info
(
'
[lbs_js] not support now
'
);
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
});
done
()
done
()
;
})
})
/**
/**
...
@@ -772,7 +818,7 @@ describe('geolocationTest_geo1', function () {
...
@@ -772,7 +818,7 @@ describe('geolocationTest_geo1', function () {
console
.
info
(
"
[lbs_js] getAddressesFromLocationName message.
"
+
JSON
.
stringify
(
error
.
message
));
console
.
info
(
"
[lbs_js] getAddressesFromLocationName message.
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
}
done
()
done
()
;
})
})
/**
/**
...
@@ -949,3 +995,5 @@ describe('geolocationTest_geo1', function () {
...
@@ -949,3 +995,5 @@ describe('geolocationTest_geo1', function () {
})
})
})
})
location/geolocation_standard/src/main/js/default/test/GetCountryCode.test.js
浏览文件 @
fe530e18
...
@@ -14,7 +14,6 @@
...
@@ -14,7 +14,6 @@
*/
*/
import
geolocation
from
'
@ohos.geolocation
'
;
import
geolocation
from
'
@ohos.geolocation
'
;
import
geolocationm
from
'
@ohos.geoLocationManager
'
;
import
geolocationm
from
'
@ohos.geoLocationManager
'
;
import
geolocations
from
'
@system.geolocation
'
;
import
abilityAccessCtrl
from
'
@ohos.abilityAccessCtrl
'
import
abilityAccessCtrl
from
'
@ohos.abilityAccessCtrl
'
import
bundle
from
'
@ohos.bundle
'
import
bundle
from
'
@ohos.bundle
'
import
osaccount
from
'
@ohos.account.osAccount
'
import
osaccount
from
'
@ohos.account.osAccount
'
...
@@ -146,7 +145,7 @@ describe('geolocationTest_4', function () {
...
@@ -146,7 +145,7 @@ describe('geolocationTest_4', function () {
* @tc.level since 9
* @tc.level since 9
*/
*/
it
(
'
SUB_HSS_LocationSystem_CountryCode_0300
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_CountryCode_0300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
[lbs_js]countryCodeChange
"
);
console
.
info
(
"
[lbs_js]
countryCodeChange
"
);
geolocationm
.
on
(
'
countryCodeChange
'
,
function
(
data
)
{
geolocationm
.
on
(
'
countryCodeChange
'
,
function
(
data
)
{
console
.
info
(
'
[lbs_js] countryCodeChange
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
[lbs_js] countryCodeChange
'
+
JSON
.
stringify
(
data
)
);
});
});
...
@@ -165,6 +164,3 @@ describe('geolocationTest_4', function () {
...
@@ -165,6 +164,3 @@ describe('geolocationTest_4', function () {
})
})
})
})
location/geolocation_standard/src/main/js/default/test/GetCountryCodeM.test.js
0 → 100644
浏览文件 @
fe530e18
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
geolocationm
from
'
@ohos.geoLocationManager
'
;
import
abilityAccessCtrl
from
'
@ohos.abilityAccessCtrl
'
import
bundle
from
'
@ohos.bundle
'
import
osaccount
from
'
@ohos.account.osAccount
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
console
.
info
(
'
[lbs_js]sleep function
'
);
}
async
function
changedLocationMode
(){
let
result1
=
geolocationm
.
isLocationEnabled
();
console
.
info
(
'
[lbs_js] getLocationSwitchState result:
'
+
JSON
.
stringify
(
result1
));
if
(
!
result1
){
await
geolocationm
.
requestEnableLocation
().
then
(
async
(
result
)
=>
{
await
sleep
(
3000
);
console
.
info
(
'
[lbs_js] test requestEnableLocation promise result:
'
+
JSON
.
stringify
(
result
));
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] promise then error.
"
+
JSON
.
stringify
(
error
));
expect
().
assertFail
();
});
}
let
result2
=
geolocationm
.
isLocationEnabled
();
console
.
info
(
'
[lbs_js] check LocationSwitchState result:
'
+
JSON
.
stringify
(
result2
));
}
async
function
applyPermission
()
{
let
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
info
(
"
====>testgetuserid get AccountManager finish====
"
);
let
localId
=
await
osAccountManager
.
getOsAccountLocalIdFromProcess
();
console
.
info
(
"
====>testgetuserid localId obtained by process:
"
+
localId
);
let
appInfo
=
await
bundle
.
getApplicationInfo
(
'
ohos.acts.location.geolocation.function
'
,
0
,
localId
);
let
atManager
=
abilityAccessCtrl
.
createAtManager
();
if
(
atManager
!=
null
)
{
let
tokenID
=
appInfo
.
accessTokenId
;
console
.
info
(
'
[permission] case accessTokenID is
'
+
tokenID
);
let
permissionName1
=
'
ohos.permission.LOCATION
'
;
let
permissionName2
=
'
ohos.permission.LOCATION_IN_BACKGROUND
'
;
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName1
,
1
).
then
((
result
)
=>
{
console
.
info
(
'
[permission] case grantUserGrantedPermission success :
'
+
result
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
[permission] case grantUserGrantedPermission failed :
'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName2
,
1
).
then
((
result
)
=>
{
console
.
info
(
'
[permission] case grantUserGrantedPermission success :
'
+
result
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
[permission] case grantUserGrantedPermission failed :
'
+
err
);
});
}
else
{
console
.
info
(
'
[permission] case apply permission failed, createAtManager failed
'
);
}
}
let
CountryCodeType
=
{
COUNTRY_CODE_FROM_LOCALE
:
1
,
COUNTRY_CODE_FROM_SIM
:
2
,
COUNTRY_CODE_FROM_LOCATION
:
3
,
COUNTRY_CODE_FROM_NETWORK
:
4
,
}
describe
(
'
geolocationTest_6
'
,
function
()
{
beforeAll
(
async
function
(
done
)
{
console
.
info
(
'
beforeAll case
'
);
await
applyPermission
();
done
();
})
beforeEach
(
async
function
(
done
)
{
console
.
info
(
'
beforeEach case
'
);
await
changedLocationMode
();
done
();
})
/**
* @tc.number SUB_HSS_LocationSystem_CountryCode_0400
* @tc.name Test getCountryCode
* @tc.desc Obtaining Country Code Information
* @tc.type Function
* @tc.level since 9
*/
it
(
'
SUB_HSS_LocationSystem_CountryCode_0400
'
,
0
,
async
function
(
done
)
{
await
geolocationm
.
getCountryCode
().
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] getCountryCode promise result:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[lbs_js] country :
"
+
result
.
country
);
console
.
info
(
"
[lbs_js] type:
"
+
result
.
type
);
expect
(
true
).
assertTrue
(
JSON
.
stringify
(
result
)
==
CountryCodeType
.
COUNTRY_CODE_FROM_LOCALE
);
expect
(
true
).
assertTrue
(
JSON
.
stringify
(
result
)
!=
CountryCodeType
.
COUNTRY_CODE_FROM_SIM
);
expect
(
true
).
assertTrue
(
JSON
.
stringify
(
result
)
!=
CountryCodeType
.
COUNTRY_CODE_FROM_LOCATION
);
expect
(
true
).
assertTrue
(
JSON
.
stringify
(
result
)
!=
CountryCodeType
.
COUNTRY_CODE_FROM_NETWORK
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getCountryCode promise then error.
"
+
JSON
.
stringify
(
error
));
expect
().
assertFail
();
});
done
();
})
/**
* @tc.number SUB_HSS_LocationSystem_CountryCode_0500
* @tc.name Test getCountryCode
* @tc.desc Obtaining Country Code Information
* @tc.type Function
* @tc.level since 9
*/
it
(
'
SUB_HSS_LocationSystem_CountryCode_0500
'
,
0
,
async
function
(
done
)
{
function
getCountryCodeCallback
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
geolocationm
.
getCountryCode
((
err
,
data
)
=>
{
if
(
err
)
{
return
console
.
info
(
"
[lbs_js] getCountryCode callback err:
"
+
JSON
.
stringify
(
err
));
}
else
{
console
.
info
(
"
[lbs_js] getCountryCode callback success
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
data
!=
null
);
}
resolve
();
})
})
}
await
getCountryCodeCallback
();
done
();
})
/**
* @tc.number SUB_HSS_LocationSystem_CountryCode_0600
* @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_0600
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
[lbs_js] countryCodeChange
"
);
geolocationm
.
on
(
'
countryCodeChange
'
,
function
(
data
)
{
console
.
info
(
'
[lbs_js] countryCodeChange
'
+
JSON
.
stringify
(
data
)
);
});
await
geolocationm
.
getCountryCode
().
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] getCountryCode promise result:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertTrue
(
JSON
.
stringify
(
result
)
!=
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getCountryCode promise then error.
"
+
JSON
.
stringify
(
error
));
expect
().
assertFail
();
});
geolocationm
.
off
(
'
countryCodeChange
'
,
function
(
data
)
{
console
.
info
(
'
[lbs_js] countryCodeChange
'
+
JSON
.
stringify
(
data
));
done
();
})
done
();
})
})
location/geolocation_standard/src/main/js/default/test/List.test.js
浏览文件 @
fe530e18
...
@@ -14,6 +14,9 @@
...
@@ -14,6 +14,9 @@
*/
*/
require
(
'
./GeocoderTest.test.js
'
)
require
(
'
./GeocoderTest.test.js
'
)
require
(
'
./GeocoderMTest.test.js
'
)
require
(
'
./GetCountryCode.test.js
'
)
require
(
'
./GetCountryCode.test.js
'
)
require
(
'
./
SystemLocation
.test.js
'
)
require
(
'
./
GetCountryCodeM
.test.js
'
)
require
(
'
./LocationTest.test.js
'
)
require
(
'
./LocationTest.test.js
'
)
require
(
'
./LocationMTest.test.js
'
)
require
(
'
./SystemLocation.test.js
'
)
location/geolocation_standard/src/main/js/default/test/LocationMTest.test.js
0 → 100644
浏览文件 @
fe530e18
此差异已折叠。
点击以展开。
location/geolocation_standard/src/main/js/default/test/LocationTest.test.js
浏览文件 @
fe530e18
...
@@ -127,12 +127,12 @@ describe('geolocationTest_geo3', function () {
...
@@ -127,12 +127,12 @@ describe('geolocationTest_geo3', function () {
console
.
info
(
"
[lbs_js] getLocationSwitchState callback data:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
[lbs_js] getLocationSwitchState callback data:
"
+
JSON
.
stringify
(
data
));
expect
(
data
).
assertTrue
();
expect
(
data
).
assertTrue
();
}
}
done
()
})
})
done
();
});
});
/**
/**
* @tc.number LocSwitch_0400
* @tc.number
SUB_HSS_LocationSystem_
LocSwitch_0400
* @tc.name Test requestrequestEnableLocation api.
* @tc.name Test requestrequestEnableLocation api.
* @tc.desc Enabling the Location Service Function for a Third-Party Application -Promise Mode
* @tc.desc Enabling the Location Service Function for a Third-Party Application -Promise Mode
* @tc.size MEDIUM
* @tc.size MEDIUM
...
@@ -493,11 +493,9 @@ describe('geolocationTest_geo3', function () {
...
@@ -493,11 +493,9 @@ describe('geolocationTest_geo3', function () {
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
done
();
done
();
})
})
done
()
done
()
;
})
})
/**
/**
* @tc.number SUB_HSS_SendCommand_0100
* @tc.number SUB_HSS_SendCommand_0100
* @tc.name Test sendCommand
* @tc.name Test sendCommand
...
@@ -508,6 +506,7 @@ describe('geolocationTest_geo3', function () {
...
@@ -508,6 +506,7 @@ describe('geolocationTest_geo3', function () {
*/
*/
it
(
'
SUB_HSS_SendCommand_0100
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_SendCommand_0100
'
,
0
,
async
function
(
done
)
{
let
requestInfo
=
{
'
scenairo
'
:
0x301
,
'
command
'
:
"
command_1
"
};
let
requestInfo
=
{
'
scenairo
'
:
0x301
,
'
command
'
:
"
command_1
"
};
try
{
await
geolocation
.
sendCommand
(
requestInfo
,
(
err
,
result
)
=>
{
await
geolocation
.
sendCommand
(
requestInfo
,
(
err
,
result
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
info
(
'
sendcommand callback err:
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
sendcommand callback err:
'
+
JSON
.
stringify
(
err
));
...
@@ -516,6 +515,11 @@ describe('geolocationTest_geo3', function () {
...
@@ -516,6 +515,11 @@ describe('geolocationTest_geo3', function () {
}
}
console
.
info
(
'
sendcommand callback result:
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
sendcommand callback result:
'
+
JSON
.
stringify
(
result
));
});
});
}
catch
(
error
)
{
console
.
info
(
'
sendcommand callback err:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
})
})
/**
/**
...
@@ -528,6 +532,7 @@ describe('geolocationTest_geo3', function () {
...
@@ -528,6 +532,7 @@ describe('geolocationTest_geo3', function () {
*/
*/
it
(
'
SUB_HSS_SendCommand_0200
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_SendCommand_0200
'
,
0
,
async
function
(
done
)
{
let
requestInfo
=
{
'
scenairo
'
:
0x301
,
'
command
'
:
"
command_1
"
};
let
requestInfo
=
{
'
scenairo
'
:
0x301
,
'
command
'
:
"
command_1
"
};
try
{
geolocation
.
sendCommand
(
requestInfo
).
then
((
result
)
=>
{
geolocation
.
sendCommand
(
requestInfo
).
then
((
result
)
=>
{
console
.
info
(
'
sendCommand promise result:
'
+
result
);
console
.
info
(
'
sendCommand promise result:
'
+
result
);
done
();
done
();
...
@@ -536,6 +541,12 @@ describe('geolocationTest_geo3', function () {
...
@@ -536,6 +541,12 @@ describe('geolocationTest_geo3', function () {
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
done
();
done
();
})
})
}
catch
(
error
)
{
console
.
info
(
'
sendcommand promise err:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
})
})
/**
/**
...
@@ -1249,3 +1260,5 @@ describe('geolocationTest_geo3', function () {
...
@@ -1249,3 +1260,5 @@ describe('geolocationTest_geo3', function () {
})
})
})
})
location/geolocation_standard/src/main/js/default/test/SystemLocation.test.js
浏览文件 @
fe530e18
...
@@ -146,7 +146,7 @@ describe('geolocationTest_geo2', function () {
...
@@ -146,7 +146,7 @@ describe('geolocationTest_geo2', function () {
expect
().
assertFail
();
expect
().
assertFail
();
},
},
});
});
geolocation
.
unsubscribe
();
geolocation
s
.
unsubscribe
();
console
.
info
(
"
[lbs_js] unsubscribe called
"
)
console
.
info
(
"
[lbs_js] unsubscribe called
"
)
done
();
done
();
})
})
...
@@ -196,3 +196,4 @@ describe('geolocationTest_geo2', function () {
...
@@ -196,3 +196,4 @@ describe('geolocationTest_geo2', function () {
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录