Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
0758ce92
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看板
未验证
提交
0758ce92
编写于
9月 27, 2022
作者:
O
openharmony_ci
提交者:
Gitee
9月 27, 2022
浏览文件
操作
浏览文件
下载
差异文件
!5682 xts接口覆盖
Merge pull request !5682 from chengxingzhen/master
上级
c01b19c4
6d4b5651
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
291 addition
and
34 deletion
+291
-34
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/CreateFormAbility/pages/MainAbility_pages.ets
...rc/main/ets/CreateFormAbility/pages/MainAbility_pages.ets
+1
-1
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/FormHostAbility/FormHostAbility.ts
...est/entry/src/main/ets/FormHostAbility/FormHostAbility.ts
+50
-0
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/FormHostAbility/pages/MainAbility_pages.ets
.../src/main/ets/FormHostAbility/pages/MainAbility_pages.ets
+62
-0
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts
...ptest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts
+1
-0
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets
...rhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets
+106
-30
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/module.json
...ntime/apicover/apicoverhaptest/entry/src/main/module.json
+13
-1
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/resources/base/profile/form_config.json
...st/entry/src/main/resources/base/profile/form_config.json
+20
-1
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/resources/base/profile/main_pages.json
...est/entry/src/main/resources/base/profile/main_pages.json
+2
-1
ability/ability_runtime/faapicover/faapicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets
...rhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets
+36
-0
未找到文件。
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/CreateFormAbility/pages/MainAbility_pages.ets
浏览文件 @
0758ce92
...
...
@@ -28,7 +28,7 @@ struct Index {
@State bundle: string = "com.example.apicoverhaptest";
@State ability: string = "FormAbility";
@State moduleName: string = "phone";
@State name: string = "
widget
";
@State name: string = "
form1
";
private dimension: FormDimension = FormDimension.Dimension_2_2;
private temporary = false;
...
...
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/FormHostAbility/FormHostAbility.ts
0 → 100644
浏览文件 @
0758ce92
/*
* 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
Ability
from
'
@ohos.application.Ability
'
export
default
class
MainAbility
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
console
.
log
(
"
[Demo] FormHostAbility onCreate
"
)
globalThis
.
abilityWant
=
want
;
globalThis
.
applicationContext
=
this
.
context
.
getApplicationContext
();
}
onDestroy
()
{
console
.
log
(
"
[Demo] FormHostAbility onDestroy
"
)
}
onWindowStageCreate
(
windowStage
)
{
// Main window is created, set main page for this ability
console
.
log
(
"
[Demo] FormHostAbility onWindowStageCreate
"
)
globalThis
.
abilityContext
=
this
.
context
;
windowStage
.
setUIContent
(
this
.
context
,
"
FormHostAbility/pages/MainAbility_pages
"
,
null
)
}
onWindowStageDestroy
()
{
// Main window is destroyed, release UI related resources
console
.
log
(
"
[Demo] FormHostAbility onWindowStageDestroy
"
)
}
onForeground
()
{
// Ability has brought to foreground
console
.
log
(
"
[Demo] FormHostAbility onForeground
"
)
}
onBackground
()
{
// Ability has back to background
console
.
log
(
"
[Demo] FormHostAbility onBackground
"
)
}
};
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/FormHostAbility/pages/MainAbility_pages.ets
0 → 100644
浏览文件 @
0758ce92
// @ts-nocheck
/*
* 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 router from '@ohos.router';
@Entry
@Component
struct Index {
@State message: string = 'FormHostAbility'
@State isShowing: boolean = true;
@State formId: number = 0;
@State bundle: string = "com.example.apicoverhaptest";
@State ability: string = "FormAbility";
@State moduleName: string = "phone";
@State name: string = "widget";
private dimension: FormDimension = FormDimension.Dimension_2_1;
private temporary = false;
build() {
Row() {
Column() {
FormComponent({
id: this.formId,
name: this.name,
bundle: this.bundle,
ability: this.ability,
module: this.moduleName,
dimension: this.dimension,
temporary: this.temporary,
})
.allowUpdate(this.allowUpate)
.visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden)
.onAcquired((form) => {
console.log("[FormComponent.FormHostAbility] get form, form id:" + form.id);
globalThis.formId21 = form.id
})
.onError((error) => {
console.log("[FormComponent.FormHostAbility] error code:" + error.errcode);
console.log("[FormComponent.FormHostAbility] error msg:" + error.msg);
})
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts
浏览文件 @
0758ce92
...
...
@@ -20,6 +20,7 @@ import rpc from '@ohos.rpc';
export
default
class
ServiceAbility
extends
ServiceExtension
{
onCreate
(
want
:
Want
)
{
globalThis
.
abilityWant
=
want
;
globalThis
.
serviceContext
=
this
.
context
let
direction
=
this
.
context
.
config
.
direction
let
pointerDervice
=
this
.
context
.
config
.
hasPointerDevice
let
AbilityInfo
=
this
.
context
.
extensionAbilityInfo
.
bundleName
...
...
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets
浏览文件 @
0758ce92
...
...
@@ -35,7 +35,6 @@ function sleep(time) {
export
default
function
ApiCoverTest
()
{
describe
(
'ApiCoverTestTest'
,
function
()
{
afterEach
(
async
(
done
)
=>
{
setTimeout
(
function
()
{
done
();
...
...
@@ -244,6 +243,8 @@ export default function ApiCoverTest() {
expect
(
1
)
.
assertEqual
(
globalThis
.
abilityContext
.
area
)
let
moduleContext
=
globalThis
.
abilityContext
.
createModuleContext
(
"module1"
)
expect
(
"/data/storage/el2/base/cache"
)
.
assertEqual
(
moduleContext
.
cacheDir
)
globalThis
.
abilityContext
.
area
=
0
expect
(
0
)
.
assertEqual
(
globalThis
.
abilityContext
.
area
)
globalThis
.
abilityContext
.
resourceManager
.
getConfiguration
((
err
,
data
)
=>
{
if
(
err
==
undefined
){
console
.
log
(
`Ability: getConfiguration success: ${JSON.stringify(data)}`
);
...
...
@@ -338,6 +339,12 @@ export default function ApiCoverTest() {
expect
(
-
1
)
.
assertEqual
(
FormInfo
.
FormState
.
UNKNOWN
)
expect
(
0
)
.
assertEqual
(
FormInfo
.
ColorMode
.
MODE_DARK
)
expect
(
1
)
.
assertEqual
(
FormInfo
.
ColorMode
.
MODE_LIGHT
)
console
.
info
(
"SUB_AA_Form_provider_TestFormInfo_0100:"
+
FormInfo
.
FormDimension
.
Dimension_2_1
);
expect
(
1
)
.
assertEqual
(
FormInfo
.
FormDimension
.
Dimension_1_2
)
expect
(
2
)
.
assertEqual
(
FormInfo
.
FormDimension
.
Dimension_2_2
)
expect
(
3
)
.
assertEqual
(
FormInfo
.
FormDimension
.
Dimension_2_4
)
expect
(
4
)
.
assertEqual
(
FormInfo
.
FormDimension
.
Dimension_4_4
)
expect
(
5
)
.
assertEqual
(
FormInfo
.
FormDimension
.
Dimension_2_1
)
done
();
});
...
...
@@ -391,10 +398,13 @@ export default function ApiCoverTest() {
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_
AbilityConstant_02
00', 0, async function (done) {
it
(
'SUB_AA_
Test_AbilityConstant_01
00'
,
0
,
async
function
(
done
)
{
expect
(
1
)
.
assertEqual
(
abilityConstant
.
LaunchReason
.
START_ABILITY
)
expect
(
1
)
.
assertEqual
(
abilityConstant
.
LastExitReason
.
ABILITY_NOT_RESPONDING
)
expect
(
2
)
.
assertEqual
(
abilityConstant
.
LastExitReason
.
NORMAL
)
expect
(
0
)
.
assertEqual
(
abilityConstant
.
MemoryLevel
.
MEMORY_LEVEL_MODERATE
)
expect
(
1
)
.
assertEqual
(
abilityConstant
.
MemoryLevel
.
MEMORY_LEVEL_LOW
)
expect
(
2
)
.
assertEqual
(
abilityConstant
.
MemoryLevel
.
MEMORY_LEVEL_CRITICAL
)
done
()
});
...
...
@@ -462,6 +472,9 @@ export default function ApiCoverTest() {
* @tc.level 3
*/
it
(
'SUB_AA_FMS_AbilityStage_0100'
,
0
,
async
function
(
done
)
{
console
.
info
(
"SUB_AA_FMS_AbilityStage_0100===AbilityStage==="
+
JSON
.
stringify
(
globalThis
.
stageContext
))
console
.
info
(
"SUB_AA_FMS_AbilityStage_0100===AbilityStage==="
+
JSON
.
stringify
(
globalThis
.
stageContext
.
config
))
let
directions
=
globalThis
.
stageContext
.
config
.
direction
let
subscriber
=
null
let
subscribeInfo
=
{
events
:
[
"AbilityStage_StartAbility"
]
...
...
@@ -470,10 +483,12 @@ export default function ApiCoverTest() {
console
.
info
(
"SUB_AA_FMS_AbilityStage_0100===UnSubscribeInfoCallback==="
)
done
()
}
function SubscribeInfoCallback(err, data) {
async
function
SubscribeInfoCallback
(
err
,
data
)
{
console
.
info
(
"SUB_AA_FMS_AbilityStage_0100===SubscribeInfoCallback==="
+
JSON
.
stringify
(
data
))
expect
(
data
.
parameters
[
"config"
])
.
assertEqual
(
-
1
)
expect
(
data
.
parameters
[
"config"
])
.
assertEqual
(
directions
)
commonEvent
.
unsubscribe
(
subscriber
,
UnSubscribeInfoCallback
)
await
sleep
(
4000
)
done
()
}
commonEvent
.
createSubscriber
(
subscribeInfo
,
(
err
,
data
)
=>
{
...
...
@@ -490,6 +505,7 @@ export default function ApiCoverTest() {
if
(
err
.
code
==
0
){
console
.
info
(
"SUB_AA_FMS_AbilityStage_0100===CreateSubscriberCallback==="
)
}
else
{
console
.
info
(
"SUB_AA_FMS_AbilityStage_0100===failed==="
)
expect
()
.
assertFail
()
done
()
}
...
...
@@ -510,12 +526,21 @@ export default function ApiCoverTest() {
function
UnSubscribeInfoCallback
(
err
,
data
)
{
console
.
info
(
"SUB_AA_FMS_AbilityStage_0200===UnSubscribeInfoCallback==="
)
}
function SubscribeInfoCallback(err, data) {
async
function
SubscribeInfoCallback
(
err
,
data
)
{
console
.
info
(
"SUB_AA_FMS_AbilityStage_0200===SubscribeInfoCallback==="
+
JSON
.
stringify
(
data
))
console
.
info
(
"SUB_AA_FMS_AbilityStage_0200===serviceContext==="
+
JSON
.
stringify
(
globalThis
.
serviceContext
))
console
.
info
(
"SUB_AA_FMS_AbilityStage_0200===config==="
+
JSON
.
stringify
(
globalThis
.
serviceContext
.
config
))
expect
(
data
.
parameters
[
"config"
])
.
assertLess
(
2
)
expect
(
data
.
parameters
[
"poniterDevices"
])
.
assertFalse
()
expect
(
data
.
parameters
[
"AbilityInfo"
])
.
assertEqual
(
"com.example.apicoverhaptest"
)
let
direction
=
globalThis
.
serviceContext
.
config
.
direction
let
pointerDervice
=
globalThis
.
serviceContext
.
config
.
hasPointerDevice
let
AbilityInfo
=
globalThis
.
serviceContext
.
extensionAbilityInfo
.
bundleName
expect
(
direction
)
.
assertLess
(
2
)
expect
(
pointerDervice
)
.
assertFalse
()
expect
(
AbilityInfo
)
.
assertEqual
(
"com.example.apicoverhaptest"
)
commonEvent
.
unsubscribe
(
subscriber
,
UnSubscribeInfoCallback
)
await
sleep
(
4000
)
done
()
}
commonEvent
.
createSubscriber
(
subscribeInfo
,
(
err
,
data
)
=>
{
...
...
@@ -582,5 +607,56 @@ export default function ApiCoverTest() {
}
})
})
/*
* @tc.number SUB_AA_FormDisplaySpecifications_0100
* @tc.name Create a form and delete.
* @tc.desc Function test
* @tc.level 3
*/
it
(
'SUB_AA_FormDisplaySpecifications_0100'
,
0
,
async
function
(
done
)
{
let
formWant
=
{
deviceId
:
""
,
bundleName
:
"com.example.apicoverhaptest"
,
abilityName
:
"FormHostAbility"
,
}
globalThis
.
abilityContext
.
startAbility
(
formWant
,
(
err
,
data
)
=>
{
if
(
err
.
code
==
0
){
console
.
info
(
"SUB_AA_FormDisplaySpecifications_0100===abilityContext startAbility success==="
)
}
else
{
expect
()
.
assertFail
()
done
()
}
})
await
sleep
(
2000
)
console
.
info
(
"SUB_AA_FormDisplaySpecifications_0100===globalThis.formId21 success==="
+
globalThis
.
formId21
)
expect
(
globalThis
.
formId21
!=
undefined
)
.
assertTrue
()
formHost
.
deleteForm
(
globalThis
.
formId21
)
.
then
((
data
)
=>
{
console
.
info
(
"SUB_AA_FormDisplaySpecifications_0100===deleteForm success==="
)
done
()
})
.
catch
((
err
)
=>
{
console
.
info
(
"SUB_AA_FormDisplaySpecifications_0100===deleteForm failed==="
)
expect
()
.
assertFail
()
done
()
})
})
/*
* @tc.number SUB_AA_FormDisplaySpecifications_0200
* @tc.name get the form info.
* @tc.desc Function test
* @tc.level 3
*/
it
(
'SUB_AA_FormDisplaySpecifications_0200'
,
0
,
async
function
(
done
)
{
await
formHost
.
getFormsInfo
(
"com.example.apicoverhaptest"
,
"phone"
)
.
then
((
data
)
=>
{
console
.
info
(
"SUB_AA_FormDisplaySpecifications_0200===deleteForm success==="
+
JSON
.
stringify
(
data
))
expect
(
5
)
.
assertEqual
(
data
[
0
]
.
defaultDimension
)
done
()
})
.
catch
((
err
)
=>
{
console
.
info
(
"SUB_AA_FormDisplaySpecifications_0200===deleteForm failed==="
+
JSON
.
stringify
(
err
))
expect
()
.
assertFail
()
done
()
})
})
})
}
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/module.json
浏览文件 @
0758ce92
...
...
@@ -55,6 +55,17 @@
"startWindowBackground"
:
"$color:white"
,
"visible"
:
true
,
"launchType"
:
"singleton"
},
{
"name"
:
"FormHostAbility"
,
"srcEntrance"
:
"./ets/FormHostAbility/FormHostAbility.ts"
,
"description"
:
"$string:phone_entry_main"
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:entry_label"
,
"startWindowIcon"
:
"$media:icon"
,
"startWindowBackground"
:
"$color:white"
,
"visible"
:
true
,
"launchType"
:
"singleton"
}
],
"extensionAbilities"
:
[
...
...
@@ -76,7 +87,8 @@
"srcEntrance"
:
"./ets/ServiceAbility/ServiceAbility.ts"
,
"label"
:
"$string:MainAbility_label"
,
"description"
:
"$string:MainAbility_desc"
,
"type"
:
"service"
"type"
:
"service"
,
"visible"
:
true
}
],
"requestPermissions"
:[
...
...
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/resources/base/profile/form_config.json
浏览文件 @
0758ce92
...
...
@@ -4,7 +4,7 @@
"isDefault"
:
true
,
"src"
:
"./js/widget/pages/index/index"
,
"scheduledUpdateTime"
:
"10:30"
,
"defaultDimension"
:
"2*
2
"
,
"defaultDimension"
:
"2*
1
"
,
"name"
:
"widget"
,
"description"
:
"This is a service widget."
,
"colorMode"
:
"auto"
,
...
...
@@ -13,6 +13,25 @@
"autoDesignWidth"
:
true
},
"formConfigAbility"
:
"ability://xxxxx"
,
"supportDimensions"
:
[
"2*1"
],
"updateEnabled"
:
true
,
"updateDuration"
:
1
},
{
"isDefault"
:
false
,
"src"
:
"./js/widget/pages/index/index"
,
"scheduledUpdateTime"
:
"10:30"
,
"defaultDimension"
:
"2*2"
,
"name"
:
"form1"
,
"description"
:
"This is a service widget."
,
"colorMode"
:
"auto"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
true
},
"formConfigAbility"
:
"ability://xxxxx"
,
"supportDimensions"
:
[
"2*2"
],
...
...
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/resources/base/profile/main_pages.json
浏览文件 @
0758ce92
...
...
@@ -2,6 +2,7 @@
"src"
:
[
"MainAbility/pages/MainAbility_pages"
,
"SecondAbility/pages/MainAbility_pages"
,
"CreateFormAbility/pages/MainAbility_pages"
"CreateFormAbility/pages/MainAbility_pages"
,
"FormHostAbility/pages/MainAbility_pages"
]
}
\ No newline at end of file
ability/ability_runtime/faapicover/faapicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets
浏览文件 @
0758ce92
...
...
@@ -16,6 +16,7 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "
import FormInfo from '@ohos.application.formInfo';
import formError from '@ohos.application.formError';
import featureAbility from '@ohos.ability.featureAbility'
export default function ApiCoverTest() {
describe('ApiCoverTestTest', function () {
...
...
@@ -75,5 +76,40 @@ export default function ApiCoverTest() {
expect(1).assertEqual(FormInfo.FormState.READY)
done();
});
/*
* @tc.number SUB_AA_OpenHarmony_CoverApiContext_0100
* @tc.name Test getExternalCacheDir by callback.
* @tc.desc Function test
* @tc.level 0
*/
it('SUB_AA_OpenHarmony_CoverApiContext_0100', 0, async function (done) {
console.log("------------start SUB_AA_OpenHarmony_CoverApi_0500-------------");
let appContext = featureAbility.getContext()
appContext.getExternalCacheDir((err, data) => {
console.info('SUB_AA_OpenHarmony_CoverApiContext_0100 successful. data: ' + JSON.stringify(data));
expect(true).assertTrue()
done()
})
})
/*
* @tc.number SUB_AA_OpenHarmony_CoverApiContext_0200
* @tc.name Test getExternalCacheDir by promise.
* @tc.desc Function test
* @tc.level 0
*/
it('SUB_AA_OpenHarmony_CoverApiContext_0200', 0, async function (done) {
console.log("------------start SUB_AA_OpenHarmony_CoverApi_0500-------------");
let appContext = featureAbility.getContext()
appContext.getExternalCacheDir().then((data)=>{
console.info('SUB_AA_OpenHarmony_CoverApiContext_0200 successful. data: ' + JSON.stringify(data));
expect(true).assertTrue()
done()
}).catch((err)=>{
expect().assertFalse();
done()
})
})
})
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录