Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
b7b8f238
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看板
提交
b7b8f238
编写于
9月 30, 2022
作者:
Y
yangbo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fetchResult<Album>
Signed-off-by:
N
yangbo
<
yangbo258@h-partners.com
>
上级
ca568c00
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
43 addition
and
63 deletion
+43
-63
multimedia/userfilemgr/common.js
multimedia/userfilemgr/common.js
+3
-20
multimedia/userfilemgr/userfilemgr_album/entry/src/main/ets/test/albumCommitModifyCallback.test.ets
...ntry/src/main/ets/test/albumCommitModifyCallback.test.ets
+4
-5
multimedia/userfilemgr/userfilemgr_album/entry/src/main/ets/test/albumCommitModifyPromise.test.ets
...entry/src/main/ets/test/albumCommitModifyPromise.test.ets
+4
-4
multimedia/userfilemgr/userfilemgr_album/entry/src/main/ets/test/albumGetFileAssetsCallback.test.ets
...try/src/main/ets/test/albumGetFileAssetsCallback.test.ets
+5
-6
multimedia/userfilemgr/userfilemgr_album/entry/src/main/ets/test/albumGetFileAssetsPromise.test.ets
...ntry/src/main/ets/test/albumGetFileAssetsPromise.test.ets
+4
-5
multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getAlbumsCallback.test.ets
...r_base/entry/src/main/ets/test/getAlbumsCallback.test.ets
+6
-6
multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getAlbumsPromise.test.ets
...gr_base/entry/src/main/ets/test/getAlbumsPromise.test.ets
+4
-4
multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetTrashCallback.test.ets
...t/entry/src/main/ets/test/fileAssetTrashCallback.test.ets
+6
-6
multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetTrashPromise.test.ets
...et/entry/src/main/ets/test/fileAssetTrashPromise.test.ets
+6
-6
multimedia/userfilemgr/userfilemgr_noPermission/entry/src/main/ets/test/userFileMgrNoPermissionCallback.test.ets
...rc/main/ets/test/userFileMgrNoPermissionCallback.test.ets
+1
-1
未找到文件。
multimedia/userfilemgr/common.js
浏览文件 @
b7b8f238
...
@@ -111,8 +111,8 @@ const albumFetchOps = function (testNum, path, albumName) {
...
@@ -111,8 +111,8 @@ const albumFetchOps = function (testNum, path, albumName) {
const
checkPresetsAssets
=
async
function
(
userfilemgr
,
hapName
)
{
const
checkPresetsAssets
=
async
function
(
userfilemgr
,
hapName
)
{
console
.
info
(
'
checkPresetsAssets start
'
)
console
.
info
(
'
checkPresetsAssets start
'
)
let
albumLis
t
=
await
userfilemgr
.
getAlbums
([
IMAGE_TYPE
,
VIDEO_TYPE
,
AUDIO_TYPE
],
allFetchOp
());
let
fetchAlbumResul
t
=
await
userfilemgr
.
getAlbums
([
IMAGE_TYPE
,
VIDEO_TYPE
,
AUDIO_TYPE
],
allFetchOp
());
let
albumsCount
=
albumList
.
length
;
let
albumsCount
=
fetchAlbumResult
.
getCount
()
;
let
fetchFileResult
=
await
userfilemgr
.
getFileAssets
([
IMAGE_TYPE
,
VIDEO_TYPE
,
AUDIO_TYPE
],
let
fetchFileResult
=
await
userfilemgr
.
getFileAssets
([
IMAGE_TYPE
,
VIDEO_TYPE
,
AUDIO_TYPE
],
allFetchOp
());
allFetchOp
());
let
assetsCount
=
await
fetchFileResult
.
getCount
();
let
assetsCount
=
await
fetchFileResult
.
getCount
();
...
@@ -124,7 +124,7 @@ const checkPresetsAssets = async function (userfilemgr, hapName) {
...
@@ -124,7 +124,7 @@ const checkPresetsAssets = async function (userfilemgr, hapName) {
const
checkAssetsCount
=
async
function
(
done
,
testNum
,
fetchFileResult
,
expectCount
)
{
const
checkAssetsCount
=
async
function
(
done
,
testNum
,
fetchFileResult
,
expectCount
)
{
if
(
!
fetchFileResult
)
{
if
(
!
fetchFileResult
)
{
console
.
info
(
`
${
testNum
}
:: fetchFileResult
error:
`
);
console
.
info
(
`
${
testNum
}
:: fetchFileResult
is undefined
`
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
done
();
return
false
return
false
...
@@ -138,22 +138,6 @@ const checkAssetsCount = async function (done, testNum, fetchFileResult, expectC
...
@@ -138,22 +138,6 @@ const checkAssetsCount = async function (done, testNum, fetchFileResult, expectC
return
count
==
expectCount
;
return
count
==
expectCount
;
}
}
const
checkAlbumsCount
=
function
(
done
,
testNum
,
albumList
,
expectCount
)
{
if
(
!
Array
.
isArray
(
albumList
))
{
console
.
info
(
`
${
testNum
}
:: albumList error:`
);
expect
(
false
).
assertTrue
();
done
();
return
false
}
let
albumsCount
=
albumList
.
length
;
if
(
albumsCount
!=
expectCount
)
{
console
.
info
(
`
${
testNum
}
:: albumsCount: expectCount -
${
albumsCount
}
:
${
expectCount
}
`
);
expect
(
albumsCount
).
assertEqual
(
expectCount
);
done
();
}
return
albumsCount
==
expectCount
;
}
const
getPermission
=
async
function
(
name
=
'
ohos.acts.multimedia.userfilemgr
'
)
{
const
getPermission
=
async
function
(
name
=
'
ohos.acts.multimedia.userfilemgr
'
)
{
console
.
info
(
'
getPermission start
'
,
name
)
console
.
info
(
'
getPermission start
'
,
name
)
let
appInfo
=
await
bundle
.
getApplicationInfo
(
'
ohos.acts.multimedia.userfilemgr
'
,
0
,
100
);
let
appInfo
=
await
bundle
.
getApplicationInfo
(
'
ohos.acts.multimedia.userfilemgr
'
,
0
,
100
);
...
@@ -203,6 +187,5 @@ export {
...
@@ -203,6 +187,5 @@ export {
albumFetchOps
,
albumFetchOps
,
checkPresetsAssets
,
checkPresetsAssets
,
checkAssetsCount
,
checkAssetsCount
,
checkAlbumsCount
,
isNum
,
isNum
,
};
};
\ No newline at end of file
multimedia/userfilemgr/userfilemgr_album/entry/src/main/ets/test/albumCommitModifyCallback.test.ets
浏览文件 @
b7b8f238
...
@@ -23,7 +23,7 @@ import {
...
@@ -23,7 +23,7 @@ import {
AUDIO_TYPE,
AUDIO_TYPE,
albumFetchOps,
albumFetchOps,
checkPresetsAssets,
checkPresetsAssets,
checkA
lbum
sCount,
checkA
sset
sCount,
getPermission,
getPermission,
} from '../../../../../../common';
} from '../../../../../../common';
...
@@ -49,17 +49,16 @@ export default function albumCommitModifyCallback(abilityContext) {
...
@@ -49,17 +49,16 @@ export default function albumCommitModifyCallback(abilityContext) {
const albumCommitModify = async function (done, testNum, media_type, fetchOp, expectAlbumCount) {
const albumCommitModify = async function (done, testNum, media_type, fetchOp, expectAlbumCount) {
try {
try {
const
albumLis
t = await userfile_mgr.getAlbums(media_type, fetchOp);
const
fetchAlbumResul
t = await userfile_mgr.getAlbums(media_type, fetchOp);
const albumCountPass = await checkA
lbumsCount(done, testNum, albumLis
t, expectAlbumCount);
const albumCountPass = await checkA
ssetsCount(done, testNum, fetchAlbumResul
t, expectAlbumCount);
if (!albumCountPass) return;
if (!albumCountPass) return;
const album = a
lbumList[0]
;
const album = a
wait fetchAlbumResult.getFirstObject()
;
const newName = 'albumName' + media_type.toString();
const newName = 'albumName' + media_type.toString();
album.albumName = newName;
album.albumName = newName;
album.commitModify(async () => {
album.commitModify(async () => {
expect(true).assertTrue();
expect(true).assertTrue();
done();
done();
});
});
} catch (error) {
} catch (error) {
console.info(`${testNum}, failed error: ${error}`)
console.info(`${testNum}, failed error: ${error}`)
expect(false).assertTrue();
expect(false).assertTrue();
...
...
multimedia/userfilemgr/userfilemgr_album/entry/src/main/ets/test/albumCommitModifyPromise.test.ets
浏览文件 @
b7b8f238
...
@@ -23,7 +23,7 @@ import {
...
@@ -23,7 +23,7 @@ import {
AUDIO_TYPE,
AUDIO_TYPE,
albumFetchOps,
albumFetchOps,
checkPresetsAssets,
checkPresetsAssets,
checkA
lbum
sCount,
checkA
sset
sCount,
getPermission,
getPermission,
} from '../../../../../../common';
} from '../../../../../../common';
...
@@ -49,10 +49,10 @@ export default function albumCommitModifyPromise(abilityContext) {
...
@@ -49,10 +49,10 @@ export default function albumCommitModifyPromise(abilityContext) {
const albumCommitModify = async function (done, testNum, media_type, fetchOp, expectAlbumCount) {
const albumCommitModify = async function (done, testNum, media_type, fetchOp, expectAlbumCount) {
try {
try {
const
albumLis
t = await userfile_mgr.getAlbums(media_type, fetchOp);
const
fetchAlbumResul
t = await userfile_mgr.getAlbums(media_type, fetchOp);
const albumCountPass = await checkA
lbumsCount(done, testNum, albumLis
t, expectAlbumCount);
const albumCountPass = await checkA
ssetsCount(done, testNum, fetchAlbumResul
t, expectAlbumCount);
if (!albumCountPass) return;
if (!albumCountPass) return;
const album = a
lbumList[0]
;
const album = a
wait fetchAlbumResult.getFirstObject()
;
const newName = 'albumName' + media_type.toString();
const newName = 'albumName' + media_type.toString();
album.albumName = newName;
album.albumName = newName;
await album.commitModify();
await album.commitModify();
...
...
multimedia/userfilemgr/userfilemgr_album/entry/src/main/ets/test/albumGetFileAssetsCallback.test.ets
浏览文件 @
b7b8f238
...
@@ -24,7 +24,7 @@ import {
...
@@ -24,7 +24,7 @@ import {
allFetchOp,
allFetchOp,
albumFetchOps,
albumFetchOps,
checkPresetsAssets,
checkPresetsAssets,
checkA
lbum
sCount,
checkA
sset
sCount,
} from '../../../../../../common';
} from '../../../../../../common';
export default function albumGetFileAssetsCallback(abilityContext) {
export default function albumGetFileAssetsCallback(abilityContext) {
...
@@ -47,14 +47,13 @@ export default function albumGetFileAssetsCallback(abilityContext) {
...
@@ -47,14 +47,13 @@ export default function albumGetFileAssetsCallback(abilityContext) {
const checkAlbumAssetsCount = async function (done, testNum, media_type, fetchOp, expectAssetsCount, expectAlbumCount = 1) {
const checkAlbumAssetsCount = async function (done, testNum, media_type, fetchOp, expectAssetsCount, expectAlbumCount = 1) {
try {
try {
const albumList = await userfile_mgr.getAlbums(media_type, fetchOp);
const fetchAlbumResult = await userfile_mgr.getAlbums(media_type, fetchOp);
// check album length
const albumCountPass = await checkAssetsCount(done, testNum, fetchAlbumResult, expectAlbumCount);
const albumCountPass = await checkAlbumsCount(done, testNum, albumList, expectAlbumCount);
if (!albumCountPass) return;
if (!albumCountPass) return;
const album = a
lbumList[0]
;
const album = a
wait fetchAlbumResult.getFirstObject()
;
album.getFileAssets(media_type, allFetchOp(), (error, fetchFileResult) => {
album.getFileAssets(media_type, allFetchOp(), (error, fetchFileResult) => {
if (error != undefined) {
if (error != undefined) {
console.info(`${testNum}
fetchFileResult
error: ${error}`);
console.info(`${testNum}
getFileAssets
error: ${error}`);
expect(false).assertTrue();
expect(false).assertTrue();
done();
done();
return;
return;
...
...
multimedia/userfilemgr/userfilemgr_album/entry/src/main/ets/test/albumGetFileAssetsPromise.test.ets
浏览文件 @
b7b8f238
...
@@ -26,7 +26,7 @@ import {
...
@@ -26,7 +26,7 @@ import {
allFetchOp,
allFetchOp,
albumFetchOps,
albumFetchOps,
checkPresetsAssets,
checkPresetsAssets,
checkA
lbum
sCount,
checkA
sset
sCount,
} from '../../../../../../common';
} from '../../../../../../common';
export default function albumGetFileAssetsPromise(abilityContext) {
export default function albumGetFileAssetsPromise(abilityContext) {
...
@@ -56,11 +56,10 @@ export default function albumGetFileAssetsPromise(abilityContext) {
...
@@ -56,11 +56,10 @@ export default function albumGetFileAssetsPromise(abilityContext) {
const checkAlbumAssetsCount = async function (done, testNum, media_type, fetchOp, expectAssetsCount, expectAlbumCount = 1) {
const checkAlbumAssetsCount = async function (done, testNum, media_type, fetchOp, expectAssetsCount, expectAlbumCount = 1) {
try {
try {
const albumList = await userfile_mgr.getAlbums(media_type, fetchOp);
const fetchAlbumResult = await userfile_mgr.getAlbums(media_type, fetchOp);
// check album length
const albumCountPass = await checkAssetsCount(done, testNum, fetchAlbumResult, expectAlbumCount);
const albumCountPass = await checkAlbumsCount(done, testNum, albumList, expectAlbumCount);
if (!albumCountPass) return;
if (!albumCountPass) return;
const album = a
lbumList[0]
;
const album = a
wait fetchAlbumResult.getFirstObject()
;
let op: userfile_manager.MediaFetchOptions = allFetchOp();
let op: userfile_manager.MediaFetchOptions = allFetchOp();
let fetchFileResult = await album.getFileAssets(media_type, op);
let fetchFileResult = await album.getFileAssets(media_type, op);
if (fetchFileResult == undefined) {
if (fetchFileResult == undefined) {
...
...
multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getAlbumsCallback.test.ets
浏览文件 @
b7b8f238
...
@@ -24,7 +24,7 @@ import {
...
@@ -24,7 +24,7 @@ import {
allFetchOp,
allFetchOp,
albumFetchOps,
albumFetchOps,
checkPresetsAssets,
checkPresetsAssets,
checkA
lbum
sCount,
checkA
sset
sCount,
getPermission,
getPermission,
isNum,
isNum,
} from '../../../../../../common';
} from '../../../../../../common';
...
@@ -89,17 +89,17 @@ export default function getAlbumsCallbackTest(abilityContext) {
...
@@ -89,17 +89,17 @@ export default function getAlbumsCallbackTest(abilityContext) {
}
}
const checkAlbumInfo = async function (done, testNum, media_type, fetchOp, relativePaths) {
const checkAlbumInfo = async function (done, testNum, media_type, fetchOp, relativePaths) {
try {
try {
userfile_mgr.getAlbums(media_type, fetchOp, async (err,
albumLis
t) => {
userfile_mgr.getAlbums(media_type, fetchOp, async (err,
fetchAlbumResul
t) => {
if(err) {
if(err) {
console.info(`${testNum}
,
err: ${err}`)
console.info(`${testNum}
getAlbums
err: ${err}`)
expect(false).assertTrue();
expect(false).assertTrue();
done();
done();
return;
return;
}
}
let expectAlbumCount = 1;
let expectAlbumCount = 1;
const albumCountPass = await checkA
lbumsCount(done, testNum, albumLis
t, expectAlbumCount);
const albumCountPass = await checkA
ssetsCount(done, testNum, fetchAlbumResul
t, expectAlbumCount);
if (!albumCountPass) return;
if (!albumCountPass) return;
const album =
albumList[0]
;
const album =
fetchAlbumResult.getFirstObject()
;
checkProps(done, testNum, album, relativePaths);
checkProps(done, testNum, album, relativePaths);
done();
done();
});
});
...
@@ -171,7 +171,7 @@ export default function getAlbumsCallbackTest(abilityContext) {
...
@@ -171,7 +171,7 @@ export default function getAlbumsCallbackTest(abilityContext) {
try {
try {
let media_type = [-1];
let media_type = [-1];
let currentFetchOp = allFetchOp();
let currentFetchOp = allFetchOp();
userfile_mgr.getAlbums(media_type, currentFetchOp, async (err,
albumLis
t) => {
userfile_mgr.getAlbums(media_type, currentFetchOp, async (err,
fetchAlbumResul
t) => {
console.info(`${testNum}, err: ${err}`);
console.info(`${testNum}, err: ${err}`);
if (err != undefined) {
if (err != undefined) {
expect(true).assertTrue();
expect(true).assertTrue();
...
...
multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getAlbumsPromise.test.ets
浏览文件 @
b7b8f238
...
@@ -24,7 +24,7 @@ import {
...
@@ -24,7 +24,7 @@ import {
allFetchOp,
allFetchOp,
albumFetchOps,
albumFetchOps,
checkPresetsAssets,
checkPresetsAssets,
checkA
lbum
sCount,
checkA
sset
sCount,
} from '../../../../../../common';
} from '../../../../../../common';
export default function getAlbumsPromiseTest(abilityContext) {
export default function getAlbumsPromiseTest(abilityContext) {
...
@@ -84,10 +84,10 @@ export default function getAlbumsPromiseTest(abilityContext) {
...
@@ -84,10 +84,10 @@ export default function getAlbumsPromiseTest(abilityContext) {
}
}
const checkAlbumInfo = async function (done, testNum, media_type, fetchOp, relativePaths, expectAlbumCount = 1) {
const checkAlbumInfo = async function (done, testNum, media_type, fetchOp, relativePaths, expectAlbumCount = 1) {
try {
try {
const
albumLis
t = await userfile_mgr.getAlbums(media_type, fetchOp);
const
fetchAlbumResul
t = await userfile_mgr.getAlbums(media_type, fetchOp);
const albumCountPass = await checkA
lbumsCount(done, testNum, albumLis
t, expectAlbumCount);
const albumCountPass = await checkA
ssetsCount(done, testNum, fetchAlbumResul
t, expectAlbumCount);
if (!albumCountPass) return;
if (!albumCountPass) return;
const album =
albumList[0]
;
const album =
fetchAlbumResult.getFirstObject()
;
checkProps(done, testNum, album, relativePaths);
checkProps(done, testNum, album, relativePaths);
done();
done();
} catch (error) {
} catch (error) {
...
...
multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetTrashCallback.test.ets
浏览文件 @
b7b8f238
...
@@ -77,8 +77,8 @@ export default function fileAssetTrashCallbackTest(abilityContext) {
...
@@ -77,8 +77,8 @@ export default function fileAssetTrashCallbackTest(abilityContext) {
let
count
=
databaseFetchFileResult
.
getCount
();
let
count
=
databaseFetchFileResult
.
getCount
();
//album info
//album info
if
(
!
noAlbum
)
{
if
(
!
noAlbum
)
{
let
albumLis
t
=
await
userfile_mgr
.
getAlbums
(
media_type
,
ablumFetchOps
);
let
fetchAlbumResul
t
=
await
userfile_mgr
.
getAlbums
(
media_type
,
ablumFetchOps
);
let
album
=
a
lbumList
[
0
]
;
let
album
=
a
wait
fetchAlbumResult
.
getFirstObject
()
;
let
op
:
userfile_manager
.
MediaFetchOptions
=
allFetchOp
();
let
op
:
userfile_manager
.
MediaFetchOptions
=
allFetchOp
();
let
albumFetchFileResult
=
await
album
.
getFileAssets
(
media_type
,
op
);
let
albumFetchFileResult
=
await
album
.
getFileAssets
(
media_type
,
op
);
let
albumFilesCount
=
albumFetchFileResult
.
getCount
();
let
albumFilesCount
=
albumFetchFileResult
.
getCount
();
...
@@ -110,8 +110,8 @@ export default function fileAssetTrashCallbackTest(abilityContext) {
...
@@ -110,8 +110,8 @@ export default function fileAssetTrashCallbackTest(abilityContext) {
expect
(
databaseCount
)
.
assertEqual
(
count
-
1
);
expect
(
databaseCount
)
.
assertEqual
(
count
-
1
);
//album info
//album info
if
(
!
noAlbum
)
{
if
(
!
noAlbum
)
{
let
albumLis
t
=
await
userfile_mgr
.
getAlbums
(
media_type
,
ablumFetchOps
);
let
fetchAlbumResul
t
=
await
userfile_mgr
.
getAlbums
(
media_type
,
ablumFetchOps
);
let
album
=
a
lbumList
[
0
]
;
let
album
=
a
wait
fetchAlbumResult
.
getFirstObject
()
;
let
op
:
userfile_manager
.
MediaFetchOptions
=
allFetchOp
();
let
op
:
userfile_manager
.
MediaFetchOptions
=
allFetchOp
();
let
albumFetchFileResult
=
await
album
.
getFileAssets
(
media_type
,
op
);
let
albumFetchFileResult
=
await
album
.
getFileAssets
(
media_type
,
op
);
let
albumFilesCount
=
albumFetchFileResult
.
getCount
();
let
albumFilesCount
=
albumFetchFileResult
.
getCount
();
...
@@ -160,8 +160,8 @@ export default function fileAssetTrashCallbackTest(abilityContext) {
...
@@ -160,8 +160,8 @@ export default function fileAssetTrashCallbackTest(abilityContext) {
expect
(
databaseCount
)
.
assertEqual
(
count
);
expect
(
databaseCount
)
.
assertEqual
(
count
);
//album info
//album info
if
(
!
noAlbum
)
{
if
(
!
noAlbum
)
{
let
albumLis
t
=
await
userfile_mgr
.
getAlbums
(
media_type
,
ablumFetchOps
);
let
fetchAlbumResul
t
=
await
userfile_mgr
.
getAlbums
(
media_type
,
ablumFetchOps
);
let
album
=
a
lbumList
[
0
]
;
let
album
=
a
wait
fetchAlbumResult
.
getFirstObject
()
;
let
op
:
userfile_manager
.
MediaFetchOptions
=
allFetchOp
();
let
op
:
userfile_manager
.
MediaFetchOptions
=
allFetchOp
();
let
albumFetchFileResult
=
await
album
.
getFileAssets
(
media_type
,
op
);
let
albumFetchFileResult
=
await
album
.
getFileAssets
(
media_type
,
op
);
let
albumFilesCount
=
albumFetchFileResult
.
getCount
();
let
albumFilesCount
=
albumFetchFileResult
.
getCount
();
...
...
multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetTrashPromise.test.ets
浏览文件 @
b7b8f238
...
@@ -70,8 +70,8 @@ export default function fileAssetTrashPromiseTest(abilityContext) {
...
@@ -70,8 +70,8 @@ export default function fileAssetTrashPromiseTest(abilityContext) {
let
count
=
databaseFetchFileResult
.
getCount
();
let
count
=
databaseFetchFileResult
.
getCount
();
//album info
//album info
if
(
!
noAlbum
)
{
if
(
!
noAlbum
)
{
let
albumLis
t
=
await
userfile_mgr
.
getAlbums
(
media_type
,
ablumFetchOps
);
let
fetchAlbumResul
t
=
await
userfile_mgr
.
getAlbums
(
media_type
,
ablumFetchOps
);
let
album
=
a
lbumList
[
0
]
;
let
album
=
a
wait
fetchAlbumResult
.
getFirstObject
()
;
let
op
:
userfile_manager
.
MediaFetchOptions
=
allFetchOp
();
let
op
:
userfile_manager
.
MediaFetchOptions
=
allFetchOp
();
let
albumFetchFileResult
=
await
album
.
getFileAssets
(
media_type
,
op
);
let
albumFetchFileResult
=
await
album
.
getFileAssets
(
media_type
,
op
);
let
albumFilesCount
=
albumFetchFileResult
.
getCount
();
let
albumFilesCount
=
albumFetchFileResult
.
getCount
();
...
@@ -88,8 +88,8 @@ export default function fileAssetTrashPromiseTest(abilityContext) {
...
@@ -88,8 +88,8 @@ export default function fileAssetTrashPromiseTest(abilityContext) {
expect
(
databaseCount
)
.
assertEqual
(
count
-
1
);
expect
(
databaseCount
)
.
assertEqual
(
count
-
1
);
//album info
//album info
if
(
!
noAlbum
)
{
if
(
!
noAlbum
)
{
var
albumLis
t
=
await
userfile_mgr
.
getAlbums
(
media_type
,
ablumFetchOps
);
var
fetchAlbumResul
t
=
await
userfile_mgr
.
getAlbums
(
media_type
,
ablumFetchOps
);
var
album
=
a
lbumList
[
0
]
;
var
album
=
a
wait
fetchAlbumResult
.
getFirstObject
()
;
let
op
:
userfile_manager
.
MediaFetchOptions
=
allFetchOp
();
let
op
:
userfile_manager
.
MediaFetchOptions
=
allFetchOp
();
var
albumFetchFileResult
=
await
album
.
getFileAssets
(
media_type
,
op
);
var
albumFetchFileResult
=
await
album
.
getFileAssets
(
media_type
,
op
);
var
albumFilesCount
=
albumFetchFileResult
.
getCount
();
var
albumFilesCount
=
albumFetchFileResult
.
getCount
();
...
@@ -116,8 +116,8 @@ export default function fileAssetTrashPromiseTest(abilityContext) {
...
@@ -116,8 +116,8 @@ export default function fileAssetTrashPromiseTest(abilityContext) {
expect
(
databaseCount
)
.
assertEqual
(
count
);
expect
(
databaseCount
)
.
assertEqual
(
count
);
//album info
//album info
if
(
!
noAlbum
)
{
if
(
!
noAlbum
)
{
let
albumLis
t
=
await
userfile_mgr
.
getAlbums
(
media_type
,
ablumFetchOps
);
let
fetchAlbumResul
t
=
await
userfile_mgr
.
getAlbums
(
media_type
,
ablumFetchOps
);
let
album
=
a
lbumList
[
0
]
;
let
album
=
a
wait
fetchAlbumResult
.
getFirstObject
()
;
let
op
:
userfile_manager
.
MediaFetchOptions
=
allFetchOp
();
let
op
:
userfile_manager
.
MediaFetchOptions
=
allFetchOp
();
let
albumFetchFileResult
=
await
album
.
getFileAssets
(
media_type
,
op
);
let
albumFetchFileResult
=
await
album
.
getFileAssets
(
media_type
,
op
);
let
albumFilesCount
=
albumFetchFileResult
.
getCount
();
let
albumFilesCount
=
albumFetchFileResult
.
getCount
();
...
...
multimedia/userfilemgr/userfilemgr_noPermission/entry/src/main/ets/test/userFileMgrNoPermissionCallback.test.ets
浏览文件 @
b7b8f238
...
@@ -82,7 +82,7 @@ export default function userFileMgrNoPermissionCallback(abilityContext) {
...
@@ -82,7 +82,7 @@ export default function userFileMgrNoPermissionCallback(abilityContext) {
const getAlbumsTest = async function (done, testNum, media_type) {
const getAlbumsTest = async function (done, testNum, media_type) {
try {
try {
await userfile_mgr.getAlbums(media_type, allFetchOp(), async (err,
albumLis
t) => {
await userfile_mgr.getAlbums(media_type, allFetchOp(), async (err,
fetchAlbumResul
t) => {
if (err != undefined) {
if (err != undefined) {
console.info(`${testNum}, err: ${err}`);
console.info(`${testNum}, err: ${err}`);
expect(true).assertTrue();
expect(true).assertTrue();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录