提交 e8ae7dfc 编写于 作者: P panqiangbiao

add video/audio thumbnail

Signed-off-by: Npanqiangbiao <panqiangbiao@huawei.com>
上级 d87e105a
......@@ -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--------------------------
});
......@@ -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(true).assertTrue();
// done();
// } catch (error) {
// console.info('MediaLibraryTest : getThumbnail 002_05 passed');
// 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(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : getThumbnail 002_05 passed');
expect(true).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(true).assertTrue();
// done();
// } catch (error) {
// console.info('MediaLibraryTest : getThumbnail 002_06 passed');
// expect(false).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(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : getThumbnail 002_06 passed');
expect(true).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(true).assertTrue();
// done();
// } catch (error) {
// console.info('MediaLibraryTest : getThumbnail 003_05 passed');
// 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(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : getThumbnail 003_05 passed');
expect(true).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(true).assertTrue();
// done();
// } catch (error) {
// console.info('MediaLibraryTest : getThumbnail 003_06 passed');
// expect(false).assertTrue();
// done();
// }
// });
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : getThumbnail 003_06 passed');
expect(true).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--------------------------
});
......@@ -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.
先完成此消息的编辑!
想要评论请 注册