提交 dc33f114 编写于 作者: I inter515

修改代码长度

Signed-off-by: Ninter515 <ry.renyi@huawei.com>
上级 dd61eca2
......@@ -106,7 +106,8 @@ describe('ActsBundleManagerTest', function () {
* @tc.desc Test getBundleInfo interfaces with one hap.
*/
it('getBundleInfo_0600', 0, async function (done) {
await demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES|demo.BundleFlag.GET_ABILITY_INFO_WITH_DISABLE , OnReceiveEvent);
await demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES|
demo.BundleFlag.GET_ABILITY_INFO_WITH_DISABLE , OnReceiveEvent);
function OnReceiveEvent(err, datainfo) {
console.info("getBundleInfo_0600 dataInfo ====" + datainfo);
expect(datainfo.name).assertEqual(NAME1);
......@@ -233,7 +234,6 @@ describe('ActsBundleManagerTest', function () {
expect(datainfo[i].moduleInfos[j].moduleSourceDir.length).assertLarger(0);
}
}
}
/**
......@@ -1103,55 +1103,58 @@ describe('ActsBundleManagerTest', function () {
await demo.queryAbilityByWant({
entities: ['entity.system.home', 'entitiesentities']
}, 4, userId).then(data => {
let queryResultCount = 0;
for (let i = 0, len = data.length; i < len; i++) {
let datainfo = data[i];
if (datainfo.bundleName == NAME3) {
expect(datainfo.name).assertEqual("com.example.myapplication.MainAbility");
expect(datainfo.label).assertEqual("$string:app_name");
expect(datainfo.description).assertEqual(DESCRIPTION);
expect(datainfo.icon).assertEqual("$media:icon");
expect(datainfo.moduleName).assertEqual("entry");
expect(datainfo.bundleName).assertEqual(NAME3);
expect(datainfo.type).assertEqual(demo.AbilityType.PAGE);
expect(datainfo.applicationInfo.name).assertEqual(NAME3);
expect(datainfo.applicationInfo.description).assertEqual(DESCRIPTION);
expect(datainfo.applicationInfo.descriptionId >= 0).assertTrue();
expect(datainfo.applicationInfo.icon).assertEqual("$media:icon");
expect(datainfo.applicationInfo.iconId >= 0).assertTrue();
expect(datainfo.applicationInfo.label).assertEqual("$string:app_name");
expect(datainfo.applicationInfo.labelId >= 0).assertTrue();
expect(datainfo.applicationInfo.systemApp).assertEqual(true);
expect(datainfo.applicationInfo.supportedModes).assertEqual(0);
expect(datainfo.orientation).assertEqual(demo.DisplayOrientation.PORTRAIT);
expect(datainfo.applicationInfo.enabled).assertEqual(true);
for (let j = 0; j < datainfo.applicationInfo.moduleInfos.length; j++) {
expect(datainfo.applicationInfo.moduleInfos[j].moduleName).assertEqual("entry");
}
queryResultCount++;
}
if (datainfo.bundleName == NAME4) {
expect(datainfo.name).assertEqual("com.example.myapplication.MainAbility");
expect(datainfo.type).assertEqual(demo.AbilityType.DATA);
expect(datainfo.bundleName).assertEqual(NAME4);
expect(datainfo.orientation).assertEqual(demo.DisplayOrientation.FOLLOW_RECENT);
queryResultCount++;
}
if (datainfo.bundleName == NAME5) {
expect(datainfo.name).assertEqual("com.example.myapplication.MainAbility");
expect(datainfo.type).assertEqual(demo.AbilityType.PAGE);
expect(datainfo.bundleName).assertEqual(NAME5);
expect(datainfo.orientation).assertEqual(demo.DisplayOrientation.UNSPECIFIED);
queryResultCount++;
}
}
expect(queryResultCount).assertEqual(3);
checkAbilityInfos(data);
done();
}).catch(err => {
expect(err).assertFail();
done();
})
})
function checkAbilityInfos(data) {
let queryResultCount = 0;
for (let i = 0, len = data.length; i < len; i++) {
let datainfo = data[i];
if (datainfo.bundleName == NAME3) {
expect(datainfo.name).assertEqual("com.example.myapplication.MainAbility");
expect(datainfo.label).assertEqual("$string:app_name");
expect(datainfo.description).assertEqual(DESCRIPTION);
expect(datainfo.icon).assertEqual("$media:icon");
expect(datainfo.moduleName).assertEqual("entry");
expect(datainfo.bundleName).assertEqual(NAME3);
expect(datainfo.type).assertEqual(demo.AbilityType.PAGE);
expect(datainfo.applicationInfo.name).assertEqual(NAME3);
expect(datainfo.applicationInfo.description).assertEqual(DESCRIPTION);
expect(datainfo.applicationInfo.descriptionId >= 0).assertTrue();
expect(datainfo.applicationInfo.icon).assertEqual("$media:icon");
expect(datainfo.applicationInfo.iconId >= 0).assertTrue();
expect(datainfo.applicationInfo.label).assertEqual("$string:app_name");
expect(datainfo.applicationInfo.labelId >= 0).assertTrue();
expect(datainfo.applicationInfo.systemApp).assertEqual(true);
expect(datainfo.applicationInfo.supportedModes).assertEqual(0);
expect(datainfo.orientation).assertEqual(demo.DisplayOrientation.PORTRAIT);
expect(datainfo.applicationInfo.enabled).assertEqual(true);
for (let j = 0; j < datainfo.applicationInfo.moduleInfos.length; j++) {
expect(datainfo.applicationInfo.moduleInfos[j].moduleName).assertEqual("entry");
}
queryResultCount++;
}
if (datainfo.bundleName == NAME4) {
expect(datainfo.name).assertEqual("com.example.myapplication.MainAbility");
expect(datainfo.type).assertEqual(demo.AbilityType.DATA);
expect(datainfo.bundleName).assertEqual(NAME4);
expect(datainfo.orientation).assertEqual(demo.DisplayOrientation.FOLLOW_RECENT);
queryResultCount++;
}
if (datainfo.bundleName == NAME5) {
expect(datainfo.name).assertEqual("com.example.myapplication.MainAbility");
expect(datainfo.type).assertEqual(demo.AbilityType.PAGE);
expect(datainfo.bundleName).assertEqual(NAME5);
expect(datainfo.orientation).assertEqual(demo.DisplayOrientation.UNSPECIFIED);
queryResultCount++;
}
}
expect(queryResultCount).assertEqual(3);
}
/**
* @tc.number queryAbilityByWant_0400
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册