Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
aa542986
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
aa542986
编写于
3月 14, 2022
作者:
J
jy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add configuration test
Signed-off-by:
N
jy
<
jiyong@huawei.com
>
上级
9ba56df7
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
48 addition
and
48 deletion
+48
-48
aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility/app.js
...urationconstant_test/entry/src/main/js/MainAbility/app.js
+2
-2
aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/app.js
...rationconstant_test/entry/src/main/js/MainAbility2/app.js
+0
-15
aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/app.js
...rationconstant_test/entry/src/main/js/MainAbility3/app.js
+2
-2
aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/test/AbilityDisableTest.js
...onstant_test/entry/src/main/js/test/AbilityDisableTest.js
+19
-15
aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/test/ClearTest.js
...gurationconstant_test/entry/src/main/js/test/ClearTest.js
+25
-14
未找到文件。
aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility/app.js
浏览文件 @
aa542986
...
...
@@ -13,14 +13,14 @@
* limitations under the License.
*/
import
commonEvent
from
'
@ohos.commonEvent
'
;
import
ability
_f
eatureAbility
from
'
@ohos.ability.featureAbility
'
;
import
ability
F
eatureAbility
from
'
@ohos.ability.featureAbility
'
;
export
default
{
onCreate
()
{
commonEvent
.
publish
(
"
ApplicationMainAbility1_onCreate
"
,()
=>
{
console
.
log
(
"
ApplicationMainAbility1_onCreate publish callBack ApplicationMainAbility1_onCreate
"
);
});
setTimeout
(()
=>
{
ability
_f
eatureAbility
.
terminateSelf
().
then
((
data
)
=>
{
ability
F
eatureAbility
.
terminateSelf
().
then
((
data
)
=>
{
console
.
log
(
"
ApplicationMainAbility2 terminateSelf data:
"
+
JSON
.
stringify
(
data
)
)
}).
catch
((
error
)
=>
{
console
.
log
(
"
ApplicationMainAbility2 terminateSelf error:
"
+
JSON
.
stringify
(
error
)
)
...
...
aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/app.js
浏览文件 @
aa542986
...
...
@@ -13,7 +13,6 @@
* limitations under the License.
*/
import
ability_featureAbility
from
'
@ohos.ability.featureAbility
'
;
import
commonEvent
from
'
@ohos.commonEvent
'
;
export
default
{
...
...
@@ -22,14 +21,6 @@ export default {
console
.
log
(
"
ApplicationMainAbility2_onCreate publish callBack ApplicationMainAbility2_onCreate
"
);
});
console
.
info
(
"
ApplicationMainAbility2 onCreate
"
);
// setTimeout(()=>{
// console.info("ApplicationMainAbility2 terminateSelf");
// ability_featureAbility.terminateSelf().then((data)=>{
// console.log("ApplicationMainAbility2 terminateSelf data:" + JSON.stringify(data) )
// }).catch((error)=>{
// console.log("ApplicationMainAbility2 terminateSelf error:" + JSON.stringify(error) )
// })
// },1000);
},
onDestroy
()
{
console
.
log
(
"
singletonEntryAbulity_onDestroy222
"
);
...
...
@@ -37,11 +28,5 @@ export default {
console
.
log
(
"
singletonEntryAbulity2_onDestroy publish callBack singletonEntryAbulity2onDestroy
"
);
});
},
// onForgeGround(){
// console.log("singletonEntryAbulity_onForgeGround");
// commonEvent.publish("ApplicationMainAbility2_onForgeGround",()=>{
// console.log("ApplicationMainAbility2_onHide publish callBack ApplicationMainAbility2_onForgeGround");
// });
// }
};
aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/app.js
浏览文件 @
aa542986
...
...
@@ -12,13 +12,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
ability
_f
eatureAbility
from
'
@ohos.ability.featureAbility
'
;
import
ability
F
eatureAbility
from
'
@ohos.ability.featureAbility
'
;
import
commonEvent
from
'
@ohos.commonEvent
'
;
export
default
{
onCreate
()
{
console
.
info
(
"
Application onCreate MainAbility3
"
);
setTimeout
(()
=>
{
ability
_f
eatureAbility
.
terminateSelf
().
then
((
data
)
=>
{
ability
F
eatureAbility
.
terminateSelf
().
then
((
data
)
=>
{
console
.
log
(
"
Application terminateSelf data:
"
+
JSON
.
stringify
(
data
)
)
}).
catch
((
error
)
=>
{
console
.
log
(
"
Application terminateSelf data:
"
+
JSON
.
stringify
(
error
)
)
...
...
aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/test/AbilityDisableTest.js
浏览文件 @
aa542986
...
...
@@ -18,7 +18,7 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "
import
missionManager
from
'
@ohos.application.missionManager
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
import
bundleManager
from
'
@ohos.bundle
'
;
import
app
_m
anager
from
"
@ohos.application.appManager
"
import
app
M
anager
from
"
@ohos.application.appManager
"
import
commonEvent
from
'
@ohos.commonEvent
'
;
import
{
onDestroys
}
from
"
../MainAbility2/app.js
"
import
abilityManager
from
'
@ohos.application.abilityManager
'
...
...
@@ -195,12 +195,12 @@ function fns(){
describe
(
'
AbilityDisableTests
'
,
function
()
{
let
mainAbility1ListS
=
new
Array
()
let
lists
=
new
Array
()
function
subscriberCallBack
_mainAbility2_
Destory
(
err
,
data
){
function
subscriberCallBack
MainAbility2
Destory
(
err
,
data
){
console
.
log
(
"
Subscribe2 CallBack data:
"
+
JSON
.
stringify
(
data
));
lists
.
push
(
data
[
"
event
"
]);
console
.
log
(
"
subscriberCallBack
_mainAbility2_
Destory lists:
"
+
lists
);
console
.
log
(
"
subscriberCallBack
MainAbility2
Destory lists:
"
+
lists
);
};
function
subscriberCallBack
_mainAbility1_
Destory
(
err
,
data
){
function
subscriberCallBack
MainAbility1
Destory
(
err
,
data
){
console
.
log
(
"
Subscribe3 CallBack data:
"
+
JSON
.
stringify
(
data
));
mainAbility1ListS
.
push
(
data
[
"
event
"
])
console
.
log
(
"
subscriberCallBack_mainAbility3_Destory mainAbility1ListS:
"
+
mainAbility1ListS
);
...
...
@@ -242,13 +242,13 @@ describe('AbilityDisableTests', function () {
console
.
log
(
"
Create Subscriber2=======>:
"
+
JSON
.
stringify
(
data
));
Subscriber2
=
data
;
console
.
log
(
"
data2 is:
"
+
JSON
.
stringify
(
Subscriber2
));
await
commonEvent
.
subscribe
(
Subscriber2
,
subscriberCallBack
_mainAbility2_
Destory
)
await
commonEvent
.
subscribe
(
Subscriber2
,
subscriberCallBack
MainAbility2
Destory
)
});
commonEvent
.
createSubscriber
(
ability1LifeEvents
).
then
(
async
(
data
)
=>
{
console
.
log
(
"
Create Subscriber1=======>:
"
+
JSON
.
stringify
(
data
));
Subscriber1
=
data
;
console
.
log
(
"
data2 is:
"
+
JSON
.
stringify
(
Subscriber1
));
await
commonEvent
.
subscribe
(
Subscriber1
,
subscriberCallBack
_mainAbility1_
Destory
)
await
commonEvent
.
subscribe
(
Subscriber1
,
subscriberCallBack
MainAbility1
Destory
)
});
setTimeout
(()
=>
{
featureAbility
.
startAbility
({
want
:
{
...
...
@@ -269,13 +269,14 @@ describe('AbilityDisableTests', function () {
});
},
1000
);
setTimeout
(()
=>
{
console
.
log
(
"
1111subscriberCallBack
_mainAbility2_
Destory lists:
"
+
lists
);
console
.
log
(
"
1111subscriberCallBack
MainAbility2
Destory lists:
"
+
lists
);
expect
(
lists
.
indexOf
(
JSON
.
stringify
(
"
singletonEntryAbulity2_onShow
"
))
!=-
1
).
assertTrue
();
expect
(
lists
.
indexOf
(
JSON
.
stringify
(
"
ApplicationMainAbility2_onCreate
"
))
!=-
1
).
assertTrue
();
},
2500
)
setTimeout
(()
=>
{
missionManager
.
getMissionInfos
(
""
,
100
,
(
err
,
data
)
=>
{
console
.
log
(
'
SUB_AA_OpenHarmony_MoveMissionToFront_2900 getMissionInfos errCode:
'
+
JSON
.
stringify
(
err
)
+
"
data:
"
+
JSON
.
stringify
(
data
));
console
.
log
(
'
SUB_AA_OpenHarmony_MoveMissionToFront_2900 getMissionInfos errCode:
'
+
JSON
.
stringify
(
err
)
+
"
data:
"
+
JSON
.
stringify
(
data
));
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
if
(
data
[
i
].
want
[
"
abilityName
"
]
==
"
com.example.abilitydisable.MainAbility2
"
){
mainAbility1missinds
.
push
(
data
[
i
][
"
missionId
"
])
...
...
@@ -298,7 +299,7 @@ describe('AbilityDisableTests', function () {
});
},
3888
);
setTimeout
(()
=>
{
console
.
log
(
"
1111subscriberCallBack
_mainAbility1_
Destory lists:
"
+
mainAbility1ListS
);
console
.
log
(
"
1111subscriberCallBack
MainAbility1
Destory lists:
"
+
mainAbility1ListS
);
expect
(
mainAbility1ListS
.
indexOf
(
JSON
.
stringify
(
"
singletonEntrymainAb
"
+
"
ility1ListSAbulity1_onInactive
"
))
!=-
1
).
assertTrue
();
expect
(
mainAbility1ListS
.
indexOf
(
JSON
.
stringify
(
"
singletonEntryA
"
+
...
...
@@ -322,13 +323,13 @@ describe('AbilityDisableTests', function () {
console
.
log
(
"
Create Subscriber2=======>:
"
+
JSON
.
stringify
(
data
));
Subscriber2
=
data
;
console
.
log
(
"
data2 is:
"
+
JSON
.
stringify
(
Subscriber2
));
await
commonEvent
.
subscribe
(
Subscriber2
,
subscriberCallBack
_mainAbility2_
Destory
)
await
commonEvent
.
subscribe
(
Subscriber2
,
subscriberCallBack
MainAbility2
Destory
)
});
commonEvent
.
createSubscriber
(
ability1LifeEvents
).
then
(
async
(
data
)
=>
{
console
.
log
(
"
Create Subscriber1=======>:
"
+
JSON
.
stringify
(
data
));
Subscriber1
=
data
;
console
.
log
(
"
data2 is:
"
+
JSON
.
stringify
(
Subscriber1
));
await
commonEvent
.
subscribe
(
Subscriber1
,
subscriberCallBack
_mainAbility1_
Destory
)
await
commonEvent
.
subscribe
(
Subscriber1
,
subscriberCallBack
MainAbility1
Destory
)
});
setTimeout
(()
=>
{
...
...
@@ -350,7 +351,8 @@ describe('AbilityDisableTests', function () {
});
},
1000
);
setTimeout
(()
=>
{
console
.
log
(
"
1111subscriberCallBack_mainAbility2_lists:singletonEntryAbulity2_onShow:
"
+
lists
);
console
.
log
(
"
1111subscriberCallBack_mainAbility2_lists:
singletonEntryAbulity2_onShow:
"
+
lists
);
console
.
log
(
"
+++++++++++++++++
"
+
lists
.
indexOf
(
"
singletonEntryAbulity2_onShow
"
)
+
"
+++++++
"
+
lists
.
indexOf
(
"
ApplicationMainAbility2_onCreate
"
)
+
lists
)
expect
(
lists
.
indexOf
(
JSON
.
stringify
(
"
singletonEntryAbulity2_onShow
"
))
!=-
1
).
assertTrue
();
expect
(
lists
.
indexOf
(
JSON
.
stringify
(
"
ApplicationMainAbility2_onCreate
"
))
!=-
1
).
assertTrue
();
...
...
@@ -372,9 +374,11 @@ describe('AbilityDisableTests', function () {
console
.
log
(
'
SUB_AA_OpenHarmony_MoveMissionToFront_3000 moveMissionToFront dataCode:++++++
'
);
missionManager
.
moveMissionToFront
(
parseInt
(
mainAbility1missinds
[
0
]),{
parameters
:{
"
windowMode
"
:
100
}}).
then
((
data
)
=>
{
console
.
log
(
'
SUB_AA_OpenHarmony_MoveMissionToFront_3000 moveMissionToFront dataCode:
'
+
"
data:
"
+
JSON
.
stringify
(
data
));
console
.
log
(
'
SUB_AA_OpenHarmony_MoveMissionToFront_3000
moveMissionToFront dataCode:
'
+
"
data:
"
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
log
(
'
SUB_AA_OpenHarmony_MoveMissionToFront_3000 moveMissionToFront errCode:
'
+
"
err:
"
+
JSON
.
stringify
(
err
));
console
.
log
(
'
SUB_AA_OpenHarmony_MoveMissionToFront_3000
moveMissionToFront errCode:
'
+
"
err:
"
+
JSON
.
stringify
(
err
));
});
},
3888
);
setTimeout
(()
=>
{
...
...
@@ -383,4 +387,4 @@ describe('AbilityDisableTests', function () {
},
3999
);
done
();
});
})
\ No newline at end of file
})
aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/test/ClearTest.js
浏览文件 @
aa542986
...
...
@@ -16,15 +16,16 @@
// @ts-nocheck
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
"
deccjsunit/index
"
import
missionManager
from
'
@ohos.application.missionManager
'
;
import
ability
_f
eatureAbility
from
'
@ohos.ability.featureAbility
'
;
import
ability
F
eatureAbility
from
'
@ohos.ability.featureAbility
'
;
import
bundleManager
from
'
@ohos.bundle
'
;
import
app
_m
anager
from
"
@ohos.application.appManager
"
import
app
M
anager
from
"
@ohos.application.appManager
"
import
commonEvent
from
'
@ohos.commonEvent
'
;
import
{
onDestroys
}
from
"
../MainAbility2/app.js
"
import
abilityManager
from
'
@ohos.application.abilityManager
'
import
ConfigurationConstant
from
"
@ohos.application.ConfigurationConstant
"
;
import
AbilityConstant
from
'
@ohos.application.AbilityConstant
'
describe
(
'
AbilityDisableTests
'
,
function
()
{
/*
* @tc.number SUB_AA_OpenHarmony_AbilityStart_6200
* @tc.name Verify the enumeration values LaunchReason. CONTINUATION
...
...
@@ -32,11 +33,12 @@ describe('AbilityDisableTests', function () {
* @tc.level 0
*/
it
(
"
SUB_AA_OpenHarmony_AbilityStart_6200
"
,
0
,
async
function
(
done
)
{
console
.
info
(
"
--------
----------logMessage SUB_AA_OpenHarmony_AbilityStart_6300---------------
----
"
);
console
.
info
(
"
--------
logMessage SUB_AA_OpenHarmony_AbilityStart_6300
----
"
);
console
.
info
(
"
SUB_AA_OpenHarmony_AbilityStart_6200 LaunchReason.CONTINUATION:
"
+
AbilityConstant
.
LaunchReason
.
CONTINUATION
);
expect
(
AbilityConstant
.
LaunchReason
.
CONTINUATION
==
3
).
assertTrue
();
done
();
});
/*
* @tc.number SUB_AA_OpenHarmony_AbilityStart_6300
* @tc.name Verify the enumeration value launchreason.start UNKNOWN
...
...
@@ -44,11 +46,13 @@ describe('AbilityDisableTests', function () {
* @tc.level 0
*/
it
(
"
SUB_AA_OpenHarmony_AbilityStart_6300
"
,
0
,
async
function
(
done
)
{
console
.
info
(
"
------------------logMessage SUB_AA_OpenHarmony_AbilityStart_6300-------------------
"
);
console
.
info
(
"
SUB_AA_OpenHarmony_AbilityStart_6300 LaunchReason.UNKNOWN:
"
+
AbilityConstant
.
LaunchReason
.
UNKNOWN
);
console
.
info
(
"
--------logMessage SUB_AA_OpenHarmony_AbilityStart_6300----
"
);
console
.
info
(
"
SUB_AA_OpenHarmony_AbilityStart_6300 LaunchReason.UNKNOWN:
"
+
AbilityConstant
.
LaunchReason
.
UNKNOWN
);
expect
(
AbilityConstant
.
LaunchReason
.
UNKNOWN
==
0
).
assertTrue
();
done
();
});
/*
* @tc.number SUB_AA_OpenHarmony_AbilityStart_6400
* @tc.name Verify the enumeration value launchreason.START_ABILITY
...
...
@@ -56,11 +60,12 @@ describe('AbilityDisableTests', function () {
* @tc.level 0
*/
it
(
"
SUB_AA_OpenHarmony_AbilityStart_6400
"
,
0
,
async
function
(
done
)
{
console
.
info
(
"
------
------------logMessage SUB_AA_OpenHarmony_AbilityStart_6400--------------
-----
"
);
console
.
info
(
"
------
logMessage SUB_AA_OpenHarmony_AbilityStart_6400
-----
"
);
console
.
info
(
"
SUB_AA_OpenHarmony_AbilityStart_6400 LaunchReason.START_ABILITY:
"
+
AbilityConstant
.
LaunchReason
.
START_ABILITY
);
expect
(
AbilityConstant
.
LaunchReason
.
START_ABILITY
==
1
).
assertTrue
();
done
();
});
/*
* @tc.number SUB_AA_OpenHarmony_AbilityStart_6500
* @tc.name Verify the enumeration values LaunchReason. CALL
...
...
@@ -68,11 +73,13 @@ describe('AbilityDisableTests', function () {
* @tc.level 0
*/
it
(
"
SUB_AA_OpenHarmony_AbilityStart_6500
"
,
0
,
async
function
(
done
)
{
console
.
info
(
"
------------------logMessage SUB_AA_OpenHarmony_AbilityStart_6500-------------------
"
);
console
.
info
(
"
SUB_AA_OpenHarmony_AbilityStart_6500 LaunchReason.CALL:
"
+
AbilityConstant
.
LaunchReason
.
CALL
);
console
.
info
(
"
-------logMessage SUB_AA_OpenHarmony_AbilityStart_6500-----
"
);
console
.
info
(
"
SUB_AA_OpenHarmony_AbilityStart_6500 LaunchReason.CALL:
"
+
AbilityConstant
.
LaunchReason
.
CALL
);
expect
(
AbilityConstant
.
LaunchReason
.
CALL
==
2
).
assertTrue
();
done
();
});
/*
* @tc.number SUB_AA_OpenHarmony_AbilityStart_6600
* @tc.name Verify the enumeration values LastExitReason.UNKNOWN
...
...
@@ -80,11 +87,13 @@ describe('AbilityDisableTests', function () {
* @tc.level 0
*/
it
(
"
SUB_AA_OpenHarmony_AbilityStart_6600
"
,
0
,
async
function
(
done
)
{
console
.
info
(
"
------------------logMessage SUB_AA_OpenHarmony_AbilityStart_6600-------------------
"
);
console
.
info
(
"
SUB_AA_OpenHarmony_AbilityStart_6600 LastExitReason.UNKNOWN:
"
+
AbilityConstant
.
LastExitReason
.
UNKNOWN
);
console
.
info
(
"
---------logMessage SUB_AA_OpenHarmony_AbilityStart_6600---------
"
);
console
.
info
(
"
SUB_AA_OpenHarmony_AbilityStart_6600 LastExitReason.UNKNOWN:
"
+
AbilityConstant
.
LastExitReason
.
UNKNOWN
);
expect
(
AbilityConstant
.
LastExitReason
.
UNKNOWN
==
0
).
assertTrue
();
done
();
});
/*
* @tc.number SUB_AA_OpenHarmony_AbilityStart_6700
* @tc.name Verify the enumeration values LastExitReason.ABILITY_NOT_RESPONDING
...
...
@@ -92,11 +101,12 @@ describe('AbilityDisableTests', function () {
* @tc.level 0
*/
it
(
"
SUB_AA_OpenHarmony_AbilityStart_6700
"
,
0
,
async
function
(
done
)
{
console
.
info
(
"
--------
----------logMessage SUB_AA_OpenHarmony_AbilityStart_6700----------
---------
"
);
console
.
info
(
"
--------
logMessage SUB_AA_OpenHarmony_AbilityStart_6700
---------
"
);
console
.
info
(
"
SUB_AA_OpenHarmony_AbilityStart_6700 LastExitReason.ABILITY_NOT_RESPONDING:
"
+
AbilityConstant
.
LastExitReason
.
ABILITY_NOT_RESPONDING
);
expect
(
AbilityConstant
.
LastExitReason
.
ABILITY_NOT_RESPONDING
==
1
).
assertTrue
();
done
();
});
/*
* @tc.number SUB_AA_OpenHarmony_AbilityStart_6700
* @tc.name Verify the enumeration values LastExitReason.NORMAL
...
...
@@ -104,9 +114,10 @@ describe('AbilityDisableTests', function () {
* @tc.level 0
*/
it
(
"
SUB_AA_OpenHarmony_AbilityStart_6800
"
,
0
,
async
function
(
done
)
{
console
.
info
(
"
------------------logMessage SUB_AA_OpenHarmony_AbilityStart_6800-------------------
"
);
console
.
info
(
"
SUB_AA_OpenHarmony_AbilityStart_6800 LastExitReason.NORMAL:
"
+
AbilityConstant
.
LastExitReason
.
NORMAL
);
console
.
info
(
"
-----logMessage SUB_AA_OpenHarmony_AbilityStart_6800-----------
"
);
console
.
info
(
"
SUB_AA_OpenHarmony_AbilityStart_6800 LastExitReason.NORMAL:
"
+
AbilityConstant
.
LastExitReason
.
NORMAL
);
expect
(
AbilityConstant
.
LastExitReason
.
NORMAL
==
2
).
assertTrue
();
done
();
});
})
\ No newline at end of file
})
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录