Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
e5ba3540
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看板
提交
e5ba3540
编写于
10月 09, 2022
作者:
Y
yangbo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix warn
Signed-off-by:
N
yangbo
<
yangbo258@h-partners.com
>
上级
641b9a33
变更
17
显示空白变更内容
内联
并排
Showing
17 changed file
with
176 addition
and
95 deletion
+176
-95
multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getFileAssetsCallback.test.ets
...se/entry/src/main/ets/test/getFileAssetsCallback.test.ets
+30
-21
multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getFileAssetsPromise.test.ets
...ase/entry/src/main/ets/test/getFileAssetsPromise.test.ets
+30
-20
multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getPublicDirectoryCallback.test.ets
...try/src/main/ets/test/getPublicDirectoryCallback.test.ets
+7
-7
multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getPublicDirectoryPromise.test.ets
...ntry/src/main/ets/test/getPublicDirectoryPromise.test.ets
+7
-7
multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/onOffReleasePromise.test.ets
...base/entry/src/main/ets/test/onOffReleasePromise.test.ets
+10
-6
multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetCommitModifyCallback.test.ets
.../src/main/ets/test/fileAssetCommitModifyCallback.test.ets
+3
-1
multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetCommitModifyPromise.test.ets
...y/src/main/ets/test/fileAssetCommitModifyPromise.test.ets
+3
-1
multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetFavoriteCallback.test.ets
...ntry/src/main/ets/test/fileAssetFavoriteCallback.test.ets
+9
-3
multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetFavoritePromise.test.ets
...entry/src/main/ets/test/fileAssetFavoritePromise.test.ets
+9
-3
multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetGetThumbnailCallback.test.ets
.../src/main/ets/test/fileAssetGetThumbnailCallback.test.ets
+5
-3
multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetGetThumbnailPromise.test.ets
...y/src/main/ets/test/fileAssetGetThumbnailPromise.test.ets
+5
-3
multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetIsDirectoryCallback.test.ets
...y/src/main/ets/test/fileAssetIsDirectoryCallback.test.ets
+3
-1
multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetIsDirectoryPromise.test.ets
...ry/src/main/ets/test/fileAssetIsDirectoryPromise.test.ets
+3
-1
multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetOpenCallback.test.ets
...et/entry/src/main/ets/test/fileAssetOpenCallback.test.ets
+12
-5
multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetOpenPromise.test.ets
...set/entry/src/main/ets/test/fileAssetOpenPromise.test.ets
+12
-4
multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetTrashCallback.test.ets
...t/entry/src/main/ets/test/fileAssetTrashCallback.test.ets
+15
-5
multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetTrashPromise.test.ets
...et/entry/src/main/ets/test/fileAssetTrashPromise.test.ets
+13
-4
未找到文件。
multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getFileAssetsCallback.test.ets
浏览文件 @
e5ba3540
...
@@ -48,24 +48,25 @@ export default function getFileAssetsCallbackTest(abilityContext) {
...
@@ -48,24 +48,25 @@ export default function getFileAssetsCallbackTest(abilityContext) {
const
props
=
{
const
props
=
{
image
:
{
image
:
{
displayName
:
'01.jpg'
,
displayName
:
'01.jpg'
,
media
Type
:
IMAGE_TYPE
.
toString
(),
file
Type
:
IMAGE_TYPE
.
toString
(),
},
},
video
:
{
video
:
{
displayName
:
'01.mp4'
,
displayName
:
'01.mp4'
,
relativePath
:
'Videos/Static/'
,
fileType
:
VIDEO_TYPE
.
toString
(),
mediaType
:
VIDEO_TYPE
.
toString
(),
},
},
audio
:
{
audio
:
{
displayName
:
'01.mp3'
,
displayName
:
'01.mp3'
,
media
Type
:
AUDIO_TYPE
.
toString
(),
file
Type
:
AUDIO_TYPE
.
toString
(),
},
},
}
}
async
function
getFirstObjectTest
(
done
,
testNum
,
fetchOp
s
,
isAudio
)
{
async
function
getFirstObjectTest
(
done
,
testNum
,
fetchOp
,
isAudio
)
{
try
{
try
{
let
fetchAssetResult
=
await
userfilemgr
.
getPhotoAssets
(
fetchOps
)
;
let
fetchAssetResult
;
if
(
isAudio
)
{
if
(
isAudio
)
{
fetchAssetResult
=
await
userfilemgr
.
getAudioAssets
(
fetchOps
);
fetchAssetResult
=
await
userfilemgr
.
getAudioAssets
(
fetchOp
);
}
else
{
fetchAssetResult
=
await
userfilemgr
.
getPhotoAssets
(
fetchOp
);
}
}
let
expectCount
=
4
;
let
expectCount
=
4
;
let
checkAssetCountPass
=
await
checkAssetsCount
(
done
,
testNum
,
fetchAssetResult
,
expectCount
);
let
checkAssetCountPass
=
await
checkAssetsCount
(
done
,
testNum
,
fetchAssetResult
,
expectCount
);
...
@@ -89,11 +90,13 @@ export default function getFileAssetsCallbackTest(abilityContext) {
...
@@ -89,11 +90,13 @@ export default function getFileAssetsCallbackTest(abilityContext) {
}
}
}
}
async
function
getLastObjectTest
(
done
,
testNum
,
fetchOp
s
,
isAudio
)
{
async
function
getLastObjectTest
(
done
,
testNum
,
fetchOp
,
isAudio
)
{
try
{
try
{
let
fetchAssetResult
=
await
userfilemgr
.
getPhotoAssets
(
fetchOps
)
;
let
fetchAssetResult
;
if
(
isAudio
)
{
if
(
isAudio
)
{
fetchAssetResult
=
await
userfilemgr
.
getAudioAssets
(
fetchOps
);
fetchAssetResult
=
await
userfilemgr
.
getAudioAssets
(
fetchOp
);
}
else
{
fetchAssetResult
=
await
userfilemgr
.
getPhotoAssets
(
fetchOp
);
}
}
let
expectCount
=
4
;
let
expectCount
=
4
;
let
checkAssetCountPass
=
await
checkAssetsCount
(
done
,
testNum
,
fetchAssetResult
,
expectCount
);
let
checkAssetCountPass
=
await
checkAssetsCount
(
done
,
testNum
,
fetchAssetResult
,
expectCount
);
...
@@ -117,11 +120,13 @@ export default function getFileAssetsCallbackTest(abilityContext) {
...
@@ -117,11 +120,13 @@ export default function getFileAssetsCallbackTest(abilityContext) {
}
}
}
}
async
function
getPositionObjectTest
(
done
,
testNum
,
fetchOp
s
,
pos
,
isAudio
)
{
async
function
getPositionObjectTest
(
done
,
testNum
,
fetchOp
,
pos
,
isAudio
)
{
try
{
try
{
let
fetchAssetResult
=
await
userfilemgr
.
getPhotoAssets
(
fetchOps
)
;
let
fetchAssetResult
;
if
(
isAudio
)
{
if
(
isAudio
)
{
fetchAssetResult
=
await
userfilemgr
.
getAudioAssets
(
fetchOps
);
fetchAssetResult
=
await
userfilemgr
.
getAudioAssets
(
fetchOp
);
}
else
{
fetchAssetResult
=
await
userfilemgr
.
getPhotoAssets
(
fetchOp
);
}
}
let
expectCount
=
4
;
let
expectCount
=
4
;
let
checkAssetCountPass
=
await
checkAssetsCount
(
done
,
testNum
,
fetchAssetResult
,
expectCount
);
let
checkAssetCountPass
=
await
checkAssetsCount
(
done
,
testNum
,
fetchAssetResult
,
expectCount
);
...
@@ -145,11 +150,13 @@ export default function getFileAssetsCallbackTest(abilityContext) {
...
@@ -145,11 +150,13 @@ export default function getFileAssetsCallbackTest(abilityContext) {
}
}
}
}
async
function
isAfterLastTest
(
done
,
testNum
,
fetchOp
s
,
isAudio
)
{
async
function
isAfterLastTest
(
done
,
testNum
,
fetchOp
,
isAudio
)
{
try
{
try
{
let
fetchAssetResult
=
await
userfilemgr
.
getPhotoAssets
(
fetchOps
)
;
let
fetchAssetResult
;
if
(
isAudio
)
{
if
(
isAudio
)
{
fetchAssetResult
=
await
userfilemgr
.
getAudioAssets
(
fetchOps
);
fetchAssetResult
=
await
userfilemgr
.
getAudioAssets
(
fetchOp
);
}
else
{
fetchAssetResult
=
await
userfilemgr
.
getPhotoAssets
(
fetchOp
);
}
}
let
expectCount
=
4
;
let
expectCount
=
4
;
let
checkAssetCountPass
=
await
checkAssetsCount
(
done
,
testNum
,
fetchAssetResult
,
expectCount
);
let
checkAssetCountPass
=
await
checkAssetsCount
(
done
,
testNum
,
fetchAssetResult
,
expectCount
);
...
@@ -172,11 +179,13 @@ export default function getFileAssetsCallbackTest(abilityContext) {
...
@@ -172,11 +179,13 @@ export default function getFileAssetsCallbackTest(abilityContext) {
}
}
}
}
async
function
checkFileAssetAttr
(
done
,
testNum
,
fetchOp
s
,
type
,
isAudio
)
{
async
function
checkFileAssetAttr
(
done
,
testNum
,
fetchOp
,
type
,
isAudio
)
{
try
{
try
{
let
fetchAssetResult
=
await
userfilemgr
.
getPhotoAssets
(
fetchOps
)
;
let
fetchAssetResult
;
if
(
isAudio
)
{
if
(
isAudio
)
{
fetchAssetResult
=
await
userfilemgr
.
getAudioAssets
(
fetchOps
);
fetchAssetResult
=
await
userfilemgr
.
getAudioAssets
(
fetchOp
);
}
else
{
fetchAssetResult
=
await
userfilemgr
.
getPhotoAssets
(
fetchOp
);
}
}
let
expectCount
=
4
;
let
expectCount
=
4
;
let
checkAssetCountPass
=
await
checkAssetsCount
(
done
,
testNum
,
fetchAssetResult
,
expectCount
);
let
checkAssetCountPass
=
await
checkAssetsCount
(
done
,
testNum
,
fetchAssetResult
,
expectCount
);
...
@@ -190,8 +199,8 @@ export default function getFileAssetsCallbackTest(abilityContext) {
...
@@ -190,8 +199,8 @@ export default function getFileAssetsCallbackTest(abilityContext) {
return
;
return
;
}
}
expect
(
asset
.
displayName
)
.
assertEqual
(
props
[
type
]
.
displayName
);
expect
(
asset
.
displayName
)
.
assertEqual
(
props
[
type
]
.
displayName
);
expect
(
asset
.
mediaType
.
toString
())
.
assertEqual
(
props
[
type
]
.
media
Type
);
expect
(
asset
.
fileType
.
toString
())
.
assertEqual
(
props
[
type
]
.
file
Type
);
expect
(
asset
.
uri
!=
undefined
)
.
assertTrue
(
);
expect
(
asset
.
uri
)
.
assertEqual
(
props
[
type
]
.
uri
);
fetchAssetResult
.
close
();
fetchAssetResult
.
close
();
done
();
done
();
});
});
...
...
multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getFileAssetsPromise.test.ets
浏览文件 @
e5ba3540
...
@@ -49,24 +49,25 @@ export default function getFileAssetsPromiseTest(abilityContext) {
...
@@ -49,24 +49,25 @@ export default function getFileAssetsPromiseTest(abilityContext) {
const
props
=
{
const
props
=
{
image
:
{
image
:
{
displayName
:
'01.jpg'
,
displayName
:
'01.jpg'
,
media
Type
:
IMAGE_TYPE
.
toString
(),
file
Type
:
IMAGE_TYPE
.
toString
(),
},
},
video
:
{
video
:
{
displayName
:
'01.mp4'
,
displayName
:
'01.mp4'
,
relativePath
:
'Videos/Static/'
,
fileType
:
VIDEO_TYPE
.
toString
(),
mediaType
:
VIDEO_TYPE
.
toString
(),
},
},
audio
:
{
audio
:
{
displayName
:
'01.mp3'
,
displayName
:
'01.mp3'
,
media
Type
:
AUDIO_TYPE
.
toString
(),
file
Type
:
AUDIO_TYPE
.
toString
(),
},
},
}
}
async
function
getFirstObjectTest
(
done
,
testNum
,
fetchOp
s
,
isAudio
)
{
async
function
getFirstObjectTest
(
done
,
testNum
,
fetchOp
,
isAudio
)
{
try
{
try
{
let
fetchAssetResult
=
await
userfilemgr
.
getPhotoAssets
(
fetchOps
)
;
let
fetchAssetResult
;
if
(
isAudio
)
{
if
(
isAudio
)
{
fetchAssetResult
=
await
userfilemgr
.
getAudioAssets
(
fetchOps
);
fetchAssetResult
=
await
userfilemgr
.
getAudioAssets
(
fetchOp
);
}
else
{
fetchAssetResult
=
await
userfilemgr
.
getPhotoAssets
(
fetchOp
);
}
}
let
expectCount
=
4
;
let
expectCount
=
4
;
let
checkAssetCountPass
=
await
checkAssetsCount
(
done
,
testNum
,
fetchAssetResult
,
expectCount
);
let
checkAssetCountPass
=
await
checkAssetsCount
(
done
,
testNum
,
fetchAssetResult
,
expectCount
);
...
@@ -82,11 +83,13 @@ export default function getFileAssetsPromiseTest(abilityContext) {
...
@@ -82,11 +83,13 @@ export default function getFileAssetsPromiseTest(abilityContext) {
}
}
}
}
async
function
getLastObjectTest
(
done
,
testNum
,
fetchOp
s
,
isAudio
)
{
async
function
getLastObjectTest
(
done
,
testNum
,
fetchOp
,
isAudio
)
{
try
{
try
{
let
fetchAssetResult
=
await
userfilemgr
.
getPhotoAssets
(
fetchOps
)
;
let
fetchAssetResult
;
if
(
isAudio
)
{
if
(
isAudio
)
{
fetchAssetResult
=
await
userfilemgr
.
getAudioAssets
(
fetchOps
);
fetchAssetResult
=
await
userfilemgr
.
getAudioAssets
(
fetchOp
);
}
else
{
fetchAssetResult
=
await
userfilemgr
.
getPhotoAssets
(
fetchOp
);
}
}
let
expectCount
=
4
;
let
expectCount
=
4
;
let
checkAssetCountPass
=
await
checkAssetsCount
(
done
,
testNum
,
fetchAssetResult
,
expectCount
);
let
checkAssetCountPass
=
await
checkAssetsCount
(
done
,
testNum
,
fetchAssetResult
,
expectCount
);
...
@@ -102,11 +105,13 @@ export default function getFileAssetsPromiseTest(abilityContext) {
...
@@ -102,11 +105,13 @@ export default function getFileAssetsPromiseTest(abilityContext) {
}
}
}
}
async
function
getPositionObjectTest
(
done
,
testNum
,
fetchOp
s
,
pos
,
isAudio
)
{
async
function
getPositionObjectTest
(
done
,
testNum
,
fetchOp
,
pos
,
isAudio
)
{
try
{
try
{
let
fetchAssetResult
=
await
userfilemgr
.
getPhotoAssets
(
fetchOps
)
;
let
fetchAssetResult
;
if
(
isAudio
)
{
if
(
isAudio
)
{
fetchAssetResult
=
await
userfilemgr
.
getAudioAssets
(
fetchOps
);
fetchAssetResult
=
await
userfilemgr
.
getAudioAssets
(
fetchOp
);
}
else
{
fetchAssetResult
=
await
userfilemgr
.
getPhotoAssets
(
fetchOp
);
}
}
let
expectCount
=
4
;
let
expectCount
=
4
;
let
checkAssetCountPass
=
await
checkAssetsCount
(
done
,
testNum
,
fetchAssetResult
,
expectCount
);
let
checkAssetCountPass
=
await
checkAssetsCount
(
done
,
testNum
,
fetchAssetResult
,
expectCount
);
...
@@ -122,11 +127,13 @@ export default function getFileAssetsPromiseTest(abilityContext) {
...
@@ -122,11 +127,13 @@ export default function getFileAssetsPromiseTest(abilityContext) {
}
}
}
}
async
function
isAfterLastTest
(
done
,
testNum
,
fetchOp
s
,
isAudio
)
{
async
function
isAfterLastTest
(
done
,
testNum
,
fetchOp
,
isAudio
)
{
try
{
try
{
let
fetchAssetResult
=
await
userfilemgr
.
getPhotoAssets
(
fetchOps
)
;
let
fetchAssetResult
;
if
(
isAudio
)
{
if
(
isAudio
)
{
fetchAssetResult
=
await
userfilemgr
.
getAudioAssets
(
fetchOps
);
fetchAssetResult
=
await
userfilemgr
.
getAudioAssets
(
fetchOp
);
}
else
{
fetchAssetResult
=
await
userfilemgr
.
getPhotoAssets
(
fetchOp
);
}
}
let
expectCount
=
4
;
let
expectCount
=
4
;
let
checkAssetCountPass
=
await
checkAssetsCount
(
done
,
testNum
,
fetchAssetResult
,
expectCount
);
let
checkAssetCountPass
=
await
checkAssetsCount
(
done
,
testNum
,
fetchAssetResult
,
expectCount
);
...
@@ -148,11 +155,13 @@ export default function getFileAssetsPromiseTest(abilityContext) {
...
@@ -148,11 +155,13 @@ export default function getFileAssetsPromiseTest(abilityContext) {
}
}
}
}
async
function
checkFileAssetAttr
(
done
,
testNum
,
fetchOp
s
,
type
,
isAudio
)
{
async
function
checkFileAssetAttr
(
done
,
testNum
,
fetchOp
,
type
,
isAudio
)
{
try
{
try
{
let
fetchAssetResult
=
await
userfilemgr
.
getPhotoAssets
(
fetchOps
)
;
let
fetchAssetResult
;
if
(
isAudio
)
{
if
(
isAudio
)
{
fetchAssetResult
=
await
userfilemgr
.
getAudioAssets
(
fetchOps
);
fetchAssetResult
=
await
userfilemgr
.
getAudioAssets
(
fetchOp
);
}
else
{
fetchAssetResult
=
await
userfilemgr
.
getPhotoAssets
(
fetchOp
);
}
}
let
expectCount
=
4
;
let
expectCount
=
4
;
let
checkAssetCountPass
=
await
checkAssetsCount
(
done
,
testNum
,
fetchAssetResult
,
expectCount
);
let
checkAssetCountPass
=
await
checkAssetsCount
(
done
,
testNum
,
fetchAssetResult
,
expectCount
);
...
@@ -166,7 +175,8 @@ export default function getFileAssetsPromiseTest(abilityContext) {
...
@@ -166,7 +175,8 @@ export default function getFileAssetsPromiseTest(abilityContext) {
return
;
return
;
}
}
expect
(
asset
.
displayName
)
.
assertEqual
(
props
[
type
]
.
displayName
);
expect
(
asset
.
displayName
)
.
assertEqual
(
props
[
type
]
.
displayName
);
expect
(
asset
.
mediaType
.
toString
())
.
assertEqual
(
props
[
type
]
.
mediaType
);
expect
(
asset
.
fileType
.
toString
())
.
assertEqual
(
props
[
type
]
.
fileType
);
expect
(
asset
.
uri
!=
undefined
)
.
assertTrue
();
fetchAssetResult
.
close
();
fetchAssetResult
.
close
();
done
();
done
();
});
});
...
...
multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getPublicDirectoryCallback.test.ets
浏览文件 @
e5ba3540
...
@@ -38,7 +38,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) {
...
@@ -38,7 +38,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) {
console.info('afterAll case');
console.info('afterAll case');
});
});
const get
et
PublicDirectoryTest = async (done, testNum, dir, val) => {
const getPublicDirectoryTest = async (done, testNum, dir, val) => {
try {
try {
userfilemgr.getPublicDirectory(dir, async (err, res) => {
userfilemgr.getPublicDirectory(dir, async (err, res) => {
if (err) {
if (err) {
...
@@ -69,7 +69,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) {
...
@@ -69,7 +69,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_01';
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_01';
let dir = userfile_manager.DirectoryType.DIR_CAMERA;
let dir = userfile_manager.DirectoryType.DIR_CAMERA;
let val = 'Camera/';
let val = 'Camera/';
await get
et
PublicDirectoryTest(done, testNum, dir, val)
await getPublicDirectoryTest(done, testNum, dir, val)
});
});
/**
/**
...
@@ -84,7 +84,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) {
...
@@ -84,7 +84,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_02';
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_02';
let dir = userfile_manager.DirectoryType.DIR_VIDEO;
let dir = userfile_manager.DirectoryType.DIR_VIDEO;
let val = 'Videos/';
let val = 'Videos/';
await get
et
PublicDirectoryTest(done, testNum, dir, val)
await getPublicDirectoryTest(done, testNum, dir, val)
});
});
/**
/**
...
@@ -99,7 +99,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) {
...
@@ -99,7 +99,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_03';
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_03';
let dir = userfile_manager.DirectoryType.DIR_IMAGE;
let dir = userfile_manager.DirectoryType.DIR_IMAGE;
let val = 'Pictures/';
let val = 'Pictures/';
await get
et
PublicDirectoryTest(done, testNum, dir, val)
await getPublicDirectoryTest(done, testNum, dir, val)
});
});
/**
/**
...
@@ -114,7 +114,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) {
...
@@ -114,7 +114,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_04';
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_04';
let dir = userfile_manager.DirectoryType.DIR_AUDIO;
let dir = userfile_manager.DirectoryType.DIR_AUDIO;
let val = 'Audios/';
let val = 'Audios/';
await get
et
PublicDirectoryTest(done, testNum, dir, val)
await getPublicDirectoryTest(done, testNum, dir, val)
});
});
/**
/**
...
@@ -129,7 +129,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) {
...
@@ -129,7 +129,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_05';
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_05';
let dir = userfile_manager.DirectoryType.DIR_DOCUMENTS;
let dir = userfile_manager.DirectoryType.DIR_DOCUMENTS;
let val = 'Documents/';
let val = 'Documents/';
await get
et
PublicDirectoryTest(done, testNum, dir, val)
await getPublicDirectoryTest(done, testNum, dir, val)
});
});
/**
/**
...
@@ -144,7 +144,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) {
...
@@ -144,7 +144,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_06';
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_06';
let dir = userfile_manager.DirectoryType.DIR_DOWNLOAD;
let dir = userfile_manager.DirectoryType.DIR_DOWNLOAD;
let val = 'Download/';
let val = 'Download/';
await get
et
PublicDirectoryTest(done, testNum, dir, val)
await getPublicDirectoryTest(done, testNum, dir, val)
});
});
});
});
}
}
...
...
multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getPublicDirectoryPromise.test.ets
浏览文件 @
e5ba3540
...
@@ -38,7 +38,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) {
...
@@ -38,7 +38,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) {
console.info('afterAll case');
console.info('afterAll case');
});
});
const get
et
PublicDirectoryTest = async (done, testNum, dir, val) => {
const getPublicDirectoryTest = async (done, testNum, dir, val) => {
try {
try {
let res = await userfilemgr.getPublicDirectory(dir);
let res = await userfilemgr.getPublicDirectory(dir);
expect(res).assertEqual(val);
expect(res).assertEqual(val);
...
@@ -62,7 +62,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) {
...
@@ -62,7 +62,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_01';
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_01';
let dir = userfile_manager.DirectoryType.DIR_CAMERA;
let dir = userfile_manager.DirectoryType.DIR_CAMERA;
let val = 'Camera/';
let val = 'Camera/';
await get
et
PublicDirectoryTest(done, testNum, dir, val)
await getPublicDirectoryTest(done, testNum, dir, val)
});
});
/**
/**
...
@@ -77,7 +77,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) {
...
@@ -77,7 +77,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_02';
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_02';
let dir = userfile_manager.DirectoryType.DIR_VIDEO;
let dir = userfile_manager.DirectoryType.DIR_VIDEO;
let val = 'Videos/';
let val = 'Videos/';
await get
et
PublicDirectoryTest(done, testNum, dir, val)
await getPublicDirectoryTest(done, testNum, dir, val)
});
});
/**
/**
...
@@ -92,7 +92,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) {
...
@@ -92,7 +92,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_03';
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_03';
let dir = userfile_manager.DirectoryType.DIR_IMAGE;
let dir = userfile_manager.DirectoryType.DIR_IMAGE;
let val = 'Pictures/';
let val = 'Pictures/';
await get
et
PublicDirectoryTest(done, testNum, dir, val)
await getPublicDirectoryTest(done, testNum, dir, val)
});
});
/**
/**
...
@@ -107,7 +107,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) {
...
@@ -107,7 +107,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_04';
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_04';
let dir = userfile_manager.DirectoryType.DIR_AUDIO;
let dir = userfile_manager.DirectoryType.DIR_AUDIO;
let val = 'Audios/';
let val = 'Audios/';
await get
et
PublicDirectoryTest(done, testNum, dir, val)
await getPublicDirectoryTest(done, testNum, dir, val)
});
});
/**
/**
...
@@ -122,7 +122,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) {
...
@@ -122,7 +122,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_05';
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_05';
let dir = userfile_manager.DirectoryType.DIR_DOCUMENTS;
let dir = userfile_manager.DirectoryType.DIR_DOCUMENTS;
let val = 'Documents/';
let val = 'Documents/';
await get
et
PublicDirectoryTest(done, testNum, dir, val)
await getPublicDirectoryTest(done, testNum, dir, val)
});
});
/**
/**
...
@@ -137,7 +137,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) {
...
@@ -137,7 +137,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_06';
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_06';
let dir = userfile_manager.DirectoryType.DIR_DOWNLOAD;
let dir = userfile_manager.DirectoryType.DIR_DOWNLOAD;
let val = 'Download/';
let val = 'Download/';
await get
et
PublicDirectoryTest(done, testNum, dir, val)
await getPublicDirectoryTest(done, testNum, dir, val)
});
});
});
});
}
}
...
...
multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/onOffReleasePromise.test.ets
浏览文件 @
e5ba3540
...
@@ -43,13 +43,15 @@ export default function onOffReleasePromiseTest(abilityContext) {
...
@@ -43,13 +43,15 @@ export default function onOffReleasePromiseTest(abilityContext) {
console.info('afterAll case');
console.info('afterAll case');
});
});
const onTest = async (done, testNum, fetchOp
s
, type, newName, isAudio) => {
const onTest = async (done, testNum, fetchOp, type, newName, isAudio) => {
try {
try {
let count = 0;
let count = 0;
userfilemgr.on(type, () => { count++; });
userfilemgr.on(type, () => { count++; });
let fetchAssetResult
= await userfilemgr.getPhotoAssets(fetchOps)
;
let fetchAssetResult;
if (isAudio) {
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOps);
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
if (!checkAssetCountPass) return;
if (!checkAssetCountPass) return;
...
@@ -66,15 +68,17 @@ export default function onOffReleasePromiseTest(abilityContext) {
...
@@ -66,15 +68,17 @@ export default function onOffReleasePromiseTest(abilityContext) {
done();
done();
}
}
}
}
const offTest = async (done, testNum, fetchOp
s
, type, newName, isAudio) => {
const offTest = async (done, testNum, fetchOp, type, newName, isAudio) => {
try {
try {
let count = 0;
let count = 0;
userfilemgr.on(type, () => {
userfilemgr.on(type, () => {
count++;
count++;
});
});
let fetchAssetResult
= await userfilemgr.getPhotoAssets(fetchOps)
;
let fetchAssetResult;
if (isAudio) {
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOps);
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
if (!checkAssetCountPass) return;
if (!checkAssetCountPass) return;
...
...
multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetCommitModifyCallback.test.ets
浏览文件 @
e5ba3540
...
@@ -49,9 +49,11 @@ export default function fileAssetCommitModifyCallbackTest(abilityContext) {
...
@@ -49,9 +49,11 @@ export default function fileAssetCommitModifyCallbackTest(abilityContext) {
const checkCommitModify = async function (done, testNum, fetchOp, prop, val, isAudio) {
const checkCommitModify = async function (done, testNum, fetchOp, prop, val, isAudio) {
try {
try {
let fetchAssetResult
= await userfilemgr.getPhotoAssets(fetchOp)
;
let fetchAssetResult;
if (isAudio) {
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
if (!checkAssetCountPass) return;
if (!checkAssetCountPass) return;
...
...
multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetCommitModifyPromise.test.ets
浏览文件 @
e5ba3540
...
@@ -47,9 +47,11 @@ export default function fileAssetCommitModifyPromiseTest(abilityContext) {
...
@@ -47,9 +47,11 @@ export default function fileAssetCommitModifyPromiseTest(abilityContext) {
const checkCommitModify = async function (done, testNum, fetchOp, prop, val, isAudio) {
const checkCommitModify = async function (done, testNum, fetchOp, prop, val, isAudio) {
try {
try {
let fetchAssetResult
= await userfilemgr.getPhotoAssets(fetchOp)
;
let fetchAssetResult;
if (isAudio) {
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
if (!checkAssetCountPass) return;
if (!checkAssetCountPass) return;
...
...
multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetFavoriteCallback.test.ets
浏览文件 @
e5ba3540
...
@@ -45,9 +45,11 @@ export default function fileAssetFavoriteCallbackTest(abilityContext) {
...
@@ -45,9 +45,11 @@ export default function fileAssetFavoriteCallbackTest(abilityContext) {
const favoriteDefaultState = async function (done, testNum, fetchOp, isAudio) {
const favoriteDefaultState = async function (done, testNum, fetchOp, isAudio) {
try {
try {
let fetchAssetResult
= await userfilemgr.getPhotoAssets(fetchOp)
;
let fetchAssetResult;
if (isAudio) {
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
if (!checkAssetCountPass) return;
if (!checkAssetCountPass) return;
...
@@ -71,9 +73,11 @@ export default function fileAssetFavoriteCallbackTest(abilityContext) {
...
@@ -71,9 +73,11 @@ export default function fileAssetFavoriteCallbackTest(abilityContext) {
}
}
const favoriteByTrue = async function (done, testNum, fetchOp, isAudio) {
const favoriteByTrue = async function (done, testNum, fetchOp, isAudio) {
try {
try {
let fetchAssetResult
= await userfilemgr.getPhotoAssets(fetchOp)
;
let fetchAssetResult;
if (isAudio) {
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
if (!checkAssetCountPass) return;
if (!checkAssetCountPass) return;
...
@@ -101,9 +105,11 @@ export default function fileAssetFavoriteCallbackTest(abilityContext) {
...
@@ -101,9 +105,11 @@ export default function fileAssetFavoriteCallbackTest(abilityContext) {
}
}
const favoriteByFalse = async function (done, testNum, fetchOp, isAudio) {
const favoriteByFalse = async function (done, testNum, fetchOp, isAudio) {
try {
try {
let fetchAssetResult
= await userfilemgr.getPhotoAssets(fetchOp)
;
let fetchAssetResult;
if (isAudio) {
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
if (!checkAssetCountPass) return;
if (!checkAssetCountPass) return;
...
...
multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetFavoritePromise.test.ets
浏览文件 @
e5ba3540
...
@@ -43,9 +43,11 @@ export default function fileAssetFavoritePromiseTest(abilityContext) {
...
@@ -43,9 +43,11 @@ export default function fileAssetFavoritePromiseTest(abilityContext) {
const favoriteDefaultState = async function (done, testNum, fetchOp, isAudio) {
const favoriteDefaultState = async function (done, testNum, fetchOp, isAudio) {
try {
try {
let fetchAssetResult
= await userfilemgr.getPhotoAssets(fetchOp)
;
let fetchAssetResult;
if (isAudio) {
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
if (!checkAssetCountPass) return;
if (!checkAssetCountPass) return;
...
@@ -62,9 +64,11 @@ export default function fileAssetFavoritePromiseTest(abilityContext) {
...
@@ -62,9 +64,11 @@ export default function fileAssetFavoritePromiseTest(abilityContext) {
}
}
const favoriteByTrue = async function (done, testNum, fetchOp, isAudio) {
const favoriteByTrue = async function (done, testNum, fetchOp, isAudio) {
try {
try {
let fetchAssetResult
= await userfilemgr.getPhotoAssets(fetchOp)
;
let fetchAssetResult;
if (isAudio) {
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
if (!checkAssetCountPass) return;
if (!checkAssetCountPass) return;
...
@@ -82,9 +86,11 @@ export default function fileAssetFavoritePromiseTest(abilityContext) {
...
@@ -82,9 +86,11 @@ export default function fileAssetFavoritePromiseTest(abilityContext) {
}
}
const favoriteByFalse = async function (done, testNum, fetchOp, isAudio) {
const favoriteByFalse = async function (done, testNum, fetchOp, isAudio) {
try {
try {
let fetchAssetResult
= await userfilemgr.getPhotoAssets(fetchOp)
;
let fetchAssetResult;
if (isAudio) {
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
if (!checkAssetCountPass) return;
if (!checkAssetCountPass) return;
...
...
multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetGetThumbnailCallback.test.ets
浏览文件 @
e5ba3540
...
@@ -43,11 +43,13 @@ export default function fileAssetGetThumbnailCallbackTest(abilityContext) {
...
@@ -43,11 +43,13 @@ export default function fileAssetGetThumbnailCallbackTest(abilityContext) {
console
.
info
(
'afterAll case'
);
console
.
info
(
'afterAll case'
);
});
});
async
function
testGetThumbnail
(
done
,
testNum
,
d
Op
,
size
,
isAudio
)
{
async
function
testGetThumbnail
(
done
,
testNum
,
fetch
Op
,
size
,
isAudio
)
{
try
{
try
{
let
fetchAssetResult
=
await
userfilemgr
.
getPhotoAssets
(
dOp
)
;
let
fetchAssetResult
;
if
(
isAudio
)
{
if
(
isAudio
)
{
fetchAssetResult
=
await
userfilemgr
.
getAudioAssets
(
dOp
);
fetchAssetResult
=
await
userfilemgr
.
getAudioAssets
(
fetchOp
);
}
else
{
fetchAssetResult
=
await
userfilemgr
.
getPhotoAssets
(
fetchOp
);
}
}
let
checkAssetCountPass
=
await
checkAssetsCount
(
done
,
testNum
,
fetchAssetResult
,
1
);
let
checkAssetCountPass
=
await
checkAssetsCount
(
done
,
testNum
,
fetchAssetResult
,
1
);
if
(
!
checkAssetCountPass
)
return
;
if
(
!
checkAssetCountPass
)
return
;
...
...
multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetGetThumbnailPromise.test.ets
浏览文件 @
e5ba3540
...
@@ -43,11 +43,13 @@ export default function fileAssetGetThumbnailPromiseTest(abilityContext) {
...
@@ -43,11 +43,13 @@ export default function fileAssetGetThumbnailPromiseTest(abilityContext) {
console
.
info
(
'afterAll case'
);
console
.
info
(
'afterAll case'
);
});
});
async
function
testGetThumbnail
(
done
,
testNum
,
d
Op
,
size
,
isAudio
)
{
async
function
testGetThumbnail
(
done
,
testNum
,
fetch
Op
,
size
,
isAudio
)
{
try
{
try
{
let
fetchAssetResult
=
await
userfilemgr
.
getPhotoAssets
(
dOp
)
;
let
fetchAssetResult
;
if
(
isAudio
)
{
if
(
isAudio
)
{
fetchAssetResult
=
await
userfilemgr
.
getAudioAssets
(
dOp
);
fetchAssetResult
=
await
userfilemgr
.
getAudioAssets
(
fetchOp
);
}
else
{
fetchAssetResult
=
await
userfilemgr
.
getPhotoAssets
(
fetchOp
);
}
}
let
checkAssetCountPass
=
await
checkAssetsCount
(
done
,
testNum
,
fetchAssetResult
,
1
);
let
checkAssetCountPass
=
await
checkAssetsCount
(
done
,
testNum
,
fetchAssetResult
,
1
);
if
(
!
checkAssetCountPass
)
return
;
if
(
!
checkAssetCountPass
)
return
;
...
...
multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetIsDirectoryCallback.test.ets
浏览文件 @
e5ba3540
...
@@ -43,9 +43,11 @@ export default function fileAssetIsDirectoryCallbackTest(abilityContext) {
...
@@ -43,9 +43,11 @@ export default function fileAssetIsDirectoryCallbackTest(abilityContext) {
const isDirectoryTest = async function (done, testNum, fetchOp, isAudio) {
const isDirectoryTest = async function (done, testNum, fetchOp, isAudio) {
try {
try {
let fetchAssetResult
= await userfilemgr.getPhotoAssets(fetchOp)
;
let fetchAssetResult;
if (isAudio) {
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
}
const asset = await fetchAssetResult.getFirstObject();
const asset = await fetchAssetResult.getFirstObject();
fetchAssetResult.close();
fetchAssetResult.close();
...
...
multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetIsDirectoryPromise.test.ets
浏览文件 @
e5ba3540
...
@@ -43,9 +43,11 @@ export default function fileAssetIsDirectoryPromiseTest(abilityContext) {
...
@@ -43,9 +43,11 @@ export default function fileAssetIsDirectoryPromiseTest(abilityContext) {
const isDirectoryTest = async function (done, testNum, fetchOp, isAudio) {
const isDirectoryTest = async function (done, testNum, fetchOp, isAudio) {
try {
try {
let fetchAssetResult
= await userfilemgr.getPhotoAssets(fetchOp)
;
let fetchAssetResult;
if (isAudio) {
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
}
const asset = await fetchAssetResult.getFirstObject();
const asset = await fetchAssetResult.getFirstObject();
fetchAssetResult.close();
fetchAssetResult.close();
...
...
multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetOpenCallback.test.ets
浏览文件 @
e5ba3540
...
@@ -47,9 +47,11 @@ export default function fileAssetOpenCallbackTest(abilityContext) {
...
@@ -47,9 +47,11 @@ export default function fileAssetOpenCallbackTest(abilityContext) {
let asset;
let asset;
let fd;
let fd;
try {
try {
let fetchAssetResult
= await userfilemgr.getPhotoAssets(fetchOp)
;
let fetchAssetResult;
if (isAudio) {
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount);
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount);
if (!checkAssetCountPass) return;
if (!checkAssetCountPass) return;
...
@@ -88,10 +90,11 @@ export default function fileAssetOpenCallbackTest(abilityContext) {
...
@@ -88,10 +90,11 @@ export default function fileAssetOpenCallbackTest(abilityContext) {
let asset, asset1;
let asset, asset1;
let fd, fd1;
let fd, fd1;
try {
try {
let fetchAssetResult;
let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
if (isAudio) {
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount);
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount);
if (!checkAssetCountPass) return;
if (!checkAssetCountPass) return;
...
@@ -134,9 +137,11 @@ export default function fileAssetOpenCallbackTest(abilityContext) {
...
@@ -134,9 +137,11 @@ export default function fileAssetOpenCallbackTest(abilityContext) {
let asset, asset1;
let asset, asset1;
let fd, fd1;
let fd, fd1;
try {
try {
let fetchAssetResult
= await userfilemgr.getPhotoAssets(fetchOp)
;
let fetchAssetResult;
if (isAudio) {
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount);
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount);
if (!checkAssetCountPass) return;
if (!checkAssetCountPass) return;
...
@@ -179,9 +184,11 @@ export default function fileAssetOpenCallbackTest(abilityContext) {
...
@@ -179,9 +184,11 @@ export default function fileAssetOpenCallbackTest(abilityContext) {
let asset;
let asset;
let fd;
let fd;
try {
try {
let fetchAssetResult
= await userfilemgr.getPhotoAssets(fetchOp)
;
let fetchAssetResult;
if (isAudio) {
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
if (!checkAssetCountPass) return;
if (!checkAssetCountPass) return;
...
...
multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetOpenPromise.test.ets
浏览文件 @
e5ba3540
...
@@ -51,9 +51,11 @@ export default function fileAssetOpenPromiseTest(abilityContext) {
...
@@ -51,9 +51,11 @@ export default function fileAssetOpenPromiseTest(abilityContext) {
let asset;
let asset;
let fd;
let fd;
try {
try {
let fetchAssetResult
= await userfilemgr.getPhotoAssets(fetchOp)
;
let fetchAssetResult;
if (isAudio) {
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount);
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount);
if (!checkAssetCountPass) return;
if (!checkAssetCountPass) return;
...
@@ -85,9 +87,11 @@ export default function fileAssetOpenPromiseTest(abilityContext) {
...
@@ -85,9 +87,11 @@ export default function fileAssetOpenPromiseTest(abilityContext) {
let asset, asset1;
let asset, asset1;
let fd, fd1;
let fd, fd1;
try {
try {
let fetchAssetResult
= await userfilemgr.getPhotoAssets(fetchOp)
;
let fetchAssetResult;
if (isAudio) {
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount);
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount);
if (!checkAssetCountPass) return;
if (!checkAssetCountPass) return;
...
@@ -126,9 +130,11 @@ export default function fileAssetOpenPromiseTest(abilityContext) {
...
@@ -126,9 +130,11 @@ export default function fileAssetOpenPromiseTest(abilityContext) {
let asset, asset1;
let asset, asset1;
let fd, fd1;
let fd, fd1;
try {
try {
let fetchAssetResult
= await userfilemgr.getPhotoAssets(fetchOp)
;
let fetchAssetResult;
if (isAudio) {
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount);
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount);
if (!checkAssetCountPass) return;
if (!checkAssetCountPass) return;
...
@@ -164,9 +170,11 @@ export default function fileAssetOpenPromiseTest(abilityContext) {
...
@@ -164,9 +170,11 @@ export default function fileAssetOpenPromiseTest(abilityContext) {
let asset;
let asset;
let fd;
let fd;
try {
try {
let fetchAssetResult
= await userfilemgr.getPhotoAssets(fetchOp)
;
let fetchAssetResult;
if (isAudio) {
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
if (!checkAssetCountPass) return;
if (!checkAssetCountPass) return;
...
...
multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetTrashCallback.test.ets
浏览文件 @
e5ba3540
...
@@ -43,9 +43,11 @@ export default function fileAssetTrashCallbackTest(abilityContext) {
...
@@ -43,9 +43,11 @@ export default function fileAssetTrashCallbackTest(abilityContext) {
const
isTrashTest
=
async
function
(
done
,
testNum
,
fetchOp
,
isAudio
)
{
const
isTrashTest
=
async
function
(
done
,
testNum
,
fetchOp
,
isAudio
)
{
try
{
try
{
let
fetchAssetResult
=
await
userfilemgr
.
getPhotoAssets
(
fetchOp
)
;
let
fetchAssetResult
;
if
(
isAudio
)
{
if
(
isAudio
)
{
fetchAssetResult
=
await
userfilemgr
.
getAudioAssets
(
fetchOp
);
fetchAssetResult
=
await
userfilemgr
.
getAudioAssets
(
fetchOp
);
}
else
{
fetchAssetResult
=
await
userfilemgr
.
getPhotoAssets
(
fetchOp
);
}
}
let
checkAssetCountPass
=
await
checkAssetsCount
(
done
,
testNum
,
fetchAssetResult
,
1
);
let
checkAssetCountPass
=
await
checkAssetsCount
(
done
,
testNum
,
fetchAssetResult
,
1
);
if
(
!
checkAssetCountPass
)
return
;
if
(
!
checkAssetCountPass
)
return
;
...
@@ -72,9 +74,11 @@ export default function fileAssetTrashCallbackTest(abilityContext) {
...
@@ -72,9 +74,11 @@ export default function fileAssetTrashCallbackTest(abilityContext) {
let
expectAssetNum
=
3
let
expectAssetNum
=
3
try
{
try
{
// database info
// database info
let
databaseFetchFileResult
=
await
userfilemgr
.
getPhotoAssets
(
databasefFetchOps
)
;
let
databaseFetchFileResult
;
if
(
isAudio
)
{
if
(
isAudio
)
{
databaseFetchFileResult
=
await
userfilemgr
.
getAudioAssets
(
databasefFetchOps
);
databaseFetchFileResult
=
await
userfilemgr
.
getAudioAssets
(
databasefFetchOps
);
}
else
{
databaseFetchFileResult
=
await
userfilemgr
.
getPhotoAssets
(
databasefFetchOps
);
}
}
let
count
=
databaseFetchFileResult
.
getCount
();
let
count
=
databaseFetchFileResult
.
getCount
();
//album info
//album info
...
@@ -109,9 +113,11 @@ export default function fileAssetTrashCallbackTest(abilityContext) {
...
@@ -109,9 +113,11 @@ export default function fileAssetTrashCallbackTest(abilityContext) {
expect
(
trashState
)
.
assertTrue
();
expect
(
trashState
)
.
assertTrue
();
try
{
try
{
// after trash database info
// after trash database info
databaseFetchFileResult
=
await
userfilemgr
.
getPhotoAssets
(
databasefFetchOps
)
;
let
databaseFetchFileResult
;
if
(
isAudio
)
{
if
(
isAudio
)
{
databaseFetchFileResult
=
await
userfilemgr
.
getAudioAssets
(
databasefFetchOps
);
databaseFetchFileResult
=
await
userfilemgr
.
getAudioAssets
(
databasefFetchOps
);
}
else
{
databaseFetchFileResult
=
await
userfilemgr
.
getPhotoAssets
(
databasefFetchOps
);
}
}
let
databaseCount
=
databaseFetchFileResult
.
getCount
();
let
databaseCount
=
databaseFetchFileResult
.
getCount
();
databaseFetchFileResult
.
close
();
databaseFetchFileResult
.
close
();
...
@@ -146,9 +152,11 @@ export default function fileAssetTrashCallbackTest(abilityContext) {
...
@@ -146,9 +152,11 @@ export default function fileAssetTrashCallbackTest(abilityContext) {
async
function
recovery
(
done
,
testNum
,
databasefFetchOps
,
ablumFetchOps
,
noAlbum
,
isAudio
)
{
async
function
recovery
(
done
,
testNum
,
databasefFetchOps
,
ablumFetchOps
,
noAlbum
,
isAudio
)
{
let
expectAssetNum
=
3
;
let
expectAssetNum
=
3
;
try
{
try
{
let
databaseFetchFileResult
=
await
userfilemgr
.
getPhotoAssets
(
databasefFetchOps
)
;
let
databaseFetchFileResult
;
if
(
isAudio
)
{
if
(
isAudio
)
{
databaseFetchFileResult
=
await
userfilemgr
.
getAudioAssets
(
databasefFetchOps
);
databaseFetchFileResult
=
await
userfilemgr
.
getAudioAssets
(
databasefFetchOps
);
}
else
{
databaseFetchFileResult
=
await
userfilemgr
.
getPhotoAssets
(
databasefFetchOps
);
}
}
let
count
=
databaseFetchFileResult
.
getCount
();
let
count
=
databaseFetchFileResult
.
getCount
();
let
asset
=
await
databaseFetchFileResult
.
getFirstObject
();
let
asset
=
await
databaseFetchFileResult
.
getFirstObject
();
...
@@ -169,9 +177,11 @@ export default function fileAssetTrashCallbackTest(abilityContext) {
...
@@ -169,9 +177,11 @@ export default function fileAssetTrashCallbackTest(abilityContext) {
}
}
expect
(
trashState
)
.
assertFalse
();
expect
(
trashState
)
.
assertFalse
();
try
{
try
{
databaseFetchFileResult
=
await
userfilemgr
.
getPhotoAssets
(
databasefFetchOps
)
;
let
databaseFetchFileResult
;
if
(
isAudio
)
{
if
(
isAudio
)
{
databaseFetchFileResult
=
await
userfilemgr
.
getAudioAssets
(
databasefFetchOps
);
databaseFetchFileResult
=
await
userfilemgr
.
getAudioAssets
(
databasefFetchOps
);
}
else
{
databaseFetchFileResult
=
await
userfilemgr
.
getPhotoAssets
(
databasefFetchOps
);
}
}
let
databaseCount
=
databaseFetchFileResult
.
getCount
();
let
databaseCount
=
databaseFetchFileResult
.
getCount
();
databaseFetchFileResult
.
close
();
databaseFetchFileResult
.
close
();
...
...
multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetTrashPromise.test.ets
浏览文件 @
e5ba3540
...
@@ -43,9 +43,11 @@ export default function fileAssetTrashPromiseTest(abilityContext) {
...
@@ -43,9 +43,11 @@ export default function fileAssetTrashPromiseTest(abilityContext) {
const
isTrashTest
=
async
function
(
done
,
testNum
,
fetchOp
,
isAudio
)
{
const
isTrashTest
=
async
function
(
done
,
testNum
,
fetchOp
,
isAudio
)
{
try
{
try
{
let
fetchAssetResult
=
await
userfilemgr
.
getPhotoAssets
(
fetchOp
)
;
let
fetchAssetResult
;
if
(
isAudio
)
{
if
(
isAudio
)
{
fetchAssetResult
=
await
userfilemgr
.
getAudioAssets
(
fetchOp
);
fetchAssetResult
=
await
userfilemgr
.
getAudioAssets
(
fetchOp
);
}
else
{
fetchAssetResult
=
await
userfilemgr
.
getPhotoAssets
(
fetchOp
);
}
}
let
checkAssetCountPass
=
await
checkAssetsCount
(
done
,
testNum
,
fetchAssetResult
,
1
);
let
checkAssetCountPass
=
await
checkAssetsCount
(
done
,
testNum
,
fetchAssetResult
,
1
);
if
(
!
checkAssetCountPass
)
return
;
if
(
!
checkAssetCountPass
)
return
;
...
@@ -65,9 +67,11 @@ export default function fileAssetTrashPromiseTest(abilityContext) {
...
@@ -65,9 +67,11 @@ export default function fileAssetTrashPromiseTest(abilityContext) {
let
expectAssetNum
=
3
let
expectAssetNum
=
3
try
{
try
{
// database info
// database info
let
databaseFetchFileResult
=
await
userfilemgr
.
getPhotoAssets
(
databasefFetchOps
)
;
let
databaseFetchFileResult
;
if
(
isAudio
)
{
if
(
isAudio
)
{
databaseFetchFileResult
=
await
userfilemgr
.
getAudioAssets
(
databasefFetchOps
);
databaseFetchFileResult
=
await
userfilemgr
.
getAudioAssets
(
databasefFetchOps
);
}
else
{
databaseFetchFileResult
=
await
userfilemgr
.
getPhotoAssets
(
databasefFetchOps
);
}
}
let
count
=
databaseFetchFileResult
.
getCount
();
let
count
=
databaseFetchFileResult
.
getCount
();
//album info
//album info
...
@@ -89,6 +93,8 @@ export default function fileAssetTrashPromiseTest(abilityContext) {
...
@@ -89,6 +93,8 @@ export default function fileAssetTrashPromiseTest(abilityContext) {
databaseFetchFileResult
=
await
userfilemgr
.
getPhotoAssets
(
databasefFetchOps
);
databaseFetchFileResult
=
await
userfilemgr
.
getPhotoAssets
(
databasefFetchOps
);
if
(
isAudio
)
{
if
(
isAudio
)
{
databaseFetchFileResult
=
await
userfilemgr
.
getAudioAssets
(
databasefFetchOps
);
databaseFetchFileResult
=
await
userfilemgr
.
getAudioAssets
(
databasefFetchOps
);
}
else
{
databaseFetchFileResult
=
await
userfilemgr
.
getPhotoAssets
(
databasefFetchOps
);
}
}
let
databaseCount
=
databaseFetchFileResult
.
getCount
();
let
databaseCount
=
databaseFetchFileResult
.
getCount
();
databaseFetchFileResult
.
close
()
databaseFetchFileResult
.
close
()
...
@@ -115,17 +121,20 @@ export default function fileAssetTrashPromiseTest(abilityContext) {
...
@@ -115,17 +121,20 @@ export default function fileAssetTrashPromiseTest(abilityContext) {
async
function
recovery
(
done
,
testNum
,
databasefFetchOps
,
ablumFetchOps
,
noAlbum
,
isAudio
)
{
async
function
recovery
(
done
,
testNum
,
databasefFetchOps
,
ablumFetchOps
,
noAlbum
,
isAudio
)
{
let
expectAssetNum
=
3
;
let
expectAssetNum
=
3
;
try
{
try
{
let
databaseFetchFileResult
=
await
userfilemgr
.
getPhotoAssets
(
databasefFetchOps
)
;
let
databaseFetchFileResult
;
if
(
isAudio
)
{
if
(
isAudio
)
{
databaseFetchFileResult
=
await
userfilemgr
.
getAudioAssets
(
databasefFetchOps
);
databaseFetchFileResult
=
await
userfilemgr
.
getAudioAssets
(
databasefFetchOps
);
}
else
{
databaseFetchFileResult
=
await
userfilemgr
.
getPhotoAssets
(
databasefFetchOps
);
}
}
let
count
=
databaseFetchFileResult
.
getCount
();
let
count
=
databaseFetchFileResult
.
getCount
();
let
asset
=
await
databaseFetchFileResult
.
getFirstObject
();
let
asset
=
await
databaseFetchFileResult
.
getFirstObject
();
await
asset
.
trash
(
true
);
await
asset
.
trash
(
true
);
await
asset
.
trash
(
false
);
await
asset
.
trash
(
false
);
databaseFetchFileResult
=
await
userfilemgr
.
getPhotoAssets
(
databasefFetchOps
);
if
(
isAudio
)
{
if
(
isAudio
)
{
databaseFetchFileResult
=
await
userfilemgr
.
getAudioAssets
(
databasefFetchOps
);
databaseFetchFileResult
=
await
userfilemgr
.
getAudioAssets
(
databasefFetchOps
);
}
else
{
databaseFetchFileResult
=
await
userfilemgr
.
getPhotoAssets
(
databasefFetchOps
);
}
}
let
databaseCount
=
databaseFetchFileResult
.
getCount
();
let
databaseCount
=
databaseFetchFileResult
.
getCount
();
databaseFetchFileResult
.
close
();
databaseFetchFileResult
.
close
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录