提交 e5ba3540 编写于 作者: Y yangbo

fix warn

Signed-off-by: Nyangbo <yangbo258@h-partners.com>
上级 641b9a33
...@@ -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',
mediaType: IMAGE_TYPE.toString(), fileType: 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',
mediaType: AUDIO_TYPE.toString(), fileType: AUDIO_TYPE.toString(),
}, },
} }
async function getFirstObjectTest(done, testNum, fetchOps, 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, fetchOps, 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, fetchOps, 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, fetchOps, 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, fetchOps, 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].mediaType); expect(asset.fileType.toString()).assertEqual(props[type].fileType);
expect(asset.uri != undefined).assertTrue(); expect(asset.uri).assertEqual(props[type].uri);
fetchAssetResult.close(); fetchAssetResult.close();
done(); done();
}); });
......
...@@ -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',
mediaType: IMAGE_TYPE.toString(), fileType: 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',
mediaType: AUDIO_TYPE.toString(), fileType: AUDIO_TYPE.toString(),
}, },
} }
async function getFirstObjectTest(done, testNum, fetchOps, 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, fetchOps, 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, fetchOps, 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, fetchOps, 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, fetchOps, 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();
}); });
......
...@@ -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 getetPublicDirectoryTest = 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 getetPublicDirectoryTest(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 getetPublicDirectoryTest(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 getetPublicDirectoryTest(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 getetPublicDirectoryTest(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 getetPublicDirectoryTest(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 getetPublicDirectoryTest(done, testNum, dir, val) await getPublicDirectoryTest(done, testNum, dir, val)
}); });
}); });
} }
......
...@@ -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 getetPublicDirectoryTest = 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 getetPublicDirectoryTest(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 getetPublicDirectoryTest(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 getetPublicDirectoryTest(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 getetPublicDirectoryTest(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 getetPublicDirectoryTest(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 getetPublicDirectoryTest(done, testNum, dir, val) await getPublicDirectoryTest(done, testNum, dir, val)
}); });
}); });
} }
......
...@@ -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, fetchOps, 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, fetchOps, 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;
......
...@@ -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;
......
...@@ -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;
......
...@@ -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;
......
...@@ -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;
......
...@@ -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, dOp, size, isAudio) { async function testGetThumbnail(done, testNum, fetchOp, 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;
......
...@@ -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, dOp, size, isAudio) { async function testGetThumbnail(done, testNum, fetchOp, 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;
......
...@@ -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();
......
...@@ -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();
......
...@@ -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;
......
...@@ -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;
......
...@@ -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();
......
...@@ -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.
先完成此消息的编辑!
想要评论请 注册