From 59c50192b3fda4687dca3f13bbea382110079f63 Mon Sep 17 00:00:00 2001 From: yangbo Date: Thu, 15 Jun 2023 12:10:53 +0800 Subject: [PATCH] update Signed-off-by: yangbo --- multimedia/medialibrary/common.js | 5 +- .../medialibrary/mediaLibrary_album/Test.json | 12 +- .../test/albumGetFileAssetsCallback.test.ets | 113 ++++---------- .../test/albumGetFileAssetsPromise.test.ets | 121 ++++----------- .../main/ets/test/albumTestCallBack.test.ets | 125 +++------------- .../main/ets/test/albumTestPromise.test.ets | 138 ++++-------------- .../medialibrary/mediaLibrary_base/Test.json | 10 +- .../test/mediaLibraryTestCallback.test.ets | 2 +- .../ets/test/mediaLibraryTestPromise.test.ets | 2 +- .../mediaLibraryTestPromiseOnOff.test.ets | 2 +- .../mediaLibrary_favorite/Test.json | 10 +- .../ets/test/favoriteTestCallback.test.ets | 2 +- .../ets/test/favoriteTestPromise.test.ets | 2 +- .../medialibrary/mediaLibrary_file/Test.json | 10 +- .../main/ets/test/fileTestCallback.test.ets | 2 +- .../main/ets/test/fileTestPromise.test.ets | 2 +- .../mediaLibrary_fileAsset/Test.json | 10 +- .../main/ets/test/fileAssetCallback2.test.ets | 2 +- .../main/ets/test/fileAssetPromise2.test.ets | 2 +- .../mediaLibrary_fileKey/Test.json | 10 +- .../ets/test/filekeyTestCallback.test.ets | 19 +-- .../main/ets/test/filekeyTestPromise.test.ets | 19 +-- .../mediaLibrary_fileResult/Test.json | 10 +- .../mediaLibrary_getExifNoLocation/Test.json | 10 +- .../mediaLibrary_getExiflocation/Test.json | 10 +- .../mediaLibrary_getThumbnail/Test.json | 10 +- .../mediaLibrary_mediafetchoptions/Test.json | 10 +- .../test/mediafetchoptionsCallback.test.ets | 2 +- .../medialibrary/mediaLibrary_trash/Test.json | 10 +- .../src/main/ets/test/trashCallback.test.ets | 2 +- .../src/main/ets/test/trashPromise.test.ets | 2 +- 31 files changed, 218 insertions(+), 468 deletions(-) diff --git a/multimedia/medialibrary/common.js b/multimedia/medialibrary/common.js index 5dad8ae88..6b8f6bc38 100644 --- a/multimedia/medialibrary/common.js +++ b/multimedia/medialibrary/common.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Huawei Device Co., Ltd. + * Copyright (C) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -95,9 +95,6 @@ const fileIdFetchOps = function (testNum, id) { }; const albumFetchOps = function (testNum, albumName, others) { - // if (!others) { - // others = { order: FILEKEY.DATE_ADDED + " DESC" }; - // } let ops = { selections: ALBUM_NAME + "= ?", selectionArgs: [albumName], diff --git a/multimedia/medialibrary/mediaLibrary_album/Test.json b/multimedia/medialibrary/mediaLibrary_album/Test.json index e21ca265e..7d7502478 100644 --- a/multimedia/medialibrary/mediaLibrary_album/Test.json +++ b/multimedia/medialibrary/mediaLibrary_album/Test.json @@ -18,9 +18,8 @@ "scanner", "sleep 5", "rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*", - "killall com.ohos.medialibrary.medialibrarydata", + "kill -9 `pidof com.ohos.medialibrary.medialibrarydata`", "sleep 3", - "mkdir -pv /storage/media/100/local/files/{Camera,Pictures,Videos,Audios,Documents,Download}", "mkdir /storage/media/100/local/temp", "param set persist.ace.testmode.enabled 1", "power-shell wakeup", @@ -56,7 +55,14 @@ "sleep 10" ], "teardown-command": [ - "power-shell setmode 600" + "power-shell setmode 600", + "rm -rf /storage/media/100/local/temp", + "rm -rf /storage/media/100/local/files/*", + "rm -rf /storage/media/100/local/files/.*", + "rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*", + "kill -9 `pidof com.ohos.medialibrary.medialibrarydata`", + "scanner", + "sleep 5" ] }, { diff --git a/multimedia/medialibrary/mediaLibrary_album/entry/src/main/ets/test/albumGetFileAssetsCallback.test.ets b/multimedia/medialibrary/mediaLibrary_album/entry/src/main/ets/test/albumGetFileAssetsCallback.test.ets index c6ce2c63d..636ecbd1e 100644 --- a/multimedia/medialibrary/mediaLibrary_album/entry/src/main/ets/test/albumGetFileAssetsCallback.test.ets +++ b/multimedia/medialibrary/mediaLibrary_album/entry/src/main/ets/test/albumGetFileAssetsCallback.test.ets @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Huawei Device Co., Ltd. + * Copyright (C) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -57,7 +57,7 @@ export default function albumGetFileAssetsCallbackTest(abilityContext) { const albumCountPass = await checkAlbumsCount(done, testNum, albumList, expectAlbumCount); if (!albumCountPass) return; // one asset type - + let count = 0; for (let i = 0; i < albumList.length; i++) { albumList[i].getFileAssets(allFetchOp(), (err, fetchFileResult) => { @@ -118,6 +118,7 @@ export default function albumGetFileAssetsCallbackTest(abilityContext) { done(); } } + const abnormalAlbumAssetsCount = async function (done, testNum, fetchOp, expectAssetsCount, expectAlbumCount = 1) { try { const albumList = await media.getAlbums(fetchOp); @@ -144,7 +145,7 @@ export default function albumGetFileAssetsCallbackTest(abilityContext) { done(); } } - + /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_01 * @tc.name : getFileAssets @@ -160,21 +161,6 @@ export default function albumGetFileAssetsCallbackTest(abilityContext) { await checkAlbumAssetsCount(done, testNum, currentFetchOp, assetsCount) }); - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_02 - * @tc.name : getFileAssets - * @tc.desc : check Videos album count,check asset count - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_02', 0, async function (done) { - const testNum = 'SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_02'; - let assetsCount = [2]; - let currentFetchOp = fileFetchOption(testNum, FILEKEY.ALBUM_NAME + "= ?", ['Videos']); - await checkAlbumAssetsCount(done, testNum, currentFetchOp, assetsCount) - }); - /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_03 * @tc.name : getFileAssets @@ -209,16 +195,16 @@ export default function albumGetFileAssetsCallbackTest(abilityContext) { /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_05 * @tc.name : getFileAssets - * @tc.desc : check two albums count,check asset count + * @tc.desc : check albums count,check asset count * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_05', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_05', 2, async function (done) { const testNum = 'SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_05'; let assetsCount = [2, 1]; const selections = FILEKEY.ALBUM_NAME + '= ? or ' + FILEKEY.ALBUM_NAME + '= ?'; - const currentFetchOp = fileFetchOption(testNum, selections, ['Videos', 'Camera']); + const currentFetchOp = fileFetchOption(testNum, selections, ['Screenshots', 'Camera']); let albumCount = 2; await checkAlbumAssetsCount(done, testNum, currentFetchOp, assetsCount, albumCount) }); @@ -226,34 +212,17 @@ export default function albumGetFileAssetsCallbackTest(abilityContext) { /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_06 * @tc.name : getFileAssets - * @tc.desc : check three albums count,check asset count + * @tc.desc : check albums count,check asset count * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_06', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_06', 2, async function (done) { const testNum = 'SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_06'; - let assetsCount = [2, 2, 1]; + let assetsCount = [2, 1]; const selections = FILEKEY.ALBUM_NAME + '= ? or ' + FILEKEY.ALBUM_NAME + '= ? or ' + FILEKEY.ALBUM_NAME + '= ?'; - const currentFetchOp = fileFetchOption(testNum, selections, ['Videos', 'Screenshots', 'Camera']); - let albumCount = 3; - await checkAlbumAssetsCount(done, testNum, currentFetchOp, assetsCount, albumCount) - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_07 - * @tc.name : getFileAssets - * @tc.desc : check four albums count,check asset count - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_07', 0, async function (done) { - const testNum = 'SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_07'; - let assetsCount = [2, 2, 1]; - const selections = FILEKEY.ALBUM_NAME + '= ? or ' + FILEKEY.ALBUM_NAME + '= ? or ' + FILEKEY.ALBUM_NAME + '= ? or ' + FILEKEY.ALBUM_NAME + '= ?'; - const currentFetchOp = fileFetchOption(testNum, selections, ['Camera', 'Videos', 'Screenshots', 'ScreenRecordings']); - let albumCount = 3; + const currentFetchOp = fileFetchOption(testNum, selections, ['ScreenRecordings', 'Screenshots', 'Camera']); + let albumCount = 2; await checkAlbumAssetsCount(done, testNum, currentFetchOp, assetsCount, albumCount) }); @@ -263,39 +232,24 @@ export default function albumGetFileAssetsCallbackTest(abilityContext) { * @tc.desc : Camera album,abnormal option * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_003_01', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_003_01', 2, async function (done) { const testNum = 'SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_003_01'; let currentFetchOp = fileFetchOption(testNum, FILEKEY.ALBUM_NAME + "= ?", ['Camera']); let assetsCount = 0; await abnormalAlbumAssetsCount(done, testNum, currentFetchOp, assetsCount) }); - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_003_02 - * @tc.name : getFileAssets - * @tc.desc : Videos album,abnormal option - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_003_02', 0, async function (done) { - const testNum = 'SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_003_02'; - let currentFetchOp = fileFetchOption(testNum, FILEKEY.ALBUM_NAME + "= ?", ['Videos']); - let assetsCount = 0; - await abnormalAlbumAssetsCount(done, testNum, currentFetchOp, assetsCount) - }); - /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_003_03 * @tc.name : getFileAssets * @tc.desc : Screenshots album,abnormal option * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_003_03', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_003_03', 2, async function (done) { const testNum = 'SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_003_03'; let currentFetchOp = fileFetchOption(testNum, FILEKEY.ALBUM_NAME + "= ?", ['Screenshots']); let assetsCount = 0; @@ -308,9 +262,9 @@ export default function albumGetFileAssetsCallbackTest(abilityContext) { * @tc.desc : ScreenRecordings album,abnormal option * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_003_04', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_003_04', 2, async function (done) { const testNum = 'SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_003_04'; let currentFetchOp = fileFetchOption(testNum, FILEKEY.ALBUM_NAME + "= ?", ['ScreenRecordings']); let assetsCount = 0; @@ -323,39 +277,24 @@ export default function albumGetFileAssetsCallbackTest(abilityContext) { * @tc.desc : Camera album,no option * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_004_01', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_004_01', 2, async function (done) { const testNum = 'SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_004_01'; let assetsCount = 1; let currentFetchOp = fileFetchOption(testNum, FILEKEY.ALBUM_NAME + "= ?", ['Camera']); await checkAlbumAssetsNoOps(done, testNum, currentFetchOp, assetsCount) }); - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_004_02 - * @tc.name : getFileAssets - * @tc.desc : Videos album,no option - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_004_02', 0, async function (done) { - const testNum = 'SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_004_02'; - let assetsCount = 2; - let currentFetchOp = fileFetchOption(testNum, FILEKEY.ALBUM_NAME + "= ?", ['Videos']); - await checkAlbumAssetsNoOps(done, testNum, currentFetchOp, assetsCount) - }); - /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_004_03 * @tc.name : getFileAssets * @tc.desc : Screenshots album,no option * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_004_03', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_004_03', 2, async function (done) { const testNum = 'SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_004_03'; let assetsCount = 2; let currentFetchOp = fileFetchOption(testNum, FILEKEY.ALBUM_NAME + "= ?", ['Screenshots']); @@ -368,9 +307,9 @@ export default function albumGetFileAssetsCallbackTest(abilityContext) { * @tc.desc : ScreenRecordings album,no option * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_004_04', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_004_04', 2, async function (done) { const testNum = 'SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_004_04'; let assetsCount = 2; let currentFetchOp = fileFetchOption(testNum, FILEKEY.ALBUM_NAME + "= ?", ['ScreenRecordings']); diff --git a/multimedia/medialibrary/mediaLibrary_album/entry/src/main/ets/test/albumGetFileAssetsPromise.test.ets b/multimedia/medialibrary/mediaLibrary_album/entry/src/main/ets/test/albumGetFileAssetsPromise.test.ets index 2cba1e672..1d9048e0e 100644 --- a/multimedia/medialibrary/mediaLibrary_album/entry/src/main/ets/test/albumGetFileAssetsPromise.test.ets +++ b/multimedia/medialibrary/mediaLibrary_album/entry/src/main/ets/test/albumGetFileAssetsPromise.test.ets @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Huawei Device Co., Ltd. + * Copyright (C) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -78,6 +78,7 @@ export default function albumGetFileAssetsPromiseTest(abilityContext) { done(); } }; + const checkAlbumAssetsNoOps = async function (done, testNum, fetchOp, expectAssetsCount, expectAlbumCount = 1) { try { const albumList = await media.getAlbums(fetchOp); @@ -86,7 +87,6 @@ export default function albumGetFileAssetsPromiseTest(abilityContext) { if (!albumCountPass) return; const album = albumList[0]; - let fetchFileResult = await album.getFileAssets(); if (fetchFileResult == undefined) { console.info(`${testNum} fetchFileResult undefined`); @@ -104,6 +104,7 @@ export default function albumGetFileAssetsPromiseTest(abilityContext) { done(); } }; + const abnormalAlbumAssetsCount = async function ( done, testNum, @@ -135,6 +136,7 @@ export default function albumGetFileAssetsPromiseTest(abilityContext) { done(); } }; + /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_01 * @tc.name : getFileAssets @@ -150,21 +152,6 @@ export default function albumGetFileAssetsPromiseTest(abilityContext) { await checkAlbumAssetsCount(done, testNum, currentFetchOp, assetsCount) }); - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_02 - * @tc.name : getFileAssets - * @tc.desc : check Videos album count,check asset count - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_02', 0, async function (done) { - const testNum = 'SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_02'; - let assetsCount = [2]; - let currentFetchOp = fileFetchOption(testNum, FILEKEY.ALBUM_NAME + "= ?", ['Videos']); - await checkAlbumAssetsCount(done, testNum, currentFetchOp, assetsCount) - }); - /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_03 * @tc.name : getFileAssets @@ -199,16 +186,16 @@ export default function albumGetFileAssetsPromiseTest(abilityContext) { /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_05 * @tc.name : getFileAssets - * @tc.desc : check two albums count,check asset count + * @tc.desc : check albums count,check asset count * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_05', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_05', 2, async function (done) { const testNum = 'SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_05'; let assetsCount = [2, 1]; const selections = FILEKEY.ALBUM_NAME + '= ? or ' + FILEKEY.ALBUM_NAME + '= ?'; - const currentFetchOp = fileFetchOption(testNum, selections, ['Videos', 'Camera']); + const currentFetchOp = fileFetchOption(testNum, selections, ['Screenshots', 'Camera']); let albumCount = 2; await checkAlbumAssetsCount(done, testNum, currentFetchOp, assetsCount, albumCount) }); @@ -216,34 +203,17 @@ export default function albumGetFileAssetsPromiseTest(abilityContext) { /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_06 * @tc.name : getFileAssets - * @tc.desc : check three albums count,check asset count + * @tc.desc : check albums count,check asset count * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_06', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_06', 2, async function (done) { const testNum = 'SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_06'; - let assetsCount = [2, 2, 1]; + let assetsCount = [2, 1]; const selections = FILEKEY.ALBUM_NAME + '= ? or ' + FILEKEY.ALBUM_NAME + '= ? or ' + FILEKEY.ALBUM_NAME + '= ?'; - const currentFetchOp = fileFetchOption(testNum, selections, ['Camera', 'Videos', 'Screenshots']); - let albumCount = 3; - await checkAlbumAssetsCount(done, testNum, currentFetchOp, assetsCount, albumCount) - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_07 - * @tc.name : getFileAssets - * @tc.desc : check four albums count,check asset count - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_07', 0, async function (done) { - const testNum = 'SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_07'; - let assetsCount = [2, 2, 1]; - const selections = FILEKEY.ALBUM_NAME + '= ? or ' + FILEKEY.ALBUM_NAME + '= ? or ' + FILEKEY.ALBUM_NAME + '= ? or ' + FILEKEY.ALBUM_NAME + '= ?'; - const currentFetchOp = fileFetchOption(testNum, selections, ['Camera', 'Videos', 'Screenshots', 'ScreenRecordings']); - let albumCount = 3; + const currentFetchOp = fileFetchOption(testNum, selections, ['Camera', 'ScreenRecordings', 'Screenshots']); + let albumCount = 2; await checkAlbumAssetsCount(done, testNum, currentFetchOp, assetsCount, albumCount) }); @@ -253,39 +223,24 @@ export default function albumGetFileAssetsPromiseTest(abilityContext) { * @tc.desc : Camera album,abnormal option * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_003_01', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_003_01', 2, async function (done) { const testNum = 'SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_003_01'; let currentFetchOp = fileFetchOption(testNum, FILEKEY.ALBUM_NAME + "= ?", ['Camera']); let assetsCount = 0; await abnormalAlbumAssetsCount(done, testNum, currentFetchOp, assetsCount) }); - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_003_02 - * @tc.name : getFileAssets - * @tc.desc : Videos album,abnormal option - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_003_02', 0, async function (done) { - const testNum = 'SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_003_02'; - let currentFetchOp = fileFetchOption(testNum, FILEKEY.ALBUM_NAME + "= ?", ['Videos']); - let assetsCount = 0; - await abnormalAlbumAssetsCount(done, testNum, currentFetchOp, assetsCount) - }); - /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_003_03 * @tc.name : getFileAssets * @tc.desc : Screenshots album,abnormal option * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_003_03', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_003_03', 2, async function (done) { const testNum = 'SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_003_03'; let currentFetchOp = fileFetchOption(testNum, FILEKEY.ALBUM_NAME + "= ?", ['Screenshots']); let assetsCount = 0; @@ -298,9 +253,9 @@ export default function albumGetFileAssetsPromiseTest(abilityContext) { * @tc.desc : ScreenRecordings album,abnormal option * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_003_04', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_003_04', 2, async function (done) { const testNum = 'SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_003_04'; let currentFetchOp = fileFetchOption(testNum, FILEKEY.ALBUM_NAME + "= ?", ['ScreenRecordings']); let assetsCount = 0; @@ -313,39 +268,24 @@ export default function albumGetFileAssetsPromiseTest(abilityContext) { * @tc.desc : Camera album,no option * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_004_01', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_004_01', 2, async function (done) { const testNum = 'SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_004_01'; let assetsCount = 1; let currentFetchOp = fileFetchOption(testNum, FILEKEY.ALBUM_NAME + "= ?", ['Camera']); await checkAlbumAssetsNoOps(done, testNum, currentFetchOp, assetsCount) }); - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_004_02 - * @tc.name : getFileAssets - * @tc.desc : Videos album,no option - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_004_02', 0, async function (done) { - const testNum = 'SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_004_02'; - let assetsCount = 2; - let currentFetchOp = fileFetchOption(testNum, FILEKEY.ALBUM_NAME + "= ?", ['Videos']); - await checkAlbumAssetsNoOps(done, testNum, currentFetchOp, assetsCount) - }); - /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_004_03 * @tc.name : getFileAssets * @tc.desc : Screenshots album,no option * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_004_03', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_004_03', 2, async function (done) { const testNum = 'SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_004_03'; let assetsCount = 2; let currentFetchOp = fileFetchOption(testNum, FILEKEY.ALBUM_NAME + "= ?", ['Screenshots']); @@ -358,9 +298,9 @@ export default function albumGetFileAssetsPromiseTest(abilityContext) { * @tc.desc : ScreenRecordings album,no option * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_004_04', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_004_04', 2, async function (done) { const testNum = 'SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_004_04'; let assetsCount = 2; let currentFetchOp = fileFetchOption(testNum, FILEKEY.ALBUM_NAME + "= ?", ['ScreenRecordings']); @@ -371,12 +311,11 @@ export default function albumGetFileAssetsPromiseTest(abilityContext) { * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_004_05 * @tc.name : getFileAssets * @tc.desc : getFileAssets by undefined option - * @tc.desc : ScreenRecordings album,no option * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it("SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_004_05", 0, async function (done) { + it("SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_004_05", 2, async function (done) { const testNum = "SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_004_05"; let fetchOp = fileFetchOption(testNum, FILEKEY.ALBUM_NAME + "= ?", ['Camera']); try { @@ -413,9 +352,9 @@ export default function albumGetFileAssetsPromiseTest(abilityContext) { * @tc.desc : getFileAssets by null option * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it("SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_004_06", 0, async function (done) { + it("SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_004_06", 2, async function (done) { const testNum = "SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_004_06"; let fetchOp = fileFetchOption(testNum, FILEKEY.ALBUM_NAME + "= ?", ['Camera']); try { diff --git a/multimedia/medialibrary/mediaLibrary_album/entry/src/main/ets/test/albumTestCallBack.test.ets b/multimedia/medialibrary/mediaLibrary_album/entry/src/main/ets/test/albumTestCallBack.test.ets index 123e771d2..4daafe9f3 100644 --- a/multimedia/medialibrary/mediaLibrary_album/entry/src/main/ets/test/albumTestCallBack.test.ets +++ b/multimedia/medialibrary/mediaLibrary_album/entry/src/main/ets/test/albumTestCallBack.test.ets @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Huawei Device Co., Ltd. + * Copyright (C) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -67,6 +67,7 @@ export default function albumTestCallbackTest(abilityContext) { expect(album.count).assertEqual(prop.count); expect(album.relativePath).assertEqual(relativePath); }; + const checkAlbumInfo = async function (done, testNum, fetchOp, relativePaths, props, expectAlbumCount) { try { media.getAlbums(fetchOp, async (err, albumList) => { @@ -221,30 +222,6 @@ export default function albumTestCallbackTest(abilityContext) { await checkAlbumInfo(done, testNum, currentFetchOp, relativePaths, props, expectAlbumCount); }); - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_001_02 - * @tc.name : getAlbums - * @tc.desc : get Videos album,check album info - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_001_02", 0, async function (done) { - const testNum = "SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_001_02"; - const selections = FILEKEY.ALBUM_NAME + '= ?'; - const currentFetchOp = fileFetchOption(testNum, selections, ['Videos']); - const relativePaths = ['']; - const expectAlbumCount = 1; - const props = [ - { - albumName: "Videos", - albumUri: "file://media/album/", - count: 2, - } - ]; - await checkAlbumInfo(done, testNum, currentFetchOp, relativePaths, props, expectAlbumCount); - }); - /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_001_03 * @tc.name : getAlbums @@ -296,7 +273,7 @@ export default function albumTestCallbackTest(abilityContext) { /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_001_05 * @tc.name : getAlbums - * @tc.desc : get Camera and Videos album,check album info + * @tc.desc : get Camera and Screenshots album,check album info * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 @@ -304,12 +281,12 @@ export default function albumTestCallbackTest(abilityContext) { it("SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_001_05", 0, async function (done) { const testNum = "SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_001_05"; const selections = FILEKEY.ALBUM_NAME + '= ? or ' + FILEKEY.ALBUM_NAME + '= ?'; - const currentFetchOp = fileFetchOption(testNum, selections, ['Camera', 'Videos']); + const currentFetchOp = fileFetchOption(testNum, selections, ['Camera', 'Screenshots']); const relativePaths = ['', '']; const expectAlbumCount = 2; const props = [ { - albumName: "Videos", + albumName: "Screenshots", albumUri: "file://media/album/", count: 2, }, @@ -325,7 +302,7 @@ export default function albumTestCallbackTest(abilityContext) { /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_001_06 * @tc.name : getAlbums - * @tc.desc : get Camera and Videos and Screenshots album,check album info + * @tc.desc : get Camera and ScreenRecordings and Screenshots album,check album info * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 @@ -333,49 +310,10 @@ export default function albumTestCallbackTest(abilityContext) { it("SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_001_06", 0, async function (done) { const testNum = "SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_001_06"; const selections = FILEKEY.ALBUM_NAME + '= ? or ' + FILEKEY.ALBUM_NAME + '= ? or ' + FILEKEY.ALBUM_NAME + '= ?'; - const currentFetchOp = fileFetchOption(testNum, selections, ['Camera', 'Videos', 'Screenshots']); - const relativePaths = ['', '', '']; - const expectAlbumCount = 3; - const props = [ - { - albumName: "Videos", - albumUri: "file://media/album/", - count: 2, - }, - { - albumName: "Screenshots", - albumUri: "file://media/album/", - count: 2, - }, - { - albumName: "Camera", - albumUri: "file://media/album/", - count: 1, - }, - ]; - await checkAlbumInfo(done, testNum, currentFetchOp, relativePaths, props, expectAlbumCount); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_001_07 - * @tc.name : getAlbums - * @tc.desc : get Camera and Videos and Screenshots and ScreenRecordings album,check album info - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_001_07", 0, async function (done) { - const testNum = "SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_001_07"; - const selections = FILEKEY.ALBUM_NAME + '= ? or ' + FILEKEY.ALBUM_NAME + '= ? or ' + FILEKEY.ALBUM_NAME + '= ? or ' + FILEKEY.ALBUM_NAME + '= ?'; - const currentFetchOp = fileFetchOption(testNum, selections, ['Camera', 'Videos', 'ScreenRecordings', 'Screenshots']); - const relativePaths = ['', '', '']; - const expectAlbumCount = 3; + const currentFetchOp = fileFetchOption(testNum, selections, ['Camera', 'ScreenRecordings', 'Screenshots']); + const relativePaths = ['', '']; + const expectAlbumCount = 2; const props = [ - { - albumName: "Videos", - albumUri: "file://media/album/", - count: 2, - }, { albumName: "Screenshots", albumUri: "file://media/album/", @@ -398,9 +336,9 @@ export default function albumTestCallbackTest(abilityContext) { * @tc.desc : Get Album Assets by fileHasArgsfetchOp3 * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it("SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_CALLBACK_002_06", 0, async function (done) { + it("SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_CALLBACK_002_06", 2, async function (done) { const testNum = "SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_CALLBACK_002_06"; const selections = FILEKEY.ALBUM_NAME + '= ?'; const currentFetchOp = fileFetchOption(testNum, selections, ['666']); @@ -413,9 +351,9 @@ export default function albumTestCallbackTest(abilityContext) { * @tc.desc : Get Album Assets by fileHasArgsfetchOp4 * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it("SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_CALLBACK_002_07", 0, async function (done) { + it("SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_CALLBACK_002_07", 2, async function (done) { let testNum = "SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_CALLBACK_002_07"; const selections = "666" + "= ?"; const currentFetchOp = fileFetchOption(testNum, selections, [VIDEO_TYPE.toString()]); @@ -428,9 +366,9 @@ export default function albumTestCallbackTest(abilityContext) { * @tc.desc : Get Album Assets by fileHasArgsfetchOp5 * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it("SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_CALLBACK_002_08", 0, async function (done) { + it("SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_CALLBACK_002_08", 2, async function (done) { const testNum = "SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_CALLBACK_002_08"; const selections = "666" + "= ?"; const currentFetchOp = fileFetchOption(testNum, selections, ['666']); @@ -445,9 +383,9 @@ export default function albumTestCallbackTest(abilityContext) { * @tc.desc : Modify Camera name '' * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it("SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_CALLBACK_003_01", 0, async function (done) { + it("SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_CALLBACK_003_01", 2, async function (done) { const testNum = "SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_CALLBACK_003_01"; const selections = FILEKEY.ALBUM_NAME + '= ?'; const currentFetchOp = fileFetchOption(testNum, selections, ['Camera']); @@ -456,32 +394,15 @@ export default function albumTestCallbackTest(abilityContext) { await abnormalAlbumCommitModify(done, testNum, currentFetchOp, newName, expectAlbumCount); }); - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_CALLBACK_003_02 - * @tc.name : commitModify - * @tc.desc : Modify Videos name '' - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_CALLBACK_003_02", 0, async function (done) { - const testNum = "SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_CALLBACK_003_02"; - const selections = FILEKEY.ALBUM_NAME + '= ?'; - const currentFetchOp = fileFetchOption(testNum, selections, ['Videos']); - const newName = ""; - const expectAlbumCount = 1; - await abnormalAlbumCommitModify(done, testNum, currentFetchOp, newName, expectAlbumCount); - }); - /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_CALLBACK_003_04 * @tc.name : commitModify * @tc.desc : Modify Album name 'aaaaa....' (256) * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it("SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_CALLBACK_003_04", 0, async function (done) { + it("SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_CALLBACK_003_04", 2, async function (done) { const testNum = "SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_CALLBACK_003_04"; const selections = FILEKEY.ALBUM_NAME + '= ?'; const currentFetchOp = fileFetchOption(testNum, selections, ['Screenshots']); @@ -499,9 +420,9 @@ export default function albumTestCallbackTest(abilityContext) { * @tc.desc : Modify Album name '中中中中中....' (86 *3) * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it("SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_CALLBACK_003_05", 0, async function (done) { + it("SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_CALLBACK_003_05", 2, async function (done) { const testNum = "SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_CALLBACK_003_05"; const selections = FILEKEY.ALBUM_NAME + '= ?'; const currentFetchOp = fileFetchOption(testNum, selections, ['Screenshots']); @@ -519,9 +440,9 @@ export default function albumTestCallbackTest(abilityContext) { * @tc.desc : Modify Album name 'aaaaaaa....' (255) * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it("SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_CALLBACK_003_06", 0, async function (done) { + it("SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_CALLBACK_003_06", 2, async function (done) { const testNum = "SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_CALLBACK_003_06"; const selections = FILEKEY.ALBUM_NAME + '= ?'; const currentFetchOp = fileFetchOption(testNum, selections, ['Screenshots']); diff --git a/multimedia/medialibrary/mediaLibrary_album/entry/src/main/ets/test/albumTestPromise.test.ets b/multimedia/medialibrary/mediaLibrary_album/entry/src/main/ets/test/albumTestPromise.test.ets index a846b1aea..0263db15e 100644 --- a/multimedia/medialibrary/mediaLibrary_album/entry/src/main/ets/test/albumTestPromise.test.ets +++ b/multimedia/medialibrary/mediaLibrary_album/entry/src/main/ets/test/albumTestPromise.test.ets @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Huawei Device Co., Ltd. + * Copyright (C) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -18,14 +18,8 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from import { sleep, - IMAGE_TYPE, - VIDEO_TYPE, - AUDIO_TYPE, FILEKEY, idFetchOps, - albumFetchOps, - albumTwoTypesFetchOps, - albumThreeTypesFetchOps, checkAlbumsCount, fileFetchOption, } from "../../../../../../common"; @@ -70,6 +64,7 @@ export default function albumTestPromiseTest(abilityContext) { expect(album.count).assertEqual(prop.count); expect(album.relativePath).assertEqual(relativePath); }; + const checkAlbumInfo = async function (done, testNum, fetchOp, relativePaths, props, expectAlbumCount = 1) { try { const albumList = await media.getAlbums(fetchOp); @@ -186,29 +181,6 @@ export default function albumTestPromiseTest(abilityContext) { await checkAlbumInfo(done, testNum, currentFetchOp, relativePaths, props); }); - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_001_02 - * @tc.name : getAlbums - * @tc.desc : get Videos album,check album info - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_001_02", 0, async function (done) { - let testNum = "SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_001_02"; - const selections = FILEKEY.ALBUM_NAME + '= ?'; - const currentFetchOp = fileFetchOption(testNum, selections, ['Videos']); - let relativePaths = [""]; - const props = [ - { - albumName: "Videos", - albumUri: "file://media/album/", - count: 2, - } - ]; - await checkAlbumInfo(done, testNum, currentFetchOp, relativePaths, props); - }); - /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_001_03 * @tc.name : getAlbums @@ -259,20 +231,20 @@ export default function albumTestPromiseTest(abilityContext) { /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_001_05 * @tc.name : getAlbums - * @tc.desc : get Camera and Videos album,check album info + * @tc.desc : get Camera and Screenshots album,check album info * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it("SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_001_05", 0, async function (done) { + it("SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_001_05", 2, async function (done) { let testNum = "SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_001_05"; const selections = FILEKEY.ALBUM_NAME + '= ? or ' + FILEKEY.ALBUM_NAME + '= ?'; - const currentFetchOp = fileFetchOption(testNum, selections, ['Camera', 'Videos']); + const currentFetchOp = fileFetchOption(testNum, selections, ['Camera', 'Screenshots']); let relativePaths = ['', '']; let albumCount = 2; const props = [ { - albumName: "Videos", + albumName: "Screenshots", albumUri: "file://media/album/", count: 2, }, @@ -288,57 +260,18 @@ export default function albumTestPromiseTest(abilityContext) { /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_001_06 * @tc.name : getAlbums - * @tc.desc : get Camera and Videos and Screenshots album,check album info + * @tc.desc : get Camera and ScreenRecordings and Screenshots album,check album info * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it("SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_001_06", 0, async function (done) { + it("SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_001_06", 2, async function (done) { let testNum = "SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_001_06"; const selections = FILEKEY.ALBUM_NAME + '= ? or ' + FILEKEY.ALBUM_NAME + '= ? or ' + FILEKEY.ALBUM_NAME + '= ?'; - const currentFetchOp = fileFetchOption(testNum, selections, ['Camera', 'Videos', 'Screenshots']); - let relativePaths = ['', '', '']; - let albumCount = 3; - const props = [ - { - albumName: "Videos", - albumUri: "file://media/album/", - count: 2, - }, - { - albumName: "Screenshots", - albumUri: "file://media/album/", - count: 2, - }, - { - albumName: "Camera", - albumUri: "file://media/album/", - count: 1, - }, - ]; - await checkAlbumInfo(done, testNum, currentFetchOp, relativePaths, props, albumCount); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_001_07 - * @tc.name : getAlbums - * @tc.desc : get Camera and Videos and Screenshots and ScreenRecordings album,check album info - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_001_07", 0, async function (done) { - let testNum = "SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_001_07"; - const selections = FILEKEY.ALBUM_NAME + '= ? or ' + FILEKEY.ALBUM_NAME + '= ? or ' + FILEKEY.ALBUM_NAME + '= ? or ' + FILEKEY.ALBUM_NAME + '= ?'; - const currentFetchOp = fileFetchOption(testNum, selections, ['Camera', 'Videos', 'ScreenRecordings', 'Screenshots']); - let relativePaths = ['', '', '']; - let albumCount = 3; + const currentFetchOp = fileFetchOption(testNum, selections, ['Camera', 'ScreenRecordings', 'Screenshots']); + let relativePaths = ['', '']; + let albumCount = 2; const props = [ - { - albumName: "Videos", - albumUri: "file://media/album/", - count: 2, - }, { albumName: "Screenshots", albumUri: "file://media/album/", @@ -361,9 +294,9 @@ export default function albumTestPromiseTest(abilityContext) { * @tc.desc : Get Album Assets by abnormal option * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it("SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_PROMISE_002_06", 0, async function (done) { + it("SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_PROMISE_002_06", 2, async function (done) { let testNum = "SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_PROMISE_002_06"; const selections = FILEKEY.ALBUM_NAME + '= ?'; const currentFetchOp = fileFetchOption(testNum, selections, ['666']); @@ -376,9 +309,9 @@ export default function albumTestPromiseTest(abilityContext) { * @tc.desc : Get Album Assets by abnormal option * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it("SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_PROMISE_002_07", 0, async function (done) { + it("SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_PROMISE_002_07", 2, async function (done) { let testNum = "SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_PROMISE_002_07"; const selections = '666' + '= ?'; const currentFetchOp = fileFetchOption(testNum, selections, ['Camera']); @@ -391,9 +324,9 @@ export default function albumTestPromiseTest(abilityContext) { * @tc.desc : Get Album Assets by abnormal option * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it("SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_PROMISE_002_08", 0, async function (done) { + it("SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_PROMISE_002_08", 2, async function (done) { let testNum = "SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_PROMISE_002_08"; const selections = '666' + '= ?'; const currentFetchOp = fileFetchOption(testNum, selections, ['666']); @@ -408,9 +341,9 @@ export default function albumTestPromiseTest(abilityContext) { * @tc.desc : Modify Camera name '' * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it("SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_PROMISE_003_01", 0, async function (done) { + it("SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_PROMISE_003_01", 2, async function (done) { let testNum = "SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_PROMISE_003_01"; const selections = FILEKEY.ALBUM_NAME + '= ?'; const currentFetchOp = fileFetchOption(testNum, selections, ['Camera']); @@ -419,32 +352,15 @@ export default function albumTestPromiseTest(abilityContext) { await abnormalAlbumCommitModify(done, testNum, currentFetchOp, newName, expectAlbumCount); }); - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_PROMISE_003_02 - * @tc.name : commitModify - * @tc.desc : Modify Videos name '' - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_PROMISE_003_02", 0, async function (done) { - let testNum = "SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_PROMISE_003_02"; - const selections = FILEKEY.ALBUM_NAME + '= ?'; - const currentFetchOp = fileFetchOption(testNum, selections, ['Videos']); - let newName = ""; - let expectAlbumCount = 1; - await abnormalAlbumCommitModify(done, testNum, currentFetchOp, newName, expectAlbumCount); - }); - /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_PROMISE_003_04 * @tc.name : commitModify * @tc.desc : Modify Screenshots name 'aaaaa....' (256) * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it("SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_PROMISE_003_04", 0, async function (done) { + it("SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_PROMISE_003_04", 2, async function (done) { let testNum = "SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_PROMISE_003_04"; const selections = FILEKEY.ALBUM_NAME + '= ?'; const currentFetchOp = fileFetchOption(testNum, selections, ['Screenshots']); @@ -462,9 +378,9 @@ export default function albumTestPromiseTest(abilityContext) { * @tc.desc : Modify Screenshots name '中中中中中....' (86 *3) * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it("SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_PROMISE_003_05", 0, async function (done) { + it("SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_PROMISE_003_05", 2, async function (done) { let testNum = "SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_PROMISE_003_05"; const selections = FILEKEY.ALBUM_NAME + '= ?'; const currentFetchOp = fileFetchOption(testNum, selections, ['Screenshots']); @@ -524,9 +440,9 @@ export default function albumTestPromiseTest(abilityContext) { * @tc.desc : check album.coverUri * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it("SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_004_01", 0, async function (done) { + it("SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_004_01", 2, async function (done) { let testNum = "SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_004_01"; try { let coverUrifetchOp = { diff --git a/multimedia/medialibrary/mediaLibrary_base/Test.json b/multimedia/medialibrary/mediaLibrary_base/Test.json index 16fa42989..b1ee582a6 100644 --- a/multimedia/medialibrary/mediaLibrary_base/Test.json +++ b/multimedia/medialibrary/mediaLibrary_base/Test.json @@ -18,7 +18,6 @@ "kill -9 `pidof com.ohos.medialibrary.medialibrarydata`", "scanner", "sleep 5", - "mkdir -pv /storage/media/100/local/files/{Camera,Pictures,Videos,Audios,Documents,Download}", "mkdir /storage/media/100/local/temp", "param set persist.ace.testmode.enabled 1", "power-shell wakeup", @@ -59,7 +58,14 @@ "sleep 10" ], "teardown-command": [ - "power-shell setmode 600" + "power-shell setmode 600", + "rm -rf /storage/media/100/local/temp", + "rm -rf /storage/media/100/local/files/*", + "rm -rf /storage/media/100/local/files/.*", + "rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*", + "kill -9 `pidof com.ohos.medialibrary.medialibrarydata`", + "scanner", + "sleep 5" ] }, { diff --git a/multimedia/medialibrary/mediaLibrary_base/entry/src/main/ets/test/mediaLibraryTestCallback.test.ets b/multimedia/medialibrary/mediaLibrary_base/entry/src/main/ets/test/mediaLibraryTestCallback.test.ets index 33b4c7ff9..f7f674c98 100644 --- a/multimedia/medialibrary/mediaLibrary_base/entry/src/main/ets/test/mediaLibraryTestCallback.test.ets +++ b/multimedia/medialibrary/mediaLibrary_base/entry/src/main/ets/test/mediaLibraryTestCallback.test.ets @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Huawei Device Co., Ltd. + * Copyright (C) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/multimedia/medialibrary/mediaLibrary_base/entry/src/main/ets/test/mediaLibraryTestPromise.test.ets b/multimedia/medialibrary/mediaLibrary_base/entry/src/main/ets/test/mediaLibraryTestPromise.test.ets index 06ce75958..2eef384c9 100644 --- a/multimedia/medialibrary/mediaLibrary_base/entry/src/main/ets/test/mediaLibraryTestPromise.test.ets +++ b/multimedia/medialibrary/mediaLibrary_base/entry/src/main/ets/test/mediaLibraryTestPromise.test.ets @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Huawei Device Co., Ltd. + * Copyright (C) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/multimedia/medialibrary/mediaLibrary_base/entry/src/main/ets/test/mediaLibraryTestPromiseOnOff.test.ets b/multimedia/medialibrary/mediaLibrary_base/entry/src/main/ets/test/mediaLibraryTestPromiseOnOff.test.ets index da3e241d6..74559fafc 100644 --- a/multimedia/medialibrary/mediaLibrary_base/entry/src/main/ets/test/mediaLibraryTestPromiseOnOff.test.ets +++ b/multimedia/medialibrary/mediaLibrary_base/entry/src/main/ets/test/mediaLibraryTestPromiseOnOff.test.ets @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Huawei Device Co., Ltd. + * Copyright (C) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/multimedia/medialibrary/mediaLibrary_favorite/Test.json b/multimedia/medialibrary/mediaLibrary_favorite/Test.json index 73b643da9..ddf8fb96a 100644 --- a/multimedia/medialibrary/mediaLibrary_favorite/Test.json +++ b/multimedia/medialibrary/mediaLibrary_favorite/Test.json @@ -18,7 +18,6 @@ "kill -9 `pidof com.ohos.medialibrary.medialibrarydata`", "scanner", "sleep 5", - "mkdir -pv /storage/media/100/local/files/{Camera,Pictures,Videos,Audios,Documents,Download}", "mkdir /storage/media/100/local/temp", "param set persist.ace.testmode.enabled 1", "power-shell wakeup", @@ -57,7 +56,14 @@ "sleep 10" ], "teardown-command": [ - "power-shell setmode 600" + "power-shell setmode 600", + "rm -rf /storage/media/100/local/temp", + "rm -rf /storage/media/100/local/files/*", + "rm -rf /storage/media/100/local/files/.*", + "rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*", + "kill -9 `pidof com.ohos.medialibrary.medialibrarydata`", + "scanner", + "sleep 5" ] }, { diff --git a/multimedia/medialibrary/mediaLibrary_favorite/entry/src/main/ets/test/favoriteTestCallback.test.ets b/multimedia/medialibrary/mediaLibrary_favorite/entry/src/main/ets/test/favoriteTestCallback.test.ets index a0819f36b..d634a50fb 100644 --- a/multimedia/medialibrary/mediaLibrary_favorite/entry/src/main/ets/test/favoriteTestCallback.test.ets +++ b/multimedia/medialibrary/mediaLibrary_favorite/entry/src/main/ets/test/favoriteTestCallback.test.ets @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Huawei Device Co., Ltd. + * Copyright (C) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/multimedia/medialibrary/mediaLibrary_favorite/entry/src/main/ets/test/favoriteTestPromise.test.ets b/multimedia/medialibrary/mediaLibrary_favorite/entry/src/main/ets/test/favoriteTestPromise.test.ets index 43b902bea..3c80bb15b 100644 --- a/multimedia/medialibrary/mediaLibrary_favorite/entry/src/main/ets/test/favoriteTestPromise.test.ets +++ b/multimedia/medialibrary/mediaLibrary_favorite/entry/src/main/ets/test/favoriteTestPromise.test.ets @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Huawei Device Co., Ltd. + * Copyright (C) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/multimedia/medialibrary/mediaLibrary_file/Test.json b/multimedia/medialibrary/mediaLibrary_file/Test.json index ad446464e..85e583c29 100644 --- a/multimedia/medialibrary/mediaLibrary_file/Test.json +++ b/multimedia/medialibrary/mediaLibrary_file/Test.json @@ -18,7 +18,6 @@ "kill -9 `pidof com.ohos.medialibrary.medialibrarydata`", "scanner", "sleep 5", - "mkdir -pv /storage/media/100/local/files/{Camera,Pictures,Videos,Audios,Documents,Download}", "mkdir /storage/media/100/local/temp", "param set persist.ace.testmode.enabled 1", "power-shell wakeup", @@ -61,7 +60,14 @@ "sleep 10" ], "teardown-command": [ - "power-shell setmode 600" + "power-shell setmode 600", + "rm -rf /storage/media/100/local/temp", + "rm -rf /storage/media/100/local/files/*", + "rm -rf /storage/media/100/local/files/.*", + "rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*", + "kill -9 `pidof com.ohos.medialibrary.medialibrarydata`", + "scanner", + "sleep 5" ] }, { diff --git a/multimedia/medialibrary/mediaLibrary_file/entry/src/main/ets/test/fileTestCallback.test.ets b/multimedia/medialibrary/mediaLibrary_file/entry/src/main/ets/test/fileTestCallback.test.ets index 9036655ca..5b190949e 100644 --- a/multimedia/medialibrary/mediaLibrary_file/entry/src/main/ets/test/fileTestCallback.test.ets +++ b/multimedia/medialibrary/mediaLibrary_file/entry/src/main/ets/test/fileTestCallback.test.ets @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Huawei Device Co., Ltd. + * Copyright (C) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/multimedia/medialibrary/mediaLibrary_file/entry/src/main/ets/test/fileTestPromise.test.ets b/multimedia/medialibrary/mediaLibrary_file/entry/src/main/ets/test/fileTestPromise.test.ets index 42a19ffea..3800d67a0 100644 --- a/multimedia/medialibrary/mediaLibrary_file/entry/src/main/ets/test/fileTestPromise.test.ets +++ b/multimedia/medialibrary/mediaLibrary_file/entry/src/main/ets/test/fileTestPromise.test.ets @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Huawei Device Co., Ltd. + * Copyright (C) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/multimedia/medialibrary/mediaLibrary_fileAsset/Test.json b/multimedia/medialibrary/mediaLibrary_fileAsset/Test.json index 99056f433..499fbd49c 100644 --- a/multimedia/medialibrary/mediaLibrary_fileAsset/Test.json +++ b/multimedia/medialibrary/mediaLibrary_fileAsset/Test.json @@ -18,7 +18,6 @@ "kill -9 `pidof com.ohos.medialibrary.medialibrarydata`", "scanner", "sleep 5", - "mkdir -pv /storage/media/100/local/files/{Camera,Pictures,Videos,Audios,Documents,Download}", "mkdir /storage/media/100/local/temp", "param set persist.ace.testmode.enabled 1", "power-shell wakeup", @@ -61,7 +60,14 @@ "sleep 10" ], "teardown-command": [ - "power-shell setmode 600" + "power-shell setmode 600", + "rm -rf /storage/media/100/local/temp", + "rm -rf /storage/media/100/local/files/*", + "rm -rf /storage/media/100/local/files/.*", + "rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*", + "kill -9 `pidof com.ohos.medialibrary.medialibrarydata`", + "scanner", + "sleep 5" ] }, { diff --git a/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetCallback2.test.ets b/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetCallback2.test.ets index 8087b98e7..e758d62a2 100644 --- a/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetCallback2.test.ets +++ b/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetCallback2.test.ets @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Huawei Device Co., Ltd. + * Copyright (C) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetPromise2.test.ets b/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetPromise2.test.ets index 513a8cd2e..8b27aa540 100644 --- a/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetPromise2.test.ets +++ b/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetPromise2.test.ets @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Huawei Device Co., Ltd. + * Copyright (C) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/multimedia/medialibrary/mediaLibrary_fileKey/Test.json b/multimedia/medialibrary/mediaLibrary_fileKey/Test.json index 9b442aacb..fad234aef 100644 --- a/multimedia/medialibrary/mediaLibrary_fileKey/Test.json +++ b/multimedia/medialibrary/mediaLibrary_fileKey/Test.json @@ -18,7 +18,6 @@ "kill -9 `pidof com.ohos.medialibrary.medialibrarydata`", "scanner", "sleep 5", - "mkdir -pv /storage/media/100/local/files/{Camera,Pictures,Videos,Audios,Documents,Download}", "mkdir /storage/media/100/local/temp", "param set persist.ace.testmode.enabled 1", "power-shell wakeup", @@ -53,7 +52,14 @@ "sleep 10" ], "teardown-command": [ - "power-shell setmode 600" + "power-shell setmode 600", + "rm -rf /storage/media/100/local/temp", + "rm -rf /storage/media/100/local/files/*", + "rm -rf /storage/media/100/local/files/.*", + "rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*", + "kill -9 `pidof com.ohos.medialibrary.medialibrarydata`", + "scanner", + "sleep 5" ] }, { diff --git a/multimedia/medialibrary/mediaLibrary_fileKey/entry/src/main/ets/test/filekeyTestCallback.test.ets b/multimedia/medialibrary/mediaLibrary_fileKey/entry/src/main/ets/test/filekeyTestCallback.test.ets index 6697e6876..5f13a7841 100644 --- a/multimedia/medialibrary/mediaLibrary_fileKey/entry/src/main/ets/test/filekeyTestCallback.test.ets +++ b/multimedia/medialibrary/mediaLibrary_fileKey/entry/src/main/ets/test/filekeyTestCallback.test.ets @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Huawei Device Co., Ltd. + * Copyright (C) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -49,7 +49,6 @@ export default function filekeyTestCallbackTest(abilityContext) { }); const { - PARENT, MIME_TYPE, SIZE, DATE_ADDED, @@ -59,14 +58,12 @@ export default function filekeyTestCallbackTest(abilityContext) { WIDTH, HEIGHT, ORIENTATION, - ALBUM_ID, ARTIST, AUDIOALBUM, DATE_MODIFIED, DATE_TAKEN, RELATIVE_PATH, DISPLAY_NAME, - MEDIA_TYPE, } = FILEKEY; async function getFileAssetsBy(done, testNum, type, fileKey) { @@ -107,20 +104,6 @@ export default function filekeyTestCallbackTest(abilityContext) { } } - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FILE_KEY_CALLBACK_001 - * @tc.name : getFileAssets - * @tc.desc : filekey parentOp - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it("SUB_MEDIA_MEDIALIBRARY_FILE_KEY_CALLBACK_001", 0, async function (done) { - let testNum = "SUB_MEDIA_MEDIALIBRARY_FILE_KEY_CALLBACK_001"; - await getFileAssetsBy(done, testNum, "parent", PARENT); - }); - /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_FILE_KEY_CALLBACK_002 * @tc.name : getFileAssets diff --git a/multimedia/medialibrary/mediaLibrary_fileKey/entry/src/main/ets/test/filekeyTestPromise.test.ets b/multimedia/medialibrary/mediaLibrary_fileKey/entry/src/main/ets/test/filekeyTestPromise.test.ets index 37acf5c9e..ccb0af234 100644 --- a/multimedia/medialibrary/mediaLibrary_fileKey/entry/src/main/ets/test/filekeyTestPromise.test.ets +++ b/multimedia/medialibrary/mediaLibrary_fileKey/entry/src/main/ets/test/filekeyTestPromise.test.ets @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Huawei Device Co., Ltd. + * Copyright (C) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -46,7 +46,6 @@ export default function filekeyTestPromiseTest(abilityContext) { }); const { - PARENT, MIME_TYPE, SIZE, DATE_ADDED, @@ -56,14 +55,12 @@ export default function filekeyTestPromiseTest(abilityContext) { WIDTH, HEIGHT, ORIENTATION, - ALBUM_ID, ARTIST, AUDIOALBUM, DATE_MODIFIED, DATE_TAKEN, RELATIVE_PATH, DISPLAY_NAME, - MEDIA_TYPE, } = FILEKEY; async function getFileAssetsBy(done, testNum, type, fileKey) { @@ -97,20 +94,6 @@ export default function filekeyTestPromiseTest(abilityContext) { } } - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FILE_KEY_PROMISE_001 - * @tc.name : getFileAssets - * @tc.desc : filekey parentOp - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it("SUB_MEDIA_MEDIALIBRARY_FILE_KEY_PROMISE_001", 0, async function (done) { - let testNum = "SUB_MEDIA_MEDIALIBRARY_FILE_KEY_PROMISE_001"; - await getFileAssetsBy(done, testNum, "parent", PARENT); - }); - /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_FILE_KEY_PROMISE_002 * @tc.name : getFileAssets diff --git a/multimedia/medialibrary/mediaLibrary_fileResult/Test.json b/multimedia/medialibrary/mediaLibrary_fileResult/Test.json index 7bd462a2b..1d2917047 100644 --- a/multimedia/medialibrary/mediaLibrary_fileResult/Test.json +++ b/multimedia/medialibrary/mediaLibrary_fileResult/Test.json @@ -18,7 +18,6 @@ "kill -9 `pidof com.ohos.medialibrary.medialibrarydata`", "scanner", "sleep 5", - "mkdir -pv /storage/media/100/local/files/{Camera,Pictures,Videos,Audios,Documents,Download}", "mkdir /storage/media/100/local/temp", "param set persist.ace.testmode.enabled 1", "power-shell wakeup", @@ -57,7 +56,14 @@ "sleep 10" ], "teardown-command": [ - "power-shell setmode 600" + "power-shell setmode 600", + "rm -rf /storage/media/100/local/temp", + "rm -rf /storage/media/100/local/files/*", + "rm -rf /storage/media/100/local/files/.*", + "rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*", + "kill -9 `pidof com.ohos.medialibrary.medialibrarydata`", + "scanner", + "sleep 5" ] }, { diff --git a/multimedia/medialibrary/mediaLibrary_getExifNoLocation/Test.json b/multimedia/medialibrary/mediaLibrary_getExifNoLocation/Test.json index 7f5880669..62e7bdbc2 100644 --- a/multimedia/medialibrary/mediaLibrary_getExifNoLocation/Test.json +++ b/multimedia/medialibrary/mediaLibrary_getExifNoLocation/Test.json @@ -18,7 +18,6 @@ "kill -9 `pidof com.ohos.medialibrary.medialibrarydata`", "scanner", "sleep 5", - "mkdir -pv /storage/media/100/local/files/{Camera,Pictures,Videos,Audios,Documents,Download}", "mkdir /storage/media/100/local/temp", "param set persist.ace.testmode.enabled 1", "power-shell wakeup", @@ -48,7 +47,14 @@ "sleep 10" ], "teardown-command": [ - "power-shell setmode 600" + "power-shell setmode 600", + "rm -rf /storage/media/100/local/temp", + "rm -rf /storage/media/100/local/files/*", + "rm -rf /storage/media/100/local/files/.*", + "rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*", + "kill -9 `pidof com.ohos.medialibrary.medialibrarydata`", + "scanner", + "sleep 5" ] }, { diff --git a/multimedia/medialibrary/mediaLibrary_getExiflocation/Test.json b/multimedia/medialibrary/mediaLibrary_getExiflocation/Test.json index d5c6e5b00..5ded43bde 100644 --- a/multimedia/medialibrary/mediaLibrary_getExiflocation/Test.json +++ b/multimedia/medialibrary/mediaLibrary_getExiflocation/Test.json @@ -18,7 +18,6 @@ "kill -9 `pidof com.ohos.medialibrary.medialibrarydata`", "scanner", "sleep 5", - "mkdir -pv /storage/media/100/local/files/{Camera,Pictures,Videos,Audios,Documents,Download}", "mkdir /storage/media/100/local/temp", "param set persist.ace.testmode.enabled 1", "power-shell wakeup", @@ -48,7 +47,14 @@ "sleep 10" ], "teardown-command": [ - "power-shell setmode 600" + "power-shell setmode 600", + "rm -rf /storage/media/100/local/temp", + "rm -rf /storage/media/100/local/files/*", + "rm -rf /storage/media/100/local/files/.*", + "rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*", + "kill -9 `pidof com.ohos.medialibrary.medialibrarydata`", + "scanner", + "sleep 5" ] }, { diff --git a/multimedia/medialibrary/mediaLibrary_getThumbnail/Test.json b/multimedia/medialibrary/mediaLibrary_getThumbnail/Test.json index e15822d87..c2aed8c1c 100644 --- a/multimedia/medialibrary/mediaLibrary_getThumbnail/Test.json +++ b/multimedia/medialibrary/mediaLibrary_getThumbnail/Test.json @@ -18,7 +18,6 @@ "kill -9 `pidof com.ohos.medialibrary.medialibrarydata`", "scanner", "sleep 5", - "mkdir -pv /storage/media/100/local/files/{Camera,Pictures,Videos,Audios,Documents,Download}", "mkdir /storage/media/100/local/temp", "param set persist.ace.testmode.enabled 1", "power-shell wakeup", @@ -54,7 +53,14 @@ "sleep 10" ], "teardown-command": [ - "power-shell setmode 600" + "power-shell setmode 600", + "rm -rf /storage/media/100/local/temp", + "rm -rf /storage/media/100/local/files/*", + "rm -rf /storage/media/100/local/files/.*", + "rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*", + "kill -9 `pidof com.ohos.medialibrary.medialibrarydata`", + "scanner", + "sleep 5" ] }, { diff --git a/multimedia/medialibrary/mediaLibrary_mediafetchoptions/Test.json b/multimedia/medialibrary/mediaLibrary_mediafetchoptions/Test.json index e160957bc..6d2d16b94 100644 --- a/multimedia/medialibrary/mediaLibrary_mediafetchoptions/Test.json +++ b/multimedia/medialibrary/mediaLibrary_mediafetchoptions/Test.json @@ -18,7 +18,6 @@ "kill -9 `pidof com.ohos.medialibrary.medialibrarydata`", "scanner", "sleep 5", - "mkdir -pv /storage/media/100/local/files/{Camera,Pictures,Videos,Audios,Documents,Download}", "mkdir /storage/media/100/local/temp", "param set persist.ace.testmode.enabled 1", "power-shell wakeup", @@ -54,7 +53,14 @@ "sleep 10" ], "teardown-command": [ - "power-shell setmode 600" + "power-shell setmode 600", + "rm -rf /storage/media/100/local/temp", + "rm -rf /storage/media/100/local/files/*", + "rm -rf /storage/media/100/local/files/.*", + "rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*", + "kill -9 `pidof com.ohos.medialibrary.medialibrarydata`", + "scanner", + "sleep 5" ] }, { diff --git a/multimedia/medialibrary/mediaLibrary_mediafetchoptions/entry/src/main/ets/test/mediafetchoptionsCallback.test.ets b/multimedia/medialibrary/mediaLibrary_mediafetchoptions/entry/src/main/ets/test/mediafetchoptionsCallback.test.ets index 954535e23..2dab92a01 100644 --- a/multimedia/medialibrary/mediaLibrary_mediafetchoptions/entry/src/main/ets/test/mediafetchoptionsCallback.test.ets +++ b/multimedia/medialibrary/mediaLibrary_mediafetchoptions/entry/src/main/ets/test/mediafetchoptionsCallback.test.ets @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Huawei Device Co., Ltd. + * Copyright (C) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/multimedia/medialibrary/mediaLibrary_trash/Test.json b/multimedia/medialibrary/mediaLibrary_trash/Test.json index 4c6d82c78..1c8eeb168 100644 --- a/multimedia/medialibrary/mediaLibrary_trash/Test.json +++ b/multimedia/medialibrary/mediaLibrary_trash/Test.json @@ -18,7 +18,6 @@ "kill -9 `pidof com.ohos.medialibrary.medialibrarydata`", "scanner", "sleep 5", - "mkdir -pv /storage/media/100/local/files/{Camera,Pictures,Videos,Audios,Documents,Download}", "mkdir /storage/media/100/local/temp", "param set persist.ace.testmode.enabled 1", "power-shell wakeup", @@ -57,7 +56,14 @@ "sleep 10" ], "teardown-command": [ - "power-shell setmode 600" + "power-shell setmode 600", + "rm -rf /storage/media/100/local/temp", + "rm -rf /storage/media/100/local/files/*", + "rm -rf /storage/media/100/local/files/.*", + "rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*", + "kill -9 `pidof com.ohos.medialibrary.medialibrarydata`", + "scanner", + "sleep 5" ] }, { diff --git a/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/ets/test/trashCallback.test.ets b/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/ets/test/trashCallback.test.ets index e632e9c1f..61b0c770e 100644 --- a/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/ets/test/trashCallback.test.ets +++ b/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/ets/test/trashCallback.test.ets @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Huawei Device Co., Ltd. + * Copyright (C) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/ets/test/trashPromise.test.ets b/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/ets/test/trashPromise.test.ets index 78ab3b8e6..87bc7faf4 100644 --- a/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/ets/test/trashPromise.test.ets +++ b/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/ets/test/trashPromise.test.ets @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Huawei Device Co., Ltd. + * Copyright (C) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -- GitLab