From 95a4e0f303eddce79752861c042b098246d437cf Mon Sep 17 00:00:00 2001 From: yangbo Date: Tue, 4 Jul 2023 10:27:18 +0800 Subject: [PATCH] fixbug 3.0 Signed-off-by: yangbo --- multimedia/photoAccess/common.ts | 1 + .../entry/src/main/ets/test/List.test.ets | 16 +- .../createAsset.ets | 244 ++++++------------ .../getAlbums.ets | 0 .../getAssets.ets | 8 +- .../registerChange.ets} | 30 +-- .../release.ets | 0 .../unRegisterChange.ets} | 42 +-- .../main/ets/test/PhotoAsset/commitModify.ets | 76 +++--- .../ets/test/PhotoAsset/getReadOnlyFd.ets | 12 +- .../ets/test/PhotoAssetFetchResult/close.ets | 10 +- .../PhotoAssetFetchResult/getLastObject.ets | 6 +- .../getObjectByPosition.ets | 6 +- .../photoAccess/photoAccessSystem/BUILD.gn | 12 +- .../ets/test/publicApiTestWithSystemApi.ets | 74 +++--- .../main/resources/base/element/string.json | 6 +- 16 files changed, 234 insertions(+), 309 deletions(-) rename multimedia/photoAccess/photoAccess/entry/src/main/ets/test/{UserFileManager => PhotoAccessHelper}/createAsset.ets (70%) rename multimedia/photoAccess/photoAccess/entry/src/main/ets/test/{UserFileManager => PhotoAccessHelper}/getAlbums.ets (100%) rename multimedia/photoAccess/photoAccess/entry/src/main/ets/test/{UserFileManager => PhotoAccessHelper}/getAssets.ets (97%) rename multimedia/photoAccess/photoAccess/entry/src/main/ets/test/{UserFileManager/on.ets => PhotoAccessHelper/registerChange.ets} (88%) rename multimedia/photoAccess/photoAccess/entry/src/main/ets/test/{UserFileManager => PhotoAccessHelper}/release.ets (100%) rename multimedia/photoAccess/photoAccess/entry/src/main/ets/test/{UserFileManager/off.ets => PhotoAccessHelper/unRegisterChange.ets} (89%) diff --git a/multimedia/photoAccess/common.ts b/multimedia/photoAccess/common.ts index 43eeea984..40d8c44c6 100644 --- a/multimedia/photoAccess/common.ts +++ b/multimedia/photoAccess/common.ts @@ -13,6 +13,7 @@ * limitations under the License. */ +// @ts-nocheck import photoAccessHelper from '@ohos.file.photoAccessHelper'; import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; import bundleManager from '@ohos.bundle.bundleManager'; diff --git a/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/List.test.ets b/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/List.test.ets index b2aee5235..09fe90f6c 100644 --- a/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/List.test.ets +++ b/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/List.test.ets @@ -35,12 +35,12 @@ import assetGetLastObjectTest from './PhotoAssetFetchResult/getLastObject' import assetGetNextObjectTest from './PhotoAssetFetchResult/getNextObject' import assetGetPositionObjectTest from './PhotoAssetFetchResult/getObjectByPosition' import assetIsAfterLastTest from './PhotoAssetFetchResult/isAfterLast' -import createAssetTest from './UserFileManager/createAsset' -import getAlbumsTest from './UserFileManager/getAlbums' -import getAssetsTest from './UserFileManager/getAssets' -import offTest from './UserFileManager/off' -import onTest from './UserFileManager/on' -import releaseTest from './UserFileManager/release' +import createAssetTest from './PhotoAccessHelper/createAsset' +import getAlbumsTest from './PhotoAccessHelper/getAlbums' +import getAssetsTest from './PhotoAccessHelper/getAssets' +import unRegisterChangeTest from './PhotoAccessHelper/unRegisterChange' +import registerChangeTest from './PhotoAccessHelper/registerChange' +import releaseTest from './PhotoAccessHelper/release' import checkAttrTest from './PhotoAsset/checkAttr' import closeTest from './PhotoAsset/close' import commitModifyTest from './PhotoAsset/commitModify' @@ -74,8 +74,8 @@ export default function testsuite () { createAssetTest() getAlbumsTest() getAssetsTest() - offTest() - onTest() + unRegisterChangeTest() + registerChangeTest() releaseTest() checkAttrTest() closeTest() diff --git a/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/UserFileManager/createAsset.ets b/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAccessHelper/createAsset.ets similarity index 70% rename from multimedia/photoAccess/photoAccess/entry/src/main/ets/test/UserFileManager/createAsset.ets rename to multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAccessHelper/createAsset.ets index e0ec3ce58..8142cb365 100644 --- a/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/UserFileManager/createAsset.ets +++ b/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAccessHelper/createAsset.ets @@ -24,7 +24,7 @@ export default function createAssetTest () { async function createAssetCallback1 (done, testNum, type, extension, options) { try { - helper.createAsset(type, extension, options, (err, uri) => { + helper.createAsset(type, extension, options, (err, uri) => { try { if (err !== undefined) { console.info(`${testNum} err: ${err}`); @@ -38,15 +38,15 @@ export default function createAssetTest () { done(); }) } catch (error) { - console.info(`${testNum} failed; error: ${error}`); - expect(false).assertTrue(); - done(); + console.info(`${testNum} failed; error: ${error}`); + expect(false).assertTrue(); + done(); } } async function createAssetCallback2 (done, testNum, type, extension) { try { - helper.createAsset(type, extension, (err, uri) => { + helper.createAsset(type, extension, (err, uri) => { try { if (err !== undefined) { console.info(`${testNum} err: ${err}`); @@ -60,15 +60,15 @@ export default function createAssetTest () { done(); }) } catch (error) { - console.info(`${testNum} failed; error: ${error}`); - expect(false).assertTrue(); - done(); + console.info(`${testNum} failed; error: ${error}`); + expect(false).assertTrue(); + done(); } } async function createAssetAbnormalCallback1 (done, testNum, type, extension, options) { try { - helper.createAsset(type, extension, options, (err, uri) => { + helper.createAsset(type, extension, options, (err, uri) => { try { if (err !== undefined) { console.info(`${testNum} err: ${err}`); @@ -82,9 +82,9 @@ export default function createAssetTest () { done(); }) } catch (error) { - console.info(`${testNum} failed; error: ${error}`); - expect(true).assertTrue(); - done(); + console.info(`${testNum} failed; error: ${error}`); + expect(true).assertTrue(); + done(); } } @@ -93,9 +93,9 @@ export default function createAssetTest () { await helper.createAsset(type, extension, options); done(); } catch (error) { - console.info(`${testNum} failed; error: ${error}`); - expect(false).assertTrue(); - done(); + console.info(`${testNum} failed; error: ${error}`); + expect(false).assertTrue(); + done(); } } @@ -104,21 +104,21 @@ export default function createAssetTest () { await helper.createAsset(type, extension); done(); } catch (error) { - console.info(`${testNum} failed; error: ${error}`); - expect(false).assertTrue(); - done(); + console.info(`${testNum} failed; error: ${error}`); + expect(false).assertTrue(); + done(); } } async function createAssetAbnormalPromise1 (done, testNum, type, extension, options) { try { await helper.createAsset(type, extension, options); - expect(false).assertTrue(); + expect(false).assertTrue(); done() } catch (error) { - console.info(`${testNum} failed; error: ${error}`); - expect(true).assertTrue(); - done(); + console.info(`${testNum} failed; error: ${error}`); + expect(true).assertTrue(); + done(); } } @@ -131,13 +131,13 @@ export default function createAssetTest () { * @tc.level : Level 0 */ it('createImage_callback_000', 0, async function (done) { - const testNum = 'createImage_callback_000'; + const testNum = 'createImage_callback_000'; const type = photoType.IMAGE; const extension = 'jpg'; const options: photoAccessHelper.CreateOptions = { title: testNum } - await createAssetCallback1(done, testNum, type, extension, options); + await createAssetCallback1(done, testNum, type, extension, options); }); /** @@ -149,10 +149,10 @@ export default function createAssetTest () { * @tc.level : Level 0 */ it('createImage_callback_001', 0, async function (done) { - const testNum = 'createImage_callback_001'; + const testNum = 'createImage_callback_001'; const type = photoType.IMAGE; const extension = 'jpg'; - await createAssetCallback2(done, testNum, type, extension); + await createAssetCallback2(done, testNum, type, extension); }); /** @@ -164,13 +164,13 @@ export default function createAssetTest () { * @tc.level : Level 2 */ it('createImage_callback_002', 2, async function (done) { - const testNum = 'createImage_callback_002'; + const testNum = 'createImage_callback_002'; const type = undefined; const extension = 'jpg'; const options: photoAccessHelper.CreateOptions = { title: testNum } - await createAssetAbnormalCallback1(done, testNum, type, extension, options); + await createAssetAbnormalCallback1(done, testNum, type, extension, options); }); /** @@ -182,13 +182,13 @@ export default function createAssetTest () { * @tc.level : Level 2 */ it('createImage_callback_003', 2, async function (done) { - const testNum = 'createImage_callback_003'; + const testNum = 'createImage_callback_003'; const type = photoType.IMAGE; const extension = '123'; const options: photoAccessHelper.CreateOptions = { title: testNum } - await createAssetAbnormalCallback1(done, testNum, type, extension, options); + await createAssetAbnormalCallback1(done, testNum, type, extension, options); }); /** @@ -200,13 +200,13 @@ export default function createAssetTest () { * @tc.level : Level 2 */ it('createImage_callback_004', 2, async function (done) { - const testNum = 'createImage_callback_004'; + const testNum = 'createImage_callback_004'; const type = photoType.IMAGE; const extension = undefined; const options: photoAccessHelper.CreateOptions = { title: testNum } - await createAssetAbnormalCallback1(done, testNum, type, extension, options); + await createAssetAbnormalCallback1(done, testNum, type, extension, options); }); /** @@ -218,13 +218,13 @@ export default function createAssetTest () { * @tc.level : Level 2 */ it('createImage_callback_005', 2, async function (done) { - const testNum = 'createImage_callback_005'; + const testNum = 'createImage_callback_005'; const type = photoType.IMAGE; const extension = 'jpg'; const options: photoAccessHelper.CreateOptions = { title: undefined } - await createAssetCallback1(done, testNum, type, extension, options); + await createAssetCallback1(done, testNum, type, extension, options); }); /** @@ -236,34 +236,12 @@ export default function createAssetTest () { * @tc.level : Level 2 */ it('createImage_callback_006', 2, async function (done) { - const testNum = 'createImage_callback_006'; + const testNum = 'createImage_callback_006'; const type = photoType.IMAGE; const extension = 'jpg'; const options: photoAccessHelper.CreateOptions = undefined; - await createAssetAbnormalCallback1(done, testNum, type, extension, options); + await createAssetAbnormalCallback1(done, testNum, type, extension, options); }); - - /** - * @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_IMAGE_0700 - * @tc.name : createImage_callback_007 - * @tc.desc : createAsset with title 'aaaaaaa....' (253) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - // it('createImage_callback_007', 2, async function (done) { - // const testNum = 'createImage_callback_007'; - // let value = ''; - // for (let i = 0; i < 253; i++) { - // value += 'a'; - // } - // const type = photoType.IMAGE; - // const extension = 'jpg'; - // const options: photoAccessHelper.CreateOptions = { - // title: value - // } - // await createAssetAbnormalCallback1(done, testNum, type, extension, options); - // }); /** * @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_IMAGE_0000 @@ -274,13 +252,13 @@ export default function createAssetTest () { * @tc.level : Level 0 */ it('createImage_promise_000', 0, async function (done) { - const testNum = 'createImage_promise_000'; + const testNum = 'createImage_promise_000'; const type = photoType.IMAGE; const extension = 'jpg'; const options: photoAccessHelper.CreateOptions = { title: testNum } - await createAssetPromise1(done, testNum, type, extension, options); + await createAssetPromise1(done, testNum, type, extension, options); }); /** @@ -292,10 +270,10 @@ export default function createAssetTest () { * @tc.level : Level 0 */ it('createImage_promise_001', 0, async function (done) { - const testNum = 'createImage_promise_001'; + const testNum = 'createImage_promise_001'; const type = photoType.IMAGE; const extension = 'jpg'; - await createAssetPromise2(done, testNum, type, extension); + await createAssetPromise2(done, testNum, type, extension); }); /** @@ -307,13 +285,13 @@ export default function createAssetTest () { * @tc.level : Level 2 */ it('createImage_promise_002', 2, async function (done) { - const testNum = 'createImage_promise_002'; + const testNum = 'createImage_promise_002'; const type = undefined; const extension = 'jpg'; const options: photoAccessHelper.CreateOptions = { title: testNum } - await createAssetAbnormalPromise1(done, testNum, type, extension, options); + await createAssetAbnormalPromise1(done, testNum, type, extension, options); }); /** @@ -325,13 +303,13 @@ export default function createAssetTest () { * @tc.level : Level 2 */ it('createImage_promise_003', 2, async function (done) { - const testNum = 'createImage_promise_003'; + const testNum = 'createImage_promise_003'; const type = photoType.IMAGE; const extension = '123'; const options: photoAccessHelper.CreateOptions = { title: testNum } - await createAssetAbnormalPromise1(done, testNum, type, extension, options); + await createAssetAbnormalPromise1(done, testNum, type, extension, options); }); /** @@ -343,13 +321,13 @@ export default function createAssetTest () { * @tc.level : Level 2 */ it('createImage_promise_004', 2, async function (done) { - const testNum = 'createImage_promise_004'; + const testNum = 'createImage_promise_004'; const type = photoType.IMAGE; const extension = undefined; const options: photoAccessHelper.CreateOptions = { title: testNum } - await createAssetAbnormalPromise1(done, testNum, type, extension, options); + await createAssetAbnormalPromise1(done, testNum, type, extension, options); }); /** @@ -361,13 +339,13 @@ export default function createAssetTest () { * @tc.level : Level 2 */ it('createImage_promise_005', 2, async function (done) { - const testNum = 'createImage_promise_005'; + const testNum = 'createImage_promise_005'; const type = photoType.IMAGE; const extension = 'jpg'; const options: photoAccessHelper.CreateOptions = { title: undefined } - await createAssetPromise1(done, testNum, type, extension, options); + await createAssetPromise1(done, testNum, type, extension, options); }); /** @@ -379,35 +357,13 @@ export default function createAssetTest () { * @tc.level : Level 2 */ it('createImage_promise_006', 2, async function (done) { - const testNum = 'createImage_promise_006'; + const testNum = 'createImage_promise_006'; const type = photoType.IMAGE; const extension = 'jpg'; const options: photoAccessHelper.CreateOptions = undefined; - await createAssetAbnormalPromise1(done, testNum, type, extension, options); + await createAssetAbnormalPromise1(done, testNum, type, extension, options); }); - /** - * @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_IMAGE_0700 - * @tc.name : createImage_promise_007 - * @tc.desc : createAsset with title 'aaaaaaa....' (253) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - // it('createImage_promise_007', 2, async function (done) { - // const testNum = 'createImage_promise_007'; - // let value = ''; - // for (let i = 0; i < 253; i++) { - // value += 'a'; - // } - // const type = photoType.IMAGE; - // const extension = 'jpg'; - // const options: photoAccessHelper.CreateOptions = { - // title: value - // } - // await createAssetAbnormalPromise1(done, testNum, type, extension, options); - // }); - /** * @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_VIDEO_0000 * @tc.name : createVideo_callback_000 @@ -417,13 +373,13 @@ export default function createAssetTest () { * @tc.level : Level 0 */ it('createVideo_callback_000', 0, async function (done) { - const testNum = 'createVideo_callback_000'; + const testNum = 'createVideo_callback_000'; const type = photoType.VIDEO; const extension = 'mp4'; const options: photoAccessHelper.CreateOptions = { title: testNum } - await createAssetCallback1(done, testNum, type, extension, options); + await createAssetCallback1(done, testNum, type, extension, options); }); /** @@ -435,10 +391,10 @@ export default function createAssetTest () { * @tc.level : Level 0 */ it('createVideo_callback_001', 0, async function (done) { - const testNum = 'createVideo_callback_001'; + const testNum = 'createVideo_callback_001'; const type = photoType.VIDEO; const extension = 'mp4'; - await createAssetCallback2(done, testNum, type, extension); + await createAssetCallback2(done, testNum, type, extension); }); /** @@ -450,13 +406,13 @@ export default function createAssetTest () { * @tc.level : Level 2 */ it('createVideo_callback_002', 2, async function (done) { - const testNum = 'createVideo_callback_002'; + const testNum = 'createVideo_callback_002'; const type = undefined; const extension = 'mp4'; const options: photoAccessHelper.CreateOptions = { title: testNum } - await createAssetAbnormalCallback1(done, testNum, type, extension, options); + await createAssetAbnormalCallback1(done, testNum, type, extension, options); }); /** @@ -468,13 +424,13 @@ export default function createAssetTest () { * @tc.level : Level 2 */ it('createVideo_callback_003', 2, async function (done) { - const testNum = 'createVideo_callback_003'; + const testNum = 'createVideo_callback_003'; const type = photoType.VIDEO; const extension = '123'; const options: photoAccessHelper.CreateOptions = { title: testNum } - await createAssetAbnormalCallback1(done, testNum, type, extension, options); + await createAssetAbnormalCallback1(done, testNum, type, extension, options); }); /** @@ -486,13 +442,13 @@ export default function createAssetTest () { * @tc.level : Level 2 */ it('createVideo_callback_004', 2, async function (done) { - const testNum = 'createVideo_callback_004'; + const testNum = 'createVideo_callback_004'; const type = photoType.VIDEO; const extension = undefined; const options: photoAccessHelper.CreateOptions = { title: testNum } - await createAssetAbnormalCallback1(done, testNum, type, extension, options); + await createAssetAbnormalCallback1(done, testNum, type, extension, options); }); /** @@ -504,13 +460,13 @@ export default function createAssetTest () { * @tc.level : Level 2 */ it('createVideo_callback_005', 2, async function (done) { - const testNum = 'createVideo_callback_005'; + const testNum = 'createVideo_callback_005'; const type = photoType.VIDEO; const extension = 'mp4'; const options: photoAccessHelper.CreateOptions = { title: undefined } - await createAssetCallback1(done, testNum, type, extension, options); + await createAssetCallback1(done, testNum, type, extension, options); }); /** @@ -522,35 +478,13 @@ export default function createAssetTest () { * @tc.level : Level 2 */ it('createVideo_callback_006', 2, async function (done) { - const testNum = 'createVideo_callback_006'; + const testNum = 'createVideo_callback_006'; const type = photoType.VIDEO; const extension = 'mp4'; const options: photoAccessHelper.CreateOptions = undefined; - await createAssetAbnormalCallback1(done, testNum, type, extension, options); + await createAssetAbnormalCallback1(done, testNum, type, extension, options); }); - /** - * @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_VIDEO_0700 - * @tc.name : createVideo_callback_007 - * @tc.desc : createAsset with title 'aaaaaaa....' (253) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - // it('createVideo_callback_007', 2, async function (done) { - // const testNum = 'createVideo_callback_007'; - // let value = ''; - // for (let i = 0; i < 253; i++) { - // value += 'a'; - // } - // const type = photoType.VIDEO; - // const extension = 'mp4'; - // const options: photoAccessHelper.CreateOptions = { - // title: value - // } - // await createAssetAbnormalCallback1(done, testNum, type, extension, options); - // }); - /** * @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_VIDEO_0000 * @tc.name : createVideo_promise_000 @@ -560,13 +494,13 @@ export default function createAssetTest () { * @tc.level : Level 0 */ it('createVideo_promise_000', 0, async function (done) { - const testNum = 'createVideo_promise_000'; + const testNum = 'createVideo_promise_000'; const type = photoType.VIDEO; const extension = 'mp4'; const options: photoAccessHelper.CreateOptions = { title: testNum } - await createAssetPromise1(done, testNum, type, extension, options); + await createAssetPromise1(done, testNum, type, extension, options); }); /** @@ -578,10 +512,10 @@ export default function createAssetTest () { * @tc.level : Level 0 */ it('createVideo_promise_001', 0, async function (done) { - const testNum = 'createVideo_promise_001'; + const testNum = 'createVideo_promise_001'; const type = photoType.VIDEO; const extension = 'mp4'; - await createAssetPromise2(done, testNum, type, extension); + await createAssetPromise2(done, testNum, type, extension); }); /** @@ -593,13 +527,13 @@ export default function createAssetTest () { * @tc.level : Level 2 */ it('createVideo_promise_002', 2, async function (done) { - const testNum = 'createVideo_promise_002'; + const testNum = 'createVideo_promise_002'; const type = undefined; const extension = 'mp4'; const options: photoAccessHelper.CreateOptions = { title: testNum } - await createAssetAbnormalPromise1(done, testNum, type, extension, options); + await createAssetAbnormalPromise1(done, testNum, type, extension, options); }); /** @@ -611,13 +545,13 @@ export default function createAssetTest () { * @tc.level : Level 2 */ it('createVideo_promise_003', 2, async function (done) { - const testNum = 'createVideo_promise_003'; + const testNum = 'createVideo_promise_003'; const type = photoType.VIDEO; const extension = '123'; const options: photoAccessHelper.CreateOptions = { title: testNum } - await createAssetAbnormalPromise1(done, testNum, type, extension, options); + await createAssetAbnormalPromise1(done, testNum, type, extension, options); }); /** @@ -629,13 +563,13 @@ export default function createAssetTest () { * @tc.level : Level 2 */ it('createVideo_promise_004', 2, async function (done) { - const testNum = 'createVideo_promise_004'; + const testNum = 'createVideo_promise_004'; const type = photoType.VIDEO; const extension = undefined; const options: photoAccessHelper.CreateOptions = { title: testNum } - await createAssetAbnormalPromise1(done, testNum, type, extension, options); + await createAssetAbnormalPromise1(done, testNum, type, extension, options); }); /** @@ -647,13 +581,13 @@ export default function createAssetTest () { * @tc.level : Level 2 */ it('createVideo_promise_005', 2, async function (done) { - const testNum = 'createVideo_promise_005'; + const testNum = 'createVideo_promise_005'; const type = photoType.VIDEO; const extension = 'mp4'; const options: photoAccessHelper.CreateOptions = { title: undefined } - await createAssetPromise1(done, testNum, type, extension, options); + await createAssetPromise1(done, testNum, type, extension, options); }); /** @@ -665,33 +599,11 @@ export default function createAssetTest () { * @tc.level : Level 2 */ it('createVideo_promise_006', 2, async function (done) { - const testNum = 'createVideo_promise_006'; + const testNum = 'createVideo_promise_006'; const type = photoType.VIDEO; const extension = 'mp4'; const options: photoAccessHelper.CreateOptions = undefined; - await createAssetAbnormalPromise1(done, testNum, type, extension, options); + await createAssetAbnormalPromise1(done, testNum, type, extension, options); }); - - /** - * @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_VIDEO_0700 - * @tc.name : createVideo_promise_007 - * @tc.desc : createAsset with title 'aaaaaaa....' (253) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - // it('createVideo_promise_007', 2, async function (done) { - // const testNum = 'createVideo_promise_007'; - // let value = ''; - // for (let i = 0; i < 253; i++) { - // value += 'a'; - // } - // const type = photoType.VIDEO; - // const extension = 'mp4'; - // const options: photoAccessHelper.CreateOptions = { - // title: value - // } - // await createAssetAbnormalPromise1(done, testNum, type, extension, options); - // }); }) } diff --git a/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/UserFileManager/getAlbums.ets b/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAccessHelper/getAlbums.ets similarity index 100% rename from multimedia/photoAccess/photoAccess/entry/src/main/ets/test/UserFileManager/getAlbums.ets rename to multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAccessHelper/getAlbums.ets diff --git a/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/UserFileManager/getAssets.ets b/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAccessHelper/getAssets.ets similarity index 97% rename from multimedia/photoAccess/photoAccess/entry/src/main/ets/test/UserFileManager/getAssets.ets rename to multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAccessHelper/getAssets.ets index 857549b52..9c0d9437a 100644 --- a/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/UserFileManager/getAssets.ets +++ b/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAccessHelper/getAssets.ets @@ -133,9 +133,9 @@ export default function getAssetsTest () { * @tc.desc : getAssets image * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it('getAssets_callback_003', 0, async function (done) { + it('getAssets_callback_003', 2, async function (done) { const testNum = 'getAssets_callback_003'; await getAssetsAbnormalCallbackTest(done, testNum, undefined); }); @@ -177,9 +177,9 @@ export default function getAssetsTest () { * @tc.desc : getAssets image * @tc.size : MEDIUM * @tc.type : Function - * @tc.level : Level 0 + * @tc.level : Level 2 */ - it('getAssets_promise_003', 0, async function (done) { + it('getAssets_promise_003', 2, async function (done) { const testNum = 'getAssets_promise_003'; await getAssetsAbnormalPromiseTest(done, testNum, undefined); }); diff --git a/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/UserFileManager/on.ets b/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAccessHelper/registerChange.ets similarity index 88% rename from multimedia/photoAccess/photoAccess/entry/src/main/ets/test/UserFileManager/on.ets rename to multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAccessHelper/registerChange.ets index 7fb2aec1d..9487ca830 100644 --- a/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/UserFileManager/on.ets +++ b/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAccessHelper/registerChange.ets @@ -25,8 +25,8 @@ import { photoType, } from '../../../../../../../common' -export default function onTest () { - describe('onTest', function () { +export default function registerChangeTest () { + describe('registerChangeTest', function () { const helper = photoAccessHelper.getPhotoAccessHelper(globalThis.abilityContext) const { NOTIFY_ADD, NOTIFY_UPDATE, NOTIFY_REMOVE, NOTIFY_ALBUM_ADD_ASSET, NOTIFY_ALBUM_REMOVE_ASSET } = photoAccessHelper.NotifyType; @@ -48,10 +48,10 @@ export default function onTest () { const asset = await getFileAsset(testNum, fetchOps); let count = 0; await sleep(500); - helper.on(asset.uri, false, async (changeData) => { + helper.registerChange(asset.uri, false, async (changeData) => { count++; console.info(`${testNum} changeData: ${JSON.stringify(changeData)}`); - helper.off(asset.uri); + helper.unRegisterChange(asset.uri); expect(changeData.type).assertEqual(NOTIFY_UPDATE); expect(changeData.uris[0]).assertEqual(asset.uri); }); @@ -81,10 +81,10 @@ export default function onTest () { try { let changeDataUri = ''; let listenCount = 0; - helper.on(DEFAULT_ALBUM_URI, true, async (changeData) => { + helper.registerChange(DEFAULT_ALBUM_URI, true, async (changeData) => { listenCount++; console.info(`${testNum} changeData: ${JSON.stringify(changeData)}`); - helper.off(DEFAULT_ALBUM_URI); + helper.unRegisterChange(DEFAULT_ALBUM_URI); changeDataUri = changeData.uris[0]; expect(changeData.type).assertEqual(NOTIFY_ADD); }); @@ -92,7 +92,7 @@ export default function onTest () { let album = await helper.createAlbum(albumName); let creatAlbumUri = album.albumUri; await sleep(2000); - helper.off(DEFAULT_ALBUM_URI); + helper.unRegisterChange(DEFAULT_ALBUM_URI); expect(creatAlbumUri).assertEqual(changeDataUri); expect(listenCount).assertEqual(1); done(); @@ -120,7 +120,7 @@ export default function onTest () { let album = await helper.createAlbum(albumName); albumUri = album.albumUri; await sleep(500); - helper.on(albumUri, false, async (changeData) => { + helper.registerChange(albumUri, false, async (changeData) => { count++; console.info(`${testNum} changeData: ${JSON.stringify(changeData)}`); expect(changeData.type).assertEqual(NOTIFY_UPDATE); @@ -129,7 +129,7 @@ export default function onTest () { album.albumName = Date.now() + album.albumName; await album.commitModify(); await sleep(1000); - helper.off(albumUri); + helper.unRegisterChange(albumUri); expect(count).assertEqual(1); done(); } catch (error) { @@ -156,16 +156,16 @@ export default function onTest () { const asset = await getFileAsset(testNum, fetchOps); let count = 0; await sleep(500); - helper.on(album.albumUri, false, async (changeData) => { + helper.registerChange(album.albumUri, false, async (changeData) => { count++; console.info(`${testNum} changeData: ${JSON.stringify(changeData)}`); expect(changeData.type).assertEqual(NOTIFY_ALBUM_ADD_ASSET); expect(changeData.uris[0]).assertEqual(album.albumUri); - // expect(changeData.extraUris[0]).assertEqual(asset.uri); + expect(changeData.extraUris[0]).assertEqual(asset.uri); }); await album.addAssets([asset]); await sleep(1000); - helper.off(album.albumUri); + helper.unRegisterChange(album.albumUri); expect(count).assertEqual(1); done(); } catch (error) { @@ -193,16 +193,16 @@ export default function onTest () { let count = 0; await album.addAssets([asset]); await sleep(500); - helper.on(album.albumUri, false, async (changeData) => { + helper.registerChange(album.albumUri, false, async (changeData) => { count++; console.info(`${testNum} changeData: ${JSON.stringify(changeData)}`); expect(changeData.type).assertEqual(NOTIFY_ALBUM_REMOVE_ASSET); expect(changeData.uris[0]).assertEqual(album.albumUri); - // expect(changeData.extraUris[0]).assertEqual(asset.uri); + expect(changeData.extraUris[0]).assertEqual(asset.uri); }); await album.removeAssets([asset]); await sleep(1000); - helper.off(album.albumUri); + helper.unRegisterChange(album.albumUri); expect(count).assertEqual(1); done(); } catch (error) { diff --git a/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/UserFileManager/release.ets b/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAccessHelper/release.ets similarity index 100% rename from multimedia/photoAccess/photoAccess/entry/src/main/ets/test/UserFileManager/release.ets rename to multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAccessHelper/release.ets diff --git a/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/UserFileManager/off.ets b/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAccessHelper/unRegisterChange.ets similarity index 89% rename from multimedia/photoAccess/photoAccess/entry/src/main/ets/test/UserFileManager/off.ets rename to multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAccessHelper/unRegisterChange.ets index c4549832b..ec904abb8 100644 --- a/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/UserFileManager/off.ets +++ b/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAccessHelper/unRegisterChange.ets @@ -27,8 +27,8 @@ import { albumSubtype } from '../../../../../../../common' -export default function offTest () { - describe('offTest', function () { +export default function unRegisterChangeTest () { + describe('unRegisterChangeTest', function () { const helper = photoAccessHelper.getPhotoAccessHelper(globalThis.abilityContext) const DEFAULT_PHOTO_URI = photoAccessHelper.DefaultChangeUri.DEFAULT_PHOTO_URI; const DEFAULT_ALBUM_URI = photoAccessHelper.DefaultChangeUri.DEFAULT_ALBUM_URI; @@ -48,12 +48,12 @@ export default function offTest () { const asset = await getFileAsset(testNum, fetchOps); let count = 0; await sleep(500); - helper.on(asset.uri, false, async (changeData) => { + helper.registerChange(asset.uri, false, async (changeData) => { count++; console.info(`${testNum} changeData: ${JSON.stringify(changeData)}`); }); await sleep(100); - helper.off(asset.uri); + helper.unRegisterChange(asset.uri); await sleep(100); const newTitle = testNum + asset.get(photoKeys.TITLE); asset.set(photoKeys.TITLE, newTitle); @@ -80,12 +80,12 @@ export default function offTest () { const testNum = 'off_007'; try { let count = 0; - helper.on(DEFAULT_ALBUM_URI, true, async (changeData) => { + helper.registerChange(DEFAULT_ALBUM_URI, true, async (changeData) => { count++; console.info(`${testNum} changeData: ${JSON.stringify(changeData)}`); }); await sleep(100); - helper.off(DEFAULT_ALBUM_URI); + helper.unRegisterChange(DEFAULT_ALBUM_URI); await sleep(100); let albumName = testNum + Date.now(); await helper.createAlbum(albumName); @@ -116,12 +116,12 @@ export default function offTest () { let album = await helper.createAlbum(albumName); albumUri = album.albumUri; await sleep(500); - helper.on(albumUri, false, async (changeData) => { + helper.registerChange(albumUri, false, async (changeData) => { count++; console.info(`${testNum} changeData: ${JSON.stringify(changeData)}`); }); await sleep(100); - helper.off(albumUri); + helper.unRegisterChange(albumUri); await sleep(100); album.albumName = Date.now() + album.albumName; await album.commitModify(); @@ -155,12 +155,12 @@ export default function offTest () { albumUri = album.albumUri; await album.addAssets([asset]); await sleep(500); - helper.on(albumUri, false, async (changeData) => { + helper.registerChange(albumUri, false, async (changeData) => { count++; console.info(`${testNum} changeData: ${JSON.stringify(changeData)}`); }); await sleep(100); - helper.off(albumUri); + helper.unRegisterChange(albumUri); await sleep(100); album.albumName = testNum + album.albumName; await album.commitModify(); @@ -191,12 +191,12 @@ export default function offTest () { const asset = await getFileAsset(testNum, fetchOps); let count = 0; await sleep(500); - helper.on(album.albumUri, false, async (changeData) => { + helper.registerChange(album.albumUri, false, async (changeData) => { count++; console.info(`${testNum} changeData: ${JSON.stringify(changeData)}`); }); await sleep(100); - helper.off(album.albumUri); + helper.unRegisterChange(album.albumUri); await sleep(100); await album.addAssets([asset]); await sleep(1000); @@ -227,12 +227,12 @@ export default function offTest () { let count = 0; await album.addAssets([asset]); await sleep(500); - helper.on(album.albumUri, false, async (changeData) => { + helper.registerChange(album.albumUri, false, async (changeData) => { count++; console.info(`${testNum} changeData: ${JSON.stringify(changeData)}`); }); await sleep(100); - helper.off(album.albumUri); + helper.unRegisterChange(album.albumUri); await sleep(100); await album.removeAssets([asset]); await sleep(1000); @@ -260,16 +260,16 @@ export default function offTest () { const asset = await getFileAsset(testNum, fetchOps); let listenCount = 0; await sleep(500); - helper.on(asset.uri, false, async (changeData) => { + helper.registerChange(asset.uri, false, async (changeData) => { listenCount++; console.info(`${testNum} changeData1: ${JSON.stringify(changeData)}`); }); - helper.on(asset.uri, false, async (changeData) => { + helper.registerChange(asset.uri, false, async (changeData) => { listenCount++; console.info(`${testNum} changeData2: ${JSON.stringify(changeData)}`); }); await sleep(100); - helper.off(asset.uri); + helper.unRegisterChange(asset.uri); await sleep(100); const newTitle = testNum + asset.get(photoKeys.TITLE); asset.set(photoKeys.TITLE, newTitle); @@ -307,13 +307,13 @@ export default function offTest () { const callback2 = async (changeData) => { listenCount2++; console.info(`${testNum} callback2: ${JSON.stringify(changeData)}`); - helper.off(asset.uri, callback2); + helper.unRegisterChange(asset.uri, callback2); }; - helper.on(asset.uri, false, callback1); - helper.on(asset.uri, false, callback2); + helper.registerChange(asset.uri, false, callback1); + helper.registerChange(asset.uri, false, callback2); await sleep(100); - helper.off(asset.uri, callback1); + helper.unRegisterChange(asset.uri, callback1); await sleep(100); const newTitle = testNum + asset.get(photoKeys.TITLE); asset.set(photoKeys.TITLE, newTitle); diff --git a/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAsset/commitModify.ets b/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAsset/commitModify.ets index da25d246a..37218b163 100644 --- a/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAsset/commitModify.ets +++ b/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAsset/commitModify.ets @@ -117,14 +117,14 @@ export default function commitModifyTest () { it('photoAsset_commitModify_callback_000', 0, async function (done) { const testNum = 'photoAsset_commitModify_callback_000'; const fetchOps = photoFetchOption(testNum, photoKeys.DISPLAY_NAME, 'modifyCb01.jpg'); - const newTitle = new Date().getTime() + '.jpg'; + const newTitle = new Date().getTime() + testNum; await commitModifyCallback(done, testNum, fetchOps, newTitle); }); /** * @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_FILE_ASSET_COMMITMODIFY_0100 * @tc.name : photoAsset_commitModify_callback_001 - * @tc.desc : modify image displayName '中中...' (83) + * @tc.desc : modify image displayName '一...' (84) * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 2 @@ -133,10 +133,9 @@ export default function commitModifyTest () { const testNum = 'photoAsset_commitModify_callback_001'; const fetchOps = photoFetchOption(testNum, photoKeys.DISPLAY_NAME, 'modifyCb02.jpg'); let newTitle = ''; - for (let i = 0; i < 83; i++) { - newTitle += '中'; + for (let i = 0; i < 84; i++) { + newTitle += '一'; } - newTitle += '.jpg'; await commitModifyCallback(done, testNum, fetchOps, newTitle); }); @@ -155,7 +154,6 @@ export default function commitModifyTest () { for (let i = 0; i < 251; i++) { newTitle += 'a'; } - newTitle += '.jpg'; await commitModifyCallback(done, testNum, fetchOps, newTitle); }); @@ -194,7 +192,7 @@ export default function commitModifyTest () { /** * @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_FILE_ASSET_COMMITMODIFY_0500 * @tc.name : photoAsset_commitModify_callback_005 - * @tc.desc : modify image displayName '中中....jpg' (84) + * @tc.desc : modify image displayName '二二....jpg' (84) * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 2 @@ -205,7 +203,7 @@ export default function commitModifyTest () { const type = 'displayName'; let value = ''; for (let i = 0; i < 84; i++) { - value += '中'; + value += '二'; } value += '.jpg'; await commitModifyAbnormalCallback(done, testNum, fetchOps, type, value); @@ -214,7 +212,7 @@ export default function commitModifyTest () { /** * @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_FILE_ASSET_COMMITMODIFY_0600 * @tc.name : photoAsset_commitModify_callback_006 - * @tc.desc : modify image displayName 'aaaaaaa...' (252) + * @tc.desc : modify image displayName 'bbbbbbb...' (252) * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 2 @@ -225,7 +223,7 @@ export default function commitModifyTest () { const type = 'displayName'; let value = ''; for (let i = 0; i < 252; i++) { - value += 'a'; + value += 'b'; } value += '.jpg'; await commitModifyAbnormalCallback(done, testNum, fetchOps, type, value); @@ -243,14 +241,14 @@ export default function commitModifyTest () { it('photoAsset_commitModify_callback_007', 0, async function (done) { const testNum = 'photoAsset_commitModify_callback_007'; const fetchOps = photoFetchOption(testNum, photoKeys.DISPLAY_NAME, 'modifyCb01.mp4'); - const newTitle = new Date().getTime() + '.mp4'; + const newTitle = new Date().getTime() + testNum; await commitModifyCallback(done, testNum, fetchOps, newTitle); }); /** * @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_FILE_ASSET_COMMITMODIFY_0800 * @tc.name : photoAsset_commitModify_callback_008 - * @tc.desc : modify video displayName '中中...' (83) + * @tc.desc : modify video displayName '三三...' (84) * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 2 @@ -259,17 +257,16 @@ export default function commitModifyTest () { const testNum = 'photoAsset_commitModify_callback_008'; const fetchOps = photoFetchOption(testNum, photoKeys.DISPLAY_NAME, 'modifyCb02.mp4'); let newTitle = ''; - for (let i = 0; i < 83; i++) { - newTitle += '中'; + for (let i = 0; i < 84; i++) { + newTitle += '三'; } - newTitle += '.mp4'; await commitModifyCallback(done, testNum, fetchOps, newTitle); }); /** * @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_FILE_ASSET_COMMITMODIFY_0900 * @tc.name : photoAsset_commitModify_callback_009 - * @tc.desc : modify image displayName 'aaaaaaa...' (251) + * @tc.desc : modify image displayName 'ccccccc...' (251) * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 2 @@ -279,9 +276,8 @@ export default function commitModifyTest () { const fetchOps = photoFetchOption(testNum, photoKeys.DISPLAY_NAME, 'modifyCb03.mp4'); let newTitle = ''; for (let i = 0; i < 251; i++) { - newTitle += 'a'; + newTitle += 'c'; } - newTitle += '.mp4'; await commitModifyCallback(done, testNum, fetchOps, newTitle); }); @@ -320,7 +316,7 @@ export default function commitModifyTest () { /** * @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_FILE_ASSET_COMMITMODIFY_1200 * @tc.name : photoAsset_commitModify_callback_012 - * @tc.desc : modify image displayName '中中...' (84) + * @tc.desc : modify image displayName '四四...' (84) * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 2 @@ -331,7 +327,7 @@ export default function commitModifyTest () { const type = 'displayName'; let value = ''; for (let i = 0; i < 84; i++) { - value += '中'; + value += '四'; } value += '.mp4'; await commitModifyAbnormalCallback(done, testNum, fetchOps, type, value); @@ -340,7 +336,7 @@ export default function commitModifyTest () { /** * @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_FILE_ASSET_COMMITMODIFY_1300 * @tc.name : photoAsset_commitModify_callback_013 - * @tc.desc : modify image displayName 'aaaaaaa...' (252) + * @tc.desc : modify image displayName 'ddddddd...' (252) * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 2 @@ -351,7 +347,7 @@ export default function commitModifyTest () { const type = 'displayName'; let value = ''; for (let i = 0; i < 252; i++) { - value += 'a'; + value += 'd'; } value += '.mp4'; await commitModifyAbnormalCallback(done, testNum, fetchOps, type, value); @@ -377,7 +373,7 @@ export default function commitModifyTest () { /** * @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_FILE_ASSET_COMMITMODIFY_0100 * @tc.name : photoAsset_commitModify_promise_001 - * @tc.desc : modify image displayName '中中...' (83) + * @tc.desc : modify image displayName '五五...' (83) * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 2 @@ -387,16 +383,15 @@ export default function commitModifyTest () { const fetchOps = photoFetchOption(testNum, photoKeys.DISPLAY_NAME, 'modifyPro02.jpg'); let newTitle = ''; for (let i = 0; i < 83; i++) { - newTitle += '中'; + newTitle += '五'; } - newTitle += '.jpg'; await commitModifyPromise(done, testNum, fetchOps, newTitle); }); /** * @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_FILE_ASSET_COMMITMODIFY_0200 * @tc.name : photoAsset_commitModify_promise_002 - * @tc.desc : modify image displayName 'aaaaaaa...' (251) + * @tc.desc : modify image displayName 'eeeeeee...' (251) * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 2 @@ -406,9 +401,8 @@ export default function commitModifyTest () { const fetchOps = photoFetchOption(testNum, photoKeys.DISPLAY_NAME, 'modifyPro03.jpg'); let newTitle = ''; for (let i = 0; i < 251; i++) { - newTitle += 'a'; + newTitle += 'e'; } - newTitle += '.jpg'; await commitModifyPromise(done, testNum, fetchOps, newTitle); }); @@ -447,7 +441,7 @@ export default function commitModifyTest () { /** * @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_FILE_ASSET_COMMITMODIFY_0500 * @tc.name : photoAsset_commitModify_promise_005 - * @tc.desc : modify image displayName '中中....jpg' (84) + * @tc.desc : modify image displayName '六六....jpg' (84) * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 2 @@ -458,7 +452,7 @@ export default function commitModifyTest () { const type = 'displayName'; let value = ''; for (let i = 0; i < 84; i++) { - value += '中'; + value += '六'; } value += '.jpg'; await commitModifyAbnormalPromise(done, testNum, fetchOps, type, value); @@ -467,7 +461,7 @@ export default function commitModifyTest () { /** * @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_FILE_ASSET_COMMITMODIFY_0600 * @tc.name : photoAsset_commitModify_promise_006 - * @tc.desc : modify image displayName 'aaaaaaa...' (252) + * @tc.desc : modify image displayName 'fffffff...' (252) * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 2 @@ -478,7 +472,7 @@ export default function commitModifyTest () { const type = 'displayName'; let value = ''; for (let i = 0; i < 252; i++) { - value += 'a'; + value += 'f'; } value += '.jpg'; await commitModifyAbnormalPromise(done, testNum, fetchOps, type, value); @@ -503,7 +497,7 @@ export default function commitModifyTest () { /** * @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_FILE_ASSET_COMMITMODIFY_0800 * @tc.name : photoAsset_commitModify_promise_008 - * @tc.desc : modify video displayName '中中...' (83) + * @tc.desc : modify video displayName '七七...' (83) * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 2 @@ -513,16 +507,15 @@ export default function commitModifyTest () { const fetchOps = photoFetchOption(testNum, photoKeys.DISPLAY_NAME, 'modifyPro02.mp4'); let newTitle = ''; for (let i = 0; i < 83; i++) { - newTitle += '中'; + newTitle += '七'; } - newTitle += '.mp4'; await commitModifyPromise(done, testNum, fetchOps, newTitle); }); /** * @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_FILE_ASSET_COMMITMODIFY_0900 * @tc.name : photoAsset_commitModify_promise_009 - * @tc.desc : modify image displayName 'aaaaaaa...' (251) + * @tc.desc : modify image displayName 'ggggggg...' (251) * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 2 @@ -532,9 +525,8 @@ export default function commitModifyTest () { const fetchOps = photoFetchOption(testNum, photoKeys.DISPLAY_NAME, 'modifyPro03.mp4'); let newTitle = ''; for (let i = 0; i < 251; i++) { - newTitle += 'a'; + newTitle += 'g'; } - newTitle += '.mp4'; await commitModifyPromise(done, testNum, fetchOps, newTitle); }); @@ -573,7 +565,7 @@ export default function commitModifyTest () { /** * @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_FILE_ASSET_COMMITMODIFY_1200 * @tc.name : photoAsset_commitModify_promise_012 - * @tc.desc : modify image displayName '中中...' (84) + * @tc.desc : modify image displayName '八八...' (84) * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 2 @@ -584,7 +576,7 @@ export default function commitModifyTest () { const type = 'displayName'; let value = ''; for (let i = 0; i < 84; i++) { - value += '中'; + value += '八'; } value += '.mp4'; await commitModifyAbnormalPromise(done, testNum, fetchOps, type, value); @@ -593,7 +585,7 @@ export default function commitModifyTest () { /** * @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_FILE_ASSET_COMMITMODIFY_1300 * @tc.name : photoAsset_commitModify_promise_013 - * @tc.desc : modify image displayName 'aaaaaaa...' (252) + * @tc.desc : modify image displayName 'hhhhhhh...' (252) * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 2 @@ -604,7 +596,7 @@ export default function commitModifyTest () { const type = 'displayName'; let value = ''; for (let i = 0; i < 252; i++) { - value += 'a'; + value += 'h'; } value += '.mp4'; await commitModifyAbnormalPromise(done, testNum, fetchOps, type, value); diff --git a/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAsset/getReadOnlyFd.ets b/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAsset/getReadOnlyFd.ets index dff6219ea..0b6fe23ca 100644 --- a/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAsset/getReadOnlyFd.ets +++ b/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAsset/getReadOnlyFd.ets @@ -14,6 +14,7 @@ */ // @ts-nocheck +import fileio from "@ohos.fileio"; import { describe, it, expect } from 'deccjsunit/index' import { photoKeys, @@ -34,7 +35,12 @@ export default function getReadOnlyFdTest () { expect(false).assertTrue(); } else { console.info(`${testNum} fd: ${fd}`); - expect(isNum(fd)).assertTrue(); + try { + await fileio.write(fd, testNum); + expect(false).assertTrue(); + } catch (error) { + console.info(`${testNum} error: ${error}`); + } } done(); }) @@ -50,11 +56,11 @@ export default function getReadOnlyFdTest () { const asset = await getFileAsset(testNum, fetchOps); const fd = await asset.getReadOnlyFd(); console.info(`${testNum} fd: ${fd}`); - expect(isNum(fd)).assertTrue(); + await fileio.write(fd, testNum); + expect(false).assertTrue(); done(); } catch (error) { console.info(`${testNum} failed; error: ${error}`); - expect(false).assertTrue(); done(); } } diff --git a/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAssetFetchResult/close.ets b/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAssetFetchResult/close.ets index 400bd6d72..e40b4e520 100644 --- a/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAssetFetchResult/close.ets +++ b/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAssetFetchResult/close.ets @@ -31,50 +31,58 @@ export default function assetCloseTest () { let fetchResult = await helper.getAssets(fetchOps); expect(fetchResult.getCount() > 0).assertTrue(); fetchResult.close(); + let testCount = 0; let count = 0; try { + testCount++; fetchResult.getCount(); } catch (error) { console.info(`${testNum} getCount failed; error: ${error}`); count++; } try { + testCount++; await fetchResult.getFirstObject(); } catch (error) { console.info(`${testNum} getFirstObject failed; error: ${error}`); count++; } try { + testCount++; await fetchResult.getNextObject(); } catch (error) { console.info(`${testNum} getNextObject failed; error: ${error}`); count++; } try { + testCount++; await fetchResult.getLastObject(); } catch (error) { console.info(`${testNum} getLastObject failed; error: ${error}`); count++; } try { + testCount++; await fetchResult.getObjectByPosition(0); } catch (error) { console.info(`${testNum} getObjectByPosition failed; error: ${error}`); count++; } try { + testCount++; await fetchResult.getAllObjects(); } catch (error) { console.info(`${testNum} getAllObjects failed; error: ${error}`); count++; } try { + testCount++; fetchResult.isAfterLast(); } catch (error) { console.info(`${testNum} isAfterLast failed; error: ${error}`); count++; } - expect(count).assertEqual(7); + expect(count).assertEqual(testCount); done(); } catch (error) { console.info(`${testNum} failed; error: ${error}`); diff --git a/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAssetFetchResult/getLastObject.ets b/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAssetFetchResult/getLastObject.ets index 5db5753ae..96a05ab69 100644 --- a/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAssetFetchResult/getLastObject.ets +++ b/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAssetFetchResult/getLastObject.ets @@ -37,6 +37,8 @@ export default function assetGetLastObjectTest () { expect(false).assertTrue(); } else { expect(asset !== undefined).assertTrue(); + const ret = fetchResult.isAfterLast(); + expect(ret).assertTrue(); } } catch (error) { console.info(`${testNum} getLastObject failed; error: ${error}`); @@ -56,8 +58,10 @@ export default function assetGetLastObjectTest () { let fetchResult = await helper.getAssets(fetchOps); expect(fetchResult.getCount() > 0).assertTrue(); const asset = await fetchResult.getLastObject(); - fetchResult.close(); expect(asset !== undefined).assertTrue(); + const ret = fetchResult.isAfterLast(); + fetchResult.close(); + expect(ret).assertTrue(); done(); } catch (error) { console.info(`${testNum} failed; error: ${error}`); diff --git a/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAssetFetchResult/getObjectByPosition.ets b/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAssetFetchResult/getObjectByPosition.ets index 04cb01601..00151defc 100644 --- a/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAssetFetchResult/getObjectByPosition.ets +++ b/multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAssetFetchResult/getObjectByPosition.ets @@ -30,13 +30,14 @@ export default function assetGetPositionObjectTest () { try { let fetchResult = await helper.getAssets(fetchOps); expect(fetchResult.getCount() > 0).assertTrue(); + const firAsset = await fetchResult.getFirstObject(); fetchResult.getObjectByPosition(0, (err, asset) => { try { if (err !== undefined) { console.info(`${testNum} getObjectByPosition failed; err: ${err}`); expect(false).assertTrue(); } else { - expect(asset !== undefined).assertTrue(); + expect(asset.displayName).assertEqual(firAsset.displayName); } } catch (error) { console.info(`${testNum} getObjectByPosition failed; error: ${error}`); @@ -55,9 +56,10 @@ export default function assetGetPositionObjectTest () { try { let fetchResult = await helper.getAssets(fetchOps); expect(fetchResult.getCount() > 0).assertTrue(); + const firAsset = await fetchResult.getFirstObject(); const asset = await fetchResult.getObjectByPosition(0); fetchResult.close(); - expect(asset !== undefined).assertTrue(); + expect(asset.displayName).assertEqual(firAsset.displayName); done(); } catch (error) { console.info(`${testNum} failed; error: ${error}`); diff --git a/multimedia/photoAccess/photoAccessSystem/BUILD.gn b/multimedia/photoAccess/photoAccessSystem/BUILD.gn index ac6eec3cf..efb6a596b 100644 --- a/multimedia/photoAccess/photoAccessSystem/BUILD.gn +++ b/multimedia/photoAccess/photoAccessSystem/BUILD.gn @@ -17,8 +17,8 @@ ohos_js_hap_suite("photoAccess_system_js_hap") { hap_profile = "entry/src/main/module.json" js_build_mode = "debug" deps = [ - ":photoAccess_js_assets", - ":photoAccess_resources", + ":photoAccessSystem_js_assets", + ":photoAccessSystem_resources", ] ets2abc = true certificate_profile = "signature/openharmony_sx.p7b" @@ -27,17 +27,17 @@ ohos_js_hap_suite("photoAccess_system_js_hap") { subsystem_name = "multimedia" } -ohos_app_scope("photoAccess_app_profile") { +ohos_app_scope("photoAccessSystem_app_profile") { app_profile = "AppScope/app.json" sources = [ "AppScope/resources" ] } -ohos_js_assets("photoAccess_js_assets") { +ohos_js_assets("photoAccessSystem_js_assets") { source_dir = "entry/src/main/ets" } -ohos_resources("photoAccess_resources") { +ohos_resources("photoAccessSystem_resources") { sources = [ "entry/src/main/resources" ] - deps = [ ":photoAccess_app_profile" ] + deps = [ ":photoAccessSystem_app_profile" ] hap_profile = "entry/src/main/module.json" } diff --git a/multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/publicApiTestWithSystemApi.ets b/multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/publicApiTestWithSystemApi.ets index a85cbc596..7aca480c2 100644 --- a/multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/publicApiTestWithSystemApi.ets +++ b/multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/publicApiTestWithSystemApi.ets @@ -273,11 +273,11 @@ export default function publicApiTestWithSystemApiTest () { await createAsset.close(fd); let count = 0; await sleep(500); - helper.on(createAsset.uri, false, async (changeData) => { + helper.registerChange(createAsset.uri, false, async (changeData) => { count++; console.info(`${testNum} changeData: ${JSON.stringify(changeData)}`); }); - helper.off(createAsset.uri); + helper.unRegisterChange(createAsset.uri); await sleep(100); fd = await createAsset.getReadOnlyFd(); await createAsset.close(fd); @@ -306,12 +306,12 @@ export default function publicApiTestWithSystemApiTest () { const asset = await getFileAsset(testNum, fetchOps); let count= 0; await sleep(500); - helper.on(asset.uri, false, async (changeData) => { + helper.registerChange(asset.uri, false, async (changeData) => { count++; console.info(`${testNum} changeData: ${JSON.stringify(changeData)}`); }); await sleep(100); - helper.off(asset.uri); + helper.unRegisterChange(asset.uri); await sleep(100); await asset.setFavorite(true); await sleep(1000); @@ -340,12 +340,12 @@ export default function publicApiTestWithSystemApiTest () { await asset.setFavorite(true); let count= 0; await sleep(500); - helper.on(asset.uri, false, async (changeData) => { + helper.registerChange(asset.uri, false, async (changeData) => { count++; console.info(`${testNum} changeData: ${JSON.stringify(changeData)}`); }); await sleep(100); - helper.off(asset.uri); + helper.unRegisterChange(asset.uri); await sleep(100); await asset.setFavorite(false); await sleep(1000); @@ -373,12 +373,12 @@ export default function publicApiTestWithSystemApiTest () { const asset = await getFileAsset(testNum, fetchOps); let count= 0; await sleep(500); - helper.on(asset.uri, false, async (changeData) => { + helper.registerChange(asset.uri, false, async (changeData) => { count++; console.info(`${testNum} asset changeData: ${JSON.stringify(changeData)}`); }); await sleep(100); - helper.off(asset.uri); + helper.unRegisterChange(asset.uri); await sleep(100); await helper.deleteAssets([asset.uri]); await sleep(2000); @@ -414,14 +414,14 @@ export default function publicApiTestWithSystemApiTest () { const trashFileAsset = await trashFetchResult.getFirstObject(); let count= 0; await sleep(500); - helper.on(trashFileAsset.uri, false, async (changeData) => { + helper.registerChange(trashFileAsset.uri, false, async (changeData) => { count++; console.info(`off_005 changeData: ${JSON.stringify(changeData)}`); expect(false).assertTrue(); done(); }); await sleep(100); - helper.off(trashFileAsset.uri); + helper.unRegisterChange(trashFileAsset.uri); await sleep(100); await trashAlbum.recoverAssets([trashFileAsset]); await sleep(2000); @@ -457,12 +457,12 @@ export default function publicApiTestWithSystemApiTest () { const trashFileAsset = await trashFetchResult.getFirstObject(); let count= 0; await sleep(500); - helper.on(trashAlbum.albumUri, false, async (changeData) => { + helper.registerChange(trashAlbum.albumUri, false, async (changeData) => { count++; console.info(`off_006 changeData: ${JSON.stringify(changeData)}`); }); await sleep(100); - helper.off(trashAlbum.albumUri); + helper.unRegisterChange(trashAlbum.albumUri); await sleep(100); await trashAlbum.deleteAssets([trashFileAsset]); await sleep(1000); @@ -489,12 +489,12 @@ export default function publicApiTestWithSystemApiTest () { let albumName = 'testAlbum' + Date.now(); let album = await helper.createAlbum(albumName); await sleep(500); - helper.on(DEFAULT_ALBUM_URI, true, async (changeData) => { + helper.registerChange(DEFAULT_ALBUM_URI, true, async (changeData) => { count++; console.info(`off_009 changeData: ${JSON.stringify(changeData)}`); }); await sleep(100); - helper.off(DEFAULT_ALBUM_URI); + helper.unRegisterChange(DEFAULT_ALBUM_URI); await sleep(100); await helper.deleteAlbums([album]); await sleep(1000); @@ -527,12 +527,12 @@ export default function publicApiTestWithSystemApiTest () { await helper.deleteAssets([fileAsset.uri]); await sleep(500); let listenCount = 0; - helper.on(DEFAULT_ALBUM_URI, true, async (changeData) => { + helper.registerChange(DEFAULT_ALBUM_URI, true, async (changeData) => { listenCount++; console.info(`${testNum} changeData: ${JSON.stringify(changeData)}`); }); await sleep(100); - helper.off(DEFAULT_ALBUM_URI); + helper.unRegisterChange(DEFAULT_ALBUM_URI); await sleep(100); // 1 let albumName = 'testAlbum' + Date.now(); @@ -581,12 +581,12 @@ export default function publicApiTestWithSystemApiTest () { let listenCount = 0; let fetchOps = photoFetchOption(testNum, photoKeys.DISPLAY_NAME, 'off14.jpg'); const asset = await getFileAsset(testNum, fetchOps); - helper.on(DEFAULT_PHOTO_URI, true, async (changeData) => { + helper.registerChange(DEFAULT_PHOTO_URI, true, async (changeData) => { listenCount++; console.info(`${testNum} changeData: ${JSON.stringify(changeData)}`); }); await sleep(100); - helper.off(DEFAULT_PHOTO_URI); + helper.unRegisterChange(DEFAULT_PHOTO_URI); await sleep(100); // 1 let fd = await asset.open('rw'); @@ -639,7 +639,7 @@ export default function publicApiTestWithSystemApiTest () { await createAsset.close(fd); let count = 0; await sleep(500); - helper.on(createAsset.uri, false, async (changeData) => { + helper.registerChange(createAsset.uri, false, async (changeData) => { count++; console.info(`${testNum} changeData: ${JSON.stringify(changeData)}`); expect(changeData.type).assertEqual(NOTIFY_ADD); @@ -649,7 +649,7 @@ export default function publicApiTestWithSystemApiTest () { fd = await createAsset.getReadOnlyFd(); await createAsset.close(fd); await sleep(1000); - helper.off(createAsset.uri); + helper.unRegisterChange(createAsset.uri); expect(count).assertEqual(0); done(); } catch (error) { @@ -674,7 +674,7 @@ export default function publicApiTestWithSystemApiTest () { const asset = await getFileAsset(testNum, fetchOps); let count= 0; await sleep(500); - helper.on(asset.uri, false, async (changeData) => { + helper.registerChange(asset.uri, false, async (changeData) => { count++; console.info(`${testNum} changeData: ${JSON.stringify(changeData)}`); expect(changeData.type).assertEqual(NOTIFY_UPDATE); @@ -682,7 +682,7 @@ export default function publicApiTestWithSystemApiTest () { }); await asset.setFavorite(true); await sleep(1000); - helper.off(asset.uri); + helper.unRegisterChange(asset.uri); expect(count).assertEqual(1); done(); } catch (error) { @@ -708,7 +708,7 @@ export default function publicApiTestWithSystemApiTest () { await asset.setFavorite(true); let count= 0; await sleep(500); - helper.on(asset.uri, false, async (changeData) => { + helper.registerChange(asset.uri, false, async (changeData) => { count++; console.info(`${testNum} changeData: ${JSON.stringify(changeData)}`); expect(changeData.type).assertEqual(NOTIFY_UPDATE); @@ -716,7 +716,7 @@ export default function publicApiTestWithSystemApiTest () { }); await asset.setFavorite(false); await sleep(1000); - helper.off(asset.uri); + helper.unRegisterChange(asset.uri); expect(count).assertEqual(1); done(); } catch (error) { @@ -749,7 +749,7 @@ export default function publicApiTestWithSystemApiTest () { const trashFileAsset = await trashFetchResult.getFirstObject(); let count= 0; await sleep(500); - helper.on(trashFileAsset.uri, false, async (changeData) => { + helper.registerChange(trashFileAsset.uri, false, async (changeData) => { count++; console.info(`on_callback_005 changeData: ${JSON.stringify(changeData)}`); expect(changeData.type).assertEqual(NOTIFY_ADD); @@ -757,7 +757,7 @@ export default function publicApiTestWithSystemApiTest () { }); await trashAlbum.recoverAssets([trashFileAsset]); await sleep(2000); - helper.off(trashFileAsset.uri); + helper.unRegisterChange(trashFileAsset.uri); expect(count).assertEqual(1); done(); } catch (error) { @@ -790,15 +790,15 @@ export default function publicApiTestWithSystemApiTest () { const trashFileAsset = await trashFetchResult.getFirstObject(); let count= 0; await sleep(500); - helper.on(trashAlbum.albumUri, false, async (changeData) => { + helper.registerChange(trashAlbum.albumUri, false, async (changeData) => { count++; console.info(`on_callback_006 changeData: ${JSON.stringify(changeData)}`); expect(changeData.type).assertEqual(NOTIFY_ALBUM_REMOVE_ASSET); - // expect(changeData.extraUris[0]).assertEqual(trashFileAsset.uri); + expect(changeData.extraUris[0]).assertEqual(trashFileAsset.uri); }); await trashAlbum.deleteAssets([trashFileAsset]); await sleep(1000); - helper.off(trashAlbum.albumUri); + helper.unRegisterChange(trashAlbum.albumUri); expect(count).assertEqual(1); done(); } catch (error) { @@ -824,7 +824,7 @@ export default function publicApiTestWithSystemApiTest () { let album = await helper.createAlbum(albumName); albumUri = album.albumUri; await sleep(500); - helper.on(DEFAULT_ALBUM_URI, true, async (changeData) => { + helper.registerChange(DEFAULT_ALBUM_URI, true, async (changeData) => { listenCount++; if (listenCount < 2) { console.info(`on_callback_009 changeData: ${JSON.stringify(changeData)}`); @@ -836,7 +836,7 @@ export default function publicApiTestWithSystemApiTest () { await helper.deleteAlbums([album]); await sleep(1000); expect(listenCount).assertEqual(1); - helper.off(DEFAULT_ALBUM_URI); + helper.unRegisterChange(DEFAULT_ALBUM_URI); done(); } catch (error) { console.log(`on_callback_009: tryError: $${error}`); @@ -860,7 +860,7 @@ export default function publicApiTestWithSystemApiTest () { const fetchOps = photoFetchOption(testNum, photoKeys.DISPLAY_NAME, 'on14.jpg'); const asset = await getFileAsset(testNum, fetchOps); let photoAssetUri = asset.uri; - helper.on(DEFAULT_PHOTO_URI, true, async (changeData) => { + helper.registerChange(DEFAULT_PHOTO_URI, true, async (changeData) => { listenCount++; switch (listenCount) { case 1: @@ -894,7 +894,7 @@ export default function publicApiTestWithSystemApiTest () { await sleep(500); await asset.setFavorite(false); await sleep(1000); - helper.off(DEFAULT_PHOTO_URI); + helper.unRegisterChange(DEFAULT_PHOTO_URI); expect(listenCount).assertEqual(3); done(); } catch (error) { @@ -921,7 +921,7 @@ export default function publicApiTestWithSystemApiTest () { await asset.close(fd); let listenCount = 0; await sleep(500); - helper.on(asset.uri, false, async (changeData) => { + helper.registerChange(asset.uri, false, async (changeData) => { listenCount++; console.info(`${testNum} changeData: ${JSON.stringify(changeData)}`); expect(changeData.type).assertEqual(NOTIFY_UPDATE); @@ -936,7 +936,7 @@ export default function publicApiTestWithSystemApiTest () { await sleep(500); } await sleep(2000); - helper.off(asset.uri); + helper.unRegisterChange(asset.uri); expect(listenCount).assertEqual(10); done(); } catch (error) { @@ -965,7 +965,7 @@ export default function publicApiTestWithSystemApiTest () { await fileAsset.close(fd); let count= 0; await sleep(1000); - helper.on(fileAsset.uri, false, async (changeData) => { + helper.registerChange(fileAsset.uri, false, async (changeData) => { count++; console.info(`on_callback_017 changeData: ${JSON.stringify(changeData)}`); expect(changeData.type).assertEqual(NOTIFY_UPDATE); @@ -979,7 +979,7 @@ export default function publicApiTestWithSystemApiTest () { await fileAsset.close(fd); await sleep(1000); expect(count).assertEqual(1); - helper.off(fileAsset.uri); + helper.unRegisterChange(fileAsset.uri); done(); } catch (error) { console.log(`on_callback_017: tryError: $${error}`); diff --git a/multimedia/photoAccess/photoAccessSystem/entry/src/main/resources/base/element/string.json b/multimedia/photoAccess/photoAccessSystem/entry/src/main/resources/base/element/string.json index 480c5ade7..4287e7d8b 100644 --- a/multimedia/photoAccess/photoAccessSystem/entry/src/main/resources/base/element/string.json +++ b/multimedia/photoAccess/photoAccessSystem/entry/src/main/resources/base/element/string.json @@ -14,15 +14,15 @@ }, { "name": "form_description", - "value": "photoAccess" + "value": "photoAccessSystem" }, { "name": "serviceability_description", - "value": "photoAccess" + "value": "photoAccessSystem" }, { "name": "description_application", - "value": "photoAccess test" + "value": "photoAccessSystem test" }, { "name": "app_name", -- GitLab