Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
df952576
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看板
提交
df952576
编写于
8月 22, 2023
作者:
U
ustblx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
【distributeddatamgr】【UDMF】add and modify UDMF api test case.
Signed-off-by:
N
ustblx
<
lvxin29@huawei.com
>
上级
106f7b66
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
67 addition
and
63 deletion
+67
-63
distributeddatamgr/UDMFtest/UDMFtest/entry/src/main/ets/test/UDMF.test.ets
...r/UDMFtest/UDMFtest/entry/src/main/ets/test/UDMF.test.ets
+67
-63
未找到文件。
distributeddatamgr/UDMFtest/UDMFtest/entry/src/main/ets/test/UDMF.test.ets
浏览文件 @
df952576
...
...
@@ -17,10 +17,8 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from
import unifiedDataChannel from '@ohos.data.unifiedDataChannel';
import uniformTypeDescriptor from '@ohos.data.uniformTypeDescriptor';
export default function UDMFApiTest() {
describe('UDMFApiTest', function () {
console.info('start################################start');
console.info('start UDMFApiTest');
let text = new unifiedDataChannel.Text();
text.details = {
...
...
@@ -40,7 +38,6 @@ export default function UDMFApiTest() {
link.details = {
title:"标题",
content:"内容"
};
link.url = "url";
link.description = "description";
...
...
@@ -81,12 +78,12 @@ export default function UDMFApiTest() {
};
video.videoUri = "videoUri";
let
A
udio = new unifiedDataChannel.Audio();
A
udio.details = {
let
a
udio = new unifiedDataChannel.Audio();
a
udio.details = {
title:"标题",
content:"内容"
};
A
udio.audioUri = "audioUri";
a
udio.audioUri = "audioUri";
let arrayBuf = new ArrayBuffer(2 * 3 * 4);
let u8Array = new Uint8Array(arrayBuf);
...
...
@@ -242,6 +239,7 @@ export default function UDMFApiTest() {
expect(records.length).assertEqual(1);
expect(record.details.title).assertEqual('标题');
expect(record.details.content).assertEqual('内容');
expect(record.uri).assertEqual('uri');
console.info("SUB_DistributedData_Udmf_API005 end");
done();
})
...
...
@@ -262,6 +260,7 @@ export default function UDMFApiTest() {
expect(records.length).assertEqual(1);
expect(record.details.title).assertEqual('标题');
expect(record.details.content).assertEqual('内容');
expect(record.folderUri).assertEqual('folderUri');
console.info("SUB_DistributedData_Udmf_API006 end");
done();
})
...
...
@@ -282,6 +281,7 @@ export default function UDMFApiTest() {
expect(records.length).assertEqual(1);
expect(record.details.title).assertEqual('标题');
expect(record.details.content).assertEqual('内容');
expect(record.imageUri).assertEqual('imageUri');
console.info("SUB_DistributedData_Udmf_API007 end");
done();
})
...
...
@@ -302,6 +302,7 @@ export default function UDMFApiTest() {
expect(records.length).assertEqual(1);
expect(record.details.title).assertEqual('标题');
expect(record.details.content).assertEqual('内容');
expect(record.videoUri).assertEqual('videoUri');
console.info("SUB_DistributedData_Udmf_API008 end");
done();
})
...
...
@@ -309,13 +310,34 @@ export default function UDMFApiTest() {
/**
* @tc.number SUB_DistributedData_Udmf_API009
* @tc.name CreateData
* @tc.desc Test unifiedDataChannel creating a unifieddata with a
systemdefinedrecord
record.
* @tc.desc Test unifiedDataChannel creating a unifieddata with a
audio
record.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_DistributedData_Udmf_API009',0, async function (done) {
console.info('SUB_DistributedData_Udmf_API009 start');
let unifiedData = new unifiedDataChannel.UnifiedData(audio);
let records = unifiedData.getRecords();
let record = <unifiedDataChannel.Audio>(records[0]);
expect(records.length).assertEqual(1);
expect(record.details.title).assertEqual('标题');
expect(record.details.content).assertEqual('内容');
expect(record.audioUri).assertEqual('audioUri');
console.info("SUB_DistributedData_Udmf_API009 end");
done();
})
/**
* @tc.number SUB_DistributedData_Udmf_API010
* @tc.name CreateData
* @tc.desc Test unifiedDataChannel creating a unifieddata with a systemdefinedrecord record.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_DistributedData_Udmf_API010',0, async function (done) {
console.info('SUB_DistributedData_Udmf_API010 start');
let unifiedData = new unifiedDataChannel.UnifiedData(systemDefinedRecord);
let records = unifiedData.getRecords();
let record = <unifiedDataChannel.SystemDefinedRecord>(records[0]);
...
...
@@ -325,20 +347,20 @@ export default function UDMFApiTest() {
for(var i = 0; i<u8Array.length; i++){
expect(record.details.content[i]).assertEqual(u8Array[i]);
}
console.info("SUB_DistributedData_Udmf_API0
09
end");
console.info("SUB_DistributedData_Udmf_API0
10
end");
done();
})
/**
* @tc.number SUB_DistributedData_Udmf_API01
0
* @tc.number SUB_DistributedData_Udmf_API01
1
* @tc.name CreateData
* @tc.desc Test unifiedDataChannel creating a unifieddata with a systemdefinedform record.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_DistributedData_Udmf_API01
0
',0, async function (done) {
console.info('SUB_DistributedData_Udmf_API01
0
start');
it('SUB_DistributedData_Udmf_API01
1
',0, async function (done) {
console.info('SUB_DistributedData_Udmf_API01
1
start');
let unifiedData = new unifiedDataChannel.UnifiedData(systemDefinedForm);
let records = unifiedData.getRecords();
let record = <unifiedDataChannel.SystemDefinedForm>(records[0]);
...
...
@@ -353,20 +375,20 @@ export default function UDMFApiTest() {
expect(record.bundleName).assertEqual('bundleName');
expect(record.abilityName).assertEqual('abilityName');
expect(record.module).assertEqual('module');
console.info("SUB_DistributedData_Udmf_API01
0
end");
console.info("SUB_DistributedData_Udmf_API01
1
end");
done();
})
/**
* @tc.number SUB_DistributedData_Udmf_API01
1
* @tc.number SUB_DistributedData_Udmf_API01
2
* @tc.name CreateData
* @tc.desc Test unifiedDataChannel creating a unifieddata with a systemdefinedappitem record.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_DistributedData_Udmf_API01
1
',0, async function (done) {
console.info('SUB_DistributedData_Udmf_API01
1
start');
it('SUB_DistributedData_Udmf_API01
2
',0, async function (done) {
console.info('SUB_DistributedData_Udmf_API01
2
start');
let unifiedData = new unifiedDataChannel.UnifiedData(systemDefinedAppItem);
let records = unifiedData.getRecords();
let record = <unifiedDataChannel.SystemDefinedAppItem>(records[0]);
...
...
@@ -382,20 +404,20 @@ export default function UDMFApiTest() {
expect(record.appLabelId).assertEqual('appLabelId');
expect(record.bundleName).assertEqual('bundleName');
expect(record.abilityName).assertEqual('abilityName');
console.info("SUB_DistributedData_Udmf_API01
1
end");
console.info("SUB_DistributedData_Udmf_API01
2
end");
done();
})
/**
* @tc.number SUB_DistributedData_Udmf_API01
2
* @tc.number SUB_DistributedData_Udmf_API01
3
* @tc.name CreateData
* @tc.desc Test unifiedDataChannel creating a unifieddata with a systemdefinedpixelmap record.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_DistributedData_Udmf_API01
2
',0, async function (done) {
console.info('SUB_DistributedData_Udmf_API01
2
start');
it('SUB_DistributedData_Udmf_API01
3
',0, async function (done) {
console.info('SUB_DistributedData_Udmf_API01
3
start');
let unifiedData = new unifiedDataChannel.UnifiedData(systemDefinedPixelMap);
let records = unifiedData.getRecords();
let record = <unifiedDataChannel.SystemDefinedPixelMap>(records[0]);
...
...
@@ -408,20 +430,20 @@ export default function UDMFApiTest() {
for(var i = 0; i<u8Array.length; i++){
expect(record.rawData[i]).assertEqual(u8Array[i]);
}
console.info("SUB_DistributedData_Udmf_API01
2
end");
console.info("SUB_DistributedData_Udmf_API01
3
end");
done();
})
/**
* @tc.number SUB_DistributedData_Udmf_API01
3
* @tc.number SUB_DistributedData_Udmf_API01
4
* @tc.name CreateData
* @tc.desc Test unifiedDataChannel creating a unifieddata with a applicationdefinedrecord record.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_DistributedData_Udmf_API01
3
',0, async function (done) {
console.info('SUB_DistributedData_Udmf_API01
3
start');
it('SUB_DistributedData_Udmf_API01
4
',0, async function (done) {
console.info('SUB_DistributedData_Udmf_API01
4
start');
let unifiedData = new unifiedDataChannel.UnifiedData(applicationDefinedRecord);
let records = unifiedData.getRecords();
let record = <unifiedDataChannel.ApplicationDefinedRecord>(records[0]);
...
...
@@ -430,20 +452,20 @@ export default function UDMFApiTest() {
for(var i = 0; i<u8Array.length; i++){
expect(record.rawData[i]).assertEqual(u8Array[i]);
}
console.info("SUB_DistributedData_Udmf_API01
3
end");
console.info("SUB_DistributedData_Udmf_API01
4
end");
done();
})
/**
* @tc.number SUB_DistributedData_Udmf_API01
4
* @tc.number SUB_DistributedData_Udmf_API01
5
* @tc.name CreateData
* @tc.desc Test unifiedDataChannel creating a unifieddata with a recordgroup.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_DistributedData_Udmf_API01
4
',0, async function (done) {
console.info('SUB_DistributedData_Udmf_API01
4
start');
it('SUB_DistributedData_Udmf_API01
5
',0, async function (done) {
console.info('SUB_DistributedData_Udmf_API01
5
start');
let unifiedData = new unifiedDataChannel.UnifiedData(text);
unifiedData.addRecord(plainText);
unifiedData.addRecord(link);
...
...
@@ -452,6 +474,7 @@ export default function UDMFApiTest() {
unifiedData.addRecord(folder);
unifiedData.addRecord(image);
unifiedData.addRecord(video);
unifiedData.addRecord(audio);
unifiedData.addRecord(systemDefinedRecord);
unifiedData.addRecord(systemDefinedForm);
unifiedData.addRecord(systemDefinedAppItem);
...
...
@@ -466,12 +489,13 @@ export default function UDMFApiTest() {
let record6 = <unifiedDataChannel.Folder>(records[5]);
let record7 = <unifiedDataChannel.Image>(records[6]);
let record8 = <unifiedDataChannel.Video>(records[7]);
let record9 = <unifiedDataChannel.SystemDefinedRecord>(records[8]);
let record10 = <unifiedDataChannel.SystemDefinedForm>(records[9]);
let record11 = <unifiedDataChannel.SystemDefinedAppItem>(records[10]);
let record12 = <unifiedDataChannel.SystemDefinedPixelMap>(records[11]);
let record13 = <unifiedDataChannel.ApplicationDefinedRecord>(records[12]);
expect(records.length).assertEqual(13);
let record9 = <unifiedDataChannel.Audio>(records[8]);
let record10 = <unifiedDataChannel.SystemDefinedRecord>(records[9]);
let record11 = <unifiedDataChannel.SystemDefinedForm>(records[10]);
let record12 = <unifiedDataChannel.SystemDefinedAppItem>(records[11]);
let record13 = <unifiedDataChannel.SystemDefinedPixelMap>(records[12]);
let record14 = <unifiedDataChannel.ApplicationDefinedRecord>(records[13]);
expect(records.length).assertEqual(14);
expect(record1.getType()).assertEqual(uniformTypeDescriptor.UniformDataType.TEXT);
expect(record2.getType()).assertEqual(uniformTypeDescriptor.UniformDataType.PLAIN_TEXT);
expect(record3.getType()).assertEqual(uniformTypeDescriptor.UniformDataType.HYPERLINK);
...
...
@@ -480,32 +504,12 @@ export default function UDMFApiTest() {
expect(record6.getType()).assertEqual(uniformTypeDescriptor.UniformDataType.FOLDER);
expect(record7.getType()).assertEqual(uniformTypeDescriptor.UniformDataType.IMAGE);
expect(record8.getType()).assertEqual(uniformTypeDescriptor.UniformDataType.VIDEO);
expect(record10.getType()).assertEqual(uniformTypeDescriptor.UniformDataType.OPENHARMONY_FORM);
expect(record11.getType()).assertEqual(uniformTypeDescriptor.UniformDataType.OPENHARMONY_APP_ITEM);
expect(record12.getType()).assertEqual(uniformTypeDescriptor.UniformDataType.OPENHARMONY_PIXEL_MAP);
console.info("SUB_DistributedData_Udmf_API014 end");
expect(record9.getType()).assertEqual(uniformTypeDescriptor.UniformDataType.AUDIO);
expect(record11.getType()).assertEqual(uniformTypeDescriptor.UniformDataType.OPENHARMONY_FORM);
expect(record12.getType()).assertEqual(uniformTypeDescriptor.UniformDataType.OPENHARMONY_APP_ITEM);
expect(record13.getType()).assertEqual(uniformTypeDescriptor.UniformDataType.OPENHARMONY_PIXEL_MAP);
console.info("SUB_DistributedData_Udmf_API015 end");
done();
})
/**
* @tc.number SUB_DistributedData_Udmf_API015
* @tc.name CreateData
* @tc.desc Test unifiedDataChannel creating a unifieddata with a Audio record.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_DistributedData_Udmf_API015',0, function (done) {
console.info('SUB_DistributedData_Udmf_API008 start');
let unifiedData = new unifiedDataChannel.UnifiedData(Audio);
let records = unifiedData.getRecords();
let record = <unifiedDataChannel.Audio>(records[0]);
expect(records.length).assertEqual(1);
expect(record.details.title).assertEqual('标题');
expect(record.details.content).assertEqual('内容');
console.info("SUB_DistributedData_Udmf_API008 end");
done();
})
})
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录