Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
778db44e
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,发现更多精彩内容 >>
未验证
提交
778db44e
编写于
3月 19, 2022
作者:
O
openharmony_ci
提交者:
Gitee
3月 19, 2022
浏览文件
操作
浏览文件
下载
差异文件
!2663 add video/audio thumbnail
Merge pull request !2663 from 潘强标/master
上级
3f2056bb
e8ae7dfc
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
966 addition
and
914 deletion
+966
-914
multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/FileAssetGetThumbnailCallBack.test.js
...rd/src/main/js/test/FileAssetGetThumbnailCallBack.test.js
+509
-457
multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/FileAssetGetThumbnailPromise.test.js
...ard/src/main/js/test/FileAssetGetThumbnailPromise.test.js
+456
-456
multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/List.test.js
...ry/mediaLibrary_js_standard/src/main/js/test/List.test.js
+1
-1
未找到文件。
multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/FileAssetGetThumbnailCallBack.test.js
浏览文件 @
778db44e
...
...
@@ -336,475 +336,527 @@ describe('FileAssetGetThumbnailPromise.test.js', function () {
});
// ------------------------------image type end--------------------------
// // ------------------------------video type start -----------------------
// /**
// * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_01
// * @tc.name : getThumbnail
// * @tc.desc : getThumbnail(video) by { width: 128, height: 128 }
// * @tc.size : MEDIUM
// * @tc.type : Function
// * @tc.level : Level 0
// */
// it('SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_01', 0, async function (done) {
// try {
// const fetchFileResult = await media.getFileAssets(videoFetchOp);
// const dataList = await fetchFileResult.getAllObject();
// const asset = dataList[0];
// let size = { width: 128, height: 128 };
// const pixelmap = await asset.getThumbnail(size);
// const info = await pixelmap.getImageInfo();
// console.info('MediaLibraryTest : 002_01 pixel image info ' + info);
// console.info('MediaLibraryTest : 002_01 pixel width ' + info.size.width);
// console.info('MediaLibraryTest : 002_01 pixel height ' + info.size.height);
// if (info.size.width == size.width && info.size.height == size.height) {
// expect(true).assertTrue();
// console.info('MediaLibraryTest : getThumbnail 002_01 passed');
// done();
// } else {
// expect(false).assertTrue();
// console.info('MediaLibraryTest : getThumbnail 002_01 failed');
// done();
// }
// } catch (error) {
// console.info('MediaLibraryTest : getThumbnail 002_01 failed ' + error.message);
// expect(false).assertTrue();
// done();
// }
// });
// /**
// * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_02
// * @tc.name : getThumbnail
// * @tc.desc : getThumbnail(video) by { width: 128, height: 256 }
// * @tc.size : MEDIUM
// * @tc.type : Function
// * @tc.level : Level 0
// */
// it('SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_02', 0, async function (done) {
// try {
// const fetchFileResult = await media.getFileAssets(videoFetchOp);
// const dataList = await fetchFileResult.getAllObject();
// const asset = dataList[0];
// let size = { width: 128, height: 256 };
// const pixelmap = await asset.getThumbnail(size);
// const info = await pixelmap.getImageInfo();
// console.info('MediaLibraryTest : 002_02 pixel image info ' + info);
// console.info('MediaLibraryTest : 002_02 pixel width ' + info.size.width);
// console.info('MediaLibraryTest : 002_02 pixel height ' + info.size.height);
// if (info.size.width == size.width && info.size.height == size.height) {
// expect(true).assertTrue();
// console.info('MediaLibraryTest : getThumbnail 002_02 passed');
// done();
// } else {
// expect(false).assertTrue();
// console.info('MediaLibraryTest : getThumbnail 002_02 failed');
// done();
// }
// } catch (error) {
// console.info('MediaLibraryTest : getThumbnail 002_02 failed ' + error.message);
// expect(false).assertTrue();
// done();
// }
// });
// ------------------------------video type start -----------------------
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_01
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(video) by { width: 128, height: 128 }
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_01
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
videoFetchOp
);
const
dataList
=
await
fetchFileResult
.
getAllObject
();
const
asset
=
dataList
[
0
];
let
size
=
{
width
:
128
,
height
:
128
};
asset
.
getThumbnail
(
size
,
async
(
err
,
pixelmap
)
=>
{
const
info
=
await
pixelmap
.
getImageInfo
();
console
.
info
(
'
MediaLibraryTest : 002_01 pixel image info
'
+
info
);
console
.
info
(
'
MediaLibraryTest : 002_01 pixel width
'
+
info
.
size
.
width
);
console
.
info
(
'
MediaLibraryTest : 002_01 pixel height
'
+
info
.
size
.
height
);
if
(
info
.
size
.
width
==
size
.
width
&&
info
.
size
.
height
==
size
.
height
)
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_01 passed
'
);
done
();
}
else
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_01 failed
'
);
done
();
}
});
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_01 failed
'
+
error
.
message
);
expect
(
false
).
assertTrue
();
done
();
}
});
// /**
// * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_03
// * @tc.name : getThumbnail
// * @tc.desc : getThumbnail(video) by no arg
// * @tc.size : MEDIUM
// * @tc.type : Function
// * @tc.level : Level 0
// */
// it('SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_03', 0, async function (done) {
// try {
// const fetchFileResult = await media.getFileAssets(videoFetchOp);
// const dataList = await fetchFileResult.getAllObject();
// const asset = dataList[0];
// let size = { width: 256, height: 256 };
// const pixelmap = await asset.getThumbnail();
// console.info('MediaLibraryTest : getThumbnail 002_03 Successfull ' + pixelmap);
// const info = await pixelmap.getImageInfo();
// console.info('MediaLibraryTest : 002_03 pixel image info ' + info);
// console.info('MediaLibraryTest : 002_03 pixel width ' + info.size.width);
// console.info('MediaLibraryTest : 002_03 pixel height ' + info.size.height);
// if (info.size.width == size.width && info.size.height == size.height) {
// expect(true).assertTrue();
// console.info('MediaLibraryTest : getThumbnail 002_03 passed');
// done();
// } else {
// expect(false).assertTrue();
// console.info('MediaLibraryTest : getThumbnail 002_03 failed');
// done();
// }
// } catch (error) {
// console.info('MediaLibraryTest : getThumbnail 002_03 failed ' + error.message);
// expect(false).assertTrue();
// done();
// }
// });
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_02
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(video) by { width: 128, height: 256 }
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_02
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
videoFetchOp
);
const
dataList
=
await
fetchFileResult
.
getAllObject
();
const
asset
=
dataList
[
0
];
let
size
=
{
width
:
128
,
height
:
256
};
asset
.
getThumbnail
(
size
,
async
(
err
,
pixelmap
)
=>
{
const
info
=
await
pixelmap
.
getImageInfo
();
console
.
info
(
'
MediaLibraryTest : 002_02 pixel image info
'
+
info
);
console
.
info
(
'
MediaLibraryTest : 002_02 pixel width
'
+
info
.
size
.
width
);
console
.
info
(
'
MediaLibraryTest : 002_02 pixel height
'
+
info
.
size
.
height
);
if
(
info
.
size
.
width
==
size
.
width
&&
info
.
size
.
height
==
size
.
height
)
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_02 passed
'
);
done
();
}
else
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_02 failed
'
);
done
();
}
});
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_02 failed
'
+
error
.
message
);
expect
(
false
).
assertTrue
();
done
();
}
});
// /**
// * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_04
// * @tc.name : getThumbnail
// * @tc.desc : getThumbnail(video) by { width: 1, height: 1 }
// * @tc.size : MEDIUM
// * @tc.type : Function
// * @tc.level : Level 0
// */
// it('SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_04', 0, async function (done) {
// try {
// const fetchFileResult = await media.getFileAssets(videoFetchOp);
// const dataList = await fetchFileResult.getAllObject();
// const asset = dataList[0];
// let size = { width: 1, height: 1 };
// const pixelmap = await asset.getThumbnail(size);
// const info = await pixelmap.getImageInfo();
// console.info('MediaLibraryTest : 002_04 pixel image info ' + info);
// console.info('MediaLibraryTest : 002_04 pixel width ' + info.size.width);
// console.info('MediaLibraryTest : 002_04 pixel height ' + info.size.height);
// if (info.size.width == size.width && info.size.height == size.height) {
// expect(true).assertTrue();
// console.info('MediaLibraryTest : getThumbnail 001_05 passed');
// done();
// } else {
// expect(false).assertTrue();
// console.info('MediaLibraryTest : getThumbnail 001_05 failed');
// done();
// }
// } catch (error) {
// console.info('MediaLibraryTest : getThumbnail 002_04 failed ' + error.message);
// expect(false).assertTrue();
// done();
// }
// });
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_03
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(video) by no arg
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_03
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
videoFetchOp
);
const
dataList
=
await
fetchFileResult
.
getAllObject
();
const
asset
=
dataList
[
0
];
let
size
=
{
width
:
256
,
height
:
256
};
asset
.
getThumbnail
(
async
(
err
,
pixelmap
)
=>
{
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_03 Successfull
'
+
pixelmap
);
const
info
=
await
pixelmap
.
getImageInfo
();
console
.
info
(
'
MediaLibraryTest : 002_03 pixel image info
'
+
info
);
console
.
info
(
'
MediaLibraryTest : 002_03 pixel width
'
+
info
.
size
.
width
);
console
.
info
(
'
MediaLibraryTest : 002_03 pixel height
'
+
info
.
size
.
height
);
if
(
info
.
size
.
width
==
size
.
width
&&
info
.
size
.
height
==
size
.
height
)
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_03 passed
'
);
done
();
}
else
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_03 failed
'
);
done
();
}
});
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_03 failed
'
+
error
.
message
);
expect
(
false
).
assertTrue
();
done
();
}
});
// /**
// * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_05
// * @tc.name : getThumbnail
// * @tc.desc : getThumbnail(video) by { width: 0, height: 0 }
// * @tc.size : MEDIUM
// * @tc.type : Function
// * @tc.level : Level 0
// */
// it('SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_05', 0, async function (done) {
// try {
// const fetchFileResult = await media.getFileAssets(videoFetchOp);
// const dataList = await fetchFileResult.getAllObject();
// const asset = dataList[0];
// let size = { width: 0, height: 0 };
// const pixelmap = await asset.getThumbnail(size);
// const info = await pixelmap.getImageInfo();
// console.info('MediaLibraryTest : 002_05 pixel image info ' + info);
// console.info('MediaLibraryTest : 002_05 pixel width ' + info.size.width);
// console.info('MediaLibraryTest : 002_05 pixel height ' + info.size.height);
// console.info('MediaLibraryTest : getThumbnail 002_05 failed');
// expect(true).assertTrue();
// done();
// } catch (error) {
// console.info('MediaLibraryTest : getThumbnail 002_05 passed');
// expect(false).assertTrue();
// done();
// }
// });
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_04
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(video) by { width: 1, height: 1 }
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_04
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
videoFetchOp
);
const
dataList
=
await
fetchFileResult
.
getAllObject
();
const
asset
=
dataList
[
0
];
let
size
=
{
width
:
1
,
height
:
1
};
asset
.
getThumbnail
(
size
,
async
(
err
,
pixelmap
)
=>
{
const
info
=
await
pixelmap
.
getImageInfo
();
console
.
info
(
'
MediaLibraryTest : 002_04 pixel image info
'
+
info
);
console
.
info
(
'
MediaLibraryTest : 002_04 pixel width
'
+
info
.
size
.
width
);
console
.
info
(
'
MediaLibraryTest : 002_04 pixel height
'
+
info
.
size
.
height
);
if
(
info
.
size
.
width
==
size
.
width
&&
info
.
size
.
height
==
size
.
height
)
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 001_05 passed
'
);
done
();
}
else
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 001_05 failed
'
);
done
();
}
});
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_04 failed
'
+
error
.
message
);
expect
(
false
).
assertTrue
();
done
();
}
});
// /**
// * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_06
// * @tc.name : getThumbnail
// * @tc.desc : getThumbnail(video) by { width: -128, height: -128 }
// * @tc.size : MEDIUM
// * @tc.type : Function
// * @tc.level : Level 0
// */
// it('SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_06', 0, async function (done) {
// try {
// const fetchFileResult = await media.getFileAssets(videoFetchOp);
// const dataList = await fetchFileResult.getAllObject();
// const asset = dataList[0];
// let size = { width: -128, height: -128 };
// const pixelmap = await asset.getThumbnail(size);
// const info = await pixelmap.getImageInfo();
// console.info('MediaLibraryTest : 002_06 pixel image info ' + info);
// console.info('MediaLibraryTest : 002_06 pixel width ' + info.size.width);
// console.info('MediaLibraryTest : 002_06 pixel height ' + info.size.height);
// console.info('MediaLibraryTest : getThumbnail 003_01 failed');
// expect(true).assertTrue();
// done();
// } catch (error) {
// console.info('MediaLibraryTest : getThumbnail 002_06 passed');
// expect(false).assertTrue();
// done();
// }
// });
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_05
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(video) by { width: 0, height: 0 }
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_05
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
videoFetchOp
);
const
dataList
=
await
fetchFileResult
.
getAllObject
();
const
asset
=
dataList
[
0
];
let
size
=
{
width
:
0
,
height
:
0
};
asset
.
getThumbnail
(
size
,
async
(
err
,
pixelmap
)
=>
{
if
(
pixelmap
==
undefined
)
{
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_05 passed
'
);
expect
(
true
).
assertTrue
();
done
();
}
else
{
const
info
=
await
pixelmap
.
getImageInfo
();
console
.
info
(
'
MediaLibraryTest : 002_05 pixel image info
'
+
info
);
console
.
info
(
'
MediaLibraryTest : 002_05 pixel width
'
+
info
.
size
.
width
);
console
.
info
(
'
MediaLibraryTest : 002_05 pixel height
'
+
info
.
size
.
height
);
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_05 failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
});
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_05 failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
});
// /**
// * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_07
// * @tc.name : getThumbnail
// * @tc.desc : getThumbnail(audio) by { width: 1024, height: 1024 }
// * @tc.size : MEDIUM
// * @tc.type : Function
// * @tc.level : Level 0
// */
// it('SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_07', 0, async function (done) {
// try {
// const fetchFileResult = await media.getFileAssets(videoFetchOp);
// const dataList = await fetchFileResult.getAllObject();
// const asset = dataList[0];
// let size = { width: 1024, height: 1024 };
// const pixelmap = await asset.getThumbnail(size);
// const info = await pixelmap.getImageInfo();
// console.info('MediaLibraryTest : 003_06 pixel image info ' + info);
// console.info('MediaLibraryTest : 003_06 pixel width ' + info.size.width);
// console.info('MediaLibraryTest : 003_06 pixel height ' + info.size.height);
// if (info.size.width == size.width && info.size.height == size.height) {
// expect(true).assertTrue();
// console.info('MediaLibraryTest : getThumbnail 002_07 passed');
// done();
// } else {
// expect(false).assertTrue();
// console.info('MediaLibraryTest : getThumbnail 002_07 failed');
// done();
// }
// } catch (error) {
// console.info('MediaLibraryTest : getThumbnail 002_07 failed ' + error.message);
// expect(false).assertTrue();
// done();
// }
// });
// // ------------------------------video type end--------------------------
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_06
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(video) by { width: -128, height: -128 }
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_06
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
videoFetchOp
);
const
dataList
=
await
fetchFileResult
.
getAllObject
();
const
asset
=
dataList
[
0
];
let
size
=
{
width
:
-
128
,
height
:
-
128
};
const
pixelmap
=
await
asset
.
getThumbnail
(
size
,
async
(
err
,
pixelmap
)
=>
{
if
(
pixelmap
==
undefined
)
{
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_06 passed
'
);
expect
(
true
).
assertTrue
();
done
();
}
else
{
const
info
=
await
pixelmap
.
getImageInfo
();
console
.
info
(
'
MediaLibraryTest : 002_06 pixel image info
'
+
info
);
console
.
info
(
'
MediaLibraryTest : 002_06 pixel width
'
+
info
.
size
.
width
);
console
.
info
(
'
MediaLibraryTest : 002_06 pixel height
'
+
info
.
size
.
height
);
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_01 failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
});
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_06 failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
});
// // ------------------------------audio type start -----------------------
// /**
// * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_01
// * @tc.name : getThumbnail
// * @tc.desc : getThumbnail(audio) by { width: 128, height: 128 }
// * @tc.size : MEDIUM
// * @tc.type : Function
// * @tc.level : Level 0
// */
// it('SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_01', 0, async function (done) {
// try {
// const fetchFileResult = await media.getFileAssets(audioFetchOp);
// const dataList = await fetchFileResult.getAllObject();
// const asset = dataList[0];
// let size = { width: 128, height: 128 };
// const pixelmap = await asset.getThumbnail(size);
// const info = await pixelmap.getImageInfo();
// console.info('MediaLibraryTest : 003_01 pixel image info ' + info);
// console.info('MediaLibraryTest : 003_01 pixel width ' + info.size.width);
// console.info('MediaLibraryTest : 003_01 pixel height ' + info.size.height);
// if (info.size.width == size.width && info.size.height == size.height) {
// expect(true).assertTrue();
// console.info('MediaLibraryTest : getThumbnail 003_01 passed');
// done();
// } else {
// expect(false).assertTrue();
// console.info('MediaLibraryTest : getThumbnail 003_01 failed');
// done();
// }
// } catch (error) {
// console.info('MediaLibraryTest : getThumbnail 003_01 failed ' + error.message);
// expect(false).assertTrue();
// done();
// }
// });
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_07
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(audio) by { width: 1024, height: 1024 }
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_07
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
videoFetchOp
);
const
dataList
=
await
fetchFileResult
.
getAllObject
();
const
asset
=
dataList
[
0
];
let
size
=
{
width
:
1024
,
height
:
1024
};
asset
.
getThumbnail
(
size
,
async
(
err
,
pixelmap
)
=>
{
const
info
=
await
pixelmap
.
getImageInfo
();
console
.
info
(
'
MediaLibraryTest : 003_06 pixel image info
'
+
info
);
console
.
info
(
'
MediaLibraryTest : 003_06 pixel width
'
+
info
.
size
.
width
);
console
.
info
(
'
MediaLibraryTest : 003_06 pixel height
'
+
info
.
size
.
height
);
if
(
info
.
size
.
width
==
size
.
width
&&
info
.
size
.
height
==
size
.
height
)
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_07 passed
'
);
done
();
}
else
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_07 failed
'
);
done
();
}
});
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_07 failed
'
+
error
.
message
);
expect
(
false
).
assertTrue
();
done
();
}
});
// ------------------------------video type end--------------------------
// /**
// * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_02
// * @tc.name : getThumbnail
// * @tc.desc : getThumbnail(audio) by { width: 128, height: 256 }
// * @tc.size : MEDIUM
// * @tc.type : Function
// * @tc.level : Level 0
// */
// it('SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_02', 0, async function (done) {
// try {
// const fetchFileResult = await media.getFileAssets(audioFetchOp);
// const dataList = await fetchFileResult.getAllObject();
// const asset = dataList[0];
// let size = { width: 128, height: 256 };
// const pixelmap = await asset.getThumbnail(size);
// const info = await pixelmap.getImageInfo();
// console.info('MediaLibraryTest : 003_02 pixel image info ' + info);
// console.info('MediaLibraryTest : 003_02 pixel width ' + info.size.width);
// console.info('MediaLibraryTest : 003_02 pixel height ' + info.size.height);
// if (info.size.width == size.width && info.size.height == size.height) {
// expect(true).assertTrue();
// console.info('MediaLibraryTest : getThumbnail 003_02 passed');
// done();
// } else {
// expect(false).assertTrue();
// console.info('MediaLibraryTest : getThumbnail 003_02 failed');
// done();
// }
// } catch (error) {
// console.info('MediaLibraryTest : getThumbnail 003_02 failed ' + error.message);
// expect(false).assertTrue();
// done();
// }
// });
// ------------------------------audio type start -----------------------
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_01
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(audio) by { width: 128, height: 128 }
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_01
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
audioFetchOp
);
const
dataList
=
await
fetchFileResult
.
getAllObject
();
const
asset
=
dataList
[
0
];
let
size
=
{
width
:
128
,
height
:
128
};
asset
.
getThumbnail
(
size
,
async
(
err
,
pixelmap
)
=>
{
const
info
=
await
pixelmap
.
getImageInfo
();
console
.
info
(
'
MediaLibraryTest : 003_01 pixel image info
'
+
info
);
console
.
info
(
'
MediaLibraryTest : 003_01 pixel width
'
+
info
.
size
.
width
);
console
.
info
(
'
MediaLibraryTest : 003_01 pixel height
'
+
info
.
size
.
height
);
if
(
info
.
size
.
width
==
size
.
width
&&
info
.
size
.
height
==
size
.
height
)
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_01 passed
'
);
done
();
}
else
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_01 failed
'
);
done
();
}
});
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_01 failed
'
+
error
.
message
);
expect
(
false
).
assertTrue
();
done
();
}
});
// /**
// * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_03
// * @tc.name : getThumbnail
// * @tc.desc : getThumbnail(audio) by no arg
// * @tc.size : MEDIUM
// * @tc.type : Function
// * @tc.level : Level 0
// */
// it('SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_03', 0, async function (done) {
// try {
// const fetchFileResult = await media.getFileAssets(audioFetchOp);
// const dataList = await fetchFileResult.getAllObject();
// const asset = dataList[0];
// let size = { width: 256, height: 256 };
// const pixelmap = await asset.getThumbnail();
// const info = await pixelmap.getImageInfo();
// console.info('MediaLibraryTest : 003_03 pixel image info ' + info);
// console.info('MediaLibraryTest : 003_03 pixel width ' + info.size.width);
// console.info('MediaLibraryTest : 003_03 pixel height ' + info.size.height);
// if (info.size.width == size.width && info.size.height == size.height) {
// expect(true).assertTrue();
// console.info('MediaLibraryTest : getThumbnail 003_03 passed');
// done();
// } else {
// expect(false).assertTrue();
// console.info('MediaLibraryTest : getThumbnail 003_03 failed');
// done();
// }
// } catch (error) {
// console.info('MediaLibraryTest : getThumbnail 003_03 failed ' + error.message);
// expect(false).assertTrue();
// done();
// }
// });
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_02
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(audio) by { width: 128, height: 256 }
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_02
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
audioFetchOp
);
const
dataList
=
await
fetchFileResult
.
getAllObject
();
const
asset
=
dataList
[
0
];
let
size
=
{
width
:
128
,
height
:
256
};
asset
.
getThumbnail
(
size
,
async
(
err
,
pixelmap
)
=>
{
const
info
=
await
pixelmap
.
getImageInfo
();
console
.
info
(
'
MediaLibraryTest : 003_02 pixel image info
'
+
info
);
console
.
info
(
'
MediaLibraryTest : 003_02 pixel width
'
+
info
.
size
.
width
);
console
.
info
(
'
MediaLibraryTest : 003_02 pixel height
'
+
info
.
size
.
height
);
if
(
info
.
size
.
width
==
size
.
width
&&
info
.
size
.
height
==
size
.
height
)
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_02 passed
'
);
done
();
}
else
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_02 failed
'
);
done
();
}
});
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_02 failed
'
+
error
.
message
);
expect
(
false
).
assertTrue
();
done
();
}
});
// /**
// * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_04
// * @tc.name : getThumbnail
// * @tc.desc : getThumbnail(audio) by { width: 1, height: 1 }
// * @tc.size : MEDIUM
// * @tc.type : Function
// * @tc.level : Level 0
// */
// it('SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_04', 0, async function (done) {
// try {
// const fetchFileResult = await media.getFileAssets(audioFetchOp);
// const dataList = await fetchFileResult.getAllObject();
// const asset = dataList[0];
// let size = { width: 1, height: 1 };
// const pixelmap = await asset.getThumbnail(size);
// const info = await pixelmap.getImageInfo();
// console.info('MediaLibraryTest : 003_04 pixel image info ' + info);
// console.info('MediaLibraryTest : 003_04 pixel width ' + info.size.width);
// console.info('MediaLibraryTest : 003_04 pixel height ' + info.size.height);
// if (info.size.width == size.width && info.size.height == size.height) {
// expect(true).assertTrue();
// console.info('MediaLibraryTest : getThumbnail 003_04 passed');
// done();
// } else {
// expect(false).assertTrue();
// console.info('MediaLibraryTest : getThumbnail 003_04 failed');
// done();
// }
// } catch (error) {
// console.info('MediaLibraryTest : getThumbnail 003_04 failed ' + error.message);
// expect(false).assertTrue();
// done();
// }
// });
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_03
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(audio) by no arg
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_03
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
audioFetchOp
);
const
dataList
=
await
fetchFileResult
.
getAllObject
();
const
asset
=
dataList
[
0
];
let
size
=
{
width
:
256
,
height
:
256
};
asset
.
getThumbnail
(
async
(
err
,
pixelmap
)
=>
{
const
info
=
await
pixelmap
.
getImageInfo
();
console
.
info
(
'
MediaLibraryTest : 003_03 pixel image info
'
+
info
);
console
.
info
(
'
MediaLibraryTest : 003_03 pixel width
'
+
info
.
size
.
width
);
console
.
info
(
'
MediaLibraryTest : 003_03 pixel height
'
+
info
.
size
.
height
);
if
(
info
.
size
.
width
==
size
.
width
&&
info
.
size
.
height
==
size
.
height
)
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_03 passed
'
);
done
();
}
else
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_03 failed
'
);
done
();
}
});
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_03 failed
'
+
error
.
message
);
expect
(
false
).
assertTrue
();
done
();
}
});
// /**
// * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_05
// * @tc.name : getThumbnail
// * @tc.desc : getThumbnail(audio) by { width: 0, height: 0 }
// * @tc.size : MEDIUM
// * @tc.type : Function
// * @tc.level : Level 0
// */
// it('SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_05', 0, async function (done) {
// try {
// const fetchFileResult = await media.getFileAssets(audioFetchOp);
// const dataList = await fetchFileResult.getAllObject();
// const asset = dataList[0];
// let size = { width: 0, height: 0 };
// const pixelmap = await asset.getThumbnail(size);
// const info = await pixelmap.getImageInfo();
// console.info('MediaLibraryTest : getThumbnail 003_06 failed');
// console.info('MediaLibraryTest : 003_05 pixel image info ' + info);
// console.info('MediaLibraryTest : 003_05 pixel width ' + info.size.width);
// console.info('MediaLibraryTest : 003_05 pixel height ' + info.size.height);
// expect(true).assertTrue();
// done();
// } catch (error) {
// console.info('MediaLibraryTest : getThumbnail 003_05 passed');
// expect(false).assertTrue();
// done();
// }
// });
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_04
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(audio) by { width: 1, height: 1 }
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_04
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
audioFetchOp
);
const
dataList
=
await
fetchFileResult
.
getAllObject
();
const
asset
=
dataList
[
0
];
let
size
=
{
width
:
1
,
height
:
1
};
asset
.
getThumbnail
(
size
,
async
(
err
,
pixelmap
)
=>
{
const
info
=
await
pixelmap
.
getImageInfo
();
console
.
info
(
'
MediaLibraryTest : 003_04 pixel image info
'
+
info
);
console
.
info
(
'
MediaLibraryTest : 003_04 pixel width
'
+
info
.
size
.
width
);
console
.
info
(
'
MediaLibraryTest : 003_04 pixel height
'
+
info
.
size
.
height
);
if
(
info
.
size
.
width
==
size
.
width
&&
info
.
size
.
height
==
size
.
height
)
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_04 passed
'
);
done
();
}
else
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_04 failed
'
);
done
();
}
});
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_04 failed
'
+
error
.
message
);
expect
(
false
).
assertTrue
();
done
();
}
});
// /**
// * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_06
// * @tc.name : getThumbnail
// * @tc.desc : getThumbnail(audio) by { width: -128, height: -128 }
// * @tc.size : MEDIUM
// * @tc.type : Function
// * @tc.level : Level 0
// */
// it('SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_06', 0, async function (done) {
// try {
// const fetchFileResult = await media.getFileAssets(audioFetchOp);
// const dataList = await fetchFileResult.getAllObject();
// const asset = dataList[0];
// let size = { width: -128, height: -128 };
// const pixelmap = await asset.getThumbnail(size);
// const info = await pixelmap.getImageInfo();
// console.info('MediaLibraryTest : 003_06 pixel image info ' + info);
// console.info('MediaLibraryTest : 003_06 pixel width ' + info.size.width);
// console.info('MediaLibraryTest : 003_06 pixel height ' + info.size.height);
// console.info('MediaLibraryTest : getThumbnail 003_06 failed');
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_05
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(audio) by { width: 0, height: 0 }
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_05
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
audioFetchOp
);
const
dataList
=
await
fetchFileResult
.
getAllObject
();
const
asset
=
dataList
[
0
];
let
size
=
{
width
:
0
,
height
:
0
};
asset
.
getThumbnail
(
size
,
async
(
err
,
pixelmap
)
=>
{
if
(
pixelmap
==
undefined
)
{
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_05 passed
'
);
expect
(
true
).
assertTrue
();
done
();
}
else
{
const
info
=
await
pixelmap
.
getImageInfo
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_06 failed
'
);
console
.
info
(
'
MediaLibraryTest : 003_05 pixel image info
'
+
info
);
console
.
info
(
'
MediaLibraryTest : 003_05 pixel width
'
+
info
.
size
.
width
);
console
.
info
(
'
MediaLibraryTest : 003_05 pixel height
'
+
info
.
size
.
height
);
expect
(
false
).
assertTrue
();
done
();
}
});
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_05 failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
});
// expect(true).assertTrue();
// done();
// } catch (error) {
// console.info('MediaLibraryTest : getThumbnail 003_06 passed');
// expect(false).assertTrue();
// done();
// }
// });
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_06
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(audio) by { width: -128, height: -128 }
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_06
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
audioFetchOp
);
const
dataList
=
await
fetchFileResult
.
getAllObject
();
const
asset
=
dataList
[
0
];
let
size
=
{
width
:
-
128
,
height
:
-
128
};
asset
.
getThumbnail
(
size
,
async
(
err
,
pixelmap
)
=>
{
if
(
pixelmap
==
undefined
)
{
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_06 passed
'
);
expect
(
true
).
assertTrue
();
done
();
}
else
{
const
info
=
await
pixelmap
.
getImageInfo
();
console
.
info
(
'
MediaLibraryTest : 003_06 pixel image info
'
+
info
);
console
.
info
(
'
MediaLibraryTest : 003_06 pixel width
'
+
info
.
size
.
width
);
console
.
info
(
'
MediaLibraryTest : 003_06 pixel height
'
+
info
.
size
.
height
);
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_06 failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
});
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_06 failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
});
// /**
// * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_07
// * @tc.name : getThumbnail
// * @tc.desc : getThumbnail(audio) by { width: 1024, height: 1024 }
// * @tc.size : MEDIUM
// * @tc.type : Function
// * @tc.level : Level 0
// */
// it('SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_07', 0, async function (done) {
// try {
// const fetchFileResult = await media.getFileAssets(audioFetchOp);
// const dataList = await fetchFileResult.getAllObject();
// const asset = dataList[0];
// let size = { width: 1024, height: 1024 };
// const pixelmap = await asset.getThumbnail(size);
// const info = await pixelmap.getImageInfo();
// console.info('MediaLibraryTest : 003_06 pixel image info ' + info);
// console.info('MediaLibraryTest : 003_06 pixel width ' + info.size.width);
// console.info('MediaLibraryTest : 003_06 pixel height ' + info.size.height);
// if (info.size.width == size.width && info.size.height == size.height) {
// expect(true).assertTrue();
// console.info('MediaLibraryTest : getThumbnail 003_07 passed');
// done();
// } else {
// expect(false).assertTrue();
// console.info('MediaLibraryTest : getThumbnail 003_07 failed');
// done();
// }
// } catch (error) {
// console.info('MediaLibraryTest : getThumbnail 003_07 failed ' + error.message);
// expect(false).assertTrue();
// done();
// }
// });
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_07
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(audio) by { width: 1024, height: 1024 }
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_07
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
audioFetchOp
);
const
dataList
=
await
fetchFileResult
.
getAllObject
();
const
asset
=
dataList
[
0
];
let
size
=
{
width
:
1024
,
height
:
1024
};
asset
.
getThumbnail
(
size
,
async
(
err
,
pixelmap
)
=>
{
const
info
=
await
pixelmap
.
getImageInfo
();
console
.
info
(
'
MediaLibraryTest : 003_06 pixel image info
'
+
info
);
console
.
info
(
'
MediaLibraryTest : 003_06 pixel width
'
+
info
.
size
.
width
);
console
.
info
(
'
MediaLibraryTest : 003_06 pixel height
'
+
info
.
size
.
height
);
if
(
info
.
size
.
width
==
size
.
width
&&
info
.
size
.
height
==
size
.
height
)
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_07 passed
'
);
done
();
}
else
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_07 failed
'
);
done
();
}
});
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_07 failed
'
+
error
.
message
);
expect
(
false
).
assertTrue
();
done
();
}
});
// ------------------------------audio type end--------------------------
});
multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/FileAssetGetThumbnailPromise.test.js
浏览文件 @
778db44e
...
...
@@ -285,475 +285,475 @@ describe('FileAssetGetThumbnailPromise.test.js', function () {
});
// ------------------------------image type end--------------------------
//
//
------------------------------video type start -----------------------
/
/ /
**
//
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_01
//
* @tc.name : getThumbnail
//
* @tc.desc : getThumbnail(video) by { width: 128, height: 128 }
//
* @tc.size : MEDIUM
//
* @tc.type : Function
//
* @tc.level : Level 0
//
*/
//
it('SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_01', 0, async function (done) {
//
try {
//
const fetchFileResult = await media.getFileAssets(videoFetchOp);
//
const dataList = await fetchFileResult.getAllObject();
//
const asset = dataList[0];
//
let size = { width: 128, height: 128 };
//
const pixelmap = await asset.getThumbnail(size);
//
const info = await pixelmap.getImageInfo();
//
console.info('MediaLibraryTest : 002_01 pixel image info ' + info);
//
console.info('MediaLibraryTest : 002_01 pixel width ' + info.size.width);
//
console.info('MediaLibraryTest : 002_01 pixel height ' + info.size.height);
//
if (info.size.width == size.width && info.size.height == size.height) {
//
expect(true).assertTrue();
//
console.info('MediaLibraryTest : getThumbnail 002_01 passed');
//
done();
//
} else {
//
expect(false).assertTrue();
//
console.info('MediaLibraryTest : getThumbnail 002_01 failed');
//
done();
//
}
//
} catch (error) {
//
console.info('MediaLibraryTest : getThumbnail 002_01 failed ' + error.message);
//
expect(false).assertTrue();
//
done();
//
}
//
});
// ------------------------------video type start -----------------------
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_01
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(video) by { width: 128, height: 128 }
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_01
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
videoFetchOp
);
const
dataList
=
await
fetchFileResult
.
getAllObject
();
const
asset
=
dataList
[
0
];
let
size
=
{
width
:
128
,
height
:
128
};
const
pixelmap
=
await
asset
.
getThumbnail
(
size
);
const
info
=
await
pixelmap
.
getImageInfo
();
console
.
info
(
'
MediaLibraryTest : 002_01 pixel image info
'
+
info
);
console
.
info
(
'
MediaLibraryTest : 002_01 pixel width
'
+
info
.
size
.
width
);
console
.
info
(
'
MediaLibraryTest : 002_01 pixel height
'
+
info
.
size
.
height
);
if
(
info
.
size
.
width
==
size
.
width
&&
info
.
size
.
height
==
size
.
height
)
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_01 passed
'
);
done
();
}
else
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_01 failed
'
);
done
();
}
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_01 failed
'
+
error
.
message
);
expect
(
false
).
assertTrue
();
done
();
}
});
/
/ /
**
//
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_02
//
* @tc.name : getThumbnail
//
* @tc.desc : getThumbnail(video) by { width: 128, height: 256 }
//
* @tc.size : MEDIUM
//
* @tc.type : Function
//
* @tc.level : Level 0
//
*/
//
it('SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_02', 0, async function (done) {
//
try {
//
const fetchFileResult = await media.getFileAssets(videoFetchOp);
//
const dataList = await fetchFileResult.getAllObject();
//
const asset = dataList[0];
//
let size = { width: 128, height: 256 };
//
const pixelmap = await asset.getThumbnail(size);
//
const info = await pixelmap.getImageInfo();
//
console.info('MediaLibraryTest : 002_02 pixel image info ' + info);
//
console.info('MediaLibraryTest : 002_02 pixel width ' + info.size.width);
//
console.info('MediaLibraryTest : 002_02 pixel height ' + info.size.height);
//
if (info.size.width == size.width && info.size.height == size.height) {
//
expect(true).assertTrue();
//
console.info('MediaLibraryTest : getThumbnail 002_02 passed');
//
done();
//
} else {
//
expect(false).assertTrue();
//
console.info('MediaLibraryTest : getThumbnail 002_02 failed');
//
done();
//
}
//
} catch (error) {
//
console.info('MediaLibraryTest : getThumbnail 002_02 failed ' + error.message);
//
expect(false).assertTrue();
//
done();
//
}
//
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_02
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(video) by { width: 128, height: 256 }
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_02
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
videoFetchOp
);
const
dataList
=
await
fetchFileResult
.
getAllObject
();
const
asset
=
dataList
[
0
];
let
size
=
{
width
:
128
,
height
:
256
};
const
pixelmap
=
await
asset
.
getThumbnail
(
size
);
const
info
=
await
pixelmap
.
getImageInfo
();
console
.
info
(
'
MediaLibraryTest : 002_02 pixel image info
'
+
info
);
console
.
info
(
'
MediaLibraryTest : 002_02 pixel width
'
+
info
.
size
.
width
);
console
.
info
(
'
MediaLibraryTest : 002_02 pixel height
'
+
info
.
size
.
height
);
if
(
info
.
size
.
width
==
size
.
width
&&
info
.
size
.
height
==
size
.
height
)
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_02 passed
'
);
done
();
}
else
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_02 failed
'
);
done
();
}
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_02 failed
'
+
error
.
message
);
expect
(
false
).
assertTrue
();
done
();
}
});
/
/ /
**
//
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_03
//
* @tc.name : getThumbnail
//
* @tc.desc : getThumbnail(video) by no arg
//
* @tc.size : MEDIUM
//
* @tc.type : Function
//
* @tc.level : Level 0
//
*/
//
it('SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_03', 0, async function (done) {
//
try {
//
const fetchFileResult = await media.getFileAssets(videoFetchOp);
//
const dataList = await fetchFileResult.getAllObject();
//
const asset = dataList[0];
//
let size = { width: 256, height: 256 };
//
const pixelmap = await asset.getThumbnail();
//
console.info('MediaLibraryTest : getThumbnail 002_03 Successfull ' + pixelmap);
//
const info = await pixelmap.getImageInfo();
//
console.info('MediaLibraryTest : 002_03 pixel image info ' + info);
//
console.info('MediaLibraryTest : 002_03 pixel width ' + info.size.width);
//
console.info('MediaLibraryTest : 002_03 pixel height ' + info.size.height);
//
if (info.size.width == size.width && info.size.height == size.height) {
//
expect(true).assertTrue();
//
console.info('MediaLibraryTest : getThumbnail 002_03 passed');
//
done();
//
} else {
//
expect(false).assertTrue();
//
console.info('MediaLibraryTest : getThumbnail 002_03 failed');
//
done();
//
}
//
} catch (error) {
//
console.info('MediaLibraryTest : getThumbnail 002_03 failed ' + error.message);
//
expect(false).assertTrue();
//
done();
//
}
//
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_03
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(video) by no arg
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_03
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
videoFetchOp
);
const
dataList
=
await
fetchFileResult
.
getAllObject
();
const
asset
=
dataList
[
0
];
let
size
=
{
width
:
256
,
height
:
256
};
const
pixelmap
=
await
asset
.
getThumbnail
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_03 Successfull
'
+
pixelmap
);
const
info
=
await
pixelmap
.
getImageInfo
();
console
.
info
(
'
MediaLibraryTest : 002_03 pixel image info
'
+
info
);
console
.
info
(
'
MediaLibraryTest : 002_03 pixel width
'
+
info
.
size
.
width
);
console
.
info
(
'
MediaLibraryTest : 002_03 pixel height
'
+
info
.
size
.
height
);
if
(
info
.
size
.
width
==
size
.
width
&&
info
.
size
.
height
==
size
.
height
)
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_03 passed
'
);
done
();
}
else
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_03 failed
'
);
done
();
}
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_03 failed
'
+
error
.
message
);
expect
(
false
).
assertTrue
();
done
();
}
});
/
/ /
**
//
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_04
//
* @tc.name : getThumbnail
//
* @tc.desc : getThumbnail(video) by { width: 1, height: 1 }
//
* @tc.size : MEDIUM
//
* @tc.type : Function
//
* @tc.level : Level 0
//
*/
//
it('SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_04', 0, async function (done) {
//
try {
//
const fetchFileResult = await media.getFileAssets(videoFetchOp);
//
const dataList = await fetchFileResult.getAllObject();
//
const asset = dataList[0];
//
let size = { width: 1, height: 1 };
//
const pixelmap = await asset.getThumbnail(size);
//
const info = await pixelmap.getImageInfo();
//
console.info('MediaLibraryTest : 002_04 pixel image info ' + info);
//
console.info('MediaLibraryTest : 002_04 pixel width ' + info.size.width);
//
console.info('MediaLibraryTest : 002_04 pixel height ' + info.size.height);
//
if (info.size.width == size.width && info.size.height == size.height) {
//
expect(true).assertTrue();
//
console.info('MediaLibraryTest : getThumbnail 001_05 passed');
//
done();
//
} else {
//
expect(false).assertTrue();
//
console.info('MediaLibraryTest : getThumbnail 001_05 failed');
//
done();
//
}
//
} catch (error) {
//
console.info('MediaLibraryTest : getThumbnail 002_04 failed ' + error.message);
//
expect(false).assertTrue();
//
done();
//
}
//
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_04
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(video) by { width: 1, height: 1 }
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_04
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
videoFetchOp
);
const
dataList
=
await
fetchFileResult
.
getAllObject
();
const
asset
=
dataList
[
0
];
let
size
=
{
width
:
1
,
height
:
1
};
const
pixelmap
=
await
asset
.
getThumbnail
(
size
);
const
info
=
await
pixelmap
.
getImageInfo
();
console
.
info
(
'
MediaLibraryTest : 002_04 pixel image info
'
+
info
);
console
.
info
(
'
MediaLibraryTest : 002_04 pixel width
'
+
info
.
size
.
width
);
console
.
info
(
'
MediaLibraryTest : 002_04 pixel height
'
+
info
.
size
.
height
);
if
(
info
.
size
.
width
==
size
.
width
&&
info
.
size
.
height
==
size
.
height
)
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 001_05 passed
'
);
done
();
}
else
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 001_05 failed
'
);
done
();
}
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_04 failed
'
+
error
.
message
);
expect
(
false
).
assertTrue
();
done
();
}
});
/
/ /
**
//
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_05
//
* @tc.name : getThumbnail
//
* @tc.desc : getThumbnail(video) by { width: 0, height: 0 }
//
* @tc.size : MEDIUM
//
* @tc.type : Function
//
* @tc.level : Level 0
//
*/
//
it('SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_05', 0, async function (done) {
//
try {
//
const fetchFileResult = await media.getFileAssets(videoFetchOp);
//
const dataList = await fetchFileResult.getAllObject();
//
const asset = dataList[0];
//
let size = { width: 0, height: 0 };
//
const pixelmap = await asset.getThumbnail(size);
//
const info = await pixelmap.getImageInfo();
//
console.info('MediaLibraryTest : 002_05 pixel image info ' + info);
//
console.info('MediaLibraryTest : 002_05 pixel width ' + info.size.width);
//
console.info('MediaLibraryTest : 002_05 pixel height ' + info.size.height);
//
console.info('MediaLibraryTest : getThumbnail 002_05 failed');
// expect(tru
e).assertTrue();
//
done();
//
} catch (error) {
//
console.info('MediaLibraryTest : getThumbnail 002_05 passed');
// expect(fals
e).assertTrue();
//
done();
//
}
//
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_05
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(video) by { width: 0, height: 0 }
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_05
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
videoFetchOp
);
const
dataList
=
await
fetchFileResult
.
getAllObject
();
const
asset
=
dataList
[
0
];
let
size
=
{
width
:
0
,
height
:
0
};
const
pixelmap
=
await
asset
.
getThumbnail
(
size
);
const
info
=
await
pixelmap
.
getImageInfo
();
console
.
info
(
'
MediaLibraryTest : 002_05 pixel image info
'
+
info
);
console
.
info
(
'
MediaLibraryTest : 002_05 pixel width
'
+
info
.
size
.
width
);
console
.
info
(
'
MediaLibraryTest : 002_05 pixel height
'
+
info
.
size
.
height
);
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_05 failed
'
);
expect
(
fals
e
).
assertTrue
();
done
();
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_05 passed
'
);
expect
(
tru
e
).
assertTrue
();
done
();
}
});
/
/ /
**
//
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_06
//
* @tc.name : getThumbnail
//
* @tc.desc : getThumbnail(video) by { width: -128, height: -128 }
//
* @tc.size : MEDIUM
//
* @tc.type : Function
//
* @tc.level : Level 0
//
*/
//
it('SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_06', 0, async function (done) {
//
try {
//
const fetchFileResult = await media.getFileAssets(videoFetchOp);
//
const dataList = await fetchFileResult.getAllObject();
//
const asset = dataList[0];
//
let size = { width: -128, height: -128 };
//
const pixelmap = await asset.getThumbnail(size);
//
const info = await pixelmap.getImageInfo();
//
console.info('MediaLibraryTest : 002_06 pixel image info ' + info);
//
console.info('MediaLibraryTest : 002_06 pixel width ' + info.size.width);
//
console.info('MediaLibraryTest : 002_06 pixel height ' + info.size.height);
//
console.info('MediaLibraryTest : getThumbnail 003_01 failed');
// expect(tru
e).assertTrue();
//
done();
//
} catch (error) {
//
console.info('MediaLibraryTest : getThumbnail 002_06 passed');
// expect(fals
e).assertTrue();
//
done();
//
}
//
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_06
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(video) by { width: -128, height: -128 }
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_06
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
videoFetchOp
);
const
dataList
=
await
fetchFileResult
.
getAllObject
();
const
asset
=
dataList
[
0
];
let
size
=
{
width
:
-
128
,
height
:
-
128
};
const
pixelmap
=
await
asset
.
getThumbnail
(
size
);
const
info
=
await
pixelmap
.
getImageInfo
();
console
.
info
(
'
MediaLibraryTest : 002_06 pixel image info
'
+
info
);
console
.
info
(
'
MediaLibraryTest : 002_06 pixel width
'
+
info
.
size
.
width
);
console
.
info
(
'
MediaLibraryTest : 002_06 pixel height
'
+
info
.
size
.
height
);
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_01 failed
'
);
expect
(
fals
e
).
assertTrue
();
done
();
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_06 passed
'
);
expect
(
tru
e
).
assertTrue
();
done
();
}
});
/
/ /
**
//
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_07
//
* @tc.name : getThumbnail
//
* @tc.desc : getThumbnail(audio) by { width: 1024, height: 1024 }
//
* @tc.size : MEDIUM
//
* @tc.type : Function
//
* @tc.level : Level 0
//
*/
//
it('SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_07', 0, async function (done) {
//
try {
//
const fetchFileResult = await media.getFileAssets(videoFetchOp);
//
const dataList = await fetchFileResult.getAllObject();
//
const asset = dataList[0];
//
let size = { width: 1024, height: 1024 };
//
const pixelmap = await asset.getThumbnail(size);
//
const info = await pixelmap.getImageInfo();
//
console.info('MediaLibraryTest : 003_06 pixel image info ' + info);
//
console.info('MediaLibraryTest : 003_06 pixel width ' + info.size.width);
//
console.info('MediaLibraryTest : 003_06 pixel height ' + info.size.height);
//
if (info.size.width == size.width && info.size.height == size.height) {
//
expect(true).assertTrue();
//
console.info('MediaLibraryTest : getThumbnail 002_07 passed');
//
done();
//
} else {
//
expect(false).assertTrue();
//
console.info('MediaLibraryTest : getThumbnail 002_07 failed');
//
done();
//
}
//
} catch (error) {
//
console.info('MediaLibraryTest : getThumbnail 002_07 failed ' + error.message);
//
expect(false).assertTrue();
//
done();
//
}
//
});
//
//
------------------------------video type end--------------------------
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_07
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(audio) by { width: 1024, height: 1024 }
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_07
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
videoFetchOp
);
const
dataList
=
await
fetchFileResult
.
getAllObject
();
const
asset
=
dataList
[
0
];
let
size
=
{
width
:
1024
,
height
:
1024
};
const
pixelmap
=
await
asset
.
getThumbnail
(
size
);
const
info
=
await
pixelmap
.
getImageInfo
();
console
.
info
(
'
MediaLibraryTest : 003_06 pixel image info
'
+
info
);
console
.
info
(
'
MediaLibraryTest : 003_06 pixel width
'
+
info
.
size
.
width
);
console
.
info
(
'
MediaLibraryTest : 003_06 pixel height
'
+
info
.
size
.
height
);
if
(
info
.
size
.
width
==
size
.
width
&&
info
.
size
.
height
==
size
.
height
)
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_07 passed
'
);
done
();
}
else
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_07 failed
'
);
done
();
}
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : getThumbnail 002_07 failed
'
+
error
.
message
);
expect
(
false
).
assertTrue
();
done
();
}
});
// ------------------------------video type end--------------------------
//
//
------------------------------audio type start -----------------------
/
/ /
**
//
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_01
//
* @tc.name : getThumbnail
//
* @tc.desc : getThumbnail(audio) by { width: 128, height: 128 }
//
* @tc.size : MEDIUM
//
* @tc.type : Function
//
* @tc.level : Level 0
//
*/
//
it('SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_01', 0, async function (done) {
//
try {
//
const fetchFileResult = await media.getFileAssets(audioFetchOp);
//
const dataList = await fetchFileResult.getAllObject();
//
const asset = dataList[0];
//
let size = { width: 128, height: 128 };
//
const pixelmap = await asset.getThumbnail(size);
//
const info = await pixelmap.getImageInfo();
//
console.info('MediaLibraryTest : 003_01 pixel image info ' + info);
//
console.info('MediaLibraryTest : 003_01 pixel width ' + info.size.width);
//
console.info('MediaLibraryTest : 003_01 pixel height ' + info.size.height);
//
if (info.size.width == size.width && info.size.height == size.height) {
//
expect(true).assertTrue();
//
console.info('MediaLibraryTest : getThumbnail 003_01 passed');
//
done();
//
} else {
//
expect(false).assertTrue();
//
console.info('MediaLibraryTest : getThumbnail 003_01 failed');
//
done();
//
}
//
} catch (error) {
//
console.info('MediaLibraryTest : getThumbnail 003_01 failed ' + error.message);
//
expect(false).assertTrue();
//
done();
//
}
//
});
// ------------------------------audio type start -----------------------
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_01
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(audio) by { width: 128, height: 128 }
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_01
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
audioFetchOp
);
const
dataList
=
await
fetchFileResult
.
getAllObject
();
const
asset
=
dataList
[
0
];
let
size
=
{
width
:
128
,
height
:
128
};
const
pixelmap
=
await
asset
.
getThumbnail
(
size
);
const
info
=
await
pixelmap
.
getImageInfo
();
console
.
info
(
'
MediaLibraryTest : 003_01 pixel image info
'
+
info
);
console
.
info
(
'
MediaLibraryTest : 003_01 pixel width
'
+
info
.
size
.
width
);
console
.
info
(
'
MediaLibraryTest : 003_01 pixel height
'
+
info
.
size
.
height
);
if
(
info
.
size
.
width
==
size
.
width
&&
info
.
size
.
height
==
size
.
height
)
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_01 passed
'
);
done
();
}
else
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_01 failed
'
);
done
();
}
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_01 failed
'
+
error
.
message
);
expect
(
false
).
assertTrue
();
done
();
}
});
/
/ /
**
//
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_02
//
* @tc.name : getThumbnail
//
* @tc.desc : getThumbnail(audio) by { width: 128, height: 256 }
//
* @tc.size : MEDIUM
//
* @tc.type : Function
//
* @tc.level : Level 0
//
*/
//
it('SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_02', 0, async function (done) {
//
try {
//
const fetchFileResult = await media.getFileAssets(audioFetchOp);
//
const dataList = await fetchFileResult.getAllObject();
//
const asset = dataList[0];
//
let size = { width: 128, height: 256 };
//
const pixelmap = await asset.getThumbnail(size);
//
const info = await pixelmap.getImageInfo();
//
console.info('MediaLibraryTest : 003_02 pixel image info ' + info);
//
console.info('MediaLibraryTest : 003_02 pixel width ' + info.size.width);
//
console.info('MediaLibraryTest : 003_02 pixel height ' + info.size.height);
//
if (info.size.width == size.width && info.size.height == size.height) {
//
expect(true).assertTrue();
//
console.info('MediaLibraryTest : getThumbnail 003_02 passed');
//
done();
//
} else {
//
expect(false).assertTrue();
//
console.info('MediaLibraryTest : getThumbnail 003_02 failed');
//
done();
//
}
//
} catch (error) {
//
console.info('MediaLibraryTest : getThumbnail 003_02 failed ' + error.message);
//
expect(false).assertTrue();
//
done();
//
}
//
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_02
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(audio) by { width: 128, height: 256 }
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_02
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
audioFetchOp
);
const
dataList
=
await
fetchFileResult
.
getAllObject
();
const
asset
=
dataList
[
0
];
let
size
=
{
width
:
128
,
height
:
256
};
const
pixelmap
=
await
asset
.
getThumbnail
(
size
);
const
info
=
await
pixelmap
.
getImageInfo
();
console
.
info
(
'
MediaLibraryTest : 003_02 pixel image info
'
+
info
);
console
.
info
(
'
MediaLibraryTest : 003_02 pixel width
'
+
info
.
size
.
width
);
console
.
info
(
'
MediaLibraryTest : 003_02 pixel height
'
+
info
.
size
.
height
);
if
(
info
.
size
.
width
==
size
.
width
&&
info
.
size
.
height
==
size
.
height
)
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_02 passed
'
);
done
();
}
else
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_02 failed
'
);
done
();
}
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_02 failed
'
+
error
.
message
);
expect
(
false
).
assertTrue
();
done
();
}
});
/
/ /
**
//
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_03
//
* @tc.name : getThumbnail
//
* @tc.desc : getThumbnail(audio) by no arg
//
* @tc.size : MEDIUM
//
* @tc.type : Function
//
* @tc.level : Level 0
//
*/
//
it('SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_03', 0, async function (done) {
//
try {
//
const fetchFileResult = await media.getFileAssets(audioFetchOp);
//
const dataList = await fetchFileResult.getAllObject();
//
const asset = dataList[0];
//
let size = { width: 256, height: 256 };
//
const pixelmap = await asset.getThumbnail();
//
const info = await pixelmap.getImageInfo();
//
console.info('MediaLibraryTest : 003_03 pixel image info ' + info);
//
console.info('MediaLibraryTest : 003_03 pixel width ' + info.size.width);
//
console.info('MediaLibraryTest : 003_03 pixel height ' + info.size.height);
//
if (info.size.width == size.width && info.size.height == size.height) {
//
expect(true).assertTrue();
//
console.info('MediaLibraryTest : getThumbnail 003_03 passed');
//
done();
//
} else {
//
expect(false).assertTrue();
//
console.info('MediaLibraryTest : getThumbnail 003_03 failed');
//
done();
//
}
//
} catch (error) {
//
console.info('MediaLibraryTest : getThumbnail 003_03 failed ' + error.message);
//
expect(false).assertTrue();
//
done();
//
}
//
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_03
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(audio) by no arg
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_03
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
audioFetchOp
);
const
dataList
=
await
fetchFileResult
.
getAllObject
();
const
asset
=
dataList
[
0
];
let
size
=
{
width
:
256
,
height
:
256
};
const
pixelmap
=
await
asset
.
getThumbnail
();
const
info
=
await
pixelmap
.
getImageInfo
();
console
.
info
(
'
MediaLibraryTest : 003_03 pixel image info
'
+
info
);
console
.
info
(
'
MediaLibraryTest : 003_03 pixel width
'
+
info
.
size
.
width
);
console
.
info
(
'
MediaLibraryTest : 003_03 pixel height
'
+
info
.
size
.
height
);
if
(
info
.
size
.
width
==
size
.
width
&&
info
.
size
.
height
==
size
.
height
)
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_03 passed
'
);
done
();
}
else
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_03 failed
'
);
done
();
}
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_03 failed
'
+
error
.
message
);
expect
(
false
).
assertTrue
();
done
();
}
});
/
/ /
**
//
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_04
//
* @tc.name : getThumbnail
//
* @tc.desc : getThumbnail(audio) by { width: 1, height: 1 }
//
* @tc.size : MEDIUM
//
* @tc.type : Function
//
* @tc.level : Level 0
//
*/
//
it('SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_04', 0, async function (done) {
//
try {
//
const fetchFileResult = await media.getFileAssets(audioFetchOp);
//
const dataList = await fetchFileResult.getAllObject();
//
const asset = dataList[0];
//
let size = { width: 1, height: 1 };
//
const pixelmap = await asset.getThumbnail(size);
//
const info = await pixelmap.getImageInfo();
//
console.info('MediaLibraryTest : 003_04 pixel image info ' + info);
//
console.info('MediaLibraryTest : 003_04 pixel width ' + info.size.width);
//
console.info('MediaLibraryTest : 003_04 pixel height ' + info.size.height);
//
if (info.size.width == size.width && info.size.height == size.height) {
//
expect(true).assertTrue();
//
console.info('MediaLibraryTest : getThumbnail 003_04 passed');
//
done();
//
} else {
//
expect(false).assertTrue();
//
console.info('MediaLibraryTest : getThumbnail 003_04 failed');
//
done();
//
}
//
} catch (error) {
//
console.info('MediaLibraryTest : getThumbnail 003_04 failed ' + error.message);
//
expect(false).assertTrue();
//
done();
//
}
//
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_04
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(audio) by { width: 1, height: 1 }
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_04
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
audioFetchOp
);
const
dataList
=
await
fetchFileResult
.
getAllObject
();
const
asset
=
dataList
[
0
];
let
size
=
{
width
:
1
,
height
:
1
};
const
pixelmap
=
await
asset
.
getThumbnail
(
size
);
const
info
=
await
pixelmap
.
getImageInfo
();
console
.
info
(
'
MediaLibraryTest : 003_04 pixel image info
'
+
info
);
console
.
info
(
'
MediaLibraryTest : 003_04 pixel width
'
+
info
.
size
.
width
);
console
.
info
(
'
MediaLibraryTest : 003_04 pixel height
'
+
info
.
size
.
height
);
if
(
info
.
size
.
width
==
size
.
width
&&
info
.
size
.
height
==
size
.
height
)
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_04 passed
'
);
done
();
}
else
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_04 failed
'
);
done
();
}
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_04 failed
'
+
error
.
message
);
expect
(
false
).
assertTrue
();
done
();
}
});
/
/ /
**
//
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_05
//
* @tc.name : getThumbnail
//
* @tc.desc : getThumbnail(audio) by { width: 0, height: 0 }
//
* @tc.size : MEDIUM
//
* @tc.type : Function
//
* @tc.level : Level 0
//
*/
//
it('SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_05', 0, async function (done) {
//
try {
//
const fetchFileResult = await media.getFileAssets(audioFetchOp);
//
const dataList = await fetchFileResult.getAllObject();
//
const asset = dataList[0];
//
let size = { width: 0, height: 0 };
//
const pixelmap = await asset.getThumbnail(size);
//
const info = await pixelmap.getImageInfo();
//
console.info('MediaLibraryTest : getThumbnail 003_06 failed');
//
console.info('MediaLibraryTest : 003_05 pixel image info ' + info);
//
console.info('MediaLibraryTest : 003_05 pixel width ' + info.size.width);
//
console.info('MediaLibraryTest : 003_05 pixel height ' + info.size.height);
// expect(tru
e).assertTrue();
//
done();
//
} catch (error) {
//
console.info('MediaLibraryTest : getThumbnail 003_05 passed');
// expect(fals
e).assertTrue();
//
done();
//
}
//
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_05
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(audio) by { width: 0, height: 0 }
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_05
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
audioFetchOp
);
const
dataList
=
await
fetchFileResult
.
getAllObject
();
const
asset
=
dataList
[
0
];
let
size
=
{
width
:
0
,
height
:
0
};
const
pixelmap
=
await
asset
.
getThumbnail
(
size
);
const
info
=
await
pixelmap
.
getImageInfo
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_06 failed
'
);
console
.
info
(
'
MediaLibraryTest : 003_05 pixel image info
'
+
info
);
console
.
info
(
'
MediaLibraryTest : 003_05 pixel width
'
+
info
.
size
.
width
);
console
.
info
(
'
MediaLibraryTest : 003_05 pixel height
'
+
info
.
size
.
height
);
expect
(
fals
e
).
assertTrue
();
done
();
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_05 passed
'
);
expect
(
tru
e
).
assertTrue
();
done
();
}
});
/
/ /
**
//
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_06
//
* @tc.name : getThumbnail
//
* @tc.desc : getThumbnail(audio) by { width: -128, height: -128 }
//
* @tc.size : MEDIUM
//
* @tc.type : Function
//
* @tc.level : Level 0
//
*/
//
it('SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_06', 0, async function (done) {
//
try {
//
const fetchFileResult = await media.getFileAssets(audioFetchOp);
//
const dataList = await fetchFileResult.getAllObject();
//
const asset = dataList[0];
//
let size = { width: -128, height: -128 };
//
const pixelmap = await asset.getThumbnail(size);
//
const info = await pixelmap.getImageInfo();
//
console.info('MediaLibraryTest : 003_06 pixel image info ' + info);
//
console.info('MediaLibraryTest : 003_06 pixel width ' + info.size.width);
//
console.info('MediaLibraryTest : 003_06 pixel height ' + info.size.height);
//
console.info('MediaLibraryTest : getThumbnail 003_06 failed');
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_06
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(audio) by { width: -128, height: -128 }
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_06
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
audioFetchOp
);
const
dataList
=
await
fetchFileResult
.
getAllObject
();
const
asset
=
dataList
[
0
];
let
size
=
{
width
:
-
128
,
height
:
-
128
};
const
pixelmap
=
await
asset
.
getThumbnail
(
size
);
const
info
=
await
pixelmap
.
getImageInfo
();
console
.
info
(
'
MediaLibraryTest : 003_06 pixel image info
'
+
info
);
console
.
info
(
'
MediaLibraryTest : 003_06 pixel width
'
+
info
.
size
.
width
);
console
.
info
(
'
MediaLibraryTest : 003_06 pixel height
'
+
info
.
size
.
height
);
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_06 failed
'
);
// expect(tru
e).assertTrue();
//
done();
//
} catch (error) {
//
console.info('MediaLibraryTest : getThumbnail 003_06 passed');
// expect(fals
e).assertTrue();
//
done();
//
}
//
});
expect
(
fals
e
).
assertTrue
();
done
();
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_06 passed
'
);
expect
(
tru
e
).
assertTrue
();
done
();
}
});
/
/ /
**
//
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_07
//
* @tc.name : getThumbnail
//
* @tc.desc : getThumbnail(audio) by { width: 1024, height: 1024 }
//
* @tc.size : MEDIUM
//
* @tc.type : Function
//
* @tc.level : Level 0
//
*/
//
it('SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_07', 0, async function (done) {
//
try {
//
const fetchFileResult = await media.getFileAssets(audioFetchOp);
//
const dataList = await fetchFileResult.getAllObject();
//
const asset = dataList[0];
//
let size = { width: 1024, height: 1024 };
//
const pixelmap = await asset.getThumbnail(size);
//
const info = await pixelmap.getImageInfo();
//
console.info('MediaLibraryTest : 003_06 pixel image info ' + info);
//
console.info('MediaLibraryTest : 003_06 pixel width ' + info.size.width);
//
console.info('MediaLibraryTest : 003_06 pixel height ' + info.size.height);
//
if (info.size.width == size.width && info.size.height == size.height) {
//
expect(true).assertTrue();
//
console.info('MediaLibraryTest : getThumbnail 003_07 passed');
//
done();
//
} else {
//
expect(false).assertTrue();
//
console.info('MediaLibraryTest : getThumbnail 003_07 failed');
//
done();
//
}
//
} catch (error) {
//
console.info('MediaLibraryTest : getThumbnail 003_07 failed ' + error.message);
//
expect(false).assertTrue();
//
done();
//
}
//
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_07
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(audio) by { width: 1024, height: 1024 }
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_07
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
audioFetchOp
);
const
dataList
=
await
fetchFileResult
.
getAllObject
();
const
asset
=
dataList
[
0
];
let
size
=
{
width
:
1024
,
height
:
1024
};
const
pixelmap
=
await
asset
.
getThumbnail
(
size
);
const
info
=
await
pixelmap
.
getImageInfo
();
console
.
info
(
'
MediaLibraryTest : 003_06 pixel image info
'
+
info
);
console
.
info
(
'
MediaLibraryTest : 003_06 pixel width
'
+
info
.
size
.
width
);
console
.
info
(
'
MediaLibraryTest : 003_06 pixel height
'
+
info
.
size
.
height
);
if
(
info
.
size
.
width
==
size
.
width
&&
info
.
size
.
height
==
size
.
height
)
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_07 passed
'
);
done
();
}
else
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_07 failed
'
);
done
();
}
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : getThumbnail 003_07 failed
'
+
error
.
message
);
expect
(
false
).
assertTrue
();
done
();
}
});
// ------------------------------audio type end--------------------------
});
multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/List.test.js
浏览文件 @
778db44e
...
...
@@ -40,9 +40,9 @@ require('./getAllPeersTestCallback.test.js')
require
(
'
./getAllPeersTestPromise.test.js
'
)
require
(
'
./mediaLibraryTestCallBack.test.js
'
)
require
(
'
./mediaLibraryTestPromise.test.js
'
)
require
(
'
./mediaLibraryTestPromiseOnOff.test.js
'
)
require
(
'
./albumTestCallBack.test.js
'
)
require
(
'
./albumTestPromise.test.js
'
)
require
(
'
./mediaLibraryTestPromiseOnOff.test.js
'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录