Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
3604745e
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看板
提交
3604745e
编写于
11月 29, 2022
作者:
Q
quanli
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
quanli1@huawei.com
Signed-off-by:
N
quanli
<
quanli1@huawei.com
>
上级
230853eb
变更
25
展开全部
隐藏空白更改
内联
并排
Showing
25 changed file
with
2120 addition
and
958 deletion
+2120
-958
location/geolocation_standard/BUILD.gn
location/geolocation_standard/BUILD.gn
+3
-1
location/geolocation_standard/Test.json
location/geolocation_standard/Test.json
+6
-4
location/geolocation_standard/src/main/config.json
location/geolocation_standard/src/main/config.json
+39
-7
location/geolocation_standard/src/main/js/MainAbility/app.js
location/geolocation_standard/src/main/js/MainAbility/app.js
+0
-0
location/geolocation_standard/src/main/js/MainAbility/i18n/en-US.json
...location_standard/src/main/js/MainAbility/i18n/en-US.json
+0
-0
location/geolocation_standard/src/main/js/MainAbility/i18n/zh-CN.json
...location_standard/src/main/js/MainAbility/i18n/zh-CN.json
+0
-0
location/geolocation_standard/src/main/js/MainAbility/pages/index/index.css
...on_standard/src/main/js/MainAbility/pages/index/index.css
+0
-0
location/geolocation_standard/src/main/js/MainAbility/pages/index/index.hml
...on_standard/src/main/js/MainAbility/pages/index/index.hml
+0
-0
location/geolocation_standard/src/main/js/MainAbility/pages/index/index.js
...ion_standard/src/main/js/MainAbility/pages/index/index.js
+15
-7
location/geolocation_standard/src/main/js/TestAbility/app.js
location/geolocation_standard/src/main/js/TestAbility/app.js
+31
-0
location/geolocation_standard/src/main/js/TestAbility/i18n/en-US.json
...location_standard/src/main/js/TestAbility/i18n/en-US.json
+8
-0
location/geolocation_standard/src/main/js/TestAbility/i18n/zh-CN.json
...location_standard/src/main/js/TestAbility/i18n/zh-CN.json
+8
-0
location/geolocation_standard/src/main/js/TestAbility/pages/index/index.css
...on_standard/src/main/js/TestAbility/pages/index/index.css
+30
-0
location/geolocation_standard/src/main/js/TestAbility/pages/index/index.hml
...on_standard/src/main/js/TestAbility/pages/index/index.hml
+5
-0
location/geolocation_standard/src/main/js/TestAbility/pages/index/index.js
...ion_standard/src/main/js/TestAbility/pages/index/index.js
+26
-43
location/geolocation_standard/src/main/js/TestRunner/OpenHarmonyTestRunner.js
..._standard/src/main/js/TestRunner/OpenHarmonyTestRunner.js
+59
-0
location/geolocation_standard/src/main/js/test/GeocoderMTest.test.js
...olocation_standard/src/main/js/test/GeocoderMTest.test.js
+140
-96
location/geolocation_standard/src/main/js/test/GeocoderTest.test.js
...eolocation_standard/src/main/js/test/GeocoderTest.test.js
+152
-104
location/geolocation_standard/src/main/js/test/GetCountryCode.test.js
...location_standard/src/main/js/test/GetCountryCode.test.js
+75
-51
location/geolocation_standard/src/main/js/test/GetCountryCodeM.test.js
...ocation_standard/src/main/js/test/GetCountryCodeM.test.js
+76
-51
location/geolocation_standard/src/main/js/test/List.test.js
location/geolocation_standard/src/main/js/test/List.test.js
+32
-0
location/geolocation_standard/src/main/js/test/LocationMTest.test.js
...olocation_standard/src/main/js/test/LocationMTest.test.js
+657
-264
location/geolocation_standard/src/main/js/test/LocationTest.test.js
...eolocation_standard/src/main/js/test/LocationTest.test.js
+722
-314
location/geolocation_standard/src/main/js/test/SystemLocation.test.js
...location_standard/src/main/js/test/SystemLocation.test.js
+20
-16
location/geolocation_standard/src/main/resources/base/element/string.json
...tion_standard/src/main/resources/base/element/string.json
+16
-0
未找到文件。
location/geolocation_standard/BUILD.gn
浏览文件 @
3604745e
...
@@ -29,7 +29,9 @@ ohos_js_hap_suite("ActslocationJsTest") {
...
@@ -29,7 +29,9 @@ ohos_js_hap_suite("ActslocationJsTest") {
subsystem_name = "location"
subsystem_name = "location"
}
}
ohos_js_assets("geolocation_js_assets") {
ohos_js_assets("geolocation_js_assets") {
source_dir = "./src/main/js/default"
js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
}
}
ohos_resources("geolocation_resources") {
ohos_resources("geolocation_resources") {
sources = [ "./src/main/resources" ]
sources = [ "./src/main/resources" ]
...
...
location/geolocation_standard/Test.json
浏览文件 @
3604745e
{
{
"description"
:
"Configuration for geolocation js api Tests"
,
"description"
:
"Configuration for geolocation js api Tests"
,
"driver"
:
{
"driver"
:
{
"type"
:
"JSUnitTest"
,
"type"
:
"OHJSUnitTest"
,
"bundle-name"
:
"ohos.acts.location.geolocation.function"
,
"package-name"
:
"ohos.acts.location.geolocation.function"
,
"test-timeout"
:
"600000"
,
"test-timeout"
:
"600000"
,
"
package"
:
"ohos.acts.location.geolocation.function
"
,
"
shell-timeout"
:
"60000
"
,
"
shell-timeout"
:
"60000"
"
testcase-timeout"
:
70000
},
},
"kits"
:
[
"kits"
:
[
{
{
...
@@ -14,7 +16,7 @@
...
@@ -14,7 +16,7 @@
"type"
:
"AppInstallKit"
,
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
"cleanup-apps"
:
true
},
},
{
{
"type"
:
"ShellKit"
,
"type"
:
"ShellKit"
,
"run-command"
:
[
"run-command"
:
[
"hilog -Q pidoff"
"hilog -Q pidoff"
...
...
location/geolocation_standard/src/main/config.json
浏览文件 @
3604745e
...
@@ -15,8 +15,9 @@
...
@@ -15,8 +15,9 @@
"deviceConfig"
:
{},
"deviceConfig"
:
{},
"module"
:
{
"module"
:
{
"package"
:
"ohos.acts.location.geolocation.function"
,
"package"
:
"ohos.acts.location.geolocation.function"
,
"name"
:
".MyApplication"
,
"name"
:
".entry"
,
"mainAbility"
:
"ohos.acts.location.geolocation.function.MainAbility"
,
"mainAbility"
:
".MainAbility"
,
"srcPath"
:
""
,
"deviceType"
:
[
"deviceType"
:
[
"tablet"
,
"tablet"
,
"default"
,
"default"
,
...
@@ -28,7 +29,7 @@
...
@@ -28,7 +29,7 @@
"moduleType"
:
"entry"
"moduleType"
:
"entry"
},
},
"abilities"
:
[
"abilities"
:
[
{
{
"skills"
:
[
"skills"
:
[
{
{
"entities"
:
[
"entities"
:
[
...
@@ -39,12 +40,29 @@
...
@@ -39,12 +40,29 @@
]
]
}
}
],
],
"orientation"
:
"unspecified"
,
"formsEnabled"
:
false
,
"name"
:
".MainAbility"
,
"srcLanguage"
:
"js"
,
"srcPath"
:
"MainAbility"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:MainAbility_desc"
,
"label"
:
"$string:MainAbility_label"
,
"type"
:
"page"
,
"visible"
:
true
,
"visible"
:
true
,
"name"
:
"ohos.acts.location.geolocation.function.MainAbility"
,
"launchType"
:
"standard"
},
{
"orientation"
:
"unspecified"
,
"formsEnabled"
:
false
,
"name"
:
".TestAbility"
,
"srcLanguage"
:
"js"
,
"srcPath"
:
"TestAbility"
,
"icon"
:
"$media:icon"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:
mainability_description
"
,
"description"
:
"$string:
TestAbility_desc
"
,
"label"
:
"$string:
app_name
"
,
"label"
:
"$string:
TestAbility_label
"
,
"type"
:
"page"
,
"type"
:
"page"
,
"visible"
:
true
,
"launchType"
:
"standard"
"launchType"
:
"standard"
}
}
],
],
...
@@ -124,8 +142,22 @@
...
@@ -124,8 +142,22 @@
"designWidth"
:
720
,
"designWidth"
:
720
,
"autoDesignWidth"
:
false
"autoDesignWidth"
:
false
}
}
},
{
"pages"
:
[
"pages/index/index"
],
"name"
:
".TestAbility"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
}
}
]
],
"testRunner"
:
{
"name"
:
"OpenHarmonyTestRunner"
,
"srcPath"
:
"TestRunner"
}
}
}
}
}
location/geolocation_standard/src/main/js/
default
/app.js
→
location/geolocation_standard/src/main/js/
MainAbility
/app.js
浏览文件 @
3604745e
文件已移动
location/geolocation_standard/src/main/js/
default
/i18n/en-US.json
→
location/geolocation_standard/src/main/js/
MainAbility
/i18n/en-US.json
浏览文件 @
3604745e
文件已移动
location/geolocation_standard/src/main/js/
default
/i18n/zh-CN.json
→
location/geolocation_standard/src/main/js/
MainAbility
/i18n/zh-CN.json
浏览文件 @
3604745e
文件已移动
location/geolocation_standard/src/main/js/
default
/pages/index/index.css
→
location/geolocation_standard/src/main/js/
MainAbility
/pages/index/index.css
浏览文件 @
3604745e
文件已移动
location/geolocation_standard/src/main/js/
default
/pages/index/index.hml
→
location/geolocation_standard/src/main/js/
MainAbility
/pages/index/index.hml
浏览文件 @
3604745e
文件已移动
location/geolocation_standard/src/main/js/
default/test/List.test
.js
→
location/geolocation_standard/src/main/js/
MainAbility/pages/index/index
.js
浏览文件 @
3604745e
...
@@ -13,10 +13,18 @@
...
@@ -13,10 +13,18 @@
* limitations under the License.
* limitations under the License.
*/
*/
require
(
'
./GeocoderTest.test.js
'
)
import
app
from
'
@system.app
'
require
(
'
./GeocoderMTest.test.js
'
)
require
(
'
./GetCountryCode.test.js
'
)
export
default
{
require
(
'
./GetCountryCodeM.test.js
'
)
data
:
{
require
(
'
./LocationTest.test.js
'
)
title
:
""
require
(
'
./LocationMTest.test.js
'
)
},
require
(
'
./SystemLocation.test.js
'
)
onInit
()
{
this
.
title
=
this
.
$t
(
'
strings.world
'
);
},
onShow
()
{
console
.
info
(
'
onShow finish
'
)
},
onReady
()
{
},
}
location/geolocation_standard/src/main/js/TestAbility/app.js
0 → 100644
浏览文件 @
3604745e
/*
* 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
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
import
{
Hypium
}
from
'
@ohos/hypium
'
import
testsuite
from
'
../test/List.test
'
export
default
{
onCreate
()
{
console
.
info
(
'
TestApplication onCreate
'
)
var
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
var
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
console
.
info
(
'
start run testcase!!!
'
)
Hypium
.
hypiumTest
(
abilityDelegator
,
abilityDelegatorArguments
,
testsuite
)
},
onDestroy
()
{
console
.
info
(
"
TestApplication onDestroy
"
);
}
};
location/geolocation_standard/src/main/js/TestAbility/i18n/en-US.json
0 → 100644
浏览文件 @
3604745e
{
"strings"
:
{
"hello"
:
"Hello"
,
"world"
:
"World"
},
"Files"
:
{
}
}
\ No newline at end of file
location/geolocation_standard/src/main/js/TestAbility/i18n/zh-CN.json
0 → 100644
浏览文件 @
3604745e
{
"strings"
:
{
"hello"
:
"您好"
,
"world"
:
"世界"
},
"Files"
:
{
}
}
\ No newline at end of file
location/geolocation_standard/src/main/js/TestAbility/pages/index/index.css
0 → 100644
浏览文件 @
3604745e
.container
{
display
:
flex
;
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
left
:
0px
;
top
:
0px
;
width
:
100%
;
height
:
100%
;
}
.title
{
font-size
:
60px
;
text-align
:
center
;
width
:
100%
;
height
:
40%
;
margin
:
10px
;
}
@media
screen
and
(
device-type
:
phone
)
and
(
orientation
:
landscape
)
{
.title
{
font-size
:
60px
;
}
}
@media
screen
and
(
device-type
:
tablet
)
and
(
orientation
:
landscape
)
{
.title
{
font-size
:
100px
;
}
}
\ No newline at end of file
location/geolocation_standard/src/main/js/TestAbility/pages/index/index.hml
0 → 100644
浏览文件 @
3604745e
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
location/geolocation_standard/src/main/js/
default
/pages/index/index.js
→
location/geolocation_standard/src/main/js/
TestAbility
/pages/index/index.js
浏览文件 @
3604745e
/*
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import
app
from
'
@system.app
'
export
default
{
import
{
Core
,
ExpectExtend
}
from
'
deccjsunit/index
'
data
:
{
title
:
""
export
default
{
},
data
:
{
onInit
()
{
title
:
""
this
.
title
=
this
.
$t
(
'
strings.world
'
);
},
}
onInit
()
{
}
this
.
title
=
this
.
$t
(
'
strings.world
'
);
},
onShow
()
{
console
.
info
(
'
onShow finish
'
)
const
core
=
Core
.
getInstance
()
const
expectExtend
=
new
ExpectExtend
({
'
id
'
:
'
extend
'
})
core
.
addService
(
'
expect
'
,
expectExtend
)
core
.
init
()
const
configService
=
core
.
getDefaultService
(
'
config
'
)
configService
.
setConfig
(
this
)
require
(
'
../../test/List.test
'
)
core
.
execute
()
},
onReady
()
{
},
}
location/geolocation_standard/src/main/js/TestRunner/OpenHarmonyTestRunner.js
0 → 100644
浏览文件 @
3604745e
/*
* 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
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
function
translateParamsToString
(
parameters
)
{
const
keySet
=
new
Set
([
'
-s class
'
,
'
-s notClass
'
,
'
-s suite
'
,
'
-s itName
'
,
'
-s level
'
,
'
-s testType
'
,
'
-s size
'
,
'
-s timeout
'
,
'
-s package
'
,
'
-s dryRun
'
])
let
targetParams
=
''
;
for
(
const
key
in
parameters
)
{
if
(
keySet
.
has
(
key
))
{
targetParams
+=
'
'
+
key
+
'
'
+
parameters
[
key
]
}
}
return
targetParams
.
trim
()
}
export
default
{
onPrepare
()
{
console
.
info
(
'
OpenHarmonyTestRunner OnPrepare
'
)
},
onRun
()
{
console
.
log
(
'
OpenHarmonyTestRunner onRun run
'
)
var
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
var
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
var
testAbilityName
=
abilityDelegatorArguments
.
parameters
[
'
-p
'
]
+
'
.TestAbility
'
var
cmd
=
'
aa start -d 0 -a
'
+
testAbilityName
+
'
-b
'
+
abilityDelegatorArguments
.
bundleName
cmd
+=
'
'
+
translateParamsToString
(
abilityDelegatorArguments
.
parameters
)
var
debug
=
abilityDelegatorArguments
.
parameters
[
"
-D
"
]
console
.
info
(
'
debug value :
'
+
debug
)
if
(
debug
==
'
true
'
)
{
cmd
+=
'
-D
'
}
console
.
info
(
'
cmd :
'
+
cmd
)
abilityDelegator
.
executeShellCommand
(
cmd
,
(
err
,
data
)
=>
{
console
.
info
(
'
executeShellCommand : err :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
executeShellCommand : data :
'
+
data
.
stdResult
);
console
.
info
(
'
executeShellCommand : data :
'
+
data
.
exitCode
);
})
}
};
location/geolocation_standard/src/main/js/
default/
test/GeocoderMTest.test.js
→
location/geolocation_standard/src/main/js/test/GeocoderMTest.test.js
浏览文件 @
3604745e
...
@@ -13,12 +13,12 @@
...
@@ -13,12 +13,12 @@
* limitations under the License.
* limitations under the License.
*/
*/
import
geolocation
from
'
@ohos.geolocation
'
;
import
geolocationm
from
'
@ohos.geoLocationManager
'
;
import
geolocationm
from
'
@ohos.geoLocationManager
'
;
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
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
let
LocationRequestScenario
=
{
let
LocationRequestScenario
=
{
UNSET
:
0x300
,
UNSET
:
0x300
,
...
@@ -44,7 +44,7 @@ async function changedLocationMode(){
...
@@ -44,7 +44,7 @@ async function changedLocationMode(){
let
result1
=
geolocationm
.
isLocationEnabled
();
let
result1
=
geolocationm
.
isLocationEnabled
();
console
.
info
(
'
[lbs_js] getLocationSwitchState result:
'
+
JSON
.
stringify
(
result1
));
console
.
info
(
'
[lbs_js] getLocationSwitchState result:
'
+
JSON
.
stringify
(
result1
));
if
(
!
result1
){
if
(
!
result1
){
await
geolocation
m
.
requestEnableLocation
().
then
(
async
(
result
)
=>
{
await
geolocation
.
requestEnableLocation
().
then
(
async
(
result
)
=>
{
await
sleep
(
3000
);
await
sleep
(
3000
);
console
.
info
(
'
[lbs_js] test requestEnableLocation promise result:
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] test requestEnableLocation promise result:
'
+
JSON
.
stringify
(
result
));
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
...
@@ -83,20 +83,23 @@ async function applyPermission() {
...
@@ -83,20 +83,23 @@ async function applyPermission() {
}
}
}
}
describe
(
'
geolocationTest_geo5
'
,
function
()
{
export
default
function
geolocationTest_geo5
()
{
console
.
log
(
'
#start AccessTokenTests#
'
);
describe
(
'
geolocationTest_geo5
'
,
function
()
{
beforeAll
(
async
function
(
done
)
{
console
.
info
(
'
beforeAll case
'
);
console
.
log
(
'
#start AccessTokenTests#
'
);
await
applyPermission
();
beforeAll
(
async
function
(
done
)
{
done
();
console
.
info
(
'
beforeAll case
'
);
})
await
applyPermission
();
done
();
})
beforeEach
(
async
function
(
done
)
{
console
.
info
(
'
beforeEach case
'
);
await
changedLocationMode
();
done
();
})
beforeEach
(
async
function
(
done
)
{
console
.
info
(
'
beforeEach case
'
);
await
changedLocationMode
();
done
();
})
/**
/**
* @tc.number SUB_HSS_LocationSystem_Geo_1900
* @tc.number SUB_HSS_LocationSystem_Geo_1900
...
@@ -106,7 +109,7 @@ describe('geolocationTest_geo5', function () {
...
@@ -106,7 +109,7 @@ describe('geolocationTest_geo5', function () {
* @tc.type Function
* @tc.type Function
* @tc.level Level 2
* @tc.level Level 2
*/
*/
it
(
'
SUB_HSS_LocationSystem_Geo_1900
'
,
0
,
function
()
{
it
(
'
SUB_HSS_LocationSystem_Geo_1900
'
,
0
,
function
()
{
try
{
try
{
let
geocoder1
=
geolocationm
.
isGeocoderAvailable
();
let
geocoder1
=
geolocationm
.
isGeocoderAvailable
();
console
.
info
(
'
[lbs_js] isGeocoderAvailable result:
'
+
JSON
.
stringify
(
geocoder1
));
console
.
info
(
'
[lbs_js] isGeocoderAvailable result:
'
+
JSON
.
stringify
(
geocoder1
));
...
@@ -126,19 +129,23 @@ describe('geolocationTest_geo5', function () {
...
@@ -126,19 +129,23 @@ describe('geolocationTest_geo5', function () {
* @tc.level Level 2
* @tc.level Level 2
*/
*/
it
(
'
SUB_HSS_LocationSystem_Geo_2000
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_2000
'
,
0
,
async
function
(
done
)
{
let
reverseGeocodeRequest
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
1
,
"
locale
"
:
"
zh
"
};
try
{
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
let
reverseGeocodeRequest
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
1
,
"
locale
"
:
"
zh
"
};
geolocationm
.
getAddressesFromLocation
(
reverseGeocodeRequest
,
(
err
,
data
)
=>
{
geolocationm
.
getAddressesFromLocation
(
reverseGeocodeRequest
,
(
err
,
data
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
info
(
'
[lbs_js] getAddressesFromLocation20 callback err is:
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
[lbs_js] getAddressesFromLocation4 callback err is:
'
+
JSON
.
stringify
(
err
));
return
;
}
else
{
}
else
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation
20
callback data is:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
[lbs_js] getAddressesFromLocation
4
callback data is:
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
data
))
!=
null
);
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
data
))
!=
null
);
}
}
resolve
();
});
});
})
}
catch
(
error
)
{
await
promise
.
then
(
done
);
console
.
info
(
"
[lbs_js] getAddressesFromLocation4 callback try error:
"
+
error
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
await
sleep
(
2000
);
done
();
})
})
/**
/**
...
@@ -150,27 +157,31 @@ describe('geolocationTest_geo5', function () {
...
@@ -150,27 +157,31 @@ describe('geolocationTest_geo5', function () {
* @tc.level Level 2
* @tc.level Level 2
*/
*/
it
(
'
SUB_HSS_LocationSystem_Geo_2100
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_2100
'
,
0
,
async
function
(
done
)
{
let
reverseGeocodeRequest
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
1
};
try
{
await
geolocationm
.
getAddressesFromLocation
(
reverseGeocodeRequest
).
then
((
data
)
=>
{
let
reverseGeocodeRequest
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
1
};
console
.
info
(
'
[lbs_js] getAddressesFromLocation21 promise:
'
+
JSON
.
stringify
(
data
));
await
geolocationm
.
getAddressesFromLocation
(
reverseGeocodeRequest
).
then
((
data
)
=>
{
console
.
info
(
'
addressUrl:
'
+
JSON
.
stringify
(
data
)[
0
].
addressUrl
console
.
info
(
'
[lbs_js] getAddressesFromLocation21 promise:
'
+
JSON
.
stringify
(
data
));
+
JSON
.
stringify
(
data
)[
0
].
administrativeArea
+
JSON
.
stringify
(
data
)[
0
].
countryCode
console
.
info
(
'
addressUrl:
'
+
JSON
.
stringify
(
data
)[
0
].
addressUrl
+
JSON
.
stringify
(
data
)[
0
].
countryName
+
JSON
.
stringify
(
data
)[
0
].
descriptions
+
JSON
.
stringify
(
data
)[
0
].
administrativeArea
+
JSON
.
stringify
(
data
)[
0
].
countryCode
+
JSON
.
stringify
(
data
)[
0
].
descriptionsSize
+
data
[
0
].
latitude
+
JSON
.
stringify
(
data
)[
0
].
countryName
+
JSON
.
stringify
(
data
)[
0
].
descriptions
+
JSON
.
stringify
(
data
)[
0
].
locale
+
JSON
.
stringify
(
data
)[
0
].
locality
+
JSON
.
stringify
(
data
)[
0
].
descriptionsSize
+
data
[
0
].
latitude
+
JSON
.
stringify
(
data
)[
0
].
longitude
+
JSON
.
stringify
(
data
)[
0
].
phoneNumber
+
JSON
.
stringify
(
data
)[
0
].
locale
+
JSON
.
stringify
(
data
)[
0
].
locality
+
JSON
.
stringify
(
data
)[
0
].
placeName
+
JSON
.
stringify
(
data
)[
0
].
longitude
+
JSON
.
stringify
(
data
)[
0
].
phoneNumber
+
JSON
.
stringify
(
data
)[
0
].
postalCode
+
JSON
.
stringify
(
data
)[
0
].
premises
+
JSON
.
stringify
(
data
)[
0
].
placeName
+
JSON
.
stringify
(
data
)[
0
].
roadName
+
JSON
.
stringify
(
data
)[
0
].
subAdministrativeArea
+
JSON
.
stringify
(
data
)[
0
].
postalCode
+
JSON
.
stringify
(
data
)[
0
].
premises
+
JSON
.
stringify
(
data
)[
0
].
subLocality
+
JSON
.
stringify
(
data
)[
0
].
subRoadName
+
JSON
.
stringify
(
data
)[
0
].
roadName
+
JSON
.
stringify
(
data
)[
0
].
subAdministrativeArea
+
JSON
.
stringify
(
data
)[
0
].
isFromMock
);
+
JSON
.
stringify
(
data
)[
0
].
subLocality
+
JSON
.
stringify
(
data
)[
0
].
subRoadName
done
();
+
JSON
.
stringify
(
data
)[
0
].
isFromMock
);
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation21 promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[lbs_js] getAddressesFromLocation21 promise then error.
"
+
JSON
.
stringify
(
error
));
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
();
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation21 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
done
();
})
})
/**
/**
...
@@ -182,17 +193,21 @@ describe('geolocationTest_geo5', function () {
...
@@ -182,17 +193,21 @@ describe('geolocationTest_geo5', function () {
* @tc.level Level 2
* @tc.level Level 2
*/
*/
it
(
'
SUB_HSS_LocationSystem_Geo_2200
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_2200
'
,
0
,
async
function
(
done
)
{
let
reverseGeocodeRequest
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
5
};
try
{
await
geolocationm
.
getAddressesFromLocation
(
reverseGeocodeRequest
).
then
((
data
)
=>
{
let
reverseGeocodeRequest
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
5
};
console
.
info
(
'
[lbs_js] getAddressesFromLocation22 promise:
'
+
JSON
.
stringify
(
data
));
await
geolocationm
.
getAddressesFromLocation
(
reverseGeocodeRequest
).
then
((
data
)
=>
{
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
data
))
!=
null
);
console
.
info
(
'
[lbs_js] getAddressesFromLocation22 promise:
'
+
JSON
.
stringify
(
data
));
done
();
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
data
))
!=
null
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation22 promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[lbs_js] getAddressesFromLocation22 promise then error.
"
+
JSON
.
stringify
(
error
));
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
();
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation22 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
done
();
})
})
/**
/**
...
@@ -403,13 +418,18 @@ describe('geolocationTest_geo5', function () {
...
@@ -403,13 +418,18 @@ describe('geolocationTest_geo5', function () {
*/
*/
it
(
'
SUB_HSS_LocationSystem_Geo_2600
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_2600
'
,
0
,
async
function
(
done
)
{
let
geocodeRequest
=
{
"
description
"
:
"
上海市浦东新区金穗路1800号
"
,
"
maxItems
"
:
1
};
let
geocodeRequest
=
{
"
description
"
:
"
上海市浦东新区金穗路1800号
"
,
"
maxItems
"
:
1
};
await
geolocationm
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
try
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation09 callback data is:
"
+
JSON
.
stringify
(
result
));
await
geolocationm
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
console
.
info
(
"
[lbs_js] getAddressesFromLocation09 callback data is:
"
+
JSON
.
stringify
(
result
));
}).
catch
((
error
)
=>
{
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
console
.
info
(
"
[lbs_js] getAddressesFromLocationName09 promise then error.
"
+
JSON
.
stringify
(
error
));
}).
catch
((
error
)
=>
{
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
console
.
info
(
"
[lbs_js] getAddressesFromLocationName09 promise then error.
"
+
JSON
.
stringify
(
error
));
});
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName26 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
done
();
done
();
})
})
...
@@ -422,15 +442,20 @@ describe('geolocationTest_geo5', function () {
...
@@ -422,15 +442,20 @@ describe('geolocationTest_geo5', function () {
* @tc.level Level 2
* @tc.level Level 2
*/
*/
it
(
'
SUB_HSS_LocationSystem_Geo_2700
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_2700
'
,
0
,
async
function
(
done
)
{
let
geocodeRequest
=
{
"
description
"
:
"
上海市浦东新区金穗路1800号
"
,
"
maxItems
"
:
5
};
try
{
await
geolocationm
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
let
geocodeRequest
=
{
"
description
"
:
"
上海市浦东新区金穗路1800号
"
,
"
maxItems
"
:
5
};
console
.
info
(
"
[lbs_js] getAddressesFromLocation10 promise data is:
"
+
JSON
.
stringify
(
result
));
await
geolocationm
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
console
.
info
(
"
[lbs_js] getAddressesFromLocation10 promise data is:
"
+
JSON
.
stringify
(
result
));
}).
catch
((
error
)
=>
{
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
console
.
info
(
"
[lbs_js] getAddressesFromLocationName10 promise then error.
"
+
JSON
.
stringify
(
error
));
}).
catch
((
error
)
=>
{
console
.
info
(
'
[lbs_js] not support now
'
);
console
.
info
(
"
[lbs_js] getAddressesFromLocationName10 promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
console
.
info
(
'
[lbs_js] not support now
'
);
});
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName27 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
done
();
done
();
})
})
...
@@ -490,14 +515,19 @@ describe('geolocationTest_geo5', function () {
...
@@ -490,14 +515,19 @@ describe('geolocationTest_geo5', function () {
"
maxLatitude
"
:
31.1537977881
,
"
maxLatitude
"
:
31.1537977881
,
"
maxLongitude
"
:
121.8026736943
"
maxLongitude
"
:
121.8026736943
};
};
await
geolocationm
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
try
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation29 promise data is:
"
+
JSON
.
stringify
(
result
));
await
geolocationm
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
console
.
info
(
"
[lbs_js] getAddressesFromLocation29 promise data is:
"
+
JSON
.
stringify
(
result
));
}).
catch
((
error
)
=>
{
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
console
.
info
(
"
[lbs_js] getAddressesFromLocationName29 promise then error.
"
+
JSON
.
stringify
(
error
));
}).
catch
((
error
)
=>
{
console
.
info
(
'
[lbs_js] not support now
'
);
console
.
info
(
"
[lbs_js] getAddressesFromLocationName29 promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
console
.
info
(
'
[lbs_js] not support now
'
);
});
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName29 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
done
();
done
();
})
})
...
@@ -572,14 +602,19 @@ describe('geolocationTest_geo5', function () {
...
@@ -572,14 +602,19 @@ describe('geolocationTest_geo5', function () {
"
maxLatitude
"
:
40.95
,
"
maxLatitude
"
:
40.95
,
"
maxLongitude
"
:
116.45
"
maxLongitude
"
:
116.45
};
};
await
geolocationm
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
try
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName31 promise data is:
"
+
JSON
.
stringify
(
result
));
await
geolocationm
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
expect
(
result
.
length
>=
0
).
assertTrue
();
console
.
info
(
"
[lbs_js] getAddressesFromLocationName31 promise data is:
"
+
JSON
.
stringify
(
result
));
}).
catch
((
error
)
=>
{
expect
(
result
.
length
>=
0
).
assertTrue
();
console
.
info
(
"
[lbs_js] getAddressesFromLocationName31 promise then error.
"
+
JSON
.
stringify
(
error
));
}).
catch
((
error
)
=>
{
console
.
info
(
'
[lbs_js] not support now
'
);
console
.
info
(
"
[lbs_js] getAddressesFromLocationName31 promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
console
.
info
(
'
[lbs_js] not support now
'
);
});
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName31 message.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
done
();
done
();
})
})
...
@@ -601,14 +636,19 @@ describe('geolocationTest_geo5', function () {
...
@@ -601,14 +636,19 @@ describe('geolocationTest_geo5', function () {
"
maxLatitude
"
:
39.85
,
"
maxLatitude
"
:
39.85
,
"
maxLongitude
"
:
116.35
"
maxLongitude
"
:
116.35
};
};
await
geolocationm
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
try
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName32 promise data is:
"
+
JSON
.
stringify
(
result
));
await
geolocationm
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
expect
(
result
.
length
>=
0
).
assertTrue
();
console
.
info
(
"
[lbs_js] getAddressesFromLocationName32 promise data is:
"
+
JSON
.
stringify
(
result
));
}).
catch
((
error
)
=>
{
expect
(
result
.
length
>=
0
).
assertTrue
();
console
.
info
(
"
[lbs_js] getAddressesFromLocationName32 promise then error.
"
+
JSON
.
stringify
(
error
));
}).
catch
((
error
)
=>
{
console
.
info
(
'
[lbs_js] not support now
'
);
console
.
info
(
"
[lbs_js] getAddressesFromLocationName32 promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
console
.
info
(
'
[lbs_js] not support now
'
);
});
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName32 message.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
done
();
done
();
})
})
...
@@ -961,4 +1001,8 @@ describe('geolocationTest_geo5', function () {
...
@@ -961,4 +1001,8 @@ describe('geolocationTest_geo5', function () {
}
}
done
();
done
();
})
})
})
})
}
location/geolocation_standard/src/main/js/
default/
test/GeocoderTest.test.js
→
location/geolocation_standard/src/main/js/test/GeocoderTest.test.js
浏览文件 @
3604745e
...
@@ -18,7 +18,7 @@ import {LocationEventListener} from '@ohos.geolocation';
...
@@ -18,7 +18,7 @@ import {LocationEventListener} from '@ohos.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
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
let
LocationRequestScenario
=
{
let
LocationRequestScenario
=
{
UNSET
:
0x300
,
UNSET
:
0x300
,
...
@@ -85,20 +85,24 @@ async function applyPermission() {
...
@@ -85,20 +85,24 @@ async function applyPermission() {
}
}
}
}
describe
(
'
geolocationTest_geo1
'
,
function
()
{
console
.
log
(
'
#start AccessTokenTests#
'
);
export
default
function
geolocationTest_geo1
()
{
beforeAll
(
async
function
(
done
)
{
console
.
info
(
'
beforeAll case
'
);
await
applyPermission
();
done
();
})
beforeEach
(
async
function
(
done
)
{
describe
(
'
geolocationTest_geo1
'
,
function
()
{
console
.
info
(
'
beforeEach case
'
);
await
changedLocationMode
();
console
.
log
(
'
#start AccessTokenTests#
'
);
done
();
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_Geo_0100
* @tc.number SUB_HSS_LocationSystem_Geo_0100
...
@@ -108,19 +112,24 @@ describe('geolocationTest_geo1', function () {
...
@@ -108,19 +112,24 @@ describe('geolocationTest_geo1', function () {
* @tc.type Function
* @tc.type Function
* @tc.level Level 2
* @tc.level Level 2
*/
*/
it
(
'
SUB_HSS_LocationSystem_Geo_0100
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_0100
'
,
0
,
async
function
(
done
)
{
geolocation
.
isGeoServiceAvailable
(
async
(
err
,
data
)
=>
{
try
{
if
(
err
)
{
geolocation
.
isGeoServiceAvailable
(
async
(
err
,
data
)
=>
{
console
.
info
(
'
[lbs_js] getGeoServiceState err is :
'
+
JSON
.
stringify
(
err
));
if
(
err
)
{
console
.
info
(
'
[lbs_js] getGeoServiceState err is :
'
+
JSON
.
stringify
(
err
));
}
else
{
}
else
{
console
.
info
(
'
[lbs_js] isGeoServiceAvailable callback result:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
[lbs_js] isGeoServiceAvailable callback result:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
[lbs_js] not support now
'
);
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
data
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
data
)
!=
null
);
done
();
}
}
})
done
();
}
catch
(
error
)
{
})
console
.
info
(
"
[lbs_js] isGeoServiceAvailable callback err.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] The geocode interface is not connected to a third-party service.
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
await
sleep
(
500
);
done
();
});
});
/**
/**
...
@@ -139,10 +148,12 @@ describe('geolocationTest_geo1', function () {
...
@@ -139,10 +148,12 @@ describe('geolocationTest_geo1', function () {
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
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] isGeoServiceAvailable error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[lbs_js] isGeoServiceAvailable error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] The geocode interface is not connected to a third-party service.
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
}
done
();
done
();
})
})
...
@@ -157,7 +168,7 @@ describe('geolocationTest_geo1', function () {
...
@@ -157,7 +168,7 @@ describe('geolocationTest_geo1', function () {
*/
*/
it
(
'
SUB_HSS_LocationSystem_Geo_0300
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_0300
'
,
0
,
async
function
(
done
)
{
let
reverseGeocodeRequest
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
1
,
"
locale
"
:
"
zh
"
};
let
reverseGeocodeRequest
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
1
,
"
locale
"
:
"
zh
"
};
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
try
{
geolocation
.
getAddressesFromLocation
(
reverseGeocodeRequest
,
(
err
,
data
)
=>
{
geolocation
.
getAddressesFromLocation
(
reverseGeocodeRequest
,
(
err
,
data
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
info
(
'
[lbs_js] getAddressesFromLocation callback err is :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
[lbs_js] getAddressesFromLocation callback err is :
'
+
JSON
.
stringify
(
err
));
...
@@ -165,10 +176,13 @@ describe('geolocationTest_geo1', function () {
...
@@ -165,10 +176,13 @@ 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
();
});
});
})
}
catch
(
error
)
{
await
promise
.
then
(
done
)
console
.
info
(
"
[lbs_js] getAddressesFromLocation callback try err:
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
await
sleep
(
1000
);
done
();
})
})
/**
/**
...
@@ -181,26 +195,30 @@ describe('geolocationTest_geo1', function () {
...
@@ -181,26 +195,30 @@ describe('geolocationTest_geo1', function () {
*/
*/
it
(
'
SUB_HSS_LocationSystem_Geo_0400
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_0400
'
,
0
,
async
function
(
done
)
{
let
reverseGeocodeRequest
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
1
};
let
reverseGeocodeRequest
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
1
};
await
geolocation
.
getAddressesFromLocation
(
reverseGeocodeRequest
).
then
((
data
)
=>
{
try
{
console
.
info
(
'
[lbs_js] getAddressesFromLocation04 promise:
'
+
JSON
.
stringify
(
data
));
await
geolocation
.
getAddressesFromLocation
(
reverseGeocodeRequest
).
then
((
data
)
=>
{
console
.
info
(
'
addressUrl:
'
+
JSON
.
stringify
(
data
)[
0
].
addressUrl
console
.
info
(
'
[lbs_js] getAddressesFromLocation04 promise:
'
+
JSON
.
stringify
(
data
));
+
JSON
.
stringify
(
data
)[
0
].
administrativeArea
+
JSON
.
stringify
(
data
)[
0
].
countryCode
console
.
info
(
'
addressUrl:
'
+
JSON
.
stringify
(
data
)[
0
].
addressUrl
+
JSON
.
stringify
(
data
)[
0
].
countryName
+
JSON
.
stringify
(
data
)[
0
].
descriptions
+
JSON
.
stringify
(
data
)[
0
].
administrativeArea
+
JSON
.
stringify
(
data
)[
0
].
countryCode
+
JSON
.
stringify
(
data
)[
0
].
descriptionsSize
+
data
[
0
].
latitude
+
JSON
.
stringify
(
data
)[
0
].
countryName
+
JSON
.
stringify
(
data
)[
0
].
descriptions
+
JSON
.
stringify
(
data
)[
0
].
locale
+
JSON
.
stringify
(
data
)[
0
].
locality
+
JSON
.
stringify
(
data
)[
0
].
descriptionsSize
+
data
[
0
].
latitude
+
JSON
.
stringify
(
data
)[
0
].
longitude
+
JSON
.
stringify
(
data
)[
0
].
phoneNumber
+
JSON
.
stringify
(
data
)[
0
].
locale
+
JSON
.
stringify
(
data
)[
0
].
locality
+
JSON
.
stringify
(
data
)[
0
].
placeName
+
JSON
.
stringify
(
data
)[
0
].
longitude
+
JSON
.
stringify
(
data
)[
0
].
phoneNumber
+
JSON
.
stringify
(
data
)[
0
].
postalCode
+
JSON
.
stringify
(
data
)[
0
].
premises
+
JSON
.
stringify
(
data
)[
0
].
placeName
+
JSON
.
stringify
(
data
)[
0
].
roadName
+
JSON
.
stringify
(
data
)[
0
].
subAdministrativeArea
+
JSON
.
stringify
(
data
)[
0
].
postalCode
+
JSON
.
stringify
(
data
)[
0
].
premises
+
JSON
.
stringify
(
data
)[
0
].
subLocality
+
JSON
.
stringify
(
data
)[
0
].
subRoadName
+
JSON
.
stringify
(
data
)[
0
].
roadName
+
JSON
.
stringify
(
data
)[
0
].
subAdministrativeArea
+
JSON
.
stringify
(
data
)[
0
].
isFromMock
);
+
JSON
.
stringify
(
data
)[
0
].
subLocality
+
JSON
.
stringify
(
data
)[
0
].
subRoadName
done
();
+
JSON
.
stringify
(
data
)[
0
].
isFromMock
);
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[lbs_js] getAddressesFromLocation promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] not support now
'
);
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation04 promise try err:
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
done
();
}
}
);
done
(
);
})
})
/**
/**
...
@@ -213,16 +231,20 @@ describe('geolocationTest_geo1', function () {
...
@@ -213,16 +231,20 @@ describe('geolocationTest_geo1', function () {
*/
*/
it
(
'
SUB_HSS_LocationSystem_Geo_0500
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_0500
'
,
0
,
async
function
(
done
)
{
let
reverseGeocodeRequest
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
5
};
let
reverseGeocodeRequest
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
5
};
await
geolocation
.
getAddressesFromLocation
(
reverseGeocodeRequest
).
then
((
data
)
=>
{
try
{
console
.
info
(
'
[lbs_js] getAddressesFromLocation05 promise:
'
+
JSON
.
stringify
(
data
));
await
geolocation
.
getAddressesFromLocation
(
reverseGeocodeRequest
).
then
((
data
)
=>
{
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
data
))
!=
null
);
console
.
info
(
'
[lbs_js] getAddressesFromLocation05 promise:
'
+
JSON
.
stringify
(
data
));
done
();
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
data
))
!=
null
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[lbs_js] getAddressesFromLocation promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] not support now
'
);
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation05 promise try err:
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
done
();
}
}
);
done
(
);
})
})
/**
/**
...
@@ -435,13 +457,18 @@ describe('geolocationTest_geo1', function () {
...
@@ -435,13 +457,18 @@ describe('geolocationTest_geo1', function () {
*/
*/
it
(
'
SUB_HSS_LocationSystem_Geo_0900
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_0900
'
,
0
,
async
function
(
done
)
{
let
geocodeRequest
=
{
"
description
"
:
"
上海市浦东新区金穗路1800号
"
,
"
maxItems
"
:
1
};
let
geocodeRequest
=
{
"
description
"
:
"
上海市浦东新区金穗路1800号
"
,
"
maxItems
"
:
1
};
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
try
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation callback data is:
"
+
JSON
.
stringify
(
result
));
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
console
.
info
(
"
[lbs_js] getAddressesFromLocation09 promise data:
"
+
JSON
.
stringify
(
result
));
}).
catch
((
error
)
=>
{
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
console
.
info
(
"
[lbs_js] getAddressesFromLocationName09 promise then error.
"
+
JSON
.
stringify
(
error
));
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName09 promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation09 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
}
);
}
done
();
done
();
})
})
...
@@ -455,14 +482,19 @@ describe('geolocationTest_geo1', function () {
...
@@ -455,14 +482,19 @@ describe('geolocationTest_geo1', function () {
*/
*/
it
(
'
SUB_HSS_LocationSystem_Geo_1000
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_1000
'
,
0
,
async
function
(
done
)
{
let
geocodeRequest
=
{
"
description
"
:
"
上海市浦东新区金穗路1800号
"
,
"
maxItems
"
:
5
};
let
geocodeRequest
=
{
"
description
"
:
"
上海市浦东新区金穗路1800号
"
,
"
maxItems
"
:
5
};
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
try
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation m callback data is:
"
+
JSON
.
stringify
(
result
));
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
console
.
info
(
"
[lbs_js] getAddressesFromLocation10 promise data:
"
+
JSON
.
stringify
(
result
));
}).
catch
((
error
)
=>
{
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
console
.
info
(
"
[lbs_js] getAddressesFromLocationName m promise then error.
"
+
JSON
.
stringify
(
error
));
}).
catch
((
error
)
=>
{
console
.
info
(
'
[lbs_js] not support now
'
);
console
.
info
(
"
[lbs_js] getAddressesFromLocationName10 promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
console
.
info
(
'
[lbs_js] not support now
'
);
});
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation10 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
}
done
();
done
();
})
})
...
@@ -478,10 +510,10 @@ describe('geolocationTest_geo1', function () {
...
@@ -478,10 +510,10 @@ describe('geolocationTest_geo1', function () {
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
111 promise data
:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName
promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[lbs_js] getAddressesFromLocationName
111
promise then error.
"
+
JSON
.
stringify
(
error
));
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
);
});
});
...
@@ -492,15 +524,15 @@ describe('geolocationTest_geo1', function () {
...
@@ -492,15 +524,15 @@ describe('geolocationTest_geo1', function () {
let
geocodeRequest1
=
{
"
description
"
:
null
,
"
maxItems
"
:
1
};
let
geocodeRequest1
=
{
"
description
"
:
null
,
"
maxItems
"
:
1
};
try
{
try
{
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest1
).
then
((
result
)
=>
{
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest1
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation
callback data is
:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[lbs_js] getAddressesFromLocation
112 promise data
:
"
+
JSON
.
stringify
(
result
));
expect
(
result
.
length
==
0
).
assertTrue
();
expect
(
result
.
length
==
0
).
assertTrue
();
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[lbs_js] getAddressesFromLocationName
112
promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
});
});
}
catch
(
error
){
}
catch
(
error
){
console
.
info
(
"
[lbs_js] getAddressesFromLocation
Name message.
"
+
JSON
.
stringify
(
error
.
message
));
console
.
info
(
"
[lbs_js] getAddressesFromLocation
11 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
}
}
done
();
done
();
})
})
...
@@ -522,14 +554,19 @@ describe('geolocationTest_geo1', function () {
...
@@ -522,14 +554,19 @@ describe('geolocationTest_geo1', function () {
"
maxLatitude
"
:
31.1537977881
,
"
maxLatitude
"
:
31.1537977881
,
"
maxLongitude
"
:
121.8026736943
"
maxLongitude
"
:
121.8026736943
};
};
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
try
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation callback data is:
"
+
JSON
.
stringify
(
result
));
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
console
.
info
(
"
[lbs_js] getAddressesFromLocation callback data is:
"
+
JSON
.
stringify
(
result
));
}).
catch
((
error
)
=>
{
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
}).
catch
((
error
)
=>
{
console
.
info
(
'
[lbs_js] not support now
'
);
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
console
.
info
(
'
[lbs_js] not support now
'
);
});
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
}
catch
(
error
){
console
.
info
(
"
[lbs_js] getAddressesFromLocation12 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
}
done
();
done
();
})
})
...
@@ -604,14 +641,19 @@ describe('geolocationTest_geo1', function () {
...
@@ -604,14 +641,19 @@ describe('geolocationTest_geo1', function () {
"
maxLatitude
"
:
40.95
,
"
maxLatitude
"
:
40.95
,
"
maxLongitude
"
:
116.45
"
maxLongitude
"
:
116.45
};
};
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
try
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation callback data is:
"
+
JSON
.
stringify
(
result
));
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
expect
(
result
.
length
>=
0
).
assertTrue
();
console
.
info
(
"
[lbs_js] getAddressesFromLocation14 promise data:
"
+
JSON
.
stringify
(
result
));
}).
catch
((
error
)
=>
{
expect
(
result
.
length
>=
0
).
assertTrue
();
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
}).
catch
((
error
)
=>
{
console
.
info
(
'
[lbs_js] not support now
'
);
console
.
info
(
"
[lbs_js] getAddressesFromLocationName14 promise then err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
console
.
info
(
'
[lbs_js] not support now
'
);
});
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
}
catch
(
error
){
console
.
info
(
"
[lbs_js] getAddressesFromLocation14 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
}
done
();
done
();
})
})
...
@@ -633,14 +675,19 @@ describe('geolocationTest_geo1', function () {
...
@@ -633,14 +675,19 @@ describe('geolocationTest_geo1', function () {
"
maxLatitude
"
:
39.85
,
"
maxLatitude
"
:
39.85
,
"
maxLongitude
"
:
116.35
"
maxLongitude
"
:
116.35
};
};
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
try
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation callback data is:
"
+
JSON
.
stringify
(
result
));
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
expect
(
result
.
length
>=
0
).
assertTrue
();
console
.
info
(
"
[lbs_js] getAddressesFromLocation15 promise data is:
"
+
JSON
.
stringify
(
result
));
}).
catch
((
error
)
=>
{
expect
(
result
.
length
>=
0
).
assertTrue
();
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
}).
catch
((
error
)
=>
{
console
.
info
(
'
[lbs_js] not support now
'
);
console
.
info
(
"
[lbs_js] getAddressesFromLocationName15 promise then err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
console
.
info
(
'
[lbs_js] not support now
'
);
});
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
}
catch
(
error
){
console
.
info
(
"
[lbs_js] getAddressesFromLocation15 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
}
done
();
done
();
})
})
...
@@ -993,7 +1040,8 @@ describe('geolocationTest_geo1', function () {
...
@@ -993,7 +1040,8 @@ describe('geolocationTest_geo1', function () {
}
}
done
();
done
();
})
})
})
})
}
location/geolocation_standard/src/main/js/
default/
test/GetCountryCode.test.js
→
location/geolocation_standard/src/main/js/test/GetCountryCode.test.js
浏览文件 @
3604745e
...
@@ -17,7 +17,7 @@ import geolocationm from '@ohos.geoLocationManager';
...
@@ -17,7 +17,7 @@ import geolocationm from '@ohos.geoLocationManager';
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
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
function
sleep
(
ms
)
{
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
...
@@ -76,18 +76,21 @@ let CountryCodeType = {
...
@@ -76,18 +76,21 @@ let CountryCodeType = {
COUNTRY_CODE_FROM_NETWORK
:
4
,
COUNTRY_CODE_FROM_NETWORK
:
4
,
}
}
describe
(
'
geolocationTest_4
'
,
function
()
{
export
default
function
geolocationTest_4
()
{
beforeAll
(
async
function
(
done
)
{
console
.
info
(
'
beforeAll case
'
);
await
applyPermission
();
done
();
})
beforeEach
(
async
function
(
done
)
{
console
.
info
(
'
beforeEach case
'
);
describe
(
'
geolocationTest_4
'
,
function
()
{
await
changedLocationMode
();
beforeAll
(
async
function
(
done
)
{
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_0100
* @tc.number SUB_HSS_LocationSystem_CountryCode_0100
...
@@ -96,19 +99,24 @@ describe('geolocationTest_4', function () {
...
@@ -96,19 +99,24 @@ describe('geolocationTest_4', function () {
* @tc.type Function
* @tc.type Function
* @tc.level since 9
* @tc.level since 9
*/
*/
it
(
'
SUB_HSS_LocationSystem_CountryCode_0100
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_CountryCode_0100
'
,
0
,
async
function
(
done
)
{
await
geolocationm
.
getCountryCode
().
then
((
result
)
=>
{
try
{
console
.
info
(
"
[lbs_js] getCountryCode promise result:
"
+
JSON
.
stringify
(
result
));
await
geolocationm
.
getCountryCode
().
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] country :
"
+
result
.
country
);
console
.
info
(
"
[lbs_js] getCountryCode promise result:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[lbs_js] type:
"
+
result
.
type
);
console
.
info
(
"
[lbs_js] country :
"
+
result
.
country
);
expect
(
true
).
assertTrue
(
JSON
.
stringify
(
result
)
==
CountryCodeType
.
COUNTRY_CODE_FROM_LOCALE
);
console
.
info
(
"
[lbs_js] type:
"
+
result
.
type
);
expect
(
true
).
assertTrue
(
JSON
.
stringify
(
result
)
!=
CountryCodeType
.
COUNTRY_CODE_FROM_SIM
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
result
.
type
)
==
CountryCodeType
.
COUNTRY_CODE_FROM_LOCALE
);
expect
(
true
).
assertTrue
(
JSON
.
stringify
(
result
)
!=
CountryCodeType
.
COUNTRY_CODE_FROM_LOCATION
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
result
.
type
)
!=
CountryCodeType
.
COUNTRY_CODE_FROM_SIM
);
expect
(
true
).
assertTrue
(
JSON
.
stringify
(
result
)
!=
CountryCodeType
.
COUNTRY_CODE_FROM_NETWORK
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
result
.
type
)
!=
CountryCodeType
.
COUNTRY_CODE_FROM_LOCATION
);
}).
catch
((
error
)
=>
{
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
result
.
type
)
!=
CountryCodeType
.
COUNTRY_CODE_FROM_NETWORK
);
console
.
info
(
"
[lbs_js] getCountryCode promise then error.
"
+
JSON
.
stringify
(
error
));
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getCountryCode promise then error.
"
+
JSON
.
stringify
(
error
));
expect
().
assertFail
();
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCountryCode promise try err.
"
+
JSON
.
stringify
(
error
));
expect
().
assertFail
();
expect
().
assertFail
();
}
);
}
done
();
done
();
})
})
...
@@ -120,20 +128,20 @@ describe('geolocationTest_4', function () {
...
@@ -120,20 +128,20 @@ describe('geolocationTest_4', function () {
* @tc.level since 9
* @tc.level since 9
*/
*/
it
(
'
SUB_HSS_LocationSystem_CountryCode_0200
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_CountryCode_0200
'
,
0
,
async
function
(
done
)
{
function
getCountryCodeCallback
()
{
try
{
return
new
Promise
((
resolve
,
reject
)
=>
{
geolocationm
.
getCountryCode
((
err
,
data
)
=>
{
geolocationm
.
getCountryCode
((
err
,
data
)
=>
{
if
(
err
)
{
if
(
err
)
{
return
console
.
info
(
"
getCountryCode callback err:
"
+
JSON
.
stringify
(
err
));
return
console
.
info
(
"
getCountryCode callback err:
"
+
JSON
.
stringify
(
err
));
}
else
{
}
else
{
console
.
info
(
"
getCountryCode callback success
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
getCountryCode callback success
"
+
JSON
.
stringify
(
data
)
);
expect
(
true
).
assertEqual
(
data
!=
null
);
expect
(
true
).
assertEqual
(
data
!=
null
);
}
}
});
resolve
();
}
catch
(
error
)
{
})
console
.
info
(
"
[lbs_js] getCountryCode callback try err.
"
+
JSON
.
stringify
(
error
));
})
expect
().
assertFail
();
}
}
await
getCountryCodeCallback
(
);
await
sleep
(
1000
);
done
();
done
();
})
})
...
@@ -146,21 +154,37 @@ describe('geolocationTest_4', function () {
...
@@ -146,21 +154,37 @@ describe('geolocationTest_4', function () {
*/
*/
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
)
{
try
{
console
.
info
(
'
[lbs_js] countryCodeChange
'
+
JSON
.
stringify
(
data
)
);
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
));
}
catch
(
error
)
{
expect
(
true
).
assertTrue
(
JSON
.
stringify
(
result
)
!=
null
);
console
.
info
(
"
[lbs_js] countryCodeChangeOn try err.
"
+
JSON
.
stringify
(
error
));
}).
catch
((
error
)
=>
{
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
console
.
info
(
"
[lbs_js] getCountryCode promise then error.
"
+
JSON
.
stringify
(
error
));
}
try
{
await
geolocationm
.
getCountryCode
().
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] getCountryCode promise result:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
result
)
!=
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getCountryCode promise then error.
"
+
JSON
.
stringify
(
error
));
expect
().
assertFail
();
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCountryCode callback try err.
"
+
JSON
.
stringify
(
error
));
expect
().
assertFail
();
expect
().
assertFail
();
});
}
geolocationm
.
off
(
'
countryCodeChange
'
,
function
(
data
)
{
try
{
console
.
info
(
'
[lbs_js] countryCodeChange
'
+
JSON
.
stringify
(
data
));
geolocationm
.
off
(
'
countryCodeChange
'
,
function
(
data
)
{
done
();
console
.
info
(
'
[lbs_js] countryCodeChange
'
+
JSON
.
stringify
(
data
));
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] countryCodeChangeOff try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
})
}
})
location/geolocation_standard/src/main/js/
default/
test/GetCountryCodeM.test.js
→
location/geolocation_standard/src/main/js/test/GetCountryCodeM.test.js
浏览文件 @
3604745e
...
@@ -13,11 +13,12 @@
...
@@ -13,11 +13,12 @@
* limitations under the License.
* limitations under the License.
*/
*/
import
geolocation
from
'
@ohos.geolocation
'
;
import
geolocationm
from
'
@ohos.geoLocationManager
'
;
import
geolocationm
from
'
@ohos.geoLocationManager
'
;
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
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
function
sleep
(
ms
)
{
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
...
@@ -28,7 +29,7 @@ async function changedLocationMode(){
...
@@ -28,7 +29,7 @@ async function changedLocationMode(){
let
result1
=
geolocationm
.
isLocationEnabled
();
let
result1
=
geolocationm
.
isLocationEnabled
();
console
.
info
(
'
[lbs_js] getLocationSwitchState result:
'
+
JSON
.
stringify
(
result1
));
console
.
info
(
'
[lbs_js] getLocationSwitchState result:
'
+
JSON
.
stringify
(
result1
));
if
(
!
result1
){
if
(
!
result1
){
await
geolocation
m
.
requestEnableLocation
().
then
(
async
(
result
)
=>
{
await
geolocation
.
requestEnableLocation
().
then
(
async
(
result
)
=>
{
await
sleep
(
3000
);
await
sleep
(
3000
);
console
.
info
(
'
[lbs_js] test requestEnableLocation promise result:
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] test requestEnableLocation promise result:
'
+
JSON
.
stringify
(
result
));
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
...
@@ -74,18 +75,21 @@ let CountryCodeType = {
...
@@ -74,18 +75,21 @@ let CountryCodeType = {
COUNTRY_CODE_FROM_NETWORK
:
4
,
COUNTRY_CODE_FROM_NETWORK
:
4
,
}
}
describe
(
'
geolocationTest_6
'
,
function
()
{
export
default
function
geolocationTest_6
()
{
beforeAll
(
async
function
(
done
)
{
console
.
info
(
'
beforeAll case
'
);
await
applyPermission
();
done
();
})
beforeEach
(
async
function
(
done
)
{
console
.
info
(
'
beforeEach case
'
);
describe
(
'
geolocationTest_6
'
,
function
()
{
await
changedLocationMode
();
beforeAll
(
async
function
(
done
)
{
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.number SUB_HSS_LocationSystem_CountryCode_0400
...
@@ -94,19 +98,24 @@ describe('geolocationTest_6', function () {
...
@@ -94,19 +98,24 @@ describe('geolocationTest_6', function () {
* @tc.type Function
* @tc.type Function
* @tc.level since 9
* @tc.level since 9
*/
*/
it
(
'
SUB_HSS_LocationSystem_CountryCode_0400
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_CountryCode_0400
'
,
0
,
async
function
(
done
)
{
await
geolocationm
.
getCountryCode
().
then
((
result
)
=>
{
try
{
console
.
info
(
"
[lbs_js] getCountryCode promise result:
"
+
JSON
.
stringify
(
result
));
await
geolocationm
.
getCountryCode
().
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] country :
"
+
result
.
country
);
console
.
info
(
"
[lbs_js] getCountryCode promise result:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[lbs_js] type:
"
+
result
.
type
);
console
.
info
(
"
[lbs_js] country :
"
+
result
.
country
);
expect
(
true
).
assertTrue
(
JSON
.
stringify
(
result
)
==
CountryCodeType
.
COUNTRY_CODE_FROM_LOCALE
);
console
.
info
(
"
[lbs_js] type:
"
+
result
.
type
);
expect
(
true
).
assertTrue
(
JSON
.
stringify
(
result
)
!=
CountryCodeType
.
COUNTRY_CODE_FROM_SIM
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
result
.
type
)
==
CountryCodeType
.
COUNTRY_CODE_FROM_LOCALE
);
expect
(
true
).
assertTrue
(
JSON
.
stringify
(
result
)
!=
CountryCodeType
.
COUNTRY_CODE_FROM_LOCATION
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
result
.
type
)
!=
CountryCodeType
.
COUNTRY_CODE_FROM_SIM
);
expect
(
true
).
assertTrue
(
JSON
.
stringify
(
result
)
!=
CountryCodeType
.
COUNTRY_CODE_FROM_NETWORK
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
result
.
type
)
!=
CountryCodeType
.
COUNTRY_CODE_FROM_LOCATION
);
}).
catch
((
error
)
=>
{
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
result
.
type
)
!=
CountryCodeType
.
COUNTRY_CODE_FROM_NETWORK
);
console
.
info
(
"
[lbs_js] getCountryCode promise then error.
"
+
JSON
.
stringify
(
error
));
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getCountryCode promise then error.
"
+
JSON
.
stringify
(
error
));
expect
().
assertFail
();
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCountryCode promise try err.
"
+
JSON
.
stringify
(
error
));
expect
().
assertFail
();
expect
().
assertFail
();
}
);
}
done
();
done
();
})
})
...
@@ -118,20 +127,20 @@ describe('geolocationTest_6', function () {
...
@@ -118,20 +127,20 @@ describe('geolocationTest_6', function () {
* @tc.level since 9
* @tc.level since 9
*/
*/
it
(
'
SUB_HSS_LocationSystem_CountryCode_0500
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_CountryCode_0500
'
,
0
,
async
function
(
done
)
{
function
getCountryCodeCallback
()
{
try
{
return
new
Promise
((
resolve
,
reject
)
=>
{
geolocationm
.
getCountryCode
((
err
,
data
)
=>
{
geolocationm
.
getCountryCode
((
err
,
data
)
=>
{
if
(
err
)
{
if
(
err
)
{
return
console
.
info
(
"
[lbs_js] getCountryCode callback err:
"
+
JSON
.
stringify
(
err
));
return
console
.
info
(
"
[lbs_js] getCountryCode callback err:
"
+
JSON
.
stringify
(
err
));
}
else
{
}
else
{
console
.
info
(
"
[lbs_js] getCountryCode callback success
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
[lbs_js] getCountryCode callback success
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
data
!=
null
);
expect
(
true
).
assertEqual
(
data
!=
null
);
}
}
resolve
();
})
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCountryCode callback try err.
"
+
JSON
.
stringify
(
error
));
expect
().
assertFail
();
}
}
await
getCountryCodeCallback
(
);
await
sleep
(
1500
);
done
();
done
();
})
})
...
@@ -144,21 +153,37 @@ describe('geolocationTest_6', function () {
...
@@ -144,21 +153,37 @@ describe('geolocationTest_6', function () {
*/
*/
it
(
'
SUB_HSS_LocationSystem_CountryCode_0600
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_CountryCode_0600
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
[lbs_js] countryCodeChange
"
);
console
.
info
(
"
[lbs_js] countryCodeChange
"
);
geolocationm
.
on
(
'
countryCodeChange
'
,
function
(
data
)
{
try
{
console
.
info
(
'
[lbs_js] countryCodeChange
'
+
JSON
.
stringify
(
data
)
);
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
));
}
catch
(
error
)
{
expect
(
true
).
assertTrue
(
JSON
.
stringify
(
result
)
!=
null
);
console
.
info
(
"
[lbs_js] countryCodeChangeOn try err.
"
+
JSON
.
stringify
(
error
));
}).
catch
((
error
)
=>
{
expect
(
true
).
assertEqual
(
error
!=
null
);
console
.
info
(
"
[lbs_js] getCountryCode promise then error.
"
+
JSON
.
stringify
(
error
));
}
try
{
await
geolocationm
.
getCountryCode
().
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] getCountryCode promise result:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
result
)
!=
null
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getCountryCode promise then error.
"
+
JSON
.
stringify
(
error
));
expect
().
assertFail
();
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCountryCode promise try err.
"
+
JSON
.
stringify
(
error
));
expect
().
assertFail
();
expect
().
assertFail
();
});
}
geolocationm
.
off
(
'
countryCodeChange
'
,
function
(
data
)
{
try
{
console
.
info
(
'
[lbs_js] countryCodeChange
'
+
JSON
.
stringify
(
data
));
geolocationm
.
off
(
'
countryCodeChange
'
,
function
(
data
)
{
done
();
console
.
info
(
'
[lbs_js] countryCodeChange
'
+
JSON
.
stringify
(
data
));
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] countryCodeChangeOn try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
error
!=
null
);
}
done
();
done
();
})
})
})
})
}
location/geolocation_standard/src/main/js/test/List.test.js
0 → 100644
浏览文件 @
3604745e
/*
* Copyright (C) 2021 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
geolocationTest_geo5
from
'
./GeocoderMTest.test.js
'
import
geolocationTest_geo1
from
'
./GeocoderTest.test.js
'
import
geolocationTest_4
from
'
./GetCountryCode.test.js
'
import
geolocationTest_6
from
'
./GetCountryCodeM.test.js
'
import
geolocationTest_geo3
from
'
./LocationTest.test.js
'
import
geolocationTest_geo7
from
'
./LocationMTest.test.js
'
import
geolocationTest_geo2
from
'
./SystemLocation.test.js
'
export
default
function
testsuite
()
{
geolocationTest_geo5
()
geolocationTest_geo1
()
geolocationTest_4
()
geolocationTest_6
()
geolocationTest_geo3
()
geolocationTest_geo7
()
geolocationTest_geo2
()
}
location/geolocation_standard/src/main/js/
default/
test/LocationMTest.test.js
→
location/geolocation_standard/src/main/js/test/LocationMTest.test.js
浏览文件 @
3604745e
此差异已折叠。
点击以展开。
location/geolocation_standard/src/main/js/
default/
test/LocationTest.test.js
→
location/geolocation_standard/src/main/js/test/LocationTest.test.js
浏览文件 @
3604745e
此差异已折叠。
点击以展开。
location/geolocation_standard/src/main/js/
default/
test/SystemLocation.test.js
→
location/geolocation_standard/src/main/js/test/SystemLocation.test.js
浏览文件 @
3604745e
...
@@ -17,7 +17,7 @@ import geolocations from '@system.geolocation';
...
@@ -17,7 +17,7 @@ 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
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
function
sleep
(
ms
)
{
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
...
@@ -67,20 +67,22 @@ async function applyPermission() {
...
@@ -67,20 +67,22 @@ async function applyPermission() {
console
.
info
(
'
[permission] case apply permission failed, createAtManager failed
'
);
console
.
info
(
'
[permission] case apply permission failed, createAtManager failed
'
);
}
}
}
}
export
default
function
geolocationTest_geo2
()
{
describe
(
'
geolocationTest_geo2
'
,
function
()
{
beforeAll
(
async
function
(
done
)
{
console
.
info
(
'
beforeAll case
'
);
await
applyPermission
();
done
();
})
beforeEach
(
async
function
(
done
)
{
console
.
info
(
'
beforeEach case
'
);
await
changedLocationMode
();
done
()
})
afterEach
(
function
()
{
})
describe
(
'
geolocationTest_geo2
'
,
function
()
{
beforeAll
(
async
function
(
done
)
{
console
.
info
(
'
beforeAll case
'
);
await
applyPermission
();
done
();
})
beforeEach
(
async
function
(
done
)
{
console
.
info
(
'
beforeEach case
'
);
await
changedLocationMode
();
done
()
})
afterEach
(
function
()
{
})
/**
/**
* @tc.number SUB_HSS_LocationSystem_systemapi_0100
* @tc.number SUB_HSS_LocationSystem_systemapi_0100
...
@@ -90,7 +92,7 @@ describe('geolocationTest_geo2', function () {
...
@@ -90,7 +92,7 @@ describe('geolocationTest_geo2', function () {
* @tc.type Function
* @tc.type Function
* @tc.level Level 2
* @tc.level Level 2
*/
*/
it
(
'
SUB_HSS_LocationSystem_systemapi_0100
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_systemapi_0100
'
,
0
,
async
function
(
done
)
{
geolocations
.
getLocation
({
geolocations
.
getLocation
({
timeout
:
30000
,
timeout
:
30000
,
coordType
:
'
wgs84
'
,
coordType
:
'
wgs84
'
,
...
@@ -191,7 +193,9 @@ describe('geolocationTest_geo2', function () {
...
@@ -191,7 +193,9 @@ describe('geolocationTest_geo2', function () {
expect
(
true
).
assertEqual
(
types
.
length
!=
0
);
expect
(
true
).
assertEqual
(
types
.
length
!=
0
);
})
})
})
})
}
...
...
location/geolocation_standard/src/main/resources/base/element/string.json
浏览文件 @
3604745e
...
@@ -7,6 +7,22 @@
...
@@ -7,6 +7,22 @@
{
{
"name"
:
"mainability_description"
,
"name"
:
"mainability_description"
,
"value"
:
"JS_Phone_Empty Feature Ability"
"value"
:
"JS_Phone_Empty Feature Ability"
},
{
"name"
:
"MainAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"MainAbility_label"
,
"value"
:
"label"
},
{
"name"
:
"TestAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"TestAbility_label"
,
"value"
:
"label"
}
}
]
]
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录