提交 e5ba3540 编写于 作者: Y yangbo

fix warn

Signed-off-by: Nyangbo <yangbo258@h-partners.com>
上级 641b9a33
......@@ -48,24 +48,25 @@ export default function getFileAssetsCallbackTest(abilityContext) {
const props = {
image: {
displayName: '01.jpg',
mediaType: IMAGE_TYPE.toString(),
fileType: IMAGE_TYPE.toString(),
},
video: {
displayName: '01.mp4',
relativePath: 'Videos/Static/',
mediaType: VIDEO_TYPE.toString(),
fileType: VIDEO_TYPE.toString(),
},
audio: {
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 {
let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOps);
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOps);
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
let expectCount = 4;
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount);
......@@ -89,11 +90,13 @@ export default function getFileAssetsCallbackTest(abilityContext) {
}
}
async function getLastObjectTest(done, testNum, fetchOps, isAudio) {
async function getLastObjectTest(done, testNum, fetchOp, isAudio) {
try {
let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOps);
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOps);
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
let expectCount = 4;
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount);
......@@ -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 {
let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOps);
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOps);
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
let expectCount = 4;
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount);
......@@ -145,11 +150,13 @@ export default function getFileAssetsCallbackTest(abilityContext) {
}
}
async function isAfterLastTest(done, testNum, fetchOps, isAudio) {
async function isAfterLastTest(done, testNum, fetchOp, isAudio) {
try {
let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOps);
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOps);
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
let expectCount = 4;
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount);
......@@ -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 {
let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOps);
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOps);
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
let expectCount = 4;
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount);
......@@ -190,8 +199,8 @@ export default function getFileAssetsCallbackTest(abilityContext) {
return;
}
expect(asset.displayName).assertEqual(props[type].displayName);
expect(asset.mediaType.toString()).assertEqual(props[type].mediaType);
expect(asset.uri != undefined).assertTrue();
expect(asset.fileType.toString()).assertEqual(props[type].fileType);
expect(asset.uri).assertEqual(props[type].uri);
fetchAssetResult.close();
done();
});
......
......@@ -49,24 +49,25 @@ export default function getFileAssetsPromiseTest(abilityContext) {
const props = {
image: {
displayName: '01.jpg',
mediaType: IMAGE_TYPE.toString(),
fileType: IMAGE_TYPE.toString(),
},
video: {
displayName: '01.mp4',
relativePath: 'Videos/Static/',
mediaType: VIDEO_TYPE.toString(),
fileType: VIDEO_TYPE.toString(),
},
audio: {
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 {
let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOps);
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOps);
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
let expectCount = 4;
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount);
......@@ -82,11 +83,13 @@ export default function getFileAssetsPromiseTest(abilityContext) {
}
}
async function getLastObjectTest(done, testNum, fetchOps, isAudio) {
async function getLastObjectTest(done, testNum, fetchOp, isAudio) {
try {
let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOps);
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOps);
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
let expectCount = 4;
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount);
......@@ -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 {
let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOps);
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOps);
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
let expectCount = 4;
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount);
......@@ -122,11 +127,13 @@ export default function getFileAssetsPromiseTest(abilityContext) {
}
}
async function isAfterLastTest(done, testNum, fetchOps, isAudio) {
async function isAfterLastTest(done, testNum, fetchOp, isAudio) {
try {
let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOps);
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOps);
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
let expectCount = 4;
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount);
......@@ -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 {
let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOps);
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOps);
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
let expectCount = 4;
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount);
......@@ -166,7 +175,8 @@ export default function getFileAssetsPromiseTest(abilityContext) {
return;
}
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();
done();
});
......
......@@ -38,7 +38,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) {
console.info('afterAll case');
});
const getetPublicDirectoryTest = async (done, testNum, dir, val) => {
const getPublicDirectoryTest = async (done, testNum, dir, val) => {
try {
userfilemgr.getPublicDirectory(dir, async (err, res) => {
if (err) {
......@@ -69,7 +69,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_01';
let dir = userfile_manager.DirectoryType.DIR_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) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_02';
let dir = userfile_manager.DirectoryType.DIR_VIDEO;
let val = 'Videos/';
await getetPublicDirectoryTest(done, testNum, dir, val)
await getPublicDirectoryTest(done, testNum, dir, val)
});
/**
......@@ -99,7 +99,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_03';
let dir = userfile_manager.DirectoryType.DIR_IMAGE;
let val = 'Pictures/';
await getetPublicDirectoryTest(done, testNum, dir, val)
await getPublicDirectoryTest(done, testNum, dir, val)
});
/**
......@@ -114,7 +114,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_04';
let dir = userfile_manager.DirectoryType.DIR_AUDIO;
let val = 'Audios/';
await getetPublicDirectoryTest(done, testNum, dir, val)
await getPublicDirectoryTest(done, testNum, dir, val)
});
/**
......@@ -129,7 +129,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_05';
let dir = userfile_manager.DirectoryType.DIR_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) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_06';
let dir = userfile_manager.DirectoryType.DIR_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) {
console.info('afterAll case');
});
const getetPublicDirectoryTest = async (done, testNum, dir, val) => {
const getPublicDirectoryTest = async (done, testNum, dir, val) => {
try {
let res = await userfilemgr.getPublicDirectory(dir);
expect(res).assertEqual(val);
......@@ -62,7 +62,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_01';
let dir = userfile_manager.DirectoryType.DIR_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) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_02';
let dir = userfile_manager.DirectoryType.DIR_VIDEO;
let val = 'Videos/';
await getetPublicDirectoryTest(done, testNum, dir, val)
await getPublicDirectoryTest(done, testNum, dir, val)
});
/**
......@@ -92,7 +92,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_03';
let dir = userfile_manager.DirectoryType.DIR_IMAGE;
let val = 'Pictures/';
await getetPublicDirectoryTest(done, testNum, dir, val)
await getPublicDirectoryTest(done, testNum, dir, val)
});
/**
......@@ -107,7 +107,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_04';
let dir = userfile_manager.DirectoryType.DIR_AUDIO;
let val = 'Audios/';
await getetPublicDirectoryTest(done, testNum, dir, val)
await getPublicDirectoryTest(done, testNum, dir, val)
});
/**
......@@ -122,7 +122,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_05';
let dir = userfile_manager.DirectoryType.DIR_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) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_06';
let dir = userfile_manager.DirectoryType.DIR_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) {
console.info('afterAll case');
});
const onTest = async (done, testNum, fetchOps, type, newName, isAudio) => {
const onTest = async (done, testNum, fetchOp, type, newName, isAudio) => {
try {
let count = 0;
userfilemgr.on(type, () => { count++; });
let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOps);
let fetchAssetResult;
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);
if (!checkAssetCountPass) return;
......@@ -66,15 +68,17 @@ export default function onOffReleasePromiseTest(abilityContext) {
done();
}
}
const offTest = async (done, testNum, fetchOps, type, newName, isAudio) => {
const offTest = async (done, testNum, fetchOp, type, newName, isAudio) => {
try {
let count = 0;
userfilemgr.on(type, () => {
count++;
});
let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOps);
let fetchAssetResult;
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);
if (!checkAssetCountPass) return;
......
......@@ -49,9 +49,11 @@ export default function fileAssetCommitModifyCallbackTest(abilityContext) {
const checkCommitModify = async function (done, testNum, fetchOp, prop, val, isAudio) {
try {
let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
if (!checkAssetCountPass) return;
......
......@@ -47,9 +47,11 @@ export default function fileAssetCommitModifyPromiseTest(abilityContext) {
const checkCommitModify = async function (done, testNum, fetchOp, prop, val, isAudio) {
try {
let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
if (!checkAssetCountPass) return;
......
......@@ -45,9 +45,11 @@ export default function fileAssetFavoriteCallbackTest(abilityContext) {
const favoriteDefaultState = async function (done, testNum, fetchOp, isAudio) {
try {
let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
if (!checkAssetCountPass) return;
......@@ -71,9 +73,11 @@ export default function fileAssetFavoriteCallbackTest(abilityContext) {
}
const favoriteByTrue = async function (done, testNum, fetchOp, isAudio) {
try {
let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
if (!checkAssetCountPass) return;
......@@ -101,9 +105,11 @@ export default function fileAssetFavoriteCallbackTest(abilityContext) {
}
const favoriteByFalse = async function (done, testNum, fetchOp, isAudio) {
try {
let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
if (!checkAssetCountPass) return;
......
......@@ -43,9 +43,11 @@ export default function fileAssetFavoritePromiseTest(abilityContext) {
const favoriteDefaultState = async function (done, testNum, fetchOp, isAudio) {
try {
let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
if (!checkAssetCountPass) return;
......@@ -62,9 +64,11 @@ export default function fileAssetFavoritePromiseTest(abilityContext) {
}
const favoriteByTrue = async function (done, testNum, fetchOp, isAudio) {
try {
let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
if (!checkAssetCountPass) return;
......@@ -82,9 +86,11 @@ export default function fileAssetFavoritePromiseTest(abilityContext) {
}
const favoriteByFalse = async function (done, testNum, fetchOp, isAudio) {
try {
let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
if (!checkAssetCountPass) return;
......
......@@ -43,11 +43,13 @@ export default function fileAssetGetThumbnailCallbackTest(abilityContext) {
console.info('afterAll case');
});
async function testGetThumbnail(done, testNum, dOp, size, isAudio) {
async function testGetThumbnail(done, testNum, fetchOp, size, isAudio) {
try {
let fetchAssetResult = await userfilemgr.getPhotoAssets(dOp);
let fetchAssetResult;
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);
if (!checkAssetCountPass) return;
......
......@@ -43,11 +43,13 @@ export default function fileAssetGetThumbnailPromiseTest(abilityContext) {
console.info('afterAll case');
});
async function testGetThumbnail(done, testNum, dOp, size, isAudio) {
async function testGetThumbnail(done, testNum, fetchOp, size, isAudio) {
try {
let fetchAssetResult = await userfilemgr.getPhotoAssets(dOp);
let fetchAssetResult;
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);
if (!checkAssetCountPass) return;
......
......@@ -43,9 +43,11 @@ export default function fileAssetIsDirectoryCallbackTest(abilityContext) {
const isDirectoryTest = async function (done, testNum, fetchOp, isAudio) {
try {
let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
const asset = await fetchAssetResult.getFirstObject();
fetchAssetResult.close();
......
......@@ -43,9 +43,11 @@ export default function fileAssetIsDirectoryPromiseTest(abilityContext) {
const isDirectoryTest = async function (done, testNum, fetchOp, isAudio) {
try {
let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
const asset = await fetchAssetResult.getFirstObject();
fetchAssetResult.close();
......
......@@ -47,9 +47,11 @@ export default function fileAssetOpenCallbackTest(abilityContext) {
let asset;
let fd;
try {
let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount);
if (!checkAssetCountPass) return;
......@@ -88,10 +90,11 @@ export default function fileAssetOpenCallbackTest(abilityContext) {
let asset, asset1;
let fd, fd1;
try {
let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount);
if (!checkAssetCountPass) return;
......@@ -134,9 +137,11 @@ export default function fileAssetOpenCallbackTest(abilityContext) {
let asset, asset1;
let fd, fd1;
try {
let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount);
if (!checkAssetCountPass) return;
......@@ -179,9 +184,11 @@ export default function fileAssetOpenCallbackTest(abilityContext) {
let asset;
let fd;
try {
let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
if (!checkAssetCountPass) return;
......
......@@ -51,9 +51,11 @@ export default function fileAssetOpenPromiseTest(abilityContext) {
let asset;
let fd;
try {
let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount);
if (!checkAssetCountPass) return;
......@@ -85,9 +87,11 @@ export default function fileAssetOpenPromiseTest(abilityContext) {
let asset, asset1;
let fd, fd1;
try {
let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount);
if (!checkAssetCountPass) return;
......@@ -126,9 +130,11 @@ export default function fileAssetOpenPromiseTest(abilityContext) {
let asset, asset1;
let fd, fd1;
try {
let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount);
if (!checkAssetCountPass) return;
......@@ -164,9 +170,11 @@ export default function fileAssetOpenPromiseTest(abilityContext) {
let asset;
let fd;
try {
let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
if (!checkAssetCountPass) return;
......
......@@ -43,9 +43,11 @@ export default function fileAssetTrashCallbackTest(abilityContext) {
const isTrashTest = async function (done, testNum, fetchOp, isAudio) {
try {
let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
if (!checkAssetCountPass) return;
......@@ -72,9 +74,11 @@ export default function fileAssetTrashCallbackTest(abilityContext) {
let expectAssetNum = 3
try {
// database info
let databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps);
let databaseFetchFileResult;
if (isAudio) {
databaseFetchFileResult = await userfilemgr.getAudioAssets(databasefFetchOps);
} else {
databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps);
}
let count = databaseFetchFileResult.getCount();
//album info
......@@ -109,9 +113,11 @@ export default function fileAssetTrashCallbackTest(abilityContext) {
expect(trashState).assertTrue();
try {
// after trash database info
databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps);
let databaseFetchFileResult;
if (isAudio) {
databaseFetchFileResult = await userfilemgr.getAudioAssets(databasefFetchOps);
} else {
databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps);
}
let databaseCount = databaseFetchFileResult.getCount();
databaseFetchFileResult.close();
......@@ -146,9 +152,11 @@ export default function fileAssetTrashCallbackTest(abilityContext) {
async function recovery(done, testNum, databasefFetchOps, ablumFetchOps, noAlbum, isAudio) {
let expectAssetNum = 3;
try {
let databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps);
let databaseFetchFileResult;
if (isAudio) {
databaseFetchFileResult = await userfilemgr.getAudioAssets(databasefFetchOps);
} else {
databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps);
}
let count = databaseFetchFileResult.getCount();
let asset = await databaseFetchFileResult.getFirstObject();
......@@ -169,9 +177,11 @@ export default function fileAssetTrashCallbackTest(abilityContext) {
}
expect(trashState).assertFalse();
try {
databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps);
let databaseFetchFileResult;
if (isAudio) {
databaseFetchFileResult = await userfilemgr.getAudioAssets(databasefFetchOps);
} else {
databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps);
}
let databaseCount = databaseFetchFileResult.getCount();
databaseFetchFileResult.close();
......
......@@ -43,9 +43,11 @@ export default function fileAssetTrashPromiseTest(abilityContext) {
const isTrashTest = async function (done, testNum, fetchOp, isAudio) {
try {
let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1);
if (!checkAssetCountPass) return;
......@@ -65,9 +67,11 @@ export default function fileAssetTrashPromiseTest(abilityContext) {
let expectAssetNum = 3
try {
// database info
let databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps);
let databaseFetchFileResult;
if (isAudio) {
databaseFetchFileResult = await userfilemgr.getAudioAssets(databasefFetchOps);
} else {
databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps);
}
let count = databaseFetchFileResult.getCount();
//album info
......@@ -89,6 +93,8 @@ export default function fileAssetTrashPromiseTest(abilityContext) {
databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps);
if (isAudio) {
databaseFetchFileResult = await userfilemgr.getAudioAssets(databasefFetchOps);
} else {
databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps);
}
let databaseCount = databaseFetchFileResult.getCount();
databaseFetchFileResult.close()
......@@ -115,17 +121,20 @@ export default function fileAssetTrashPromiseTest(abilityContext) {
async function recovery(done, testNum, databasefFetchOps, ablumFetchOps, noAlbum, isAudio) {
let expectAssetNum = 3;
try {
let databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps);
let databaseFetchFileResult;
if (isAudio) {
databaseFetchFileResult = await userfilemgr.getAudioAssets(databasefFetchOps);
} else {
databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps);
}
let count = databaseFetchFileResult.getCount();
let asset = await databaseFetchFileResult.getFirstObject();
await asset.trash(true);
await asset.trash(false);
databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps);
if (isAudio) {
databaseFetchFileResult = await userfilemgr.getAudioAssets(databasefFetchOps);
} else {
databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps);
}
let databaseCount = databaseFetchFileResult.getCount();
databaseFetchFileResult.close();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册