Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
4f7b5cf9
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看板
未验证
提交
4f7b5cf9
编写于
1月 30, 2023
作者:
O
openharmony_ci
提交者:
Gitee
1月 30, 2023
浏览文件
操作
浏览文件
下载
差异文件
!7302 【OpenHarmony】【location】【monthly1018】LBS新框架适配
Merge pull request !7302 from 权力/myfeature2
上级
7b19b375
1cbf518f
变更
22
隐藏空白更改
内联
并排
Showing
22 changed file
with
465 addition
and
223 deletion
+465
-223
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
+161
-118
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
+0
-13
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
-19
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/GeocoderTest.test.js
...eolocation_standard/src/main/js/test/GeocoderTest.test.js
+21
-16
location/geolocation_standard/src/main/js/test/GetCountryCode.test.js
...location_standard/src/main/js/test/GetCountryCode.test.js
+24
-22
location/geolocation_standard/src/main/js/test/List.test.js
location/geolocation_standard/src/main/js/test/List.test.js
+26
-0
location/geolocation_standard/src/main/js/test/LocationTest.test.js
...eolocation_standard/src/main/js/test/LocationTest.test.js
+20
-14
location/geolocation_standard/src/main/js/test/SystemLocation.test.js
...location_standard/src/main/js/test/SystemLocation.test.js
+21
-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
浏览文件 @
4f7b5cf9
...
@@ -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
浏览文件 @
4f7b5cf9
{
{
"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
浏览文件 @
4f7b5cf9
{
{
"app"
:
{
"app"
:
{
"bundleName"
:
"ohos.acts.location.geolocation.function"
,
"bundleName"
:
"ohos.acts.location.geolocation.function"
,
"vendor"
:
"acts"
,
"vendor"
:
"acts"
,
"version"
:
{
"version"
:
{
"code"
:
1000000
,
"code"
:
1000000
,
"name"
:
"1.0"
"name"
:
"1.0"
},
},
"apiVersion"
:
{
"apiVersion"
:
{
"compatible"
:
4
,
"compatible"
:
4
,
"target"
:
5
,
"target"
:
5
,
"releaseType"
:
"Beta1"
"releaseType"
:
"Beta1"
}
}
},
},
"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"
,
"deviceType"
:
[
"srcPath"
:
""
,
"deviceType"
:
[
"tablet"
,
"tablet"
,
"default"
,
"default"
,
"phone"
"phone"
],
],
"distro"
:
{
"distro"
:
{
"deliveryWithInstall"
:
true
,
"deliveryWithInstall"
:
true
,
"moduleName"
:
"entry"
,
"moduleName"
:
"entry"
,
"moduleType"
:
"entry"
"moduleType"
:
"entry"
},
},
"abilities"
:
[
"abilities"
:
[
{
{
"skills"
:
[
"skills"
:
[
{
{
"entities"
:
[
"entities"
:
[
"entity.system.home"
"entity.system.home"
],
],
"actions"
:
[
"actions"
:
[
"action.system.home"
"action.system.home"
]
]
}
}
],
],
"visible"
:
true
,
"orientation"
:
"unspecified"
,
"name"
:
"ohos.acts.location.geolocation.function.MainAbility"
,
"formsEnabled"
:
false
,
"icon"
:
"$media:icon"
,
"name"
:
".MainAbility"
,
"description"
:
"$string:mainability_description"
,
"srcLanguage"
:
"js"
,
"label"
:
"$string:app_name"
,
"srcPath"
:
"MainAbility"
,
"type"
:
"page"
,
"icon"
:
"$media:icon"
,
"launchType"
:
"standard"
"description"
:
"$string:MainAbility_desc"
,
}
"label"
:
"$string:MainAbility_label"
,
],
"type"
:
"page"
,
"reqPermissions"
:
[
"visible"
:
true
,
{
"launchType"
:
"standard"
"name"
:
"ohos.permission.LOCATION"
,
},
"reason"
:
"need use ohos.permission.LOCATION"
,
{
"usedScene"
:
{
"orientation"
:
"unspecified"
,
"ability"
:
[
"formsEnabled"
:
false
,
"ohos.acts.location.geolocation.function.MainAbility"
"name"
:
".TestAbility"
,
],
"srcLanguage"
:
"js"
,
"when"
:
"inuse"
"srcPath"
:
"TestAbility"
,
}
"icon"
:
"$media:icon"
,
},
"description"
:
"$string:TestAbility_desc"
,
{
"label"
:
"$string:TestAbility_label"
,
"name"
:
"ohos.permission.ACCESS_LOCATION"
,
"type"
:
"page"
,
"reason"
:
"need use ohos.permission.ACCESS_LOCATION"
,
"visible"
:
true
,
"usedScene"
:
{
"launchType"
:
"standard"
"ability"
:
[
}
"ohos.acts.location.geolocation.function.MainAbility"
],
],
"reqPermissions"
:
[
"when"
:
"inuse"
{
}
"name"
:
"ohos.permission.LOCATION"
,
},
"reason"
:
"need use ohos.permission.LOCATION"
,
{
"usedScene"
:
{
"name"
:
"ohos.permission.LOCATION_IN_BACKGROUND"
,
"ability"
:
[
"reason"
:
"need use ohos.permission.LOCATION_IN_BACKGROUND"
,
"ohos.acts.location.geolocation.function.MainAbility"
"usedScene"
:
{
],
"ability"
:
[
"when"
:
"inuse"
"ohos.acts.location.geolocation.function.MainAbility"
}
],
},
"when"
:
"inuse"
{
}
"name"
:
"ohos.permission.ACCESS_LOCATION"
,
},
"reason"
:
"need use ohos.permission.ACCESS_LOCATION"
,
{
"usedScene"
:
{
"name"
:
"ohos.permission.MANAGE_SECURE_SETTINGS"
,
"ability"
:
[
"reason"
:
"need use ohos.permission.MANAGE_SECURE_SETTINGS"
,
"ohos.acts.location.geolocation.function.MainAbility"
"usedScene"
:
{
],
"ability"
:
[
"when"
:
"inuse"
"ohos.acts.location.geolocation.function.MainAbility"
}
],
},
"when"
:
"inuse"
{
}
"name"
:
"ohos.permission.APPROXIMATELY_LOCATION"
,
},
"reason"
:
"need use ohos.permission.APPROXIMATELY_LOCATION"
,
{
"usedScene"
:
{
"name"
:
"ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
,
"ability"
:
[
"reason"
:
"use ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
"ohos.acts.location.geolocation.function.MainAbility"
},
],
{
"when"
:
"inuse"
"name"
:
"ohos.permission.REVOKE_SENSITIVE_PERMISSIONS"
,
}
"reason"
:
"use ohos.permission.REVOKE_SENSITIVE_PERMISSIONS"
},
},
{
{
"name"
:
"ohos.permission.LOCATION_IN_BACKGROUND"
,
"name"
:
"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
"reason"
:
"need use ohos.permission.LOCATION_IN_BACKGROUND"
,
},
"usedScene"
:
{
{
"ability"
:
[
"name"
:
"ohos.permission.GET_BUNDLE_INFO"
"ohos.acts.location.geolocation.function.MainAbility"
}
],
],
"when"
:
"inuse"
"js"
:
[
}
{
},
"pages"
:
[
{
"pages/index/index"
"name"
:
"ohos.permission.MANAGE_SECURE_SETTINGS"
,
],
"reason"
:
"need use ohos.permission.MANAGE_SECURE_SETTINGS"
,
"name"
:
"default"
,
"usedScene"
:
{
"window"
:
{
"ability"
:
[
"designWidth"
:
720
,
"ohos.acts.location.geolocation.function.MainAbility"
"autoDesignWidth"
:
false
],
}
"when"
:
"inuse"
}
}
]
},
}
{
}
"name"
:
"ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
,
"reason"
:
"use ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
},
{
"name"
:
"ohos.permission.REVOKE_SENSITIVE_PERMISSIONS"
,
"reason"
:
"use ohos.permission.REVOKE_SENSITIVE_PERMISSIONS"
},
{
"name"
:
"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"name"
:
"ohos.permission.GET_BUNDLE_INFO"
}
],
"js"
:
[
{
"pages"
:
[
"pages/index/index"
],
"name"
:
"default"
,
"window"
:
{
"designWidth"
:
720
,
"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
浏览文件 @
4f7b5cf9
文件已移动
location/geolocation_standard/src/main/js/
default
/i18n/en-US.json
→
location/geolocation_standard/src/main/js/
MainAbility
/i18n/en-US.json
浏览文件 @
4f7b5cf9
文件已移动
location/geolocation_standard/src/main/js/
default
/i18n/zh-CN.json
→
location/geolocation_standard/src/main/js/
MainAbility
/i18n/zh-CN.json
浏览文件 @
4f7b5cf9
文件已移动
location/geolocation_standard/src/main/js/
default
/pages/index/index.css
→
location/geolocation_standard/src/main/js/
MainAbility
/pages/index/index.css
浏览文件 @
4f7b5cf9
文件已移动
location/geolocation_standard/src/main/js/
default
/pages/index/index.hml
→
location/geolocation_standard/src/main/js/
MainAbility
/pages/index/index.hml
浏览文件 @
4f7b5cf9
文件已移动
location/geolocation_standard/src/main/js/
default
/pages/index/index.js
→
location/geolocation_standard/src/main/js/
MainAbility
/pages/index/index.js
浏览文件 @
4f7b5cf9
...
@@ -14,7 +14,6 @@
...
@@ -14,7 +14,6 @@
*/
*/
import
app
from
'
@system.app
'
import
app
from
'
@system.app
'
import
{
Core
,
ExpectExtend
}
from
'
deccjsunit/index
'
export
default
{
export
default
{
data
:
{
data
:
{
...
@@ -25,18 +24,6 @@ export default {
...
@@ -25,18 +24,6 @@ export default {
},
},
onShow
()
{
onShow
()
{
console
.
info
(
'
onShow finish
'
)
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
()
{
onReady
()
{
},
},
...
...
location/geolocation_standard/src/main/js/TestAbility/app.js
0 → 100644
浏览文件 @
4f7b5cf9
/*
* 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
浏览文件 @
4f7b5cf9
{
"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
浏览文件 @
4f7b5cf9
{
"strings"
:
{
"hello"
:
"您好"
,
"world"
:
"世界"
},
"Files"
:
{
}
}
\ No newline at end of file
location/geolocation_standard/src/main/js/TestAbility/pages/index/index.css
0 → 100644
浏览文件 @
4f7b5cf9
.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
浏览文件 @
4f7b5cf9
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
location/geolocation_standard/src/main/js/
default/test/List.test
.js
→
location/geolocation_standard/src/main/js/
TestAbility/pages/index/index
.js
浏览文件 @
4f7b5cf9
/*
/*
* 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.
*/
*/
require
(
'
./GeocoderTest.test.js
'
)
export
default
{
require
(
'
./GetCountryCode.test.js
'
)
data
:
{
require
(
'
./SystemLocation.test.js
'
)
title
:
""
require
(
'
./LocationTest.test.js
'
)
},
onInit
()
{
this
.
title
=
this
.
$t
(
'
strings.world
'
);
}
}
location/geolocation_standard/src/main/js/TestRunner/OpenHarmonyTestRunner.js
0 → 100644
浏览文件 @
4f7b5cf9
/*
* 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/GeocoderTest.test.js
→
location/geolocation_standard/src/main/js/test/GeocoderTest.test.js
浏览文件 @
4f7b5cf9
...
@@ -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,21 +85,24 @@ async function applyPermission() {
...
@@ -85,21 +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
)
{
console
.
info
(
'
beforeEach case
'
);
await
changedLocationMode
();
done
();
})
describe
(
'
geolocationTest_geo1
'
,
function
()
{
console
.
log
(
'
#start AccessTokenTests#
'
);
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
* @tc.name testIsGeoServiceAvailable
* @tc.name testIsGeoServiceAvailable
...
@@ -108,7 +111,7 @@ describe('geolocationTest_geo1', function () {
...
@@ -108,7 +111,7 @@ 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
)
=>
{
geolocation
.
isGeoServiceAvailable
(
async
(
err
,
data
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
info
(
'
[lbs_js] getGeoServiceState err is :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
[lbs_js] getGeoServiceState err is :
'
+
JSON
.
stringify
(
err
));
...
@@ -989,6 +992,8 @@ describe('geolocationTest_geo1', function () {
...
@@ -989,6 +992,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
浏览文件 @
4f7b5cf9
...
@@ -14,11 +14,10 @@
...
@@ -14,11 +14,10 @@
*/
*/
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
'
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
));
...
@@ -77,18 +76,22 @@ let CountryCodeType = {
...
@@ -77,18 +76,22 @@ 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
...
@@ -97,15 +100,15 @@ describe('geolocationTest_4', function () {
...
@@ -97,15 +100,15 @@ 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
)
=>
{
await
geolocationm
.
getCountryCode
().
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] getCountryCode promise result:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[lbs_js] getCountryCode promise result:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[lbs_js] country :
"
+
result
.
country
);
console
.
info
(
"
[lbs_js] country :
"
+
result
.
country
);
console
.
info
(
"
[lbs_js] type:
"
+
result
.
type
);
console
.
info
(
"
[lbs_js] type:
"
+
result
.
type
);
expect
(
true
).
assert
True
(
JSON
.
stringify
(
result
)
==
CountryCodeType
.
COUNTRY_CODE_FROM_LOCALE
);
expect
(
true
).
assert
Equal
(
JSON
.
stringify
(
result
.
type
)
==
CountryCodeType
.
COUNTRY_CODE_FROM_LOCALE
);
expect
(
true
).
assert
True
(
JSON
.
stringify
(
result
)
!=
CountryCodeType
.
COUNTRY_CODE_FROM_SIM
);
expect
(
true
).
assert
Equal
(
JSON
.
stringify
(
result
.
type
)
!=
CountryCodeType
.
COUNTRY_CODE_FROM_SIM
);
expect
(
true
).
assert
True
(
JSON
.
stringify
(
result
)
!=
CountryCodeType
.
COUNTRY_CODE_FROM_LOCATION
);
expect
(
true
).
assert
Equal
(
JSON
.
stringify
(
result
.
type
)
!=
CountryCodeType
.
COUNTRY_CODE_FROM_LOCATION
);
expect
(
true
).
assert
True
(
JSON
.
stringify
(
result
)
!=
CountryCodeType
.
COUNTRY_CODE_FROM_NETWORK
);
expect
(
true
).
assert
Equal
(
JSON
.
stringify
(
result
.
type
)
!=
CountryCodeType
.
COUNTRY_CODE_FROM_NETWORK
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getCountryCode promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[lbs_js] getCountryCode promise then error.
"
+
JSON
.
stringify
(
error
));
expect
().
assertFail
();
expect
().
assertFail
();
...
@@ -163,8 +166,7 @@ describe('geolocationTest_4', function () {
...
@@ -163,8 +166,7 @@ describe('geolocationTest_4', function () {
})
})
done
();
done
();
})
})
})
})
}
location/geolocation_standard/src/main/js/test/List.test.js
0 → 100644
浏览文件 @
4f7b5cf9
/*
* 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_geo1
from
'
./GeocoderTest.test.js
'
import
geolocationTest_4
from
'
./GetCountryCode.test.js
'
import
geolocationTest_geo3
from
'
./LocationTest.test.js
'
import
geolocationTest_geo2
from
'
./SystemLocation.test.js
'
export
default
function
testsuite
()
{
geolocationTest_geo1
()
geolocationTest_4
()
geolocationTest_geo3
()
geolocationTest_geo2
()
}
location/geolocation_standard/src/main/js/
default/
test/LocationTest.test.js
→
location/geolocation_standard/src/main/js/test/LocationTest.test.js
浏览文件 @
4f7b5cf9
...
@@ -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
=
{
UNSET
:
0x300
,
NAVIGATION
:
0x301
,
let
LocationRequestScenario
=
{
UNSET
:
0x300
,
NAVIGATION
:
0x301
,
TRAJECTORY_TRACKING
:
0x302
,
CAR_HAILING
:
0x303
,
TRAJECTORY_TRACKING
:
0x302
,
CAR_HAILING
:
0x303
,
DAILY_LIFE_SERVICE
:
0x304
,
NO_POWER
:
0x305
}
DAILY_LIFE_SERVICE
:
0x304
,
NO_POWER
:
0x305
}
...
@@ -97,18 +97,21 @@ async function applyPermission() {
...
@@ -97,18 +97,21 @@ async function applyPermission() {
}
}
}
}
describe
(
'
geolocationTest_geo3
'
,
function
()
{
export
default
function
geolocationTest_geo3
()
{
beforeAll
(
async
function
(
done
)
{
console
.
info
(
'
beforeAll case
'
);
describe
(
'
geolocationTest_geo3
'
,
function
()
{
await
applyPermission
();
beforeAll
(
async
function
(
done
)
{
done
();
console
.
info
(
'
beforeAll case
'
);
})
await
applyPermission
();
done
();
})
beforeEach
(
function
()
{
console
.
info
(
'
beforeEach case
'
);
})
afterEach
(
function
()
{
})
beforeEach
(
function
()
{
console
.
info
(
'
beforeEach case
'
);
})
afterEach
(
function
()
{
})
/**
/**
* @tc.number SUB_HSS_LocationSystem_LocSwitch_0300
* @tc.number SUB_HSS_LocationSystem_LocSwitch_0300
...
@@ -118,7 +121,7 @@ describe('geolocationTest_geo3', function () {
...
@@ -118,7 +121,7 @@ describe('geolocationTest_geo3', function () {
* @tc.type Function
* @tc.type Function
* @tc.level Level 2
* @tc.level Level 2
*/
*/
it
(
'
SUB_HSS_LocationSystem_LocSwitch_0300
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_LocSwitch_0300
'
,
0
,
async
function
(
done
)
{
geolocation
.
isLocationEnabled
(
async
(
err
,
data
)
=>
{
geolocation
.
isLocationEnabled
(
async
(
err
,
data
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
info
(
'
[lbs_js] getLocationSwitchState callback err is :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
[lbs_js] getLocationSwitchState callback err is :
'
+
JSON
.
stringify
(
err
));
...
@@ -1259,6 +1262,9 @@ describe('geolocationTest_geo3', function () {
...
@@ -1259,6 +1262,9 @@ describe('geolocationTest_geo3', function () {
},
1000
);
},
1000
);
done
();
done
();
})
})
})
})
}
location/geolocation_standard/src/main/js/
default/
test/SystemLocation.test.js
→
location/geolocation_standard/src/main/js/test/SystemLocation.test.js
浏览文件 @
4f7b5cf9
...
@@ -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,10 @@ describe('geolocationTest_geo2', function () {
...
@@ -191,7 +193,10 @@ 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
浏览文件 @
4f7b5cf9
...
@@ -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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录