From e5ba3540466c907df9b1d1fdb050527a67a7953d Mon Sep 17 00:00:00 2001 From: yangbo Date: Sun, 9 Oct 2022 18:04:36 +0800 Subject: [PATCH] fix warn Signed-off-by: yangbo --- .../ets/test/getFileAssetsCallback.test.ets | 51 +++++++++++-------- .../ets/test/getFileAssetsPromise.test.ets | 50 ++++++++++-------- .../test/getPublicDirectoryCallback.test.ets | 14 ++--- .../test/getPublicDirectoryPromise.test.ets | 14 ++--- .../ets/test/onOffReleasePromise.test.ets | 16 +++--- .../fileAssetCommitModifyCallback.test.ets | 4 +- .../fileAssetCommitModifyPromise.test.ets | 4 +- .../test/fileAssetFavoriteCallback.test.ets | 12 +++-- .../test/fileAssetFavoritePromise.test.ets | 12 +++-- .../fileAssetGetThumbnailCallback.test.ets | 8 +-- .../fileAssetGetThumbnailPromise.test.ets | 8 +-- .../fileAssetIsDirectoryCallback.test.ets | 4 +- .../test/fileAssetIsDirectoryPromise.test.ets | 4 +- .../ets/test/fileAssetOpenCallback.test.ets | 17 +++++-- .../ets/test/fileAssetOpenPromise.test.ets | 16 ++++-- .../ets/test/fileAssetTrashCallback.test.ets | 20 ++++++-- .../ets/test/fileAssetTrashPromise.test.ets | 17 +++++-- 17 files changed, 176 insertions(+), 95 deletions(-) diff --git a/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getFileAssetsCallback.test.ets b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getFileAssetsCallback.test.ets index 1bb5136db..180d53c79 100644 --- a/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getFileAssetsCallback.test.ets +++ b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getFileAssetsCallback.test.ets @@ -48,24 +48,25 @@ export default function getFileAssetsCallbackTest(abilityContext) { const props = { image: { displayName: '01.jpg', - mediaType: IMAGE_TYPE.toString(), + fileType: IMAGE_TYPE.toString(), }, video: { displayName: '01.mp4', - relativePath: 'Videos/Static/', - mediaType: VIDEO_TYPE.toString(), + fileType: VIDEO_TYPE.toString(), }, audio: { displayName: '01.mp3', - mediaType: AUDIO_TYPE.toString(), + fileType: AUDIO_TYPE.toString(), }, } - async function getFirstObjectTest(done, testNum, fetchOps, isAudio) { + async function getFirstObjectTest(done, testNum, fetchOp, isAudio) { try { - let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOps); + let fetchAssetResult; if (isAudio) { - fetchAssetResult = await userfilemgr.getAudioAssets(fetchOps); + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); } let expectCount = 4; let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount); @@ -89,11 +90,13 @@ export default function getFileAssetsCallbackTest(abilityContext) { } } - async function getLastObjectTest(done, testNum, fetchOps, isAudio) { + async function getLastObjectTest(done, testNum, fetchOp, isAudio) { try { - let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOps); + let fetchAssetResult; if (isAudio) { - fetchAssetResult = await userfilemgr.getAudioAssets(fetchOps); + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); } let expectCount = 4; let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount); @@ -117,11 +120,13 @@ export default function getFileAssetsCallbackTest(abilityContext) { } } - async function getPositionObjectTest(done, testNum, fetchOps, pos, isAudio) { + async function getPositionObjectTest(done, testNum, fetchOp, pos, isAudio) { try { - let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOps); + let fetchAssetResult; if (isAudio) { - fetchAssetResult = await userfilemgr.getAudioAssets(fetchOps); + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); } let expectCount = 4; let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount); @@ -145,11 +150,13 @@ export default function getFileAssetsCallbackTest(abilityContext) { } } - async function isAfterLastTest(done, testNum, fetchOps, isAudio) { + async function isAfterLastTest(done, testNum, fetchOp, isAudio) { try { - let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOps); + let fetchAssetResult; if (isAudio) { - fetchAssetResult = await userfilemgr.getAudioAssets(fetchOps); + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); } let expectCount = 4; let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount); @@ -172,11 +179,13 @@ export default function getFileAssetsCallbackTest(abilityContext) { } } - async function checkFileAssetAttr(done, testNum, fetchOps, type, isAudio) { + async function checkFileAssetAttr(done, testNum, fetchOp, type, isAudio) { try { - let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOps); + let fetchAssetResult; if (isAudio) { - fetchAssetResult = await userfilemgr.getAudioAssets(fetchOps); + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); } let expectCount = 4; let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount); @@ -190,8 +199,8 @@ export default function getFileAssetsCallbackTest(abilityContext) { return; } expect(asset.displayName).assertEqual(props[type].displayName); - expect(asset.mediaType.toString()).assertEqual(props[type].mediaType); - expect(asset.uri != undefined).assertTrue(); + expect(asset.fileType.toString()).assertEqual(props[type].fileType); + expect(asset.uri).assertEqual(props[type].uri); fetchAssetResult.close(); done(); }); diff --git a/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getFileAssetsPromise.test.ets b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getFileAssetsPromise.test.ets index 9f070c8fc..e5ffa5c9d 100644 --- a/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getFileAssetsPromise.test.ets +++ b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getFileAssetsPromise.test.ets @@ -49,24 +49,25 @@ export default function getFileAssetsPromiseTest(abilityContext) { const props = { image: { displayName: '01.jpg', - mediaType: IMAGE_TYPE.toString(), + fileType: IMAGE_TYPE.toString(), }, video: { displayName: '01.mp4', - relativePath: 'Videos/Static/', - mediaType: VIDEO_TYPE.toString(), + fileType: VIDEO_TYPE.toString(), }, audio: { displayName: '01.mp3', - mediaType: AUDIO_TYPE.toString(), + fileType: AUDIO_TYPE.toString(), }, } - async function getFirstObjectTest(done, testNum, fetchOps, isAudio) { + async function getFirstObjectTest(done, testNum, fetchOp, isAudio) { try { - let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOps); + let fetchAssetResult; if (isAudio) { - fetchAssetResult = await userfilemgr.getAudioAssets(fetchOps); + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); } let expectCount = 4; let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount); @@ -82,11 +83,13 @@ export default function getFileAssetsPromiseTest(abilityContext) { } } - async function getLastObjectTest(done, testNum, fetchOps, isAudio) { + async function getLastObjectTest(done, testNum, fetchOp, isAudio) { try { - let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOps); + let fetchAssetResult; if (isAudio) { - fetchAssetResult = await userfilemgr.getAudioAssets(fetchOps); + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); } let expectCount = 4; let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount); @@ -102,11 +105,13 @@ export default function getFileAssetsPromiseTest(abilityContext) { } } - async function getPositionObjectTest(done, testNum, fetchOps, pos, isAudio) { + async function getPositionObjectTest(done, testNum, fetchOp, pos, isAudio) { try { - let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOps); + let fetchAssetResult; if (isAudio) { - fetchAssetResult = await userfilemgr.getAudioAssets(fetchOps); + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); } let expectCount = 4; let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount); @@ -122,11 +127,13 @@ export default function getFileAssetsPromiseTest(abilityContext) { } } - async function isAfterLastTest(done, testNum, fetchOps, isAudio) { + async function isAfterLastTest(done, testNum, fetchOp, isAudio) { try { - let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOps); + let fetchAssetResult; if (isAudio) { - fetchAssetResult = await userfilemgr.getAudioAssets(fetchOps); + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); } let expectCount = 4; let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount); @@ -148,11 +155,13 @@ export default function getFileAssetsPromiseTest(abilityContext) { } } - async function checkFileAssetAttr(done, testNum, fetchOps, type, isAudio) { + async function checkFileAssetAttr(done, testNum, fetchOp, type, isAudio) { try { - let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOps); + let fetchAssetResult; if (isAudio) { - fetchAssetResult = await userfilemgr.getAudioAssets(fetchOps); + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); } let expectCount = 4; let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount); @@ -166,7 +175,8 @@ export default function getFileAssetsPromiseTest(abilityContext) { return; } expect(asset.displayName).assertEqual(props[type].displayName); - expect(asset.mediaType.toString()).assertEqual(props[type].mediaType); + expect(asset.fileType.toString()).assertEqual(props[type].fileType); + expect(asset.uri != undefined).assertTrue(); fetchAssetResult.close(); done(); }); diff --git a/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getPublicDirectoryCallback.test.ets b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getPublicDirectoryCallback.test.ets index 2f5bb93c2..ca74ecab1 100644 --- a/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getPublicDirectoryCallback.test.ets +++ b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getPublicDirectoryCallback.test.ets @@ -38,7 +38,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) { console.info('afterAll case'); }); - const getetPublicDirectoryTest = async (done, testNum, dir, val) => { + const getPublicDirectoryTest = async (done, testNum, dir, val) => { try { userfilemgr.getPublicDirectory(dir, async (err, res) => { if (err) { @@ -69,7 +69,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) { let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_01'; let dir = userfile_manager.DirectoryType.DIR_CAMERA; let val = 'Camera/'; - await getetPublicDirectoryTest(done, testNum, dir, val) + await getPublicDirectoryTest(done, testNum, dir, val) }); /** @@ -84,7 +84,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) { let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_02'; let dir = userfile_manager.DirectoryType.DIR_VIDEO; let val = 'Videos/'; - await getetPublicDirectoryTest(done, testNum, dir, val) + await getPublicDirectoryTest(done, testNum, dir, val) }); /** @@ -99,7 +99,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) { let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_03'; let dir = userfile_manager.DirectoryType.DIR_IMAGE; let val = 'Pictures/'; - await getetPublicDirectoryTest(done, testNum, dir, val) + await getPublicDirectoryTest(done, testNum, dir, val) }); /** @@ -114,7 +114,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) { let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_04'; let dir = userfile_manager.DirectoryType.DIR_AUDIO; let val = 'Audios/'; - await getetPublicDirectoryTest(done, testNum, dir, val) + await getPublicDirectoryTest(done, testNum, dir, val) }); /** @@ -129,7 +129,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) { let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_05'; let dir = userfile_manager.DirectoryType.DIR_DOCUMENTS; let val = 'Documents/'; - await getetPublicDirectoryTest(done, testNum, dir, val) + await getPublicDirectoryTest(done, testNum, dir, val) }); /** @@ -144,7 +144,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) { let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_06'; let dir = userfile_manager.DirectoryType.DIR_DOWNLOAD; let val = 'Download/'; - await getetPublicDirectoryTest(done, testNum, dir, val) + await getPublicDirectoryTest(done, testNum, dir, val) }); }); } diff --git a/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getPublicDirectoryPromise.test.ets b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getPublicDirectoryPromise.test.ets index 554eb7749..5f67b0357 100644 --- a/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getPublicDirectoryPromise.test.ets +++ b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getPublicDirectoryPromise.test.ets @@ -38,7 +38,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) { console.info('afterAll case'); }); - const getetPublicDirectoryTest = async (done, testNum, dir, val) => { + const getPublicDirectoryTest = async (done, testNum, dir, val) => { try { let res = await userfilemgr.getPublicDirectory(dir); expect(res).assertEqual(val); @@ -62,7 +62,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) { let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_01'; let dir = userfile_manager.DirectoryType.DIR_CAMERA; let val = 'Camera/'; - await getetPublicDirectoryTest(done, testNum, dir, val) + await getPublicDirectoryTest(done, testNum, dir, val) }); /** @@ -77,7 +77,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) { let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_02'; let dir = userfile_manager.DirectoryType.DIR_VIDEO; let val = 'Videos/'; - await getetPublicDirectoryTest(done, testNum, dir, val) + await getPublicDirectoryTest(done, testNum, dir, val) }); /** @@ -92,7 +92,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) { let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_03'; let dir = userfile_manager.DirectoryType.DIR_IMAGE; let val = 'Pictures/'; - await getetPublicDirectoryTest(done, testNum, dir, val) + await getPublicDirectoryTest(done, testNum, dir, val) }); /** @@ -107,7 +107,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) { let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_04'; let dir = userfile_manager.DirectoryType.DIR_AUDIO; let val = 'Audios/'; - await getetPublicDirectoryTest(done, testNum, dir, val) + await getPublicDirectoryTest(done, testNum, dir, val) }); /** @@ -122,7 +122,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) { let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_05'; let dir = userfile_manager.DirectoryType.DIR_DOCUMENTS; let val = 'Documents/'; - await getetPublicDirectoryTest(done, testNum, dir, val) + await getPublicDirectoryTest(done, testNum, dir, val) }); /** @@ -137,7 +137,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) { let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_06'; let dir = userfile_manager.DirectoryType.DIR_DOWNLOAD; let val = 'Download/'; - await getetPublicDirectoryTest(done, testNum, dir, val) + await getPublicDirectoryTest(done, testNum, dir, val) }); }); } diff --git a/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/onOffReleasePromise.test.ets b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/onOffReleasePromise.test.ets index 7df7d02db..caeaf2a4e 100644 --- a/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/onOffReleasePromise.test.ets +++ b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/onOffReleasePromise.test.ets @@ -43,13 +43,15 @@ export default function onOffReleasePromiseTest(abilityContext) { console.info('afterAll case'); }); - const onTest = async (done, testNum, fetchOps, type, newName, isAudio) => { + const onTest = async (done, testNum, fetchOp, type, newName, isAudio) => { try { let count = 0; userfilemgr.on(type, () => { count++; }); - let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOps); + let fetchAssetResult; if (isAudio) { - fetchAssetResult = await userfilemgr.getAudioAssets(fetchOps); + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); } let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1); if (!checkAssetCountPass) return; @@ -66,15 +68,17 @@ export default function onOffReleasePromiseTest(abilityContext) { done(); } } - const offTest = async (done, testNum, fetchOps, type, newName, isAudio) => { + const offTest = async (done, testNum, fetchOp, type, newName, isAudio) => { try { let count = 0; userfilemgr.on(type, () => { count++; }); - let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOps); + let fetchAssetResult; if (isAudio) { - fetchAssetResult = await userfilemgr.getAudioAssets(fetchOps); + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); } let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1); if (!checkAssetCountPass) return; diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetCommitModifyCallback.test.ets b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetCommitModifyCallback.test.ets index 4c394f5e1..5e32d0eba 100755 --- a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetCommitModifyCallback.test.ets +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetCommitModifyCallback.test.ets @@ -49,9 +49,11 @@ export default function fileAssetCommitModifyCallbackTest(abilityContext) { const checkCommitModify = async function (done, testNum, fetchOp, prop, val, isAudio) { try { - let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + let fetchAssetResult; if (isAudio) { fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); } let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1); if (!checkAssetCountPass) return; diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetCommitModifyPromise.test.ets b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetCommitModifyPromise.test.ets index 34043c6d4..d8078e67f 100755 --- a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetCommitModifyPromise.test.ets +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetCommitModifyPromise.test.ets @@ -47,9 +47,11 @@ export default function fileAssetCommitModifyPromiseTest(abilityContext) { const checkCommitModify = async function (done, testNum, fetchOp, prop, val, isAudio) { try { - let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + let fetchAssetResult; if (isAudio) { fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); } let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1); if (!checkAssetCountPass) return; diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetFavoriteCallback.test.ets b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetFavoriteCallback.test.ets index 070949d41..f600a96cc 100644 --- a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetFavoriteCallback.test.ets +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetFavoriteCallback.test.ets @@ -45,9 +45,11 @@ export default function fileAssetFavoriteCallbackTest(abilityContext) { const favoriteDefaultState = async function (done, testNum, fetchOp, isAudio) { try { - let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + let fetchAssetResult; if (isAudio) { fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); } let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1); if (!checkAssetCountPass) return; @@ -71,9 +73,11 @@ export default function fileAssetFavoriteCallbackTest(abilityContext) { } const favoriteByTrue = async function (done, testNum, fetchOp, isAudio) { try { - let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + let fetchAssetResult; if (isAudio) { fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); } let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1); if (!checkAssetCountPass) return; @@ -101,9 +105,11 @@ export default function fileAssetFavoriteCallbackTest(abilityContext) { } const favoriteByFalse = async function (done, testNum, fetchOp, isAudio) { try { - let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + let fetchAssetResult; if (isAudio) { fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); } let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1); if (!checkAssetCountPass) return; diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetFavoritePromise.test.ets b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetFavoritePromise.test.ets index cc25a5e9f..7ab3ddf12 100644 --- a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetFavoritePromise.test.ets +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetFavoritePromise.test.ets @@ -43,9 +43,11 @@ export default function fileAssetFavoritePromiseTest(abilityContext) { const favoriteDefaultState = async function (done, testNum, fetchOp, isAudio) { try { - let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + let fetchAssetResult; if (isAudio) { fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); } let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1); if (!checkAssetCountPass) return; @@ -62,9 +64,11 @@ export default function fileAssetFavoritePromiseTest(abilityContext) { } const favoriteByTrue = async function (done, testNum, fetchOp, isAudio) { try { - let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + let fetchAssetResult; if (isAudio) { fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); } let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1); if (!checkAssetCountPass) return; @@ -82,9 +86,11 @@ export default function fileAssetFavoritePromiseTest(abilityContext) { } const favoriteByFalse = async function (done, testNum, fetchOp, isAudio) { try { - let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + let fetchAssetResult; if (isAudio) { fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); } let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1); if (!checkAssetCountPass) return; diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetGetThumbnailCallback.test.ets b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetGetThumbnailCallback.test.ets index bef419652..655492e8e 100644 --- a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetGetThumbnailCallback.test.ets +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetGetThumbnailCallback.test.ets @@ -43,11 +43,13 @@ export default function fileAssetGetThumbnailCallbackTest(abilityContext) { console.info('afterAll case'); }); - async function testGetThumbnail(done, testNum, dOp, size, isAudio) { + async function testGetThumbnail(done, testNum, fetchOp, size, isAudio) { try { - let fetchAssetResult = await userfilemgr.getPhotoAssets(dOp); + let fetchAssetResult; if (isAudio) { - fetchAssetResult = await userfilemgr.getAudioAssets(dOp); + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); } let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1); if (!checkAssetCountPass) return; diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetGetThumbnailPromise.test.ets b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetGetThumbnailPromise.test.ets index 84d24852f..05decd975 100644 --- a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetGetThumbnailPromise.test.ets +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetGetThumbnailPromise.test.ets @@ -43,11 +43,13 @@ export default function fileAssetGetThumbnailPromiseTest(abilityContext) { console.info('afterAll case'); }); - async function testGetThumbnail(done, testNum, dOp, size, isAudio) { + async function testGetThumbnail(done, testNum, fetchOp, size, isAudio) { try { - let fetchAssetResult = await userfilemgr.getPhotoAssets(dOp); + let fetchAssetResult; if (isAudio) { - fetchAssetResult = await userfilemgr.getAudioAssets(dOp); + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); } let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1); if (!checkAssetCountPass) return; diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetIsDirectoryCallback.test.ets b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetIsDirectoryCallback.test.ets index 466c2ac9f..a4d2c6ff1 100644 --- a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetIsDirectoryCallback.test.ets +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetIsDirectoryCallback.test.ets @@ -43,9 +43,11 @@ export default function fileAssetIsDirectoryCallbackTest(abilityContext) { const isDirectoryTest = async function (done, testNum, fetchOp, isAudio) { try { - let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + let fetchAssetResult; if (isAudio) { fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); } const asset = await fetchAssetResult.getFirstObject(); fetchAssetResult.close(); diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetIsDirectoryPromise.test.ets b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetIsDirectoryPromise.test.ets index ef47fb6d9..3e20d0d77 100644 --- a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetIsDirectoryPromise.test.ets +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetIsDirectoryPromise.test.ets @@ -43,9 +43,11 @@ export default function fileAssetIsDirectoryPromiseTest(abilityContext) { const isDirectoryTest = async function (done, testNum, fetchOp, isAudio) { try { - let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + let fetchAssetResult; if (isAudio) { fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); } const asset = await fetchAssetResult.getFirstObject(); fetchAssetResult.close(); diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetOpenCallback.test.ets b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetOpenCallback.test.ets index 66f93ca04..37837ddf9 100755 --- a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetOpenCallback.test.ets +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetOpenCallback.test.ets @@ -47,9 +47,11 @@ export default function fileAssetOpenCallbackTest(abilityContext) { let asset; let fd; try { - let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + let fetchAssetResult; if (isAudio) { fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); } let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount); if (!checkAssetCountPass) return; @@ -88,10 +90,11 @@ export default function fileAssetOpenCallbackTest(abilityContext) { let asset, asset1; let fd, fd1; try { - - let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + let fetchAssetResult; if (isAudio) { fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); } let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount); if (!checkAssetCountPass) return; @@ -134,9 +137,11 @@ export default function fileAssetOpenCallbackTest(abilityContext) { let asset, asset1; let fd, fd1; try { - let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + let fetchAssetResult; if (isAudio) { fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); } let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount); if (!checkAssetCountPass) return; @@ -179,9 +184,11 @@ export default function fileAssetOpenCallbackTest(abilityContext) { let asset; let fd; try { - let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + let fetchAssetResult; if (isAudio) { fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); } let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1); if (!checkAssetCountPass) return; diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetOpenPromise.test.ets b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetOpenPromise.test.ets index e0777ff00..0c0ca17e2 100755 --- a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetOpenPromise.test.ets +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetOpenPromise.test.ets @@ -51,9 +51,11 @@ export default function fileAssetOpenPromiseTest(abilityContext) { let asset; let fd; try { - let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + let fetchAssetResult; if (isAudio) { fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); } let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount); if (!checkAssetCountPass) return; @@ -85,9 +87,11 @@ export default function fileAssetOpenPromiseTest(abilityContext) { let asset, asset1; let fd, fd1; try { - let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + let fetchAssetResult; if (isAudio) { fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); } let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount); if (!checkAssetCountPass) return; @@ -126,9 +130,11 @@ export default function fileAssetOpenPromiseTest(abilityContext) { let asset, asset1; let fd, fd1; try { - let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + let fetchAssetResult; if (isAudio) { fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); } let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount); if (!checkAssetCountPass) return; @@ -164,9 +170,11 @@ export default function fileAssetOpenPromiseTest(abilityContext) { let asset; let fd; try { - let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + let fetchAssetResult; if (isAudio) { fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); } let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1); if (!checkAssetCountPass) return; diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetTrashCallback.test.ets b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetTrashCallback.test.ets index 8b3888baf..bcf5098f3 100644 --- a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetTrashCallback.test.ets +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetTrashCallback.test.ets @@ -43,9 +43,11 @@ export default function fileAssetTrashCallbackTest(abilityContext) { const isTrashTest = async function (done, testNum, fetchOp, isAudio) { try { - let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + let fetchAssetResult; if (isAudio) { fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); } let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1); if (!checkAssetCountPass) return; @@ -72,9 +74,11 @@ export default function fileAssetTrashCallbackTest(abilityContext) { let expectAssetNum = 3 try { // database info - let databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps); + let databaseFetchFileResult; if (isAudio) { databaseFetchFileResult = await userfilemgr.getAudioAssets(databasefFetchOps); + } else { + databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps); } let count = databaseFetchFileResult.getCount(); //album info @@ -109,9 +113,11 @@ export default function fileAssetTrashCallbackTest(abilityContext) { expect(trashState).assertTrue(); try { // after trash database info - databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps); + let databaseFetchFileResult; if (isAudio) { databaseFetchFileResult = await userfilemgr.getAudioAssets(databasefFetchOps); + } else { + databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps); } let databaseCount = databaseFetchFileResult.getCount(); databaseFetchFileResult.close(); @@ -146,9 +152,11 @@ export default function fileAssetTrashCallbackTest(abilityContext) { async function recovery(done, testNum, databasefFetchOps, ablumFetchOps, noAlbum, isAudio) { let expectAssetNum = 3; try { - let databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps); + let databaseFetchFileResult; if (isAudio) { databaseFetchFileResult = await userfilemgr.getAudioAssets(databasefFetchOps); + } else { + databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps); } let count = databaseFetchFileResult.getCount(); let asset = await databaseFetchFileResult.getFirstObject(); @@ -169,9 +177,11 @@ export default function fileAssetTrashCallbackTest(abilityContext) { } expect(trashState).assertFalse(); try { - databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps); + let databaseFetchFileResult; if (isAudio) { databaseFetchFileResult = await userfilemgr.getAudioAssets(databasefFetchOps); + } else { + databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps); } let databaseCount = databaseFetchFileResult.getCount(); databaseFetchFileResult.close(); diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetTrashPromise.test.ets b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetTrashPromise.test.ets index dc7f70857..1865d3998 100644 --- a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetTrashPromise.test.ets +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetTrashPromise.test.ets @@ -43,9 +43,11 @@ export default function fileAssetTrashPromiseTest(abilityContext) { const isTrashTest = async function (done, testNum, fetchOp, isAudio) { try { - let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + let fetchAssetResult; if (isAudio) { fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); } let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1); if (!checkAssetCountPass) return; @@ -65,9 +67,11 @@ export default function fileAssetTrashPromiseTest(abilityContext) { let expectAssetNum = 3 try { // database info - let databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps); + let databaseFetchFileResult; if (isAudio) { databaseFetchFileResult = await userfilemgr.getAudioAssets(databasefFetchOps); + } else { + databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps); } let count = databaseFetchFileResult.getCount(); //album info @@ -89,6 +93,8 @@ export default function fileAssetTrashPromiseTest(abilityContext) { databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps); if (isAudio) { databaseFetchFileResult = await userfilemgr.getAudioAssets(databasefFetchOps); + } else { + databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps); } let databaseCount = databaseFetchFileResult.getCount(); databaseFetchFileResult.close() @@ -115,17 +121,20 @@ export default function fileAssetTrashPromiseTest(abilityContext) { async function recovery(done, testNum, databasefFetchOps, ablumFetchOps, noAlbum, isAudio) { let expectAssetNum = 3; try { - let databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps); + let databaseFetchFileResult; if (isAudio) { databaseFetchFileResult = await userfilemgr.getAudioAssets(databasefFetchOps); + } else { + databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps); } let count = databaseFetchFileResult.getCount(); let asset = await databaseFetchFileResult.getFirstObject(); await asset.trash(true); await asset.trash(false); - databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps); if (isAudio) { databaseFetchFileResult = await userfilemgr.getAudioAssets(databasefFetchOps); + } else { + databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps); } let databaseCount = databaseFetchFileResult.getCount(); databaseFetchFileResult.close(); -- GitLab