Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
29b3d07a
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
29b3d07a
编写于
7月 03, 2023
作者:
Y
yangbo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bug 2.0
Signed-off-by:
N
yangbo
<
yangbo258@huawei.com
>
上级
3b353832
变更
53
隐藏空白更改
内联
并排
Showing
53 changed file
with
211 addition
and
579 deletion
+211
-579
multimedia/photoAccess/common.ts
multimedia/photoAccess/common.ts
+0
-4
multimedia/photoAccess/photoAccess/BUILD.gn
multimedia/photoAccess/photoAccess/BUILD.gn
+1
-1
multimedia/photoAccess/photoAccess/Test.json
multimedia/photoAccess/photoAccess/Test.json
+0
-1
multimedia/photoAccess/photoAccess/entry/src/main/ets/MainAbility/pages/index/index.ets
...cess/entry/src/main/ets/MainAbility/pages/index/index.ets
+1
-1
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/AbsAlbum/checkAttr.ets
...hotoAccess/entry/src/main/ets/test/AbsAlbum/checkAttr.ets
+1
-2
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/AbsAlbum/getAssets.ets
...hotoAccess/entry/src/main/ets/test/AbsAlbum/getAssets.ets
+1
-1
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/Album/addAssets.ets
...s/photoAccess/entry/src/main/ets/test/Album/addAssets.ets
+1
-33
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/Album/commitModify.ets
...hotoAccess/entry/src/main/ets/test/Album/commitModify.ets
+5
-4
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/Album/removeAssets.ets
...hotoAccess/entry/src/main/ets/test/Album/removeAssets.ets
+20
-36
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/AlbumFetchResult/close.ets
...Access/entry/src/main/ets/test/AlbumFetchResult/close.ets
+22
-6
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/AlbumFetchResult/getAllObjects.ets
...ntry/src/main/ets/test/AlbumFetchResult/getAllObjects.ets
+6
-6
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/AlbumFetchResult/getCount.ets
...ess/entry/src/main/ets/test/AlbumFetchResult/getCount.ets
+7
-7
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/AlbumFetchResult/getFirstObject.ets
...try/src/main/ets/test/AlbumFetchResult/getFirstObject.ets
+2
-2
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/AlbumFetchResult/getLastObject.ets
...ntry/src/main/ets/test/AlbumFetchResult/getLastObject.ets
+2
-2
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/AlbumFetchResult/getNextObject.ets
...ntry/src/main/ets/test/AlbumFetchResult/getNextObject.ets
+2
-2
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/AlbumFetchResult/getObjectByPosition.ets
...rc/main/ets/test/AlbumFetchResult/getObjectByPosition.ets
+2
-2
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/AlbumFetchResult/isAfterLast.ets
.../entry/src/main/ets/test/AlbumFetchResult/isAfterLast.ets
+2
-2
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAsset/checkAttr.ets
...toAccess/entry/src/main/ets/test/PhotoAsset/checkAttr.ets
+1
-0
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAsset/close.ets
.../photoAccess/entry/src/main/ets/test/PhotoAsset/close.ets
+1
-0
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAsset/commitModify.ets
...ccess/entry/src/main/ets/test/PhotoAsset/commitModify.ets
+1
-0
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAsset/get.ets
...ss/photoAccess/entry/src/main/ets/test/PhotoAsset/get.ets
+2
-1
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAsset/getReadOnlyFd.ets
...cess/entry/src/main/ets/test/PhotoAsset/getReadOnlyFd.ets
+1
-0
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAsset/getThumbnail.ets
...ccess/entry/src/main/ets/test/PhotoAsset/getThumbnail.ets
+1
-1
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAssetFetchResult/close.ets
...s/entry/src/main/ets/test/PhotoAssetFetchResult/close.ets
+1
-1
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAssetFetchResult/getAllObjects.ets
...src/main/ets/test/PhotoAssetFetchResult/getAllObjects.ets
+1
-1
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAssetFetchResult/getCount.ets
...ntry/src/main/ets/test/PhotoAssetFetchResult/getCount.ets
+1
-1
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAssetFetchResult/getFirstObject.ets
...rc/main/ets/test/PhotoAssetFetchResult/getFirstObject.ets
+1
-1
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAssetFetchResult/getLastObject.ets
...src/main/ets/test/PhotoAssetFetchResult/getLastObject.ets
+1
-1
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAssetFetchResult/getNextObject.ets
...src/main/ets/test/PhotoAssetFetchResult/getNextObject.ets
+1
-1
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAssetFetchResult/getObjectByPosition.ets
...in/ets/test/PhotoAssetFetchResult/getObjectByPosition.ets
+1
-1
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAssetFetchResult/isAfterLast.ets
...y/src/main/ets/test/PhotoAssetFetchResult/isAfterLast.ets
+1
-1
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/UserFileManager/createAsset.ets
...s/entry/src/main/ets/test/UserFileManager/createAsset.ets
+76
-74
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/UserFileManager/getAlbums.ets
...ess/entry/src/main/ets/test/UserFileManager/getAlbums.ets
+2
-2
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/UserFileManager/getAssets.ets
...ess/entry/src/main/ets/test/UserFileManager/getAssets.ets
+1
-29
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/UserFileManager/off.ets
...otoAccess/entry/src/main/ets/test/UserFileManager/off.ets
+1
-1
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/UserFileManager/on.ets
...hotoAccess/entry/src/main/ets/test/UserFileManager/on.ets
+3
-2
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/UserFileManager/release.ets
...ccess/entry/src/main/ets/test/UserFileManager/release.ets
+1
-1
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/getPhotoAccessHelper.ets
...toAccess/entry/src/main/ets/test/getPhotoAccessHelper.ets
+1
-1
multimedia/photoAccess/photoAccessSystem/BUILD.gn
multimedia/photoAccess/photoAccessSystem/BUILD.gn
+1
-1
multimedia/photoAccess/photoAccessSystem/Test.json
multimedia/photoAccess/photoAccessSystem/Test.json
+0
-2
multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/MainAbility/pages/index/index.ets
...stem/entry/src/main/ets/MainAbility/pages/index/index.ets
+1
-1
multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/Album/deleteAssets.ets
...cessSystem/entry/src/main/ets/test/Album/deleteAssets.ets
+3
-1
multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/Album/recoverAssets.ets
...essSystem/entry/src/main/ets/test/Album/recoverAssets.ets
+2
-1
multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/Album/setCoverUri.ets
...ccessSystem/entry/src/main/ets/test/Album/setCoverUri.ets
+2
-0
multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/List.test.ets
...s/photoAccessSystem/entry/src/main/ets/test/List.test.ets
+1
-1
multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/createAlbum.ets
...photoAccessSystem/entry/src/main/ets/test/createAlbum.ets
+2
-0
multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/createAsset.ets
...photoAccessSystem/entry/src/main/ets/test/createAsset.ets
+1
-69
multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/deleteAlbums.ets
...hotoAccessSystem/entry/src/main/ets/test/deleteAlbums.ets
+4
-2
multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/deleteAssets.ets
...hotoAccessSystem/entry/src/main/ets/test/deleteAssets.ets
+2
-1
multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/open.ets
...Access/photoAccessSystem/entry/src/main/ets/test/open.ets
+1
-0
multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/publicApiTestWithSystemApi.ets
...em/entry/src/main/ets/test/publicApiTestWithSystemApi.ets
+12
-268
multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/setFavorite.ets
...photoAccessSystem/entry/src/main/ets/test/setFavorite.ets
+2
-0
multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/setHidden.ets
...s/photoAccessSystem/entry/src/main/ets/test/setHidden.ets
+2
-0
未找到文件。
multimedia/photoAccess/common.ts
浏览文件 @
29b3d07a
...
...
@@ -94,11 +94,7 @@ export async function getPermission(name = 'ohos.acts.multimedia.photoaccess') :
const
permissions
=
[
'
ohos.permission.MEDIA_LOCATION
'
,
'
ohos.permission.READ_IMAGEVIDEO
'
,
'
ohos.permission.READ_AUDIO
'
,
'
ohos.permission.READ_DOCUMENT
'
,
'
ohos.permission.WRITE_IMAGEVIDEO
'
,
'
ohos.permission.WRITE_AUDIO
'
,
'
ohos.permission.WRITE_DOCUMENT
'
,
];
const
atManager
=
abilityAccessCtrl
.
createAtManager
();
...
...
multimedia/photoAccess/photoAccess/BUILD.gn
浏览文件 @
29b3d07a
# Copyright (c) 202
1
Huawei Device Co., Ltd.
# Copyright (c) 202
3
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
...
...
multimedia/photoAccess/photoAccess/Test.json
浏览文件 @
29b3d07a
...
...
@@ -118,7 +118,6 @@
"cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/modifyPro06.mp4"
,
"cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/modifyPro07.mp4"
,
"chmod -R 777 /storage/media/100/local/files/*"
,
"chmod -R 777 /data/service/el2/100/hmdfs/account/files/*"
,
"hilog -p off"
,
"hilog -Q pidoff"
,
"hilog -Q domainoff"
,
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/MainAbility/pages/index/index.ets
浏览文件 @
29b3d07a
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
3
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
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/AbsAlbum/checkAttr.ets
浏览文件 @
29b3d07a
...
...
@@ -13,6 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import
photoAccessHelper
from
'@ohos.file.photoAccessHelper'
import
{
describe
,
it
,
expect
}
from
'deccjsunit/index'
import
{
...
...
@@ -39,8 +40,6 @@ export default function checkAlbumAttrTest () {
const
fetchOps
=
fetchOption
(
testNum
,
photoKeys
.
DISPLAY_NAME
,
'01.jpg'
);
const
asset
=
await
getFileAsset
(
testNum
,
fetchOps
);
await
album
.
addAssets
([
asset
]);
expect
(
album
.
count
)
.
assertEqual
(
1
);
expect
(
album
.
coverUri
)
.
assertEqual
(
asset
.
uri
);
done
();
}
catch
(
error
)
{
console
.
info
(
`${testNum} failed; error: ${error}`
);
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/AbsAlbum/getAssets.ets
浏览文件 @
29b3d07a
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import photoAccessHelper from '@ohos.file.photoAccessHelper'
import { describe, it, expect } from 'deccjsunit/index'
import {
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/Album/addAssets.ets
浏览文件 @
29b3d07a
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import photoAccessHelper from '@ohos.file.photoAccessHelper'
import { describe, it, expect } from 'deccjsunit/index'
import {
...
...
@@ -109,38 +109,6 @@ export default function addAssetsTest () {
}
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_ADD_ASSETS_0400
* @tc.name : addAssets_callback_004
* @tc.desc : add empty array to user album
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('addAssets_callback_004', 2, async function (done) {
const testNum = 'addAssets_callback_004';
try {
const album = await helper.createAlbum(testNum);
album.addAssets([], async (err) => {
try {
if (err) {
console.info(`${testNum} err: ${err}`);
} else {
expect(false).assertTrue();
}
} catch (error) {
console.info(`${testNum} error: ${error}`);
}
done();
})
} catch (error) {
console.info(`${testNum} failed; error: ${error}`);
expect(false).assertTrue();
done();
}
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_ADD_ASSETS_0500
* @tc.name : addAssets_callback_005
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/Album/commitModify.ets
浏览文件 @
29b3d07a
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import photoAccessHelper from '@ohos.file.photoAccessHelper'
import { describe, it, expect } from 'deccjsunit/index'
import {
...
...
@@ -125,7 +125,7 @@ export default function albumCommitModifyTest () {
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_ALBUM_COMMITMODIFY_0300
* @tc.name : album_commitModify_callback_003
* @tc.desc : album commitModify
with containing
characters
* @tc.desc : album commitModify
containing invalid
characters
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
...
...
@@ -134,7 +134,7 @@ export default function albumCommitModifyTest () {
const testNum = 'album_commitModify_callback_003';
try {
const album = await helper.createAlbum(testNum);
const TITLE_REGEX_CHECK = '\
.\
\/:*?"\'`<>|{}\[\]';
const TITLE_REGEX_CHECK = '\\/:*?"\'`<>|{}\[\]';
let count = 0;
for (let i = 0; i < TITLE_REGEX_CHECK.length; i++) {
let invalidName = testNum + TITLE_REGEX_CHECK[i];
...
...
@@ -250,13 +250,14 @@ export default function albumCommitModifyTest () {
const testNum = 'album_commitModify_promise_003';
try {
const album = await helper.createAlbum(testNum);
const TITLE_REGEX_CHECK = '\
.\
\/:*?"\'`<>|{}\[\]';
const TITLE_REGEX_CHECK = '\\/:*?"\'`<>|{}\[\]';
let count = 0;
for (let i = 0; i < TITLE_REGEX_CHECK.length; i++) {
let invalidName = testNum + TITLE_REGEX_CHECK[i];
album.albumName = invalidName;
try {
await album.commitModify();
console.info(`${testNum} commitModify suc: ${invalidName}`);
} catch (error) {
console.info(`${testNum} error: ${error}`);
count++;
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/Album/removeAssets.ets
浏览文件 @
29b3d07a
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import photoAccessHelper from '@ohos.file.photoAccessHelper'
import { describe, it, expect } from 'deccjsunit/index'
import {
...
...
@@ -43,6 +43,9 @@ export default function removeAssetsTest () {
const fetchOps = fetchOption(testNum, photoKeys.DISPLAY_NAME, 'removeCb01.jpg');
const asset = await getFileAsset(testNum, fetchOps);
await album.addAssets([asset]);
const fetchResult = await album.getAssets(fetchOps);
expect(fetchResult.getCount()).assertEqual(1);
fetchResult.close()
album.removeAssets([asset], async (err) => {
try {
if (err) {
...
...
@@ -86,6 +89,9 @@ export default function removeAssetsTest () {
const asset2 = await getFileAsset(testNum, fetchOps2);
assetList.push(asset2);
await album.addAssets(assetList);
const fetchResult = await album.getAssets(fetchAllOption());
expect(fetchResult.getCount()).assertEqual(2);
fetchResult.close()
album.removeAssets(assetList, async (err) => {
try {
if (err) {
...
...
@@ -109,32 +115,6 @@ export default function removeAssetsTest () {
}
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_REMOVE_ASSETS_0300
* @tc.name : removeAssets_callback_003
* @tc.desc : user album remove empty array
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('removeAssets_callback_003', 2, async function (done) {
const testNum = 'removeAssets_callback_003';
try {
const album = await helper.createAlbum(testNum);
album.removeAssets([], async (err) => {
if (err) {
console.info(`${testNum} err: ${err}`);
expect(false).assertTrue();
}
done();
})
} catch (error) {
console.info(`${testNum} failed; error: ${error}`);
expect(false).assertTrue();
done();
}
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_REMOVE_ASSETS_0400
* @tc.name : removeAssets_callback_004
...
...
@@ -164,7 +144,7 @@ export default function removeAssetsTest () {
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_REMOVE_ASSETS_0500
* @tc.name : removeAssets_callback_005
* @tc.desc :
add deleted image asset to user album
* @tc.desc :
user album image asset twice
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
...
...
@@ -196,7 +176,7 @@ export default function removeAssetsTest () {
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_REMOVE_ASSETS_0000
* @tc.name : removeAssets_promise_000
* @tc.desc :
add image asset to user album
* @tc.desc :
user album remove image asset
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
...
...
@@ -209,8 +189,11 @@ export default function removeAssetsTest () {
const asset = await getFileAsset(testNum, fetchOps);
await album.addAssets([asset]);
let fetchResult = await album.getAssets(fetchOps);
console.info(`${testNum} count: ${fetchResult.getCount()}`);
expect(fetchResult.getCount()).assertEqual(1);
await album.removeAssets([asset]);
const
fetchResult = await album.getAssets(fetchOps);
fetchResult = await album.getAssets(fetchOps);
console.info(`${testNum} count: ${fetchResult.getCount()}`);
expect(fetchResult.getCount()).assertEqual(0);
fetchResult.close();
...
...
@@ -225,7 +208,7 @@ export default function removeAssetsTest () {
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_REMOVE_ASSETS_0200
* @tc.name : removeAssets_promise_002
* @tc.desc :
add image&video asset to user album
* @tc.desc :
user album remove image&video asset
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
...
...
@@ -243,9 +226,10 @@ export default function removeAssetsTest () {
assetList.push(asset2);
await album.addAssets(assetList);
let fetchResult = await album.getAssets(fetchAllOption());
expect(fetchResult.getCount()).assertEqual(2);
await album.removeAssets(assetList);
console.info(`${testNum} album.count: ${album.count}`);
const fetchResult = await album.getAssets(fetchAllOption());
fetchResult = await album.getAssets(fetchAllOption());
expect(fetchResult.getCount()).assertEqual(0);
fetchResult.close();
done();
...
...
@@ -259,7 +243,7 @@ export default function removeAssetsTest () {
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_REMOVE_ASSETS_0300
* @tc.name : removeAssets_promise_003
* @tc.desc :
add empty array to user album
* @tc.desc :
user album remove empty array
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
...
...
@@ -280,7 +264,7 @@ export default function removeAssetsTest () {
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_REMOVE_ASSETS_0400
* @tc.name : removeAssets_promise_004
* @tc.desc :
add undefined array to user album
* @tc.desc :
user album remove undefined array
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
...
...
@@ -301,7 +285,7 @@ export default function removeAssetsTest () {
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_REMOVE_ASSETS_0500
* @tc.name : removeAssets_promise_005
* @tc.desc :
add deleted image asset to user album
* @tc.desc :
remove image asset twice
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/AlbumFetchResult/close.ets
浏览文件 @
29b3d07a
/*
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Copyright (C) 202
3
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
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import photoAccessHelper from '@ohos.file.photoAccessHelper'
import { describe, it, expect } from 'deccjsunit/index'
import {
...
...
@@ -31,7 +31,7 @@ export default function albumCloseTest () {
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_ALBUM_CLOSE_0000
* @tc.name : album_close_000
* @tc.desc : close
* @tc.desc : close
system album
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
...
...
@@ -49,50 +49,58 @@ export default function albumCloseTest () {
fetchResult = await helper.getAlbums(albumType.SYSTEM, subTypes[i]);
expect(fetchResult.getCount()).assertEqual(1);
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
);
passCount++;
if (i + 1 === subTypes.length) {
expect(passCount).assertEqual(subTypes.length);
...
...
@@ -109,7 +117,7 @@ export default function albumCloseTest () {
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_ALBUM_CLOSE_0100
* @tc.name : album_close_001
* @tc.desc : close
* @tc.desc : close
user album
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
...
...
@@ -122,50 +130,58 @@ export default function albumCloseTest () {
const fetchResult = await helper.getAlbums(albumType.USER, albumSubtype.USER_GENERIC, fetchOps);
expect(fetchResult.getCount()).assertEqual(1);
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}`);
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/AlbumFetchResult/getAllObjects.ets
浏览文件 @
29b3d07a
/*
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Copyright (C) 202
3
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
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import photoAccessHelper from '@ohos.file.photoAccessHelper'
import { describe, it, expect } from 'deccjsunit/index'
import {
...
...
@@ -34,7 +34,7 @@ export default function albumGetAllObjectTest () {
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_ALBUM_GET_ALL_OBJECTS_0000
* @tc.name : album_getAllObjects_callback_000
* @tc.desc : get
AllObjects
* @tc.desc : get
all system album object
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
...
...
@@ -81,7 +81,7 @@ export default function albumGetAllObjectTest () {
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_ALBUM_GET_ALL_OBJECTS_0100
* @tc.name : album_getAllObjects_callback_001
* @tc.desc : get
AllObjects
* @tc.desc : get
specific user album
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
...
...
@@ -119,7 +119,7 @@ export default function albumGetAllObjectTest () {
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_ALBUM_GET_ALL_OBJECTS_0000
* @tc.name : album_getAllObjects_promise_000
* @tc.desc : get
AllObjects
* @tc.desc : get
all system album object
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
...
...
@@ -155,7 +155,7 @@ export default function albumGetAllObjectTest () {
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_ALBUM_GET_ALL_OBJECTS_0100
* @tc.name : album_getAllObjects_promise_001
* @tc.desc : get
AllObjects
* @tc.desc : get
specific user album
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/AlbumFetchResult/getCount.ets
浏览文件 @
29b3d07a
/*
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Copyright (C) 202
3
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
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import photoAccessHelper from '@ohos.file.photoAccessHelper'
import { describe, it, expect } from 'deccjsunit/index'
import {
...
...
@@ -38,7 +38,7 @@ export default function albumGetCountTest () {
* @tc.level : Level 0
*/
it('album_getCount_callback_000', 0, async function (done) {
const testNum = 'album_getCount_callback_000';
const testNum = 'album_getCount_callback_000';
try {
const subTypes : Array<photoAccessHelper.AlbumSubtype> = [
albumSubtype.VIDEO,
...
...
@@ -61,8 +61,8 @@ export default function albumGetCountTest () {
}
}
} catch (error) {
console.info(`${testNum} failed; error: ${error}`);
expect(false).assertTrue();
console.info(`${testNum} failed; error: ${error}`);
expect(false).assertTrue();
done();
}
});
...
...
@@ -76,7 +76,7 @@ export default function albumGetCountTest () {
* @tc.level : Level 0
*/
it('album_getCount_callback_001', 0, async function (done) {
const testNum = 'album_getCount_callback_001';
const testNum = 'album_getCount_callback_001';
try {
const albumName = genRadomStr(10);
await createUserAlbum(testNum, albumName);
...
...
@@ -92,7 +92,7 @@ export default function albumGetCountTest () {
done();
} catch (error) {
console.info(`${testNum} failed; error: ${error}`);
expect(false).assertTrue();
expect(false).assertTrue();
done();
}
});
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/AlbumFetchResult/getFirstObject.ets
浏览文件 @
29b3d07a
/*
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Copyright (C) 202
3
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
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import photoAccessHelper from '@ohos.file.photoAccessHelper'
import { describe, it, expect } from 'deccjsunit/index'
import {
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/AlbumFetchResult/getLastObject.ets
浏览文件 @
29b3d07a
/*
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Copyright (C) 202
3
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
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import photoAccessHelper from '@ohos.file.photoAccessHelper'
import { describe, it, expect } from 'deccjsunit/index'
import {
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/AlbumFetchResult/getNextObject.ets
浏览文件 @
29b3d07a
/*
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Copyright (C) 202
3
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
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import photoAccessHelper from '@ohos.file.photoAccessHelper'
import { describe, it, expect } from 'deccjsunit/index'
import {
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/AlbumFetchResult/getObjectByPosition.ets
浏览文件 @
29b3d07a
/*
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Copyright (C) 202
3
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
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import photoAccessHelper from '@ohos.file.photoAccessHelper'
import { describe, it, expect } from 'deccjsunit/index'
import {
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/AlbumFetchResult/isAfterLast.ets
浏览文件 @
29b3d07a
/*
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Copyright (C) 202
3
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
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import photoAccessHelper from '@ohos.file.photoAccessHelper'
import { describe, it, expect } from 'deccjsunit/index'
import {
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAsset/checkAttr.ets
浏览文件 @
29b3d07a
...
...
@@ -13,6 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import
{
describe
,
it
,
expect
}
from
'deccjsunit/index'
import
{
photoKeys
,
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAsset/close.ets
浏览文件 @
29b3d07a
...
...
@@ -13,6 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import
fileio
from
"@ohos.fileio"
;
import
{
describe
,
it
,
expect
}
from
'deccjsunit/index'
import
{
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAsset/commitModify.ets
浏览文件 @
29b3d07a
...
...
@@ -13,6 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import
photoAccessHelper
from
'@ohos.file.photoAccessHelper'
import
{
describe
,
it
,
expect
}
from
'deccjsunit/index'
import
{
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAsset/get.ets
浏览文件 @
29b3d07a
...
...
@@ -13,6 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import
{
describe
,
it
,
expect
}
from
'deccjsunit/index'
import
{
photoKeys
,
...
...
@@ -556,7 +557,7 @@ export default function getTest () {
const
testNum
=
'get_065'
;
const
fetchOps
=
photoFetchOption
(
testNum
,
photoKeys
.
DISPLAY_NAME
,
'01.mp4'
);
const
key
=
photoKeys
.
HIDDEN
;
const
value
=
4853005
;
const
value
=
0
;
await
get
(
done
,
testNum
,
fetchOps
,
key
,
value
);
});
})
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAsset/getReadOnlyFd.ets
浏览文件 @
29b3d07a
...
...
@@ -13,6 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import
{
describe
,
it
,
expect
}
from
'deccjsunit/index'
import
{
photoKeys
,
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAsset/getThumbnail.ets
浏览文件 @
29b3d07a
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import
photoAccessHelper
from
'@ohos.file.photoAccessHelper'
import
image
from
'@ohos.multimedia.image'
;
import
{
describe
,
it
,
expect
}
from
'deccjsunit/index'
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAssetFetchResult/close.ets
浏览文件 @
29b3d07a
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import
photoAccessHelper
from
'@ohos.file.photoAccessHelper'
import
{
describe
,
it
,
expect
}
from
'deccjsunit/index'
import
{
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAssetFetchResult/getAllObjects.ets
浏览文件 @
29b3d07a
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import
photoAccessHelper
from
'@ohos.file.photoAccessHelper'
import
{
describe
,
it
,
expect
}
from
'deccjsunit/index'
import
{
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAssetFetchResult/getCount.ets
浏览文件 @
29b3d07a
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import
photoAccessHelper
from
'@ohos.file.photoAccessHelper'
import
{
describe
,
it
,
expect
}
from
'deccjsunit/index'
import
{
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAssetFetchResult/getFirstObject.ets
浏览文件 @
29b3d07a
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import
photoAccessHelper
from
'@ohos.file.photoAccessHelper'
import
{
describe
,
it
,
expect
}
from
'deccjsunit/index'
import
{
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAssetFetchResult/getLastObject.ets
浏览文件 @
29b3d07a
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import
photoAccessHelper
from
'@ohos.file.photoAccessHelper'
import
{
describe
,
it
,
expect
}
from
'deccjsunit/index'
import
{
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAssetFetchResult/getNextObject.ets
浏览文件 @
29b3d07a
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import
photoAccessHelper
from
'@ohos.file.photoAccessHelper'
import
{
describe
,
it
,
expect
}
from
'deccjsunit/index'
import
{
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAssetFetchResult/getObjectByPosition.ets
浏览文件 @
29b3d07a
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import
photoAccessHelper
from
'@ohos.file.photoAccessHelper'
import
{
describe
,
it
,
expect
}
from
'deccjsunit/index'
import
{
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAssetFetchResult/isAfterLast.ets
浏览文件 @
29b3d07a
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import
photoAccessHelper
from
'@ohos.file.photoAccessHelper'
import
{
describe
,
it
,
expect
}
from
'deccjsunit/index'
import
{
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/UserFileManager/createAsset.ets
浏览文件 @
29b3d07a
/*
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Copyright (C) 202
3
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
...
...
@@ -24,7 +24,7 @@ export default function createAssetTest () {
async
function
createAssetCallback1
(
done
,
testNum
,
type
,
extension
,
options
)
{
try
{
helper
.
createAsset
(
photoT
ype
,
extension
,
options
,
(
err
,
uri
)
=>
{
helper
.
createAsset
(
t
ype
,
extension
,
options
,
(
err
,
uri
)
=>
{
try
{
if
(
err
!==
undefined
)
{
console
.
info
(
`${testNum} err: ${err}`
);
...
...
@@ -46,7 +46,7 @@ export default function createAssetTest () {
async
function
createAssetCallback2
(
done
,
testNum
,
type
,
extension
)
{
try
{
helper
.
createAsset
(
photoT
ype
,
extension
,
(
err
,
uri
)
=>
{
helper
.
createAsset
(
t
ype
,
extension
,
(
err
,
uri
)
=>
{
try
{
if
(
err
!==
undefined
)
{
console
.
info
(
`${testNum} err: ${err}`
);
...
...
@@ -68,12 +68,16 @@ export default function createAssetTest () {
async
function
createAssetAbnormalCallback1
(
done
,
testNum
,
type
,
extension
,
options
)
{
try
{
helper
.
createAsset
(
photoType
,
extension
,
options
,
(
err
,
uri
)
=>
{
if
(
err
!==
undefined
)
{
console
.
info
(
`${testNum} createAsset failed; err: ${err}`
);
expect
(
true
)
.
assertTrue
();
}
else
{
expect
(
false
)
.
assertTrue
();
helper
.
createAsset
(
type
,
extension
,
options
,
(
err
,
uri
)
=>
{
try
{
if
(
err
!==
undefined
)
{
console
.
info
(
`${testNum} err: ${err}`
);
expect
(
true
)
.
assertTrue
();
}
else
{
expect
(
false
)
.
assertTrue
();
}
}
catch
(
error
)
{
console
.
info
(
`${testNum} error: ${error}`
);
}
done
();
})
...
...
@@ -86,8 +90,7 @@ export default function createAssetTest () {
async
function
createAssetPromise1
(
done
,
testNum
,
type
,
extension
,
options
)
{
try
{
const
createAsset
=
await
helper
.
createAsset
(
photoType
,
extension
,
options
);
expect
(
createAsset
.
displayName
)
.
assertEqual
(
displayName
);
await
helper
.
createAsset
(
type
,
extension
,
options
);
done
();
}
catch
(
error
)
{
console
.
info
(
`${testNum} failed; error: ${error}`
);
...
...
@@ -98,8 +101,7 @@ export default function createAssetTest () {
async
function
createAssetPromise2
(
done
,
testNum
,
type
,
extension
)
{
try
{
const
createAsset
=
await
helper
.
createAsset
(
photoType
,
extension
);
expect
(
createAsset
.
displayName
)
.
assertEqual
(
displayName
);
await
helper
.
createAsset
(
type
,
extension
);
done
();
}
catch
(
error
)
{
console
.
info
(
`${testNum} failed; error: ${error}`
);
...
...
@@ -110,7 +112,7 @@ export default function createAssetTest () {
async
function
createAssetAbnormalPromise1
(
done
,
testNum
,
type
,
extension
,
options
)
{
try
{
await
helper
.
createAsset
(
photoT
ype
,
extension
,
options
);
await
helper
.
createAsset
(
t
ype
,
extension
,
options
);
expect
(
false
)
.
assertTrue
();
done
()
}
catch
(
error
)
{
...
...
@@ -163,7 +165,7 @@ export default function createAssetTest () {
*/
it
(
'createImage_callback_002'
,
2
,
async
function
(
done
)
{
const
testNum
=
'createImage_callback_002'
;
const
photoT
ype
=
undefined
;
const
t
ype
=
undefined
;
const
extension
=
'jpg'
;
const
options
:
photoAccessHelper
.
CreateOptions
=
{
title
:
testNum
...
...
@@ -222,7 +224,7 @@ export default function createAssetTest () {
const
options
:
photoAccessHelper
.
CreateOptions
=
{
title
:
undefined
}
await
createAsset
Abnormal
Callback1
(
done
,
testNum
,
type
,
extension
,
options
);
await
createAssetCallback1
(
done
,
testNum
,
type
,
extension
,
options
);
});
/**
...
...
@@ -249,19 +251,19 @@ export default function createAssetTest () {
* @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
);
});
//
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
...
...
@@ -306,7 +308,7 @@ export default function createAssetTest () {
*/
it
(
'createImage_promise_002'
,
2
,
async
function
(
done
)
{
const
testNum
=
'createImage_promise_002'
;
const
photoT
ype
=
undefined
;
const
t
ype
=
undefined
;
const
extension
=
'jpg'
;
const
options
:
photoAccessHelper
.
CreateOptions
=
{
title
:
testNum
...
...
@@ -365,7 +367,7 @@ export default function createAssetTest () {
const
options
:
photoAccessHelper
.
CreateOptions
=
{
title
:
undefined
}
await
createAsset
Abnormal
Promise1
(
done
,
testNum
,
type
,
extension
,
options
);
await
createAssetPromise1
(
done
,
testNum
,
type
,
extension
,
options
);
});
/**
...
...
@@ -392,19 +394,19 @@ export default function createAssetTest () {
* @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
);
});
//
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
...
...
@@ -449,7 +451,7 @@ export default function createAssetTest () {
*/
it
(
'createVideo_callback_002'
,
2
,
async
function
(
done
)
{
const
testNum
=
'createVideo_callback_002'
;
const
photoT
ype
=
undefined
;
const
t
ype
=
undefined
;
const
extension
=
'mp4'
;
const
options
:
photoAccessHelper
.
CreateOptions
=
{
title
:
testNum
...
...
@@ -508,7 +510,7 @@ export default function createAssetTest () {
const
options
:
photoAccessHelper
.
CreateOptions
=
{
title
:
undefined
}
await
createAsset
Abnormal
Callback1
(
done
,
testNum
,
type
,
extension
,
options
);
await
createAssetCallback1
(
done
,
testNum
,
type
,
extension
,
options
);
});
/**
...
...
@@ -535,19 +537,19 @@ export default function createAssetTest () {
* @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
);
});
//
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
...
...
@@ -592,7 +594,7 @@ export default function createAssetTest () {
*/
it
(
'createVideo_promise_002'
,
2
,
async
function
(
done
)
{
const
testNum
=
'createVideo_promise_002'
;
const
photoT
ype
=
undefined
;
const
t
ype
=
undefined
;
const
extension
=
'mp4'
;
const
options
:
photoAccessHelper
.
CreateOptions
=
{
title
:
testNum
...
...
@@ -651,7 +653,7 @@ export default function createAssetTest () {
const
options
:
photoAccessHelper
.
CreateOptions
=
{
title
:
undefined
}
await
createAsset
Abnormal
Promise1
(
done
,
testNum
,
type
,
extension
,
options
);
await
createAssetPromise1
(
done
,
testNum
,
type
,
extension
,
options
);
});
/**
...
...
@@ -678,18 +680,18 @@ export default function createAssetTest () {
* @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
);
});
//
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);
//
});
})
}
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/UserFileManager/getAlbums.ets
浏览文件 @
29b3d07a
/*
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Copyright (C) 202
3
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
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import photoAccessHelper from '@ohos.file.photoAccessHelper'
import { describe, it, expect } from 'deccjsunit/index'
import {
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/UserFileManager/getAssets.ets
浏览文件 @
29b3d07a
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import
photoAccessHelper
from
'@ohos.file.photoAccessHelper'
import
{
describe
,
it
,
expect
}
from
'deccjsunit/index'
import
{
...
...
@@ -127,20 +127,6 @@ export default function getAssetsTest () {
await
getAssetsCallbackTest
(
done
,
testNum
,
fetchOps
,
expectCount
);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_GET_ASSETS_0200
* @tc.name : getAssets_callback_002
* @tc.desc : getAssets image
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'getAssets_callback_002'
,
0
,
async
function
(
done
)
{
const
testNum
=
'getAssets_callback_002'
;
const
fetchOps
=
fetchOption
(
testNum
,
'666'
,
'666'
);
await
getAssetsAbnormalCallbackTest
(
done
,
testNum
,
fetchOps
);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_GET_ASSETS_0300
* @tc.name : getAssets_callback_003
...
...
@@ -185,20 +171,6 @@ export default function getAssetsTest () {
await
getAssetsPromiseTest
(
done
,
testNum
,
fetchOps
,
expectCount
);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_GET_ASSETS_0200
* @tc.name : getAssets_promise_002
* @tc.desc : getAssets image
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'getAssets_promise_002'
,
0
,
async
function
(
done
)
{
const
testNum
=
'getAssets_promise_002'
;
const
fetchOps
=
fetchOption
(
testNum
,
'666'
,
'666'
);
await
getAssetsAbnormalPromiseTest
(
done
,
testNum
,
fetchOps
);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_GET_ASSETS_0300
* @tc.name : getAssets_promise_003
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/UserFileManager/off.ets
浏览文件 @
29b3d07a
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import
photoAccessHelper
from
'@ohos.file.photoAccessHelper'
import
{
describe
,
it
,
expect
}
from
'deccjsunit/index'
import
{
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/UserFileManager/on.ets
浏览文件 @
29b3d07a
...
...
@@ -13,6 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import photoAccessHelper from '@ohos.file.photoAccessHelper'
import { describe, it, expect } from 'deccjsunit/index'
import {
...
...
@@ -160,7 +161,7 @@ export default function onTest () {
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);
...
...
@@ -197,7 +198,7 @@ export default function onTest () {
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);
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/UserFileManager/release.ets
浏览文件 @
29b3d07a
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import photoAccessHelper from '@ohos.file.photoAccessHelper'
import { describe, it, expect } from 'deccjsunit/index'
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/getPhotoAccessHelper.ets
浏览文件 @
29b3d07a
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import photoAccessHelper from '@ohos.file.photoAccessHelper'
import { describe, beforeAll, it, expect } from 'deccjsunit/index'
import { getPermission } from '../../../../../../common'
...
...
multimedia/photoAccess/photoAccessSystem/BUILD.gn
浏览文件 @
29b3d07a
# Copyright (c) 202
1
Huawei Device Co., Ltd.
# Copyright (c) 202
3
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
...
...
multimedia/photoAccess/photoAccessSystem/Test.json
浏览文件 @
29b3d07a
...
...
@@ -94,7 +94,6 @@
"cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Camera/cameraPro01.jpg"
,
"cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/albumGetAssetsCb01.jpg"
,
"cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/albumGetAssetsPro01.jpg"
,
"cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/.jpg"
,
"cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/addCb02.jpg"
,
"cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/addCb04.jpg"
,
"cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/removeCb02.jpg"
,
...
...
@@ -116,7 +115,6 @@
"cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/addPro04.jpg"
,
"cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/removePro02.jpg"
,
"chmod -R 777 /storage/media/100/local/files/*"
,
"chmod -R 777 /data/service/el2/100/hmdfs/account/files/*"
,
"hilog -p off"
,
"hilog -Q pidoff"
,
"hilog -Q domainoff"
,
...
...
multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/MainAbility/pages/index/index.ets
浏览文件 @
29b3d07a
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
3
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
...
...
multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/Album/deleteAssets.ets
浏览文件 @
29b3d07a
/*
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Copyright (C) 202
3
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
...
...
@@ -12,6 +12,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import
photoAccessHelper
from
'@ohos.file.photoAccessHelper'
import
{
describe
,
beforeAll
,
it
,
expect
}
from
'deccjsunit/index'
import
{
...
...
multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/Album/recoverAssets.ets
浏览文件 @
29b3d07a
/*
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Copyright (C) 202
3
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
...
...
@@ -13,6 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import
photoAccessHelper
from
'@ohos.file.photoAccessHelper'
import
{
describe
,
beforeAll
,
it
,
expect
}
from
'deccjsunit/index'
import
{
...
...
multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/Album/setCoverUri.ets
浏览文件 @
29b3d07a
...
...
@@ -12,6 +12,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import photoAccessHelper from '@ohos.file.photoAccessHelper'
import { describe, beforeAll, it, expect } from 'deccjsunit/index'
import {
...
...
multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/List.test.ets
浏览文件 @
29b3d07a
...
...
@@ -29,7 +29,7 @@ import trashAssetsTest from './deleteAssets'
export default function testsuite () {
deleteAssetsTest()
recoverAssetsTest()
setCoverUriTest()
//
setCoverUriTest()
createAlbumTest()
createAssetTest()
...
...
multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/createAlbum.ets
浏览文件 @
29b3d07a
...
...
@@ -12,6 +12,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import photoAccessHelper from '@ohos.file.photoAccessHelper'
import { describe, beforeAll, it, expect } from 'deccjsunit/index'
import {
...
...
multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/createAsset.ets
浏览文件 @
29b3d07a
/*
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Copyright (C) 202
3
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
...
...
@@ -307,23 +307,6 @@ export default function createAssetTest () {
await
createAssetAbnormalCallback2
(
done
,
testNum
,
displayName
,
createOption
);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_ASSET_1000
* @tc.name : createAsset_callback_010
* @tc.desc : createAsset abnormal param
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
// it('createAsset_callback_010', 2, async function (done) {
// const testNum = 'createAsset_callback_010';
// const displayName = testNum + '.jpg';
// const createOption: photoAccessHelper.PhotoCreateOptions = {
// subtype: undefined,
// };
// await createAssetAbnormalCallback2(done, testNum, displayName, createOption);
// });
//promise
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_0000
...
...
@@ -472,23 +455,6 @@ export default function createAssetTest () {
await
createAssetAbnormalPromise2
(
done
,
testNum
,
displayName
,
createOption
);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_1000
* @tc.name : createAsset_promise_010
* @tc.desc : createAsset abnormal param
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
// it('createAsset_promise_010', 2, async function (done) {
// const testNum = 'createAsset_promise_010';
// const displayName = testNum + '.jpg';
// const createOption: photoAccessHelper.PhotoCreateOptions = {
// subtype: undefined,
// };
// await createAssetAbnormalPromise2(done, testNum, displayName, createOption);
// });
//video
//callback
/**
...
...
@@ -578,23 +544,6 @@ export default function createAssetTest () {
await
createAssetAbnormalCallback2
(
done
,
testNum
,
displayName
,
createOption
);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_ASSET_1700
* @tc.name : createAsset_callback_017
* @tc.desc : createAsset abnormal param
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
// it('createAsset_callback_017', 2, async function (done) {
// const testNum = 'createAsset_callback_017';
// const displayName = testNum + '.mp4';
// const createOption: photoAccessHelper.PhotoCreateOptions = {
// subtype: undefined,
// };
// await createAssetAbnormalCallback2(done, testNum, displayName, createOption);
// });
//promise
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_1100
...
...
@@ -682,22 +631,5 @@ export default function createAssetTest () {
};
await
createAssetAbnormalPromise2
(
done
,
testNum
,
displayName
,
createOption
);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_1700
* @tc.name : createAsset_promise_017
* @tc.desc : createAsset abnormal param
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
// it('createAsset_promise_017', 2, async function (done) {
// const testNum = 'createAsset_promise_017';
// const displayName = testNum + '.mp4';
// const createOption: photoAccessHelper.PhotoCreateOptions = {
// subtype: undefined,
// };
// await createAssetAbnormalPromise2(done, testNum, displayName, createOption);
// });
})
}
multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/deleteAlbums.ets
浏览文件 @
29b3d07a
/*
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Copyright (C) 202
3
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
...
...
@@ -12,8 +12,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import photoAccessHelper from '@ohos.file.photoAccessHelper'
import { describe, beforeAll,
beforeEach, afterEach, afterAll,
it, expect } from 'deccjsunit/index'
import { describe, beforeAll, it, expect } from 'deccjsunit/index'
import {
albumKeys,
albumType,
...
...
multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/deleteAssets.ets
浏览文件 @
29b3d07a
/*
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Copyright (C) 202
3
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
...
...
@@ -13,6 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import
photoAccessHelper
from
'@ohos.file.photoAccessHelper'
import
{
describe
,
it
,
expect
}
from
'deccjsunit/index'
import
{
...
...
multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/open.ets
浏览文件 @
29b3d07a
...
...
@@ -13,6 +13,7 @@
* limitations under the License.
*/
// @ts-nocheck
import
fileio
from
"@ohos.fileio"
;
import
{
describe
,
beforeAll
,
it
,
expect
}
from
'deccjsunit/index'
import
{
...
...
multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/publicApiTestWithSystemApi.ets
浏览文件 @
29b3d07a
...
...
@@ -12,6 +12,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import
fileio
from
"@ohos.fileio"
;
import
photoAccessHelper
from
'@ohos.file.photoAccessHelper'
import
{
describe
,
it
,
expect
}
from
'deccjsunit/index'
...
...
@@ -640,7 +642,6 @@ export default function publicApiTestWithSystemApiTest () {
helper
.
on
(
createAsset
.
uri
,
false
,
async
(
changeData
)
=>
{
count
++
;
console
.
info
(
`${testNum} changeData: ${JSON.stringify(changeData)}`
);
helper
.
off
(
createAsset
.
uri
);
expect
(
changeData
.
type
)
.
assertEqual
(
NOTIFY_ADD
);
expect
(
changeData
.
uris
[
0
])
.
assertEqual
(
createAsset
.
uri
);
});
...
...
@@ -648,6 +649,7 @@ export default function publicApiTestWithSystemApiTest () {
fd
=
await
createAsset
.
getReadOnlyFd
();
await
createAsset
.
close
(
fd
);
await
sleep
(
1000
);
helper
.
off
(
createAsset
.
uri
);
expect
(
count
)
.
assertEqual
(
0
);
done
();
}
catch
(
error
)
{
...
...
@@ -675,7 +677,6 @@ export default function publicApiTestWithSystemApiTest () {
helper
.
on
(
asset
.
uri
,
false
,
async
(
changeData
)
=>
{
count
++
;
console
.
info
(
`${testNum} changeData: ${JSON.stringify(changeData)}`
);
helper
.
off
(
asset
.
uri
);
expect
(
changeData
.
type
)
.
assertEqual
(
NOTIFY_UPDATE
);
expect
(
changeData
.
uris
[
0
])
.
assertEqual
(
asset
.
uri
);
});
...
...
@@ -710,7 +711,6 @@ export default function publicApiTestWithSystemApiTest () {
helper
.
on
(
asset
.
uri
,
false
,
async
(
changeData
)
=>
{
count
++
;
console
.
info
(
`${testNum} changeData: ${JSON.stringify(changeData)}`
);
helper
.
off
(
asset
.
uri
);
expect
(
changeData
.
type
)
.
assertEqual
(
NOTIFY_UPDATE
);
expect
(
changeData
.
uris
[
0
])
.
assertEqual
(
asset
.
uri
);
});
...
...
@@ -726,40 +726,6 @@ export default function publicApiTestWithSystemApiTest () {
}
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_ON_CALLBACK_0400
* @tc.name : on_callback_004
* @tc.desc : listening delete file, type NOTIFY_REMOVE
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'on_callback_004'
,
0
,
async
function
(
done
)
{
const
testNum
=
'on_callback_004'
;
try
{
let
fetchOps
=
fetchOption
(
testNum
,
photoKeys
.
DISPLAY_NAME
,
'on04.jpg'
);
const
asset
=
await
getFileAsset
(
testNum
,
fetchOps
);
let
listenCount
=
0
;
await
sleep
(
500
);
helper
.
on
(
asset
.
uri
,
false
,
async
(
changeData
)
=>
{
listenCount
++
;
console
.
info
(
`${testNum} asset changeData: ${JSON.stringify(changeData)}`
);
helper
.
off
(
asset
.
uri
);
expect
(
changeData
.
type
)
.
assertEqual
(
NOTIFY_REMOVE
);
expect
(
changeData
.
uris
[
0
])
.
assertEqual
(
asset
.
uri
);
});
await
helper
.
deleteAssets
([
asset
.
uri
]);
await
sleep
(
2000
);
helper
.
off
(
asset
.
uri
);
expect
(
listenCount
)
.
assertEqual
(
1
);
done
();
}
catch
(
error
)
{
console
.
log
(
`${testNum}: tryError: ${error}`
);
expect
(
false
)
.
assertTrue
();
done
();
}
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_ON_CALLBACK_0500
* @tc.name : on_callback_005
...
...
@@ -769,7 +735,7 @@ export default function publicApiTestWithSystemApiTest () {
* @tc.level : Level 2
*/
it
(
'on_callback_005'
,
0
,
async
function
(
done
)
{
const
testNum
=
'on_callback_005'
;
const
testNum
=
'on_callback_005'
;
try
{
let
testFileName
=
'testCreateFile'
+
Date
.
now
()
+
'.jpg'
;
let
fileAsset
=
await
helper
.
createAsset
(
testFileName
);
...
...
@@ -788,10 +754,10 @@ export default function publicApiTestWithSystemApiTest () {
console
.
info
(
`on_callback_005 changeData: ${JSON.stringify(changeData)}`
);
expect
(
changeData
.
type
)
.
assertEqual
(
NOTIFY_ADD
);
expect
(
changeData
.
uris
[
0
])
.
assertEqual
(
trashFileAsset
.
uri
);
helper
.
off
(
trashFileAsset
.
uri
);
});
await
trashAlbum
.
recoverAssets
([
trashFileAsset
]);
await
sleep
(
2000
);
helper
.
off
(
trashFileAsset
.
uri
);
expect
(
count
)
.
assertEqual
(
1
);
done
();
}
catch
(
error
)
{
...
...
@@ -810,7 +776,7 @@ export default function publicApiTestWithSystemApiTest () {
* @tc.level : Level 2
*/
it
(
'on_callback_006'
,
0
,
async
function
(
done
)
{
const
testNum
=
'on_callback_006'
;
const
testNum
=
'on_callback_006'
;
try
{
let
testFileName
=
'testCreateFile'
+
Date
.
now
()
+
'.jpg'
;
let
fileAsset
=
await
helper
.
createAsset
(
testFileName
);
...
...
@@ -827,12 +793,12 @@ export default function publicApiTestWithSystemApiTest () {
helper
.
on
(
trashAlbum
.
albumUri
,
false
,
async
(
changeData
)
=>
{
count
++
;
console
.
info
(
`on_callback_006 changeData: ${JSON.stringify(changeData)}`
);
helper
.
off
(
trashAlbum
.
albumUri
);
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
);
expect
(
count
)
.
assertEqual
(
1
);
done
();
}
catch
(
error
)
{
...
...
@@ -879,153 +845,6 @@ export default function publicApiTestWithSystemApiTest () {
}
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_ON_CALLBACK_1000
* @tc.name : on_callback_010
* @tc.desc : listening change album coverUri, type NOTIFY_UPDATE
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'on_callback_010'
,
0
,
async
function
example
(
done
)
{
const
testNum
=
'on_callback_010'
;
try
{
let
albumUri
=
''
;
let
count
=
0
;
let
albumName
=
testNum
+
Date
.
now
();
let
album
=
await
helper
.
createAlbum
(
albumName
);
albumUri
=
album
.
albumUri
;
const
fetchOps
=
fetchOption
(
testNum
,
photoKeys
.
DISPLAY_NAME
,
'on10.jpg'
);
const
asset
=
await
getFileAsset
(
testNum
,
fetchOps
);
await
sleep
(
500
);
helper
.
on
(
albumUri
,
false
,
async
(
changeData
)
=>
{
count
++
;
console
.
info
(
`${testNum} changeData: ${JSON.stringify(changeData)}`
);
expect
(
changeData
.
type
)
.
assertEqual
(
NOTIFY_UPDATE
);
expect
(
changeData
.
uris
[
0
])
.
assertEqual
(
albumUri
);
});
album
.
setCoverUri
(
asset
.
uri
);
await
album
.
commitModify
();
await
sleep
(
1000
);
helper
.
off
(
albumUri
);
expect
(
count
)
.
assertEqual
(
1
);
done
();
}
catch
(
error
)
{
console
.
log
(
`${testNum}: tryError: ${error}`
);
expect
(
false
)
.
assertTrue
();
done
();
}
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_ON_CALLBACK_1300
* @tc.name : on_callback_013
* @tc.desc : listening DEFAULT_ALBUM_URI
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
'on_callback_013'
,
0
,
async
function
(
done
)
{
const
testNum
=
'on_callback_013'
;
try
{
let
albumUri
=
''
;
let
trashAlbumUri
=
''
;
let
trashFileAssetUri
=
''
;
let
listenCount
=
0
;
const
fetchOps
=
fetchOption
(
testNum
,
photoKeys
.
DISPLAY_NAME
,
'on13.jpg'
);
const
asset
=
await
getFileAsset
(
testNum
,
fetchOps
);
let
testFileName
=
'testCreateFile'
+
Date
.
now
()
+
'.jpg'
;
let
fileAsset
=
await
helper
.
createAsset
(
testFileName
);
let
fd
=
await
fileAsset
.
open
(
'rw'
);
await
fileAsset
.
close
(
fd
);
await
helper
.
deleteAssets
([
fileAsset
.
uri
]);
await
sleep
(
500
);
helper
.
on
(
DEFAULT_ALBUM_URI
,
true
,
async
(
changeData
)
=>
{
listenCount
++
;
switch
(
listenCount
)
{
case
1
:
console
.
info
(
`on_callback_013_1 changeData: ${JSON.stringify(changeData)}`
);
expect
(
changeData
.
type
)
.
assertEqual
(
NOTIFY_ADD
);
expect
(
changeData
.
uris
[
0
])
.
assertEqual
(
albumUri
);
break
;
case
2
:
console
.
info
(
`on_callback_013_2 changeData: ${JSON.stringify(changeData)}`
);
expect
(
changeData
.
type
)
.
assertEqual
(
NOTIFY_UPDATE
);
expect
(
changeData
.
uris
[
0
])
.
assertEqual
(
albumUri
);
break
;
case
3
:
console
.
info
(
`on_callback_013_3 changeData: ${JSON.stringify(changeData)}`
);
expect
(
changeData
.
type
)
.
assertEqual
(
NOTIFY_ALBUM_ADD_ASSET
);
expect
(
changeData
.
uris
[
0
])
.
assertEqual
(
albumUri
);
break
;
case
4
:
console
.
info
(
`on_callback_013_4 changeData: ${JSON.stringify(changeData)}`
);
expect
(
changeData
.
type
)
.
assertEqual
(
NOTIFY_UPDATE
);
expect
(
changeData
.
uris
[
0
])
.
assertEqual
(
albumUri
);
break
;
case
5
:
console
.
info
(
`on_callback_013_5 changeData: ${JSON.stringify(changeData)}`
);
expect
(
changeData
.
type
)
.
assertEqual
(
NOTIFY_ALBUM_REMOVE_ASSET
);
expect
(
changeData
.
uris
[
0
])
.
assertEqual
(
albumUri
);
break
;
case
6
:
console
.
info
(
`on_callback_013_6 changeData: ${JSON.stringify(changeData)}`
);
expect
(
changeData
.
type
)
.
assertEqual
(
NOTIFY_REMOVE
);
expect
(
changeData
.
uris
[
0
])
.
assertEqual
(
albumUri
);
break
;
case
7
:
console
.
info
(
`on_callback_013_7 changeData: ${JSON.stringify(changeData)}`
);
expect
(
changeData
.
uris
[
0
])
.
assertEqual
(
trashAlbumUri
);
expect
(
changeData
.
type
)
.
assertEqual
(
NOTIFY_ALBUM_REMOVE_ASSET
);
expect
(
changeData
.
extraUris
[
0
])
.
assertEqual
(
trashFileAssetUri
);
break
;
default
:
break
;
}
});
// 1
let
albumName
=
testNum
+
Date
.
now
();
let
album
=
await
helper
.
createAlbum
(
albumName
);
albumUri
=
album
.
albumUri
;
// 2
await
sleep
(
500
);
album
.
albumName
=
Date
.
now
()
+
album
.
albumName
;
await
album
.
commitModify
();
// 3
await
sleep
(
500
);
await
album
.
addAssets
([
asset
]);
// 4
await
sleep
(
500
);
album
.
albumName
=
testNum
+
album
.
albumName
;
await
album
.
commitModify
();
// 5
await
sleep
(
500
);
await
album
.
removeAssets
([
asset
]);
// 6
await
sleep
(
500
);
await
helper
.
deleteAlbums
([
album
]);
// 7
await
sleep
(
500
);
let
trashAlbumList
=
await
helper
.
getAlbums
(
albumType
.
SYSTEM
,
albumSubtype
.
TRASH
);
let
trashAlbum
=
await
trashAlbumList
.
getFirstObject
();
trashAlbumUri
=
trashAlbum
.
albumUri
;
const
fetchOps1
=
fetchOption
(
testNum
,
photoKeys
.
DISPLAY_NAME
,
testFileName
);
let
trashFetchResult
=
await
trashAlbum
.
getAssets
(
fetchOps1
);
let
trashFileAsset
=
await
trashFetchResult
.
getFirstObject
();
trashFileAssetUri
=
trashFileAsset
.
uri
;
console
.
log
(
`on_callback_013: trashFileAssetUri: ${trashFileAssetUri}`
);
await
trashAlbum
.
deleteAssets
([
trashFileAsset
]);
await
sleep
(
1000
);
helper
.
off
(
DEFAULT_ALBUM_URI
);
expect
(
listenCount
)
.
assertEqual
(
7
);
done
();
}
catch
(
error
)
{
console
.
log
(
`${testNum}: tryError: ${error}`
);
expect
(
false
)
.
assertTrue
();
done
();
}
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_ON_CALLBACK_1400
* @tc.name : on_callback_014
...
...
@@ -1045,30 +864,20 @@ export default function publicApiTestWithSystemApiTest () {
listenCount
++
;
switch
(
listenCount
)
{
case
1
:
console
.
info
(
`
on_callback_014_2
changeData: ${JSON.stringify(changeData)}`
);
console
.
info
(
`
${testNum} 1
changeData: ${JSON.stringify(changeData)}`
);
expect
(
changeData
.
type
)
.
assertEqual
(
NOTIFY_UPDATE
);
expect
(
changeData
.
uris
[
0
])
.
assertEqual
(
photoAssetUri
);
break
;
case
2
:
console
.
info
(
`
on_callback_014_3
changeData: ${JSON.stringify(changeData)}`
);
console
.
info
(
`
${testNum} 2
changeData: ${JSON.stringify(changeData)}`
);
expect
(
changeData
.
type
)
.
assertEqual
(
NOTIFY_UPDATE
);
expect
(
changeData
.
uris
[
0
])
.
assertEqual
(
photoAssetUri
);
break
;
case
3
:
console
.
info
(
`
on_callback_014_4
changeData: ${JSON.stringify(changeData)}`
);
console
.
info
(
`
${testNum} 3
changeData: ${JSON.stringify(changeData)}`
);
expect
(
changeData
.
type
)
.
assertEqual
(
NOTIFY_UPDATE
);
expect
(
changeData
.
uris
[
0
])
.
assertEqual
(
photoAssetUri
);
break
;
case
4
:
console
.
info
(
`on_callback_014_5 changeData: ${JSON.stringify(changeData)}`
);
expect
(
changeData
.
type
)
.
assertEqual
(
NOTIFY_REMOVE
);
expect
(
changeData
.
uris
[
0
])
.
assertEqual
(
photoAssetUri
);
break
;
case
5
:
console
.
info
(
`on_callback_014_6 changeData: ${JSON.stringify(changeData)}`
);
expect
(
changeData
.
type
)
.
assertEqual
(
NOTIFY_ADD
);
expect
(
changeData
.
uris
[
0
])
.
assertEqual
(
photoAssetUri
);
break
;
default
:
break
;
}
...
...
@@ -1084,74 +893,9 @@ export default function publicApiTestWithSystemApiTest () {
// 3
await
sleep
(
500
);
await
asset
.
setFavorite
(
false
);
// 4
await
sleep
(
500
);
await
helper
.
deleteAssets
([
asset
.
uri
]);
// 5
await
sleep
(
500
);
let
trashAlbumList
=
await
helper
.
getAlbums
(
albumType
.
SYSTEM
,
albumSubtype
.
TRASH
);
let
trashAlbum
=
await
trashAlbumList
.
getFirstObject
();
const
fetchOps1
=
fetchOption
(
testNum
,
photoKeys
.
DISPLAY_NAME
,
'on14.jpg'
)
let
trashFetchResult
=
await
trashAlbum
.
getAssets
(
fetchOps1
);
let
trashFileAsset
=
await
trashFetchResult
.
getFirstObject
();
await
trashAlbum
.
recoverAssets
([
trashFileAsset
]);
await
sleep
(
1000
);
helper
.
off
(
DEFAULT_PHOTO_URI
);
expect
(
listenCount
)
.
assertEqual
(
5
);
done
();
}
catch
(
error
)
{
console
.
log
(
`${testNum}: tryError: ${error}`
);
expect
(
false
)
.
assertTrue
();
done
();
}
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_ON_CALLBACK_1500
* @tc.name : on_callback_015
* @tc.desc : listening 32
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
'on_callback_015'
,
0
,
async
function
(
done
)
{
const
testNum
=
'on_callback_015'
;
try
{
helper
.
off
(
DEFAULT_PHOTO_URI
);
let
listenCount
=
0
;
let
fetchOps
=
photoFetchOption
(
testNum
,
photoKeys
.
DISPLAY_NAME
,
'on15.jpg'
);
let
asset
=
await
getFileAsset
(
testNum
,
fetchOps
);
//prepare environment
await
asset
.
setFavorite
(
true
);
//test start; notify times lessthan 32 in 500ms
let
i
=
0
;
helper
.
on
(
DEFAULT_PHOTO_URI
,
true
,
async
(
changeData
)
=>
{
listenCount
++
;
console
.
info
(
`${testNum} i: ${i}, listenCount: ${listenCount}`
);
if
(
listenCount
>
1
)
{
if
(
i
<=
32
)
{
expect
(
listenCount
-
1
)
.
assertEqual
(
1
);
}
else
{
expect
(
listenCount
-
1
)
.
assertEqual
(
Math
.
ceil
(
i
/
32
))
}
console
.
info
(
`${testNum} changeData: ${JSON.stringify(changeData)}`
);
expect
(
changeData
.
type
)
.
assertEqual
(
NOTIFY_UPDATE
);
expect
(
changeData
.
uris
.
length
)
.
assertEqual
(
i
);
}
});
const
endTime
=
Date
.
now
()
+
500
;
for
(
let
now
=
Date
.
now
();
now
<
endTime
;
now
=
Date
.
now
())
{
i
++
;
const
newTitle
=
asset
.
get
(
photoKeys
.
TITLE
)
.
toString
()
+
i
;
asset
.
set
(
photoKeys
.
TITLE
,
newTitle
);
await
asset
.
commitModify
();
}
await
sleep
(
2000
);
helper
.
off
(
DEFAULT_PHOTO_URI
);
expect
(
listenCount
)
.
assertEqual
(
1
);
expect
(
listenCount
)
.
assertEqual
(
3
);
done
();
}
catch
(
error
)
{
console
.
log
(
`${testNum}: tryError: ${error}`
);
...
...
multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/setFavorite.ets
浏览文件 @
29b3d07a
...
...
@@ -12,6 +12,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import
photoAccessHelper
from
'@ohos.file.photoAccessHelper'
import
{
describe
,
it
,
expect
}
from
'deccjsunit/index'
import
{
...
...
multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/setHidden.ets
浏览文件 @
29b3d07a
...
...
@@ -12,6 +12,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import
photoAccessHelper
from
'@ohos.file.photoAccessHelper'
import
{
describe
,
it
,
expect
}
from
'deccjsunit/index'
import
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录