Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
149caee7
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看板
未验证
提交
149caee7
编写于
10月 08, 2022
作者:
O
openharmony_ci
提交者:
Gitee
10月 08, 2022
浏览文件
操作
浏览文件
下载
差异文件
!5801 【包管理子系统 master】新增xts用例
Merge pull request !5801 from ry/master
上级
50031424
14ef4e63
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
115 addition
and
70 deletion
+115
-70
bundlemanager/bundle_standard/bundlemanager/actsbmsetsmodulenametest/Test.json
...standard/bundlemanager/actsbmsetsmodulenametest/Test.json
+3
-1
bundlemanager/bundle_standard/bundlemanager/actsbmsetsmodulenametest/entry/src/main/ets/test/ActsBmsEtsModuleNameTest.test.ets
...entry/src/main/ets/test/ActsBmsEtsModuleNameTest.test.ets
+110
-0
bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/Utils.ets
...ctsbundlemanageretstest/entry/src/main/ets/test/Utils.ets
+2
-69
未找到文件。
bundlemanager/bundle_standard/bundlemanager/actsbmsetsmodulenametest/Test.json
浏览文件 @
149caee7
...
...
@@ -10,7 +10,9 @@
"kits"
:
[
{
"test-file-name"
:
[
"ActsBmsEtsModuleNameTest.hap"
"ActsBmsEtsModuleNameTest.hap"
,
"bmsJstest2.hap"
,
"bmsJstest3.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
...
...
bundlemanager/bundle_standard/bundlemanager/actsbmsetsmodulenametest/entry/src/main/ets/test/ActsBmsEtsModuleNameTest.test.ets
浏览文件 @
149caee7
...
...
@@ -19,12 +19,15 @@ import account from '@ohos.account.osAccount'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index'
const ABILITY_NAME = 'com.example.bmsmodulename.MainAbility';
const ABILITY_NAME1 = 'com.example.myapplication2.MainAbility';
const BUNDLE_NAME = 'com.example.bmsmodulename';
const BUNDLE_NAME1 = 'com.example.myapplication2';
const MODULE_NAME1 = '';
const MODULE_NAME2 = 'noModule';
const MODULE_NAME3 = 'entry';
const MODULE_NAME4 = undefined;
const MODULE_NAME5 = null;
const MODULE_NAME6 = 'feature';
const DEFAULT_FLAG = bundle.BundleFlag.GET_BUNDLE_DEFAULT;
const SUCCESS_CODE = 0;
const INVALID_CODE = 1;
...
...
@@ -604,6 +607,64 @@ export default function actsBmsJsModuleNameTest() {
});
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0027
* @tc.name: getAbilityIconMultiHap
* @tc.desc: test existent moduleName
*/
it('getAbilityIconMultiHap', 0, async function (done) {
await bundle.getAbilityIcon(BUNDLE_NAME1, MODULE_NAME6, ABILITY_NAME1)
.then(data => {
expect(data.getBytesNumberPerRow()).assertLarger(0);
}).catch((err) => {
expect(err).assertFail();
});
bundle.getAbilityIcon(BUNDLE_NAME1, MODULE_NAME6, ABILITY_NAME1, (err, data) => {
expect(err).assertEqual(SUCCESS_CODE);
expect(data.getBytesNumberPerRow()).assertLarger(0);
done();
});
});
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0019
* @tc.name: getAbilityInfoMultiHap
* @tc.desc: test existent moduleName
*/
it('getAbilityInfoMultiHap', 0, async function (done) {
await bundle.getAbilityInfo(BUNDLE_NAME1, MODULE_NAME6, ABILITY_NAME1)
.then(data => {
checkAbilityInfo(data);
}).catch((err) => {
expect(err).assertFail();
});
bundle.getAbilityInfo(BUNDLE_NAME1, MODULE_NAME6, ABILITY_NAME1, (err, data) => {
checkAbilityInfo(data);
expect(err).assertEqual(SUCCESS_CODE);
done();
});
});
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0023
* @tc.name: getAbilityLabelMultiHap
* @tc.desc: test existent moduleName
*/
it('getAbilityLabelMultiHap', 0, async function (done) {
await bundle.getAbilityLabel(BUNDLE_NAME1, MODULE_NAME6, ABILITY_NAME1)
.then(data => {
expect(data).assertEqual("bmsscenethree");
}).catch((err) => {
expect(err).assertFail();
});
bundle.getAbilityLabel(BUNDLE_NAME1, MODULE_NAME6, ABILITY_NAME1, (err, data) => {
expect(data).assertEqual("bmsscenethree");
expect(err).assertNull();
done();
});
});
function checkDataInfo(data) {
expect(typeof (data.bundleName)).assertEqual("string");
expect(data.bundleName).assertEqual("com.example.bmsmodulename");
...
...
@@ -654,6 +715,55 @@ export default function actsBmsJsModuleNameTest() {
console.log("---checkDataInfo End--- ");
}
function checkAbilityInfo(data) {
expect(typeof (data.bundleName)).assertEqual("string");
expect(data.bundleName).assertEqual("com.example.myapplication2");
expect(typeof (data.name)).assertEqual("string");
expect(data.name).assertEqual("com.example.myapplication2.MainAbility");
expect(data.label).assertEqual("$string:app_name");
expect(typeof (data.label)).assertEqual("string");
expect(data.description).assertEqual("$string:mainability_description");
expect(typeof (data.description)).assertEqual("string");
expect(data.icon).assertEqual("$media:icon");
expect(typeof (data.icon)).assertEqual("string");
expect(data.isVisible).assertEqual(false);
expect(data.deviceTypes[0]).assertEqual("default");
expect(typeof (data.process)).assertEqual("string");
expect(data.process).assertEqual("com.example.myapplication2");
expect(typeof (data.uri)).assertEqual("string");
expect(data.uri).assertEqual("");
expect(data.moduleName).assertEqual("feature");
expect(typeof (data.moduleName)).assertEqual("string");
expect(typeof (data.applicationInfo)).assertEqual("object");
let info = data.applicationInfo;
expect(typeof (info)).assertEqual("object");
expect(typeof (info.name)).assertEqual("string");
expect(info.name).assertEqual("com.example.myapplication2");
expect(typeof (info.codePath)).assertEqual("string");
expect(info.codePath).assertEqual("/data/app/el1/bundle/public/com.example.myapplication2");
expect(typeof (info.accessTokenId)).assertEqual("number");
expect(info.accessTokenId > 0).assertTrue();
expect(typeof (info.description)).assertEqual("string");
expect(info.description).assertEqual("$string:entry_description");
expect(typeof (info.descriptionId)).assertEqual("number");
expect(info.descriptionId).assertLarger(0);
expect(typeof (info.icon)).assertEqual("string");
expect(info.icon).assertEqual("$media:icon");
expect(typeof (info.iconId)).assertEqual("number");
expect(info.iconId > 0).assertTrue();
expect(typeof (info.label)).assertEqual("string");
expect(info.label).assertEqual("$string:app_name");
expect(typeof (info.labelId)).assertEqual("number");
expect(info.labelId > 0).assertTrue();
expect(info.systemApp).assertEqual(false);
expect(typeof (info.entryDir)).assertEqual("string");
expect(info.entryDir)
.assertEqual("/data/app/el1/bundle/public/com.example.myapplication2/com.example.myapplication1");
expect(typeof (info.process)).assertEqual("string");
expect(info.process).assertEqual("com.example.myapplication2");
expect(Array.isArray(info.permissions)).assertEqual(true);
console.log("---checkDataInfo End--- ");
}
function generateAbilityInfoForTest(bundleName, name, moduleName) {
let map1 = new Map([
["", [{
...
...
bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/Utils.ets
浏览文件 @
149caee7
// @ts-nocheck
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
...
...
@@ -23,8 +22,8 @@ export default class Utils {
static sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
setTimeout((
data
) => {
resolve(
data
)
}, time)
}).then(() => {
console.info(`sleep ${time} over...`)
...
...
@@ -46,72 +45,6 @@ export default class Utils {
}
}
static async swipe(downX, downY, upX, upY, steps) {
console.info('start to swipe')
this.drags(downX, downY, upX, upY, steps, false)
}
static async drag(downX, downY, upX, upY, steps) {
console.info('start to drag')
this.drags(downX, downY, upX, upY, steps, true)
}
static async drags(downX, downY, upX, upY, steps, drag) {
let xStep;
let yStep;
let swipeSteps;
let ret;
xStep = 0;
yStep = 0;
ret = false;
swipeSteps = steps;
if (swipeSteps == 0) {
swipeSteps = 1;
}
xStep = (upX - downX) / swipeSteps;
yStep = (upY - downY) / swipeSteps;
console.info('move step is: ' + 'xStep: ' + xStep + ' yStep: ' + yStep)
let downPonit: TouchObject = {
id: 1,
x: downX,
y: downY,
type: TouchType.Down,
}
console.info('down touch started: ' + JSON.stringify(downPonit))
sendTouchEvent(downPonit);
console.info('start to move')
if (drag) {
await this.sleep(500)
}
for (let i = 1;i <= swipeSteps; i++) {
let movePoint: TouchObject = {
id: 1,
x: downX + (xStep * i),
y: downY + (yStep * i),
type: TouchType.Move
}
console.info('move touch started: ' + JSON.stringify(movePoint))
ret = sendTouchEvent(movePoint)
if (ret == false) {
break;
}
await this.sleep(5)
}
console.info('start to up')
if (drag) {
await this.sleep(100)
}
let upPoint: TouchObject = {
id: 1,
x: upX,
y: upY,
type: TouchType.Up,
}
console.info('up touch started: ' + JSON.stringify(upPoint))
sendTouchEvent(upPoint)
await this.sleep(500)
}
static getNowTime() {
return new Date().getTime();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录