提交 59c50192 编写于 作者: Y yangbo

update

Signed-off-by: Nyangbo <yangbo258@huawei.com>
上级 435ea842
/*
* 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],
......
......@@ -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"
]
},
{
......
/*
* 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']);
......
/*
* 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 {
......
/*
* 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']);
......
/*
* 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 = {
......
......@@ -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"
]
},
{
......
/*
* 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
......
/*
* 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
......
/*
* 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,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"
]
},
{
......
/*
* 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
......
/*
* 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,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"
]
},
{
......
/*
* 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
......
/*
* 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,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"
]
},
{
......
/*
* 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
......
/*
* 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,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"
]
},
{
......
/*
* 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
......
/*
* 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
......
......@@ -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"
]
},
{
......
......@@ -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"
]
},
{
......
......@@ -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"
]
},
{
......
......@@ -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"
]
},
{
......
......@@ -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"
]
},
{
......
/*
* 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,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"
]
},
{
......
/*
* 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
......
/*
* 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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册