提交 88d7a482 编写于 作者: Y yangbo

update xts

Signed-off-by: Nyangbo <yangbo258@h-partners.com>
上级 a2b944fd
...@@ -13,10 +13,11 @@ ...@@ -13,10 +13,11 @@
* limitations under the License. * limitations under the License.
*/ */
import userfile_manager from '@ohos.filemanagement.userfile_manager'; import userFileManager from '@ohos.filemanagement.userFileManager';
import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
import bundle from '@ohos.bundle'; import bundle from '@ohos.bundle';
import dataSharePredicates from '@ohos.data.dataSharePredicates'; import dataSharePredicates from '@ohos.data.dataSharePredicates';
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
const presetsCount = { const presetsCount = {
ActsUserFileMgrAlbumJsTest: { albumsCount: 3, assetsCount: 3 }, ActsUserFileMgrAlbumJsTest: { albumsCount: 3, assetsCount: 3 },
...@@ -24,13 +25,14 @@ const presetsCount = { ...@@ -24,13 +25,14 @@ const presetsCount = {
ActsUserFileMgrFileAssetJsTest: { albumsCount: 45, assetsCount: 87 }, ActsUserFileMgrFileAssetJsTest: { albumsCount: 45, assetsCount: 87 },
} }
const IMAGE_TYPE = userfile_manager.MediaType.IMAGE; const IMAGE_TYPE = userFileManager.FileType.IMAGE;
const VIDEO_TYPE = userfile_manager.MediaType.VIDEO; const VIDEO_TYPE = userFileManager.FileType.VIDEO;
const AUDIO_TYPE = userfile_manager.MediaType.AUDIO; const AUDIO_TYPE = userFileManager.FileType.AUDIO;
const AUDIOKEY = userfile_manager.AudioKey; const AUDIOKEY = userFileManager.AudioKey;
const IMAGEVIDEOKEY = userfile_manager.ImageVideoKey; const IMAGEVIDEOKEY = userFileManager.ImageVideoKey;
const ALBUMKEY = userfile_manager.AlbumKey; const ALBUMKEY = userFileManager.AlbumKey;
const FILEKEY = mediaLibrary.FileKey;
const sleep = async function sleep(times) { const sleep = async function sleep(times) {
if (times == undefined) { if (times == undefined) {
times = 10 times = 10
...@@ -41,60 +43,65 @@ const sleep = async function sleep(times) { ...@@ -41,60 +43,65 @@ const sleep = async function sleep(times) {
const allFetchOp = function () { const allFetchOp = function () {
let predicates = new dataSharePredicates.DataSharePredicates(); let predicates = new dataSharePredicates.DataSharePredicates();
return { return {
fetchColumns: [],
predicates: predicates predicates: predicates
}; };
} }
const audioFetchOps = function (testNum, path) { const audioFetchOps = function (testNum, path) {
let predicates = new dataSharePredicates.DataSharePredicates(); let predicates = new dataSharePredicates.DataSharePredicates();
predicates.equalTo(AUDIOKEY.RELATIVE_PATH, path); predicates.equalTo(FILEKEY.RELATIVE_PATH, path);
let ops = { let ops = {
fetchColumns: [],
predicates: predicates predicates: predicates
}; };
console.info(`${testNum} queryOps: relative_path = ${path}`); console.info(`${testNum} queryOps: ${FILEKEY.RELATIVE_PATH} = ${path}`);
return ops return ops
} }
const imageVideoFetchOps = function (testNum, path) { const imageVideoFetchOps = function (testNum, path) {
let predicates = new dataSharePredicates.DataSharePredicates(); let predicates = new dataSharePredicates.DataSharePredicates();
predicates.equalTo(IMAGEVIDEOKEY.RELATIVE_PATH, path); predicates.equalTo(FILEKEY.RELATIVE_PATH, path);
let ops = { let ops = {
fetchColumns: [],
predicates: predicates predicates: predicates
}; };
console.info(`${testNum} queryOps: relative_path = ${path}`); console.info(`${testNum} queryOps: ${FILEKEY.RELATIVE_PATH} = ${path}`);
return ops return ops
} }
const audioNameFetchOps = function (testNum, path, displayName) { const audioNameFetchOps = function (testNum, path, displayName) {
let predicates = new dataSharePredicates.DataSharePredicates(); let predicates = new dataSharePredicates.DataSharePredicates();
predicates.equalTo(AUDIOKEY.RELATIVE_PATH, path) predicates.equalTo(FILEKEY.RELATIVE_PATH, path)
.equalTo(AUDIOKEY.DISPLAY_NAME, displayName); .equalTo(AUDIOKEY.DISPLAY_NAME, displayName);
let ops = { let ops = {
fetchColumns: [],
predicates: predicates predicates: predicates
}; };
console.info(`${testNum} queryOps: relative_path = ${path} AND display_name = ${displayName}`); console.info(`${testNum} queryOps: ${FILEKEY.RELATIVE_PATH} = ${path} AND display_name = ${displayName}`);
return ops return ops
} }
const imageVideoNameFetchOps = function (testNum, path, displayName) { const imageVideoNameFetchOps = function (testNum, path, displayName) {
let predicates = new dataSharePredicates.DataSharePredicates(); let predicates = new dataSharePredicates.DataSharePredicates();
predicates.equalTo(IMAGEVIDEOKEY.RELATIVE_PATH, path) predicates.equalTo(FILEKEY.RELATIVE_PATH, path)
.equalTo(IMAGEVIDEOKEY.DISPLAY_NAME, displayName); .equalTo(IMAGEVIDEOKEY.DISPLAY_NAME, displayName);
let ops = { let ops = {
fetchColumns: [],
predicates: predicates predicates: predicates
}; };
console.info(`${testNum} queryOps: relative_path = ${path} AND display_name = ${displayName}`); console.info(`${testNum} queryOps: ${FILEKEY.RELATIVE_PATH} = ${path} AND display_name = ${displayName}`);
return ops return ops
} }
const albumFetchOps = function (testNum, path, albumName) { const albumFetchOps = function (testNum, path, albumName) {
let predicates = new dataSharePredicates.DataSharePredicates(); let predicates = new dataSharePredicates.DataSharePredicates();
predicates.equalTo(ALBUMKEY.RELATIVE_PATH, path) predicates.equalTo(FILEKEY.RELATIVE_PATH, path)
.equalTo("bucket_display_name", albumName); .equalTo("bucket_display_name", albumName);
let ops = { let ops = {
predicates: predicates predicates: predicates
}; };
console.info(`${testNum} queryOps: relative_path = ${path} AND bucket_display_name = ${albumName}`); console.info(`${testNum} queryOps: ${FILEKEY.RELATIVE_PATH} = ${path} AND bucket_display_name = ${albumName}`);
return ops return ops
} }
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
"run-command": [ "run-command": [
"rm -rf /storage/media/100/local/files/*", "rm -rf /storage/media/100/local/files/*",
"rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*", "rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*",
"mkdir -pv /storage/media/100/local/files/{Pictures,Videos,Audios}", "mkdir -pv /storage/media/100/local/files/Pictures",
"mkdir -p /storage/media/100/local/temp" "mkdir -p /storage/media/100/local/temp"
] ]
}, },
...@@ -23,21 +23,15 @@ ...@@ -23,21 +23,15 @@
"pre-push": [ "pre-push": [
], ],
"push": [ "push": [
"./resource/medialibrary/01.jpg ->/storage/media/100/local/temp", "./resource/medialibrary/01.jpg ->/storage/media/100/local/temp"
"./resource/medialibrary/01.mp3 ->/storage/media/100/local/temp",
"./resource/medialibrary/01.mp4 ->/storage/media/100/local/temp"
] ]
}, },
{ {
"type": "ShellKit", "type": "ShellKit",
"run-command": [ "run-command": [
"mkdir -pv /storage/media/100/local/files/Pictures/{Static,DynamicCb,DynamicPro}", "mkdir -pv /storage/media/100/local/files/Pictures/{Static,DynamicCb,DynamicPro}",
"mkdir -pv /storage/media/100/local/files/Audios/{Static,DynamicCb,DynamicPro}",
"mkdir -pv /storage/media/100/local/files/Videos/{Static,DynamicCb,DynamicPro}",
"for d in Static DynamicCb DynamicPro; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;", "for d in Static DynamicCb DynamicPro; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;",
"for d in Static DynamicCb DynamicPro; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;",
"for d in Static DynamicCb DynamicPro; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;",
"chmod -R 777 /storage/media/100/local/files/*", "chmod -R 777 /storage/media/100/local/files/*",
"chmod -R 777 /data/service/el2/100/hmdfs/account/files/*", "chmod -R 777 /data/service/el2/100/hmdfs/account/files/*",
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import userfile_manager from '@ohos.filemanagement.userfile_manager'; import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import { import {
...@@ -27,7 +27,7 @@ import { ...@@ -27,7 +27,7 @@ import {
export default function albumCommitModifyCallback(abilityContext) { export default function albumCommitModifyCallback(abilityContext) {
describe('albumCommitModifyCallback', function () { describe('albumCommitModifyCallback', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext); const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () { beforeAll(async function () {
console.info('beforeAll case'); console.info('beforeAll case');
await getPermission(); await getPermission();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import userfile_manager from '@ohos.filemanagement.userfile_manager'; import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import { import {
...@@ -27,7 +27,7 @@ import { ...@@ -27,7 +27,7 @@ import {
export default function albumCommitModifyPromise(abilityContext) { export default function albumCommitModifyPromise(abilityContext) {
describe('albumCommitModifyPromise', function () { describe('albumCommitModifyPromise', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext); const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () { beforeAll(async function () {
console.info('beforeAll case'); console.info('beforeAll case');
await getPermission(); await getPermission();
......
...@@ -12,8 +12,9 @@ ...@@ -12,8 +12,9 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import userfile_manager from '@ohos.filemanagement.userfile_manager'; import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import dataSharePredicates from '@ohos.data.dataSharePredicates';
import { import {
sleep, sleep,
...@@ -25,7 +26,7 @@ import { ...@@ -25,7 +26,7 @@ import {
export default function albumGetFileAssetsCallback(abilityContext) { export default function albumGetFileAssetsCallback(abilityContext) {
describe('albumGetFileAssetsCallback', function () { describe('albumGetFileAssetsCallback', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext); const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () { beforeAll(async function () {
console.info('beforeAll case'); console.info('beforeAll case');
await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrAlbumJsTest'); await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrAlbumJsTest');
...@@ -41,7 +42,7 @@ export default function albumGetFileAssetsCallback(abilityContext) { ...@@ -41,7 +42,7 @@ export default function albumGetFileAssetsCallback(abilityContext) {
console.info('afterAll case'); console.info('afterAll case');
}); });
const checkAlbumAssetsCount = async function (done, testNum, fetchOp, expectAlbumCount = 1, expectAssetsCount = 1) { const getPhotoAssetsTest = async function (done, testNum, fetchOp, expectAlbumCount = 1, expectAssetsCount = 1) {
try { try {
const fetchAlbumResult = await userfilemgr.getPhotoAlbums(fetchOp); const fetchAlbumResult = await userfilemgr.getPhotoAlbums(fetchOp);
const albumCountPass = await checkAssetsCount(done, testNum, fetchAlbumResult, expectAlbumCount); const albumCountPass = await checkAssetsCount(done, testNum, fetchAlbumResult, expectAlbumCount);
...@@ -68,6 +69,37 @@ export default function albumGetFileAssetsCallback(abilityContext) { ...@@ -68,6 +69,37 @@ export default function albumGetFileAssetsCallback(abilityContext) {
} }
} }
const getPhotoAssetsErrCodeTest = async function (done, testNum, fetchOp, expectAlbumCount = 1, expectAssetsCount = 1) {
try {
const fetchAlbumResult = await userfilemgr.getPhotoAlbums(fetchOp);
const albumCountPass = await checkAssetsCount(done, testNum, fetchAlbumResult, expectAlbumCount);
if (!albumCountPass) return;
const album = await fetchAlbumResult.getFirstObject();
fetchAlbumResult.close();
let predicates = new dataSharePredicates.DataSharePredicates();
predicates.equalTo('222', '333');
let op = {
fetchColumns: ['111'],
predicates: predicates
};
album.getPhotoAssets(op, (error, fetchAssetResult) => {
if (error != undefined) {
console.info(`${testNum} getPhotoAssetsErrCodeTest error: ${error}`);
expect(false).assertTrue();
done();
return;
}
expect(false).assertTrue();
fetchAssetResult.close();
done();
});
} catch (error) {
console.info(`${testNum}, error: ${error}`);
expect(true).assertTrue();
done();
}
}
/** /**
* @tc.number : SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_CALLBACK_01 * @tc.number : SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_CALLBACK_01
* @tc.name : getPhotoAssets * @tc.name : getPhotoAssets
...@@ -79,7 +111,21 @@ export default function albumGetFileAssetsCallback(abilityContext) { ...@@ -79,7 +111,21 @@ export default function albumGetFileAssetsCallback(abilityContext) {
it('SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_CALLBACK_01', 0, async function (done) { it('SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_CALLBACK_01', 0, async function (done) {
const testNum = 'SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_CALLBACK_01'; const testNum = 'SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_CALLBACK_01';
let currentFetchOp = albumFetchOps(testNum, 'Pictures/', 'Static'); let currentFetchOp = albumFetchOps(testNum, 'Pictures/', 'Static');
await checkAlbumAssetsCount(done, testNum, currentFetchOp); await getPhotoAssetsTest(done, testNum, currentFetchOp);
});
/**
* @tc.number : SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_ERRCODE_CALLBACK_01
* @tc.name : getPhotoAssets
* @tc.desc : invalid AlbumFetchOptions
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_ERRCODE_CALLBACK_01', 0, async function (done) {
const testNum = 'SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_ERRCODE_CALLBACK_01';
let currentFetchOp = albumFetchOps(testNum, 'Pictures/', 'Static');
await getPhotoAssetsErrCodeTest(done, testNum, currentFetchOp);
}); });
}); });
} }
\ No newline at end of file
...@@ -14,8 +14,9 @@ ...@@ -14,8 +14,9 @@
*/ */
import userfile_manager from '@ohos.filemanagement.userfile_manager'; import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import dataSharePredicates from '@ohos.data.dataSharePredicates';
import { import {
sleep, sleep,
...@@ -27,7 +28,7 @@ import { ...@@ -27,7 +28,7 @@ import {
export default function albumGetFileAssetsPromise(abilityContext) { export default function albumGetFileAssetsPromise(abilityContext) {
describe('albumGetFileAssetsPromise', function () { describe('albumGetFileAssetsPromise', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext); const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () { beforeAll(async function () {
console.info('beforeAll case'); console.info('beforeAll case');
await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrAlbumJsTest'); await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrAlbumJsTest');
...@@ -43,14 +44,14 @@ export default function albumGetFileAssetsPromise(abilityContext) { ...@@ -43,14 +44,14 @@ export default function albumGetFileAssetsPromise(abilityContext) {
console.info('afterAll case'); console.info('afterAll case');
}); });
const checkAlbumAssetsCount = async function (done, testNum, fetchOp, expectAlbumCount = 1, expectAssetsCount = 1) { const getPhotoAssetsTest = async function (done, testNum, fetchOp, expectAlbumCount = 1, expectAssetsCount = 1) {
try { try {
const fetchAlbumResult = await userfilemgr.getPhotoAlbums(fetchOp); const fetchAlbumResult = await userfilemgr.getPhotoAlbums(fetchOp);
const albumCountPass = await checkAssetsCount(done, testNum, fetchAlbumResult, expectAlbumCount); const albumCountPass = await checkAssetsCount(done, testNum, fetchAlbumResult, expectAlbumCount);
if (!albumCountPass) return; if (!albumCountPass) return;
const album = await fetchAlbumResult.getFirstObject(); const album = await fetchAlbumResult.getFirstObject();
fetchAlbumResult.close(); fetchAlbumResult.close();
let op: userfile_manager.MediaFetchOptions = allFetchOp(); let op: userFileManager.FetchOptions = allFetchOp();
let fetchAssetResult = await album.getPhotoAssets(op); let fetchAssetResult = await album.getPhotoAssets(op);
if (fetchAssetResult == undefined) { if (fetchAssetResult == undefined) {
expect(false).assertTrue(); expect(false).assertTrue();
...@@ -68,6 +69,30 @@ export default function albumGetFileAssetsPromise(abilityContext) { ...@@ -68,6 +69,30 @@ export default function albumGetFileAssetsPromise(abilityContext) {
done(); done();
} }
} }
const getPhotoAssetsErrCodeTest = async function (done, testNum, fetchOp, expectAlbumCount = 1, expectAssetsCount = 1) {
try {
const fetchAlbumResult = await userfilemgr.getPhotoAlbums(fetchOp);
const albumCountPass = await checkAssetsCount(done, testNum, fetchAlbumResult, expectAlbumCount);
if (!albumCountPass) return;
const album = await fetchAlbumResult.getFirstObject();
fetchAlbumResult.close();
let predicates = new dataSharePredicates.DataSharePredicates();
predicates.equalTo('222', '333');
let op = {
fetchColumns: ['111'],
predicates: predicates
};
let fetchAssetResult = await album.getPhotoAssets(op);
expect(false).assertTrue();
fetchAssetResult.close();
done();
} catch (error) {
console.info(`${testNum}, error: ${error}`);
expect(true).assertTrue();
done();
}
}
/** /**
* @tc.number : SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_PROMISE_01 * @tc.number : SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_PROMISE_01
...@@ -80,7 +105,21 @@ export default function albumGetFileAssetsPromise(abilityContext) { ...@@ -80,7 +105,21 @@ export default function albumGetFileAssetsPromise(abilityContext) {
it('SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_PROMISE_01', 0, async function (done) { it('SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_PROMISE_01', 0, async function (done) {
const testNum = 'SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_PROMISE_01'; const testNum = 'SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_PROMISE_01';
let currentFetchOp = albumFetchOps(testNum, 'Pictures/', 'Static'); let currentFetchOp = albumFetchOps(testNum, 'Pictures/', 'Static');
await checkAlbumAssetsCount(done, testNum, currentFetchOp); await getPhotoAssetsTest(done, testNum, currentFetchOp);
});
/**
* @tc.number : SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_ERRCODE_PROMISE_01
* @tc.name : getPhotoAssets
* @tc.desc : invalid AlbumFetchOptions
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_ERRCODE_PROMISE_01', 0, async function (done) {
const testNum = 'SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_ERRCODE_PROMISE_01';
let currentFetchOp = albumFetchOps(testNum, 'Pictures/', 'Static');
await getPhotoAssetsTest(done, testNum, currentFetchOp);
}); });
}); });
} }
\ No newline at end of file
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
"run-command": [ "run-command": [
"rm -rf /storage/media/100/local/files/*", "rm -rf /storage/media/100/local/files/*",
"rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*", "rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*",
"mkdir -pv /storage/media/100/local/files/{Pictures,Videos,Audios,Documents}", "mkdir -pv /storage/media/100/local/files/{Pictures,Videos,Audios}",
"mkdir -p /storage/media/100/local/temp" "mkdir -p /storage/media/100/local/temp"
] ]
}, },
...@@ -25,26 +25,22 @@ ...@@ -25,26 +25,22 @@
"push": [ "push": [
"./resource/medialibrary/01.jpg ->/storage/media/100/local/temp", "./resource/medialibrary/01.jpg ->/storage/media/100/local/temp",
"./resource/medialibrary/01.mp3 ->/storage/media/100/local/temp", "./resource/medialibrary/01.mp3 ->/storage/media/100/local/temp",
"./resource/medialibrary/01.mp4 ->/storage/media/100/local/temp", "./resource/medialibrary/01.mp4 ->/storage/media/100/local/temp"
"./resource/medialibrary/01.dat ->/storage/media/100/local/temp"
] ]
}, },
{ {
"type": "ShellKit", "type": "ShellKit",
"run-command": [ "run-command": [
"mkdir -pv /storage/media/100/local/files/Pictures/{Static,On,Off}", "mkdir -pv /storage/media/100/local/files/Pictures/{Static,On,Off,myAlbum}",
"mkdir -pv /storage/media/100/local/files/Videos/{Static,On,Off}", "mkdir -pv /storage/media/100/local/files/Videos/{Static,On,Off,myAlbum}",
"mkdir -pv /storage/media/100/local/files/Audios/{Static,On,Off}", "mkdir -pv /storage/media/100/local/files/Audios/{Static,On,Off,myAlbum}",
"mkdir -pv /storage/media/100/local/files/Documents/{Static,On,Off}",
"for d in Static; do for i in $$(seq 4); do cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;", "for d in Static; do for i in $$(seq 4); do cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;",
"for d in Static; do for i in $$(seq 4); do cp /storage/media/100/local/temp/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;", "for d in Static; do for i in $$(seq 4); do cp /storage/media/100/local/temp/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;",
"for d in Static; do for i in $$(seq 4); do cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;", "for d in Static; do for i in $$(seq 4); do cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;",
"for d in Static; do for i in $$(seq 4); do cp /storage/media/100/local/temp/01.dat /storage/media/100/local/files/Documents/$$d/0$$i.dat; done;done;", "for d in On Off myAlbum; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;",
"for d in On Off; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;", "for d in On Off myAlbum; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;",
"for d in On Off; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;", "for d in On Off myAlbum; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;",
"for d in On Off; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;",
"for d in On Off; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.dat /storage/media/100/local/files/Documents/$$d/0$$i.dat; done;done;",
"chmod -R 777 /storage/media/100/local/files/*", "chmod -R 777 /storage/media/100/local/files/*",
"chmod -R 777 /data/service/el2/100/hmdfs/account/files/*", "chmod -R 777 /data/service/el2/100/hmdfs/account/files/*",
......
...@@ -17,8 +17,8 @@ import getAlbumsCallbackTest from './getAlbumsCallback.test.ets' ...@@ -17,8 +17,8 @@ import getAlbumsCallbackTest from './getAlbumsCallback.test.ets'
import getAlbumsPromiseTest from './getAlbumsPromise.test.ets' import getAlbumsPromiseTest from './getAlbumsPromise.test.ets'
import getFileAssetsCallbackTest from './getFileAssetsCallback.test.ets' import getFileAssetsCallbackTest from './getFileAssetsCallback.test.ets'
import getFileAssetsPromiseTest from './getFileAssetsPromise.test.ets' import getFileAssetsPromiseTest from './getFileAssetsPromise.test.ets'
import getPublicDirectoryCallbackTest from './getPublicDirectoryCallback.test.ets' //import getPublicDirectoryCallbackTest from './getPublicDirectoryCallback.test.ets'
import getPublicDirectoryPromiseTest from './getPublicDirectoryPromise.test.ets' //import getPublicDirectoryPromiseTest from './getPublicDirectoryPromise.test.ets'
import getUserFileMgrTest from './getUserFileMgr.test.ets' import getUserFileMgrTest from './getUserFileMgr.test.ets'
import onOffReleasePromiseTest from './onOffReleasePromise.test.ets' import onOffReleasePromiseTest from './onOffReleasePromise.test.ets'
export default function testsuite(abilityContext) { export default function testsuite(abilityContext) {
...@@ -26,8 +26,8 @@ export default function testsuite(abilityContext) { ...@@ -26,8 +26,8 @@ export default function testsuite(abilityContext) {
getAlbumsPromiseTest(abilityContext) getAlbumsPromiseTest(abilityContext)
getFileAssetsCallbackTest(abilityContext) getFileAssetsCallbackTest(abilityContext)
getFileAssetsPromiseTest(abilityContext) getFileAssetsPromiseTest(abilityContext)
getPublicDirectoryCallbackTest(abilityContext) //getPublicDirectoryCallbackTest(abilityContext)
getPublicDirectoryPromiseTest(abilityContext) //getPublicDirectoryPromiseTest(abilityContext)
getUserFileMgrTest(abilityContext) getUserFileMgrTest(abilityContext)
onOffReleasePromiseTest(abilityContext) onOffReleasePromiseTest(abilityContext)
} }
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import userfile_manager from '@ohos.filemanagement.userfile_manager'; import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import { import {
...@@ -28,7 +28,7 @@ import { ...@@ -28,7 +28,7 @@ import {
export default function getAlbumsCallbackTest(abilityContext) { export default function getAlbumsCallbackTest(abilityContext) {
describe('getAlbumsCallbackTest', function () { describe('getAlbumsCallbackTest', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext); const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () { beforeAll(async function () {
console.info('beforeAll case'); console.info('beforeAll case');
await getPermission(); await getPermission();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import userfile_manager from '@ohos.filemanagement.userfile_manager'; import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import { import {
...@@ -25,7 +25,7 @@ import { ...@@ -25,7 +25,7 @@ import {
export default function getAlbumsPromiseTest(abilityContext) { export default function getAlbumsPromiseTest(abilityContext) {
describe('getAlbumsPromiseTest', function () { describe('getAlbumsPromiseTest', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext); const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () { beforeAll(async function () {
console.info('beforeAll case'); console.info('beforeAll case');
await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrAlbumJsTest'); await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrAlbumJsTest');
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import userfile_manager from '@ohos.filemanagement.userfile_manager'; import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import { import {
sleep, sleep,
...@@ -29,7 +29,7 @@ import { ...@@ -29,7 +29,7 @@ import {
export default function getFileAssetsCallbackTest(abilityContext) { export default function getFileAssetsCallbackTest(abilityContext) {
describe('getFileAssetsCallbackTest', function () { describe('getFileAssetsCallbackTest', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext); const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () { beforeAll(async function () {
console.info('beforeAll case'); console.info('beforeAll case');
await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrBaseJsTest'); await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrBaseJsTest');
...@@ -150,6 +150,36 @@ export default function getFileAssetsCallbackTest(abilityContext) { ...@@ -150,6 +150,36 @@ export default function getFileAssetsCallbackTest(abilityContext) {
} }
} }
async function getPositionObjectErrCodeTest(done, testNum, fetchOp, pos, isAudio) {
try {
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
let expectCount = 4;
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount);
if (!checkAssetCountPass) return;
fetchAssetResult.getPositionObject(pos, async (err, asset) => {
if (err) {
console.info(`${testNum} err : ${err}`)
expect.assertFail();
fetchAssetResult.close();
done();
return;
}
expect(false).assertTrue();
fetchAssetResult.close();
done();
});
} catch (error) {
console.info(`${testNum}:: error :${error}`);
expect(true).assertTrue();
done();
}
}
async function isAfterLastTest(done, testNum, fetchOp, isAudio) { async function isAfterLastTest(done, testNum, fetchOp, isAudio) {
try { try {
let fetchAssetResult; let fetchAssetResult;
...@@ -200,7 +230,7 @@ export default function getFileAssetsCallbackTest(abilityContext) { ...@@ -200,7 +230,7 @@ export default function getFileAssetsCallbackTest(abilityContext) {
} }
expect(asset.displayName).assertEqual(props[type].displayName); expect(asset.displayName).assertEqual(props[type].displayName);
expect(asset.fileType.toString()).assertEqual(props[type].fileType); expect(asset.fileType.toString()).assertEqual(props[type].fileType);
expect(asset.uri).assertEqual(props[type].uri); expect(asset.uri != undefined).assertTrue();
fetchAssetResult.close(); fetchAssetResult.close();
done(); done();
}); });
...@@ -211,6 +241,38 @@ export default function getFileAssetsCallbackTest(abilityContext) { ...@@ -211,6 +241,38 @@ export default function getFileAssetsCallbackTest(abilityContext) {
} }
} }
async function getFileAssetsErrCodeTest(done, testNum, fetchOp, isAudio) {
try {
if (isAudio) {
await userfilemgr.getAudioAssets(fetchOp, (err, fetchAssetResult) => {
if (err != undefined) {
console.info(`${testNum}:: getAudioAssets error :${err}`);
expect(false).assertTrue();
done();
return;
}
expect(false).assertTrue();
done();
})
} else {
await userfilemgr.getPhotoAssets(fetchOp, (err, fetchAssetResult) => {
if (err != undefined) {
console.info(`${testNum}:: getAudioAssets error :${err}`);
expect(false).assertTrue();
done();
return;
}
expect(false).assertTrue();
done();
})
}
} catch (error) {
console.info(`${testNum}:: error :${error}`);
expect(true).assertTrue();
done();
}
}
/** /**
* @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_01_001 * @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_01_001
* @tc.name : getFirstObject * @tc.name : getFirstObject
...@@ -355,6 +417,40 @@ export default function getFileAssetsCallbackTest(abilityContext) { ...@@ -355,6 +417,40 @@ export default function getFileAssetsCallbackTest(abilityContext) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/**
* @tc.number : SUB_USERFILE_MGR_GETPOSITIONOBJECT_ERRCODE_CALLBACK_01
* @tc.name : getPositionObject
* @tc.desc : pos is not number
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETPOSITIONOBJECT_ERRCODE_CALLBACK_01', 0, async function (done) {
let testNum = 'SUB_USERFILE_MGR_GETPOSITIONOBJECT_ERRCODE_CALLBACK_01';
let currentFetchOps = imageVideoFetchOps(testNum, 'Pictures/Static/');
let pos = 'aaa';
let isAudio = false;
await getPositionObjectErrCodeTest(done, testNum, currentFetchOps, pos, isAudio);
});
/**
* @tc.number : SUB_USERFILE_MGR_GETPOSITIONOBJECT_ERRCODE_CALLBACK_02
* @tc.name : getPositionObject
* @tc.desc : pos is not number
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETPOSITIONOBJECT_ERRCODE_CALLBACK_02', 0, async function (done) {
let testNum = 'SUB_USERFILE_MGR_GETPOSITIONOBJECT_ERRCODE_CALLBACK_02';
let currentFetchOps = imageVideoFetchOps(testNum, 'Audios/Static/');
let pos = 'aaa';
let isAudio = true;
await getPositionObjectErrCodeTest(done, testNum, currentFetchOps, pos, isAudio);
});
//-----------------------------------------------------------------------------------
/** /**
* @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_04_001 * @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_04_001
* @tc.name : isAfterLast * @tc.name : isAfterLast
...@@ -449,6 +545,38 @@ export default function getFileAssetsCallbackTest(abilityContext) { ...@@ -449,6 +545,38 @@ export default function getFileAssetsCallbackTest(abilityContext) {
let isAudio = false; let isAudio = false;
await checkFileAssetAttr(done, testNum, currentFetchOps, type, isAudio); await checkFileAssetAttr(done, testNum, currentFetchOps, type, isAudio);
}); });
//------------------------------------------------------------------------------
/**
* @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_CALLBACK_01
* @tc.name : getPhotoAssets
* @tc.desc : invalid FetchOptions
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_CALLBACK_01', 0, async function (done) {
let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_CALLBACK_01';
let currentFetchOps = imageVideoFetchOps(testNum, 'aaa/');
let isAudio = false;
await getFileAssetsErrCodeTest(done, testNum, currentFetchOps, isAudio);
});
/**
* @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_CALLBACK_02
* @tc.name : getPhotoAssets
* @tc.desc : invalid FetchOptions
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_CALLBACK_02', 0, async function (done) {
let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_CALLBACK_02';
let currentFetchOps = audioFetchOps(testNum, 'aaa/');
let isAudio = true;
await getFileAssetsErrCodeTest(done, testNum, currentFetchOps, isAudio);
});
}); });
} }
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import userfile_manager from '@ohos.filemanagement.userfile_manager'; import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import { import {
sleep, sleep,
...@@ -30,7 +30,7 @@ import { ...@@ -30,7 +30,7 @@ import {
export default function getFileAssetsPromiseTest(abilityContext) { export default function getFileAssetsPromiseTest(abilityContext) {
describe('getFileAssetsPromiseTest', function () { describe('getFileAssetsPromiseTest', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext); const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () { beforeAll(async function () {
console.info('beforeAll case'); console.info('beforeAll case');
await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrBaseJsTest'); await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrBaseJsTest');
...@@ -127,6 +127,28 @@ export default function getFileAssetsPromiseTest(abilityContext) { ...@@ -127,6 +127,28 @@ export default function getFileAssetsPromiseTest(abilityContext) {
} }
} }
async function getPositionObjectErrCodeTest(done, testNum, fetchOp, pos, isAudio) {
try {
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
let expectCount = 4;
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount);
if (!checkAssetCountPass) return;
await fetchAssetResult.getPositionObject(pos);
expect(false).assertTrue();
fetchAssetResult.close();
done();
} catch (error) {
console.info(`${testNum}:: error :${error}`);
expect(true).assertTrue();
done();
}
}
async function isAfterLastTest(done, testNum, fetchOp, isAudio) { async function isAfterLastTest(done, testNum, fetchOp, isAudio) {
try { try {
let fetchAssetResult; let fetchAssetResult;
...@@ -187,6 +209,22 @@ export default function getFileAssetsPromiseTest(abilityContext) { ...@@ -187,6 +209,22 @@ export default function getFileAssetsPromiseTest(abilityContext) {
} }
} }
async function getFileAssetsErrCodeTest(done, testNum, fetchOp, isAudio) {
try {
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
expect(false).assertTrue();
} catch (error) {
console.info(`${testNum}:: error :${error}`);
expect(true).assertTrue();
done();
}
}
/** /**
* @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_01_001 * @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_01_001
* @tc.name : getFirstObject * @tc.name : getFirstObject
...@@ -331,6 +369,40 @@ export default function getFileAssetsPromiseTest(abilityContext) { ...@@ -331,6 +369,40 @@ export default function getFileAssetsPromiseTest(abilityContext) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/**
* @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_PROMISE_01
* @tc.name : getPositionObject
* @tc.desc : pos is not number
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_PROMISE_01', 0, async function (done) {
let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_PROMISE_01';
let currentFetchOps = imageVideoFetchOps(testNum, 'Pictures/Static/');
let pos = 'aaa';
let isAudio = false;
await getPositionObjectTest(done, testNum, currentFetchOps, pos, isAudio);
});
/**
* @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_PROMISE_02
* @tc.name : getPositionObject
* @tc.desc : pos is not number
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_PROMISE_02', 0, async function (done) {
let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_PROMISE_02';
let currentFetchOps = imageVideoFetchOps(testNum, 'Audios/Static/');
let pos = 'aaa';
let isAudio = true;
await getPositionObjectTest(done, testNum, currentFetchOps, pos, isAudio);
});
//---------------------------------------------------------------------------------
/** /**
* @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_04_001 * @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_04_001
* @tc.name : isAfterLast * @tc.name : isAfterLast
...@@ -425,6 +497,38 @@ export default function getFileAssetsPromiseTest(abilityContext) { ...@@ -425,6 +497,38 @@ export default function getFileAssetsPromiseTest(abilityContext) {
let isAudio = false; let isAudio = false;
await checkFileAssetAttr(done, testNum, currentFetchOps, type, isAudio); await checkFileAssetAttr(done, testNum, currentFetchOps, type, isAudio);
}); });
//------------------------------------------------------------------------------
/**
* @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_PROMISE_01
* @tc.name : getPhotoAssets
* @tc.desc : invalid FetchOptions
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_PROMISE_01', 0, async function (done) {
let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_PROMISE_01';
let currentFetchOps = imageVideoFetchOps(testNum, 'aaa/');
let isAudio = false;
await getFileAssetsErrCodeTest(done, testNum, currentFetchOps, isAudio);
});
/**
* @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_PROMISE_02
* @tc.name : getPhotoAssets
* @tc.desc : invalid FetchOptions
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_PROMISE_02', 0, async function (done) {
let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_PROMISE_02';
let currentFetchOps = audioFetchOps(testNum, 'aaa/');
let isAudio = true;
await getFileAssetsErrCodeTest(done, testNum, currentFetchOps, isAudio);
});
}); });
} }
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import userfile_manager from '@ohos.filemanagement.userfile_manager'; import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import { import {
...@@ -23,7 +23,7 @@ import { ...@@ -23,7 +23,7 @@ import {
export default function getPublicDirectoryCallbackTest(abilityContext) { export default function getPublicDirectoryCallbackTest(abilityContext) {
describe('getPublicDirectoryCallbackTest', function () { describe('getPublicDirectoryCallbackTest', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext); const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () { beforeAll(async function () {
console.info('beforeAll case'); console.info('beforeAll case');
}); });
...@@ -67,7 +67,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) { ...@@ -67,7 +67,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) {
*/ */
it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_01', 0, async function (done) { it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_01', 0, async function (done) {
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 = userFileManager.DirectoryType.DIR_CAMERA;
let val = 'Camera/'; let val = 'Camera/';
await getPublicDirectoryTest(done, testNum, dir, val) await getPublicDirectoryTest(done, testNum, dir, val)
}); });
...@@ -82,7 +82,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) { ...@@ -82,7 +82,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) {
*/ */
it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_02', 0, async function (done) { it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_02', 0, async function (done) {
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 = userFileManager.DirectoryType.DIR_VIDEO;
let val = 'Videos/'; let val = 'Videos/';
await getPublicDirectoryTest(done, testNum, dir, val) await getPublicDirectoryTest(done, testNum, dir, val)
}); });
...@@ -97,7 +97,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) { ...@@ -97,7 +97,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) {
*/ */
it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_03', 0, async function (done) { it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_03', 0, async function (done) {
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 = userFileManager.DirectoryType.DIR_IMAGE;
let val = 'Pictures/'; let val = 'Pictures/';
await getPublicDirectoryTest(done, testNum, dir, val) await getPublicDirectoryTest(done, testNum, dir, val)
}); });
...@@ -112,7 +112,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) { ...@@ -112,7 +112,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) {
*/ */
it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_04', 0, async function (done) { it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_04', 0, async function (done) {
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 = userFileManager.DirectoryType.DIR_AUDIO;
let val = 'Audios/'; let val = 'Audios/';
await getPublicDirectoryTest(done, testNum, dir, val) await getPublicDirectoryTest(done, testNum, dir, val)
}); });
...@@ -127,7 +127,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) { ...@@ -127,7 +127,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) {
*/ */
it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_05', 0, async function (done) { it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_05', 0, async function (done) {
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 = userFileManager.DirectoryType.DIR_DOCUMENTS;
let val = 'Documents/'; let val = 'Documents/';
await getPublicDirectoryTest(done, testNum, dir, val) await getPublicDirectoryTest(done, testNum, dir, val)
}); });
...@@ -142,7 +142,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) { ...@@ -142,7 +142,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) {
*/ */
it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_06', 0, async function (done) { it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_06', 0, async function (done) {
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 = userFileManager.DirectoryType.DIR_DOWNLOAD;
let val = 'Download/'; let val = 'Download/';
await getPublicDirectoryTest(done, testNum, dir, val) await getPublicDirectoryTest(done, testNum, dir, val)
}); });
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import userfile_manager from '@ohos.filemanagement.userfile_manager'; import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import { import {
...@@ -23,7 +23,7 @@ import { ...@@ -23,7 +23,7 @@ import {
export default function getPublicDirectoryPromiseTest(abilityContext) { export default function getPublicDirectoryPromiseTest(abilityContext) {
describe('getPublicDirectoryPromiseTest', function () { describe('getPublicDirectoryPromiseTest', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext); const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () { beforeAll(async function () {
console.info('beforeAll case'); console.info('beforeAll case');
}); });
...@@ -60,7 +60,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) { ...@@ -60,7 +60,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) {
*/ */
it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_01', 0, async function (done) { it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_01', 0, async function (done) {
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 = userFileManager.DirectoryType.DIR_CAMERA;
let val = 'Camera/'; let val = 'Camera/';
await getPublicDirectoryTest(done, testNum, dir, val) await getPublicDirectoryTest(done, testNum, dir, val)
}); });
...@@ -75,7 +75,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) { ...@@ -75,7 +75,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) {
*/ */
it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_02', 0, async function (done) { it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_02', 0, async function (done) {
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 = userFileManager.DirectoryType.DIR_VIDEO;
let val = 'Videos/'; let val = 'Videos/';
await getPublicDirectoryTest(done, testNum, dir, val) await getPublicDirectoryTest(done, testNum, dir, val)
}); });
...@@ -90,7 +90,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) { ...@@ -90,7 +90,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) {
*/ */
it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_03', 0, async function (done) { it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_03', 0, async function (done) {
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 = userFileManager.DirectoryType.DIR_IMAGE;
let val = 'Pictures/'; let val = 'Pictures/';
await getPublicDirectoryTest(done, testNum, dir, val) await getPublicDirectoryTest(done, testNum, dir, val)
}); });
...@@ -105,7 +105,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) { ...@@ -105,7 +105,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) {
*/ */
it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_04', 0, async function (done) { it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_04', 0, async function (done) {
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 = userFileManager.DirectoryType.DIR_AUDIO;
let val = 'Audios/'; let val = 'Audios/';
await getPublicDirectoryTest(done, testNum, dir, val) await getPublicDirectoryTest(done, testNum, dir, val)
}); });
...@@ -120,7 +120,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) { ...@@ -120,7 +120,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) {
*/ */
it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_05', 0, async function (done) { it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_05', 0, async function (done) {
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 = userFileManager.DirectoryType.DIR_DOCUMENTS;
let val = 'Documents/'; let val = 'Documents/';
await getPublicDirectoryTest(done, testNum, dir, val) await getPublicDirectoryTest(done, testNum, dir, val)
}); });
...@@ -135,7 +135,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) { ...@@ -135,7 +135,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) {
*/ */
it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_06', 0, async function (done) { it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_06', 0, async function (done) {
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 = userFileManager.DirectoryType.DIR_DOWNLOAD;
let val = 'Download/'; let val = 'Download/';
await getPublicDirectoryTest(done, testNum, dir, val) await getPublicDirectoryTest(done, testNum, dir, val)
}); });
......
...@@ -13,13 +13,13 @@ ...@@ -13,13 +13,13 @@
* limitations under the License. * limitations under the License.
*/ */
import userfile_manager from '@ohos.filemanagement.userfile_manager'; import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import { sleep } from '../../../../../../common'; import { sleep } from '../../../../../../common';
export default function getUserFileMgrTest(abilityContext) { export default function getUserFileMgrTest(abilityContext) {
describe('getUserFileMgrTest', function () { describe('getUserFileMgrTest', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext); const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () { beforeAll(async function () {
console.info('beforeAll case'); console.info('beforeAll case');
}); });
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import userfile_manager from '@ohos.filemanagement.userfile_manager'; import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import { import {
...@@ -27,7 +27,7 @@ import { ...@@ -27,7 +27,7 @@ import {
export default function onOffReleasePromiseTest(abilityContext) { export default function onOffReleasePromiseTest(abilityContext) {
describe('onOffReleasePromiseTest', function () { describe('onOffReleasePromiseTest', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext); const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () { beforeAll(async function () {
console.info('beforeAll case'); console.info('beforeAll case');
await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrAlbumJsTest'); await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrAlbumJsTest');
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
"run-command": [ "run-command": [
"rm -rf /storage/media/100/local/files/*", "rm -rf /storage/media/100/local/files/*",
"rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*", "rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*",
"mkdir -pv /storage/media/100/local/files/{Pictures,Videos,Audios,Documents}", "mkdir -pv /storage/media/100/local/files/{Pictures,Videos,Audios}",
"mkdir -p /storage/media/100/local/temp" "mkdir -p /storage/media/100/local/temp"
] ]
}, },
...@@ -25,8 +25,7 @@ ...@@ -25,8 +25,7 @@
"push": [ "push": [
"./resource/medialibrary/01.jpg ->/storage/media/100/local/temp", "./resource/medialibrary/01.jpg ->/storage/media/100/local/temp",
"./resource/medialibrary/01.mp3 ->/storage/media/100/local/temp", "./resource/medialibrary/01.mp3 ->/storage/media/100/local/temp",
"./resource/medialibrary/01.mp4 ->/storage/media/100/local/temp", "./resource/medialibrary/01.mp4 ->/storage/media/100/local/temp"
"./resource/medialibrary/01.dat ->/storage/media/100/local/temp"
] ]
}, },
{ {
...@@ -35,22 +34,18 @@ ...@@ -35,22 +34,18 @@
"mkdir -pv /storage/media/100/local/files/Pictures/{ModifyCb,ModifyPro,FavCb,FavPro,Thumbnail,Static,R_Cb,W_Cb,RW_Cb,R_Pro,W_Pro,RW_Pro,openClose,trashCb,trashPro}", "mkdir -pv /storage/media/100/local/files/Pictures/{ModifyCb,ModifyPro,FavCb,FavPro,Thumbnail,Static,R_Cb,W_Cb,RW_Cb,R_Pro,W_Pro,RW_Pro,openClose,trashCb,trashPro}",
"mkdir -pv /storage/media/100/local/files/Videos/{ModifyCb,ModifyPro,FavCb,FavPro,Thumbnail,Static,R_Cb,W_Cb,RW_Cb,R_Pro,W_Pro,RW_Pro,openClose,trashCb,trashPro}", "mkdir -pv /storage/media/100/local/files/Videos/{ModifyCb,ModifyPro,FavCb,FavPro,Thumbnail,Static,R_Cb,W_Cb,RW_Cb,R_Pro,W_Pro,RW_Pro,openClose,trashCb,trashPro}",
"mkdir -pv /storage/media/100/local/files/Audios/{ModifyCb,ModifyPro,FavCb,FavPro,Thumbnail,Static,R_Cb,W_Cb,RW_Cb,R_Pro,W_Pro,RW_Pro,openClose,trashCb,trashPro}", "mkdir -pv /storage/media/100/local/files/Audios/{ModifyCb,ModifyPro,FavCb,FavPro,Thumbnail,Static,R_Cb,W_Cb,RW_Cb,R_Pro,W_Pro,RW_Pro,openClose,trashCb,trashPro}",
"mkdir -pv /storage/media/100/local/files/Documents/{ModifyCb,ModifyPro,FavCb,FavPro,Thumbnail,Static,R_Cb,W_Cb,RW_Cb,R_Pro,W_Pro,RW_Pro,openClose,trashCb,trashPro}",
"for d in FavCb FavPro trashCb trashPro; do for i in $$(seq 3); do cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;", "for d in FavCb FavPro trashCb trashPro; do for i in $$(seq 3); do cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;",
"for d in FavCb FavPro trashCb trashPro; do for i in $$(seq 3); do cp /storage/media/100/local/temp/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;", "for d in FavCb FavPro trashCb trashPro; do for i in $$(seq 3); do cp /storage/media/100/local/temp/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;",
"for d in FavCb FavPro trashCb trashPro; do for i in $$(seq 3); do cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;", "for d in FavCb FavPro trashCb trashPro; do for i in $$(seq 3); do cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;",
"for d in FavCb FavPro trashCb trashPro; do for i in $$(seq 3); do cp /storage/media/100/local/temp/01.dat /storage/media/100/local/files/Documents/$$d/0$$i.dat; done;done;",
"for d in Thumbnail openClose W_Cb RW_Cb W_Pro RW_Pro; do for i in $$(seq 2); do cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;", "for d in Thumbnail openClose W_Cb RW_Cb W_Pro RW_Pro; do for i in $$(seq 2); do cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;",
"for d in Thumbnail openClose W_Cb RW_Cb W_Pro RW_Pro; do for i in $$(seq 2); do cp /storage/media/100/local/temp/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;", "for d in Thumbnail openClose W_Cb RW_Cb W_Pro RW_Pro; do for i in $$(seq 2); do cp /storage/media/100/local/temp/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;",
"for d in Thumbnail openClose W_Cb RW_Cb W_Pro RW_Pro; do for i in $$(seq 2); do cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;", "for d in Thumbnail openClose W_Cb RW_Cb W_Pro RW_Pro; do for i in $$(seq 2); do cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;",
"for d in Thumbnail openClose W_Cb RW_Cb W_Pro RW_Pro; do for i in $$(seq 2); do cp /storage/media/100/local/temp/01.dat /storage/media/100/local/files/Documents/$$d/0$$i.dat; done;done;",
"for d in ModifyCb ModifyPro Static R_Cb R_Pro; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;", "for d in ModifyCb ModifyPro Static R_Cb R_Pro; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;",
"for d in ModifyCb ModifyPro Static R_Cb R_Pro; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;", "for d in ModifyCb ModifyPro Static R_Cb R_Pro; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;",
"for d in ModifyCb ModifyPro Static R_Cb R_Pro; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;", "for d in ModifyCb ModifyPro Static R_Cb R_Pro; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;",
"for d in ModifyCb ModifyPro Static R_Cb R_Pro; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.dat /storage/media/100/local/files/Documents/$$d/0$$i.dat; done;done;",
"chmod -R 777 /storage/media/100/local/files/*", "chmod -R 777 /storage/media/100/local/files/*",
"chmod -R 777 /data/service/el2/100/hmdfs/account/files/*", "chmod -R 777 /data/service/el2/100/hmdfs/account/files/*",
......
...@@ -17,10 +17,11 @@ import fileAssetCommitModifyCallbackTest from './fileAssetCommitModifyCallback.t ...@@ -17,10 +17,11 @@ import fileAssetCommitModifyCallbackTest from './fileAssetCommitModifyCallback.t
import fileAssetCommitModifyPromiseTest from './fileAssetCommitModifyPromise.test.ets' import fileAssetCommitModifyPromiseTest from './fileAssetCommitModifyPromise.test.ets'
import fileAssetFavoriteCallbackTest from './fileAssetFavoriteCallback.test.ets' import fileAssetFavoriteCallbackTest from './fileAssetFavoriteCallback.test.ets'
import fileAssetFavoritePromiseTest from './fileAssetFavoritePromise.test.ets' import fileAssetFavoritePromiseTest from './fileAssetFavoritePromise.test.ets'
import fileAssetFileKeyTest from './fileAssetFileKey.test.ets'
import fileAssetGetThumbnailCallbackTest from './fileAssetGetThumbnailCallback.test.ets' import fileAssetGetThumbnailCallbackTest from './fileAssetGetThumbnailCallback.test.ets'
import fileAssetGetThumbnailPromiseTest from './fileAssetGetThumbnailPromise.test.ets' import fileAssetGetThumbnailPromiseTest from './fileAssetGetThumbnailPromise.test.ets'
import fileAssetIsDirectoryCallbackTest from './fileAssetIsDirectoryCallback.test.ets' //import fileAssetIsDirectoryCallbackTest from './fileAssetIsDirectoryCallback.test.ets'
import fileAssetIsDirectoryPromiseTest from './fileAssetIsDirectoryPromise.test.ets' //import fileAssetIsDirectoryPromiseTest from './fileAssetIsDirectoryPromise.test.ets'
import fileAssetOpenCallbackTest from './fileAssetOpenCallback.test.ets' import fileAssetOpenCallbackTest from './fileAssetOpenCallback.test.ets'
import fileAssetOpenPromiseTest from './fileAssetOpenPromise.test.ets' import fileAssetOpenPromiseTest from './fileAssetOpenPromise.test.ets'
import fileAssetTrashCallbackTest from './fileAssetTrashCallback.test.ets' import fileAssetTrashCallbackTest from './fileAssetTrashCallback.test.ets'
...@@ -30,10 +31,11 @@ export default function testsuite(abilityContext) { ...@@ -30,10 +31,11 @@ export default function testsuite(abilityContext) {
fileAssetCommitModifyPromiseTest(abilityContext) fileAssetCommitModifyPromiseTest(abilityContext)
fileAssetFavoriteCallbackTest(abilityContext) fileAssetFavoriteCallbackTest(abilityContext)
fileAssetFavoritePromiseTest(abilityContext) fileAssetFavoritePromiseTest(abilityContext)
fileAssetFileKeyTest(abilityContext)
fileAssetGetThumbnailCallbackTest(abilityContext) fileAssetGetThumbnailCallbackTest(abilityContext)
fileAssetGetThumbnailPromiseTest(abilityContext) fileAssetGetThumbnailPromiseTest(abilityContext)
fileAssetIsDirectoryCallbackTest(abilityContext) //fileAssetIsDirectoryCallbackTest(abilityContext)
fileAssetIsDirectoryPromiseTest(abilityContext) //fileAssetIsDirectoryPromiseTest(abilityContext)
fileAssetOpenCallbackTest(abilityContext) fileAssetOpenCallbackTest(abilityContext)
fileAssetOpenPromiseTest(abilityContext) fileAssetOpenPromiseTest(abilityContext)
fileAssetTrashCallbackTest(abilityContext) fileAssetTrashCallbackTest(abilityContext)
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import userfile_manager from '@ohos.filemanagement.userfile_manager'; import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import { import {
...@@ -30,7 +30,7 @@ import { ...@@ -30,7 +30,7 @@ import {
export default function fileAssetCommitModifyCallbackTest(abilityContext) { export default function fileAssetCommitModifyCallbackTest(abilityContext) {
describe('fileAssetCommitModifyCallbackTest', function () { describe('fileAssetCommitModifyCallbackTest', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext); const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () { beforeAll(async function () {
console.info('beforeAll case'); console.info('beforeAll case');
await getPermission(); await getPermission();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import userfile_manager from '@ohos.filemanagement.userfile_manager'; import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import { import {
...@@ -29,7 +29,7 @@ import { ...@@ -29,7 +29,7 @@ import {
export default function fileAssetCommitModifyPromiseTest(abilityContext) { export default function fileAssetCommitModifyPromiseTest(abilityContext) {
describe('fileAssetCommitModifyPromiseTest', function () { describe('fileAssetCommitModifyPromiseTest', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext); const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () { beforeAll(async function () {
console.info('beforeAll case'); console.info('beforeAll case');
await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrFileAssetJsTest') await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrFileAssetJsTest')
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import userfile_manager from '@ohos.filemanagement.userfile_manager'; import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import { import {
sleep, sleep,
...@@ -26,7 +26,7 @@ import { ...@@ -26,7 +26,7 @@ import {
export default function fileAssetFavoriteCallbackTest(abilityContext) { export default function fileAssetFavoriteCallbackTest(abilityContext) {
describe('fileAssetFavoriteCallbackTest', function () { describe('fileAssetFavoriteCallbackTest', function () {
var userfilemgr = userfile_manager.getUserFileMgr(abilityContext); var userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () { beforeAll(async function () {
console.info('beforeAll case'); console.info('beforeAll case');
await getPermission(); await getPermission();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import userfile_manager from '@ohos.filemanagement.userfile_manager'; import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import { import {
sleep, sleep,
...@@ -25,7 +25,7 @@ import { ...@@ -25,7 +25,7 @@ import {
export default function fileAssetFavoritePromiseTest(abilityContext) { export default function fileAssetFavoritePromiseTest(abilityContext) {
describe('fileAssetFavoritePromiseTest', function () { describe('fileAssetFavoritePromiseTest', function () {
var userfilemgr = userfile_manager.getUserFileMgr(abilityContext); var userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () { beforeAll(async function () {
console.info('beforeAll case'); console.info('beforeAll case');
await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrFavorite'); await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrFavorite');
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import userfile_manager from '@ohos.filemanagement.userfile_manager'; import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import image from '@ohos.multimedia.image'; import image from '@ohos.multimedia.image';
...@@ -27,7 +27,7 @@ import { ...@@ -27,7 +27,7 @@ import {
export default function fileAssetGetThumbnailCallbackTest(abilityContext) { export default function fileAssetGetThumbnailCallbackTest(abilityContext) {
describe('fileAssetGetThumbnailCallbackTest', function () { describe('fileAssetGetThumbnailCallbackTest', function () {
image.createPixelMap(new ArrayBuffer(4096), { size: { height: 1, width: 2 } }).then((pixelmap) => { }); image.createPixelMap(new ArrayBuffer(4096), { size: { height: 1, width: 2 } }).then((pixelmap) => { });
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext); const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () { beforeAll(async function () {
console.info('beforeAll case'); console.info('beforeAll case');
await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrGetThumbnailTest'); await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrGetThumbnailTest');
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import userfile_manager from '@ohos.filemanagement.userfile_manager'; import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import image from '@ohos.multimedia.image'; import image from '@ohos.multimedia.image';
import { import {
...@@ -27,7 +27,7 @@ import { ...@@ -27,7 +27,7 @@ import {
export default function fileAssetGetThumbnailPromiseTest(abilityContext) { export default function fileAssetGetThumbnailPromiseTest(abilityContext) {
describe('fileAssetGetThumbnailPromiseTest', function () { describe('fileAssetGetThumbnailPromiseTest', function () {
image.createPixelMap(new ArrayBuffer(4096), { size: { height: 1, width: 2 } }).then((pixelmap) => { }); image.createPixelMap(new ArrayBuffer(4096), { size: { height: 1, width: 2 } }).then((pixelmap) => { });
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext); const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () { beforeAll(async function () {
console.info('beforeAll case'); console.info('beforeAll case');
await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrGetThumbnailTest'); await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrGetThumbnailTest');
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import userfile_manager from '@ohos.filemanagement.userfile_manager'; import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import { import {
...@@ -25,7 +25,7 @@ import { ...@@ -25,7 +25,7 @@ import {
export default function fileAssetIsDirectoryCallbackTest(abilityContext) { export default function fileAssetIsDirectoryCallbackTest(abilityContext) {
describe('fileAssetIsDirectoryCallbackTest', function () { describe('fileAssetIsDirectoryCallbackTest', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext); const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () { beforeAll(async function () {
console.info('beforeAll case'); console.info('beforeAll case');
await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrFileAssetJsTest') await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrFileAssetJsTest')
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import userfile_manager from '@ohos.filemanagement.userfile_manager'; import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import { import {
...@@ -25,7 +25,7 @@ import { ...@@ -25,7 +25,7 @@ import {
export default function fileAssetIsDirectoryPromiseTest(abilityContext) { export default function fileAssetIsDirectoryPromiseTest(abilityContext) {
describe('fileAssetIsDirectoryPromiseTest', function () { describe('fileAssetIsDirectoryPromiseTest', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext); const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () { beforeAll(async function () {
console.info('beforeAll case'); console.info('beforeAll case');
await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrFileAssetJsTest') await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrFileAssetJsTest')
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import userfile_manager from '@ohos.filemanagement.userfile_manager'; import userFileManager from '@ohos.filemanagement.userFileManager';
import fileio from '@ohos.fileio'; import fileio from '@ohos.fileio';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import { import {
...@@ -27,7 +27,7 @@ import { ...@@ -27,7 +27,7 @@ import {
} from '../../../../../../common'; } from '../../../../../../common';
export default function fileAssetOpenCallbackTest(abilityContext) { export default function fileAssetOpenCallbackTest(abilityContext) {
describe('fileAssetOpenCallbackTest', function () { describe('fileAssetOpenCallbackTest', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext); const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () { beforeAll(async function () {
console.info('beforeAll case'); console.info('beforeAll case');
await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrFileAssetJsTest') await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrFileAssetJsTest')
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import userfile_manager from '@ohos.filemanagement.userfile_manager'; import userFileManager from '@ohos.filemanagement.userFileManager';
import fileio from '@ohos.fileio'; import fileio from '@ohos.fileio';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import { import {
...@@ -31,7 +31,7 @@ import { ...@@ -31,7 +31,7 @@ import {
} from '../../../../../../common'; } from '../../../../../../common';
export default function fileAssetOpenPromiseTest(abilityContext) { export default function fileAssetOpenPromiseTest(abilityContext) {
describe('fileAssetOpenPromiseTest', function () { describe('fileAssetOpenPromiseTest', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext); const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () { beforeAll(async function () {
console.info('beforeAll case'); console.info('beforeAll case');
await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrFileAssetJsTest') await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrFileAssetJsTest')
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import userfile_manager from '@ohos.filemanagement.userfile_manager'; import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "deccjsunit/index"; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "deccjsunit/index";
import { import {
sleep, sleep,
...@@ -26,7 +26,7 @@ import { ...@@ -26,7 +26,7 @@ import {
export default function fileAssetTrashCallbackTest(abilityContext) { export default function fileAssetTrashCallbackTest(abilityContext) {
describe("fileAssetTrashCallbackTest", function () { describe("fileAssetTrashCallbackTest", function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext); const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () { beforeAll(async function () {
console.info("beforeAll case"); console.info("beforeAll case");
}); });
...@@ -85,7 +85,7 @@ export default function fileAssetTrashCallbackTest(abilityContext) { ...@@ -85,7 +85,7 @@ export default function fileAssetTrashCallbackTest(abilityContext) {
if (!noAlbum) { if (!noAlbum) {
let fetchAlbumResult = await userfilemgr.getPhotoAlbums(ablumFetchOps); let fetchAlbumResult = await userfilemgr.getPhotoAlbums(ablumFetchOps);
let album = await fetchAlbumResult.getFirstObject(); let album = await fetchAlbumResult.getFirstObject();
let op: userfile_manager.MediaFetchOptions = allFetchOp(); let op: userFileManager.FetchOptions = allFetchOp();
let albumFetchFileResult = await album.getPhotoAssets(op); let albumFetchFileResult = await album.getPhotoAssets(op);
let albumFilesCount = albumFetchFileResult.getCount(); let albumFilesCount = albumFetchFileResult.getCount();
expect(albumFilesCount).assertEqual(expectAssetNum); expect(albumFilesCount).assertEqual(expectAssetNum);
...@@ -127,7 +127,7 @@ export default function fileAssetTrashCallbackTest(abilityContext) { ...@@ -127,7 +127,7 @@ export default function fileAssetTrashCallbackTest(abilityContext) {
if (!noAlbum) { if (!noAlbum) {
let fetchAlbumResult = await userfilemgr.getPhotoAlbums(ablumFetchOps); let fetchAlbumResult = await userfilemgr.getPhotoAlbums(ablumFetchOps);
let album = await fetchAlbumResult.getFirstObject(); let album = await fetchAlbumResult.getFirstObject();
let op: userfile_manager.MediaFetchOptions = allFetchOp(); let op: userFileManager.FetchOptions = allFetchOp();
let albumFetchFileResult = await album.getPhotoAssets(op); let albumFetchFileResult = await album.getPhotoAssets(op);
let albumFilesCount = albumFetchFileResult.getCount(); let albumFilesCount = albumFetchFileResult.getCount();
expect(albumFilesCount).assertEqual(expectAssetNum - 1); expect(albumFilesCount).assertEqual(expectAssetNum - 1);
...@@ -190,7 +190,7 @@ export default function fileAssetTrashCallbackTest(abilityContext) { ...@@ -190,7 +190,7 @@ export default function fileAssetTrashCallbackTest(abilityContext) {
if (!noAlbum) { if (!noAlbum) {
let fetchAlbumResult = await userfilemgr.getPhotoAlbums(ablumFetchOps); let fetchAlbumResult = await userfilemgr.getPhotoAlbums(ablumFetchOps);
let album = await fetchAlbumResult.getFirstObject(); let album = await fetchAlbumResult.getFirstObject();
let op: userfile_manager.MediaFetchOptions = allFetchOp(); let op: userFileManager.FetchOptions = allFetchOp();
let albumFetchFileResult = await album.getPhotoAssets(op); let albumFetchFileResult = await album.getPhotoAssets(op);
let albumFilesCount = albumFetchFileResult.getCount(); let albumFilesCount = albumFetchFileResult.getCount();
expect(albumFilesCount).assertEqual(expectAssetNum); expect(albumFilesCount).assertEqual(expectAssetNum);
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import userfile_manager from '@ohos.filemanagement.userfile_manager'; import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "deccjsunit/index"; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "deccjsunit/index";
import { import {
sleep, sleep,
...@@ -26,7 +26,7 @@ import { ...@@ -26,7 +26,7 @@ import {
export default function fileAssetTrashPromiseTest(abilityContext) { export default function fileAssetTrashPromiseTest(abilityContext) {
describe("fileAssetTrashPromiseTest", function () { describe("fileAssetTrashPromiseTest", function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext); const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () { beforeAll(async function () {
console.info("beforeAll case"); console.info("beforeAll case");
}); });
...@@ -78,7 +78,7 @@ export default function fileAssetTrashPromiseTest(abilityContext) { ...@@ -78,7 +78,7 @@ export default function fileAssetTrashPromiseTest(abilityContext) {
if (!noAlbum) { if (!noAlbum) {
let fetchAlbumResult = await userfilemgr.getPhotoAlbums(ablumFetchOps); let fetchAlbumResult = await userfilemgr.getPhotoAlbums(ablumFetchOps);
let album = await fetchAlbumResult.getFirstObject(); let album = await fetchAlbumResult.getFirstObject();
let op: userfile_manager.MediaFetchOptions = allFetchOp(); let op: userFileManager.FetchOptions = allFetchOp();
let albumFetchFileResult = await album.getPhotoAssets(op); let albumFetchFileResult = await album.getPhotoAssets(op);
let albumFilesCount = albumFetchFileResult.getCount(); let albumFilesCount = albumFetchFileResult.getCount();
expect(albumFilesCount).assertEqual(expectAssetNum); expect(albumFilesCount).assertEqual(expectAssetNum);
...@@ -103,7 +103,7 @@ export default function fileAssetTrashPromiseTest(abilityContext) { ...@@ -103,7 +103,7 @@ export default function fileAssetTrashPromiseTest(abilityContext) {
if (!noAlbum) { if (!noAlbum) {
var fetchAlbumResult = await userfilemgr.getPhotoAlbums(ablumFetchOps); var fetchAlbumResult = await userfilemgr.getPhotoAlbums(ablumFetchOps);
var album = await fetchAlbumResult.getFirstObject(); var album = await fetchAlbumResult.getFirstObject();
let op: userfile_manager.MediaFetchOptions = allFetchOp(); let op: userFileManager.FetchOptions = allFetchOp();
var albumFetchFileResult = await album.getPhotoAssets(op); var albumFetchFileResult = await album.getPhotoAssets(op);
var albumFilesCount = albumFetchFileResult.getCount(); var albumFilesCount = albumFetchFileResult.getCount();
expect(albumFilesCount).assertEqual(expectAssetNum - 1); expect(albumFilesCount).assertEqual(expectAssetNum - 1);
...@@ -143,7 +143,7 @@ export default function fileAssetTrashPromiseTest(abilityContext) { ...@@ -143,7 +143,7 @@ export default function fileAssetTrashPromiseTest(abilityContext) {
if (!noAlbum) { if (!noAlbum) {
let fetchAlbumResult = await userfilemgr.getPhotoAlbums(ablumFetchOps); let fetchAlbumResult = await userfilemgr.getPhotoAlbums(ablumFetchOps);
let album = await fetchAlbumResult.getFirstObject(); let album = await fetchAlbumResult.getFirstObject();
let op: userfile_manager.MediaFetchOptions = allFetchOp(); let op: userFileManager.FetchOptions = allFetchOp();
let albumFetchFileResult = await album.getPhotoAssets(op); let albumFetchFileResult = await album.getPhotoAssets(op);
let albumFilesCount = albumFetchFileResult.getCount(); let albumFilesCount = albumFetchFileResult.getCount();
expect(albumFilesCount).assertEqual(expectAssetNum); expect(albumFilesCount).assertEqual(expectAssetNum);
......
...@@ -12,7 +12,9 @@ ...@@ -12,7 +12,9 @@
"pre-push": [ "pre-push": [
], ],
"run-command": [ "run-command": [
"rm -rf /storage/media/100/local/files/*",
"rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*",
"mkdir -pv /storage/media/100/local/files/{Pictures,Videos,Audios}"
] ]
}, },
{ {
......
...@@ -13,21 +13,18 @@ ...@@ -13,21 +13,18 @@
* limitations under the License. * limitations under the License.
*/ */
import userfile_manager from '@ohos.filemanagement.userfile_manager'; import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import { import {
sleep, sleep,
IMAGE_TYPE,
VIDEO_TYPE,
AUDIO_TYPE,
allFetchOp, allFetchOp,
} from '../../../../../../common'; } from '../../../../../../common';
export default function userFileMgrNoPermissionCallback(abilityContext) { export default function userFileMgrNoPermissionCallback(abilityContext) {
describe('userFileMgrNoPermissionCallback', function () { describe('userFileMgrNoPermissionCallback', function () {
const userfile_mgr = userfile_manager.getUserFileMgr(abilityContext); const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () { beforeAll(async function () {
console.info('beforeAll case'); console.info('beforeAll case');
}); });
...@@ -42,9 +39,9 @@ export default function userFileMgrNoPermissionCallback(abilityContext) { ...@@ -42,9 +39,9 @@ export default function userFileMgrNoPermissionCallback(abilityContext) {
console.info('afterAll case'); console.info('afterAll case');
}); });
const getFileAssetsTest = async function (done, testNum, media_type) { const getPhotoAssetsTest = async function (done, testNum) {
try { try {
await userfile_mgr.getFileAssets(media_type, allFetchOp(), async (err, fetchFileResult) => { await userfilemgr.getPhotoAssets(allFetchOp(), async (err, fetchAssetResult) => {
if (err != undefined) { if (err != undefined) {
console.info(`${testNum}, err: ${err}`); console.info(`${testNum}, err: ${err}`);
expect(true).assertTrue(); expect(true).assertTrue();
...@@ -61,9 +58,9 @@ export default function userFileMgrNoPermissionCallback(abilityContext) { ...@@ -61,9 +58,9 @@ export default function userFileMgrNoPermissionCallback(abilityContext) {
} }
} }
const getAlbumsTest = async function (done, testNum, media_type) { const getPhotoAlbumsTest = async function (done, testNum) {
try { try {
await userfile_mgr.getAlbums(media_type, allFetchOp(), async (err, fetchAlbumResult) => { await userfilemgr.getPhotoAlbums(allFetchOp(), async (err, fetchAlbumResult) => {
if (err != undefined) { if (err != undefined) {
console.info(`${testNum}, err: ${err}`); console.info(`${testNum}, err: ${err}`);
expect(true).assertTrue(); expect(true).assertTrue();
...@@ -82,88 +79,30 @@ export default function userFileMgrNoPermissionCallback(abilityContext) { ...@@ -82,88 +79,30 @@ export default function userFileMgrNoPermissionCallback(abilityContext) {
/** /**
* @tc.number : SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_CALLBACK_01 * @tc.number : SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_CALLBACK_01
* @tc.name : getFileAssets * @tc.name : getPhotoAssets
* @tc.desc : getFileAssets(image) with no permission * @tc.desc : getPhotoAssets(image) with no permission
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_CALLBACK_01', 0, async function (done) { it('SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_CALLBACK_01', 0, async function (done) {
const testNum = 'SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_CALLBACK_01'; const testNum = 'SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_CALLBACK_01';
let media_type = [IMAGE_TYPE]; await getPhotoAssetsTest(done, testNum);
await getFileAssetsTest(done, testNum, media_type);
});
/**
* @tc.number : SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_CALLBACK_02
* @tc.name : getFileAssets
* @tc.desc : getFileAssets(audio) with no permission
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_CALLBACK_02', 0, async function (done) {
const testNum = 'SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_CALLBACK_02';
let media_type = [AUDIO_TYPE];
await getFileAssetsTest(done, testNum, media_type);
});
/**
* @tc.number : SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_CALLBACK_03
* @tc.name : getFileAssets
* @tc.desc : getFileAssets(video) with no permission
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_CALLBACK_03', 0, async function (done) {
const testNum = 'SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_CALLBACK_03';
let media_type = [VIDEO_TYPE];
await getFileAssetsTest(done, testNum, media_type);
}); });
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
/** /**
* @tc.number : SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_CALLBACK_01 * @tc.number : SUB_USERFILE_MGR_GETPHOTOALBUMS_NOPERMISSION_CALLBACK_01
* @tc.name : getAlbums * @tc.name : getPhotoAlbums
* @tc.desc : getAlbums(image) with no permission * @tc.desc : getPhotoAlbums with no permission
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_CALLBACK_01', 0, async function (done) {
const testNum = 'SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_CALLBACK_01';
let media_type = [IMAGE_TYPE];
await getAlbumsTest(done, testNum, media_type);
});
/**
* @tc.number : SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_CALLBACK_02
* @tc.name : getAlbums
* @tc.desc : getAlbums(audio) with no permission
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_CALLBACK_02', 0, async function (done) {
const testNum = 'SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_CALLBACK_02';
let media_type = [AUDIO_TYPE];
await getAlbumsTest(done, testNum, media_type);
});
/**
* @tc.number : SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_CALLBACK_03
* @tc.name : getAlbums
* @tc.desc : getAlbums(video) with no permission
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_CALLBACK_03', 0, async function (done) { it('SUB_USERFILE_MGR_GETPHOTOALBUMS_NOPERMISSION_CALLBACK_01', 0, async function (done) {
const testNum = 'SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_CALLBACK_03'; const testNum = 'SUB_USERFILE_MGR_GETPHOTOALBUMS_NOPERMISSION_CALLBACK_01';
let media_type = [VIDEO_TYPE]; await getPhotoAlbumsTest(done, testNum);
await getAlbumsTest(done, testNum, media_type);
}); });
}); });
} }
......
...@@ -13,21 +13,18 @@ ...@@ -13,21 +13,18 @@
* limitations under the License. * limitations under the License.
*/ */
import userfile_manager from '@ohos.filemanagement.userfile_manager'; import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import { import {
sleep, sleep,
IMAGE_TYPE,
VIDEO_TYPE,
AUDIO_TYPE,
allFetchOp, allFetchOp,
} from '../../../../../../common'; } from '../../../../../../common';
export default function userFileMgrNoPermissionPromise(abilityContext) { export default function userFileMgrNoPermissionPromise(abilityContext) {
describe('userFileMgrNoPermissionPromise', function () { describe('userFileMgrNoPermissionPromise', function () {
const userfile_mgr = userfile_manager.getUserFileMgr(abilityContext); const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () { beforeAll(async function () {
console.info('beforeAll case'); console.info('beforeAll case');
}); });
...@@ -42,9 +39,9 @@ export default function userFileMgrNoPermissionPromise(abilityContext) { ...@@ -42,9 +39,9 @@ export default function userFileMgrNoPermissionPromise(abilityContext) {
console.info('afterAll case'); console.info('afterAll case');
}); });
const getFileAssetsTest = async function (done, testNum, media_type) { const getPhotoAssetsTest = async function (done, testNum) {
try { try {
await userfile_mgr.getFileAssets(media_type, allFetchOp()); await userfilemgr.getPhotoAssets(allFetchOp());
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} catch (error) { } catch (error) {
...@@ -54,9 +51,9 @@ export default function userFileMgrNoPermissionPromise(abilityContext) { ...@@ -54,9 +51,9 @@ export default function userFileMgrNoPermissionPromise(abilityContext) {
} }
} }
const getAlbumsTest = async function (done, testNum, media_type) { const getPhotoAlbumsTest = async function (done, testNum) {
try { try {
await userfile_mgr.getAlbums(media_type, allFetchOp()); await userfilemgr.getPhotoAlbums(allFetchOp());
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} catch (error) { } catch (error) {
...@@ -68,88 +65,30 @@ export default function userFileMgrNoPermissionPromise(abilityContext) { ...@@ -68,88 +65,30 @@ export default function userFileMgrNoPermissionPromise(abilityContext) {
/** /**
* @tc.number : SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_PROMISE_01 * @tc.number : SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_PROMISE_01
* @tc.name : getFileAssets * @tc.name : getPhotoAssets
* @tc.desc : getFileAssets(image) with no permission * @tc.desc : getPhotoAssets(image) with no permission
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_PROMISE_01', 0, async function (done) { it('SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_PROMISE_01', 0, async function (done) {
const testNum = 'SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_PROMISE_01'; const testNum = 'SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_PROMISE_01';
let media_type = [IMAGE_TYPE]; await getPhotoAssetsTest(done, testNum);
await getFileAssetsTest(done, testNum, media_type);
});
/**
* @tc.number : SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_PROMISE_02
* @tc.name : getFileAssets
* @tc.desc : getFileAssets(audio) with no permission
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_PROMISE_02', 0, async function (done) {
const testNum = 'SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_PROMISE_02';
let media_type = [AUDIO_TYPE];
await getFileAssetsTest(done, testNum, media_type);
});
/**
* @tc.number : SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_PROMISE_03
* @tc.name : getFileAssets
* @tc.desc : getFileAssets(video) with no permission
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_PROMISE_03', 0, async function (done) {
const testNum = 'SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_PROMISE_03';
let media_type = [VIDEO_TYPE];
await getFileAssetsTest(done, testNum, media_type);
}); });
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
/** /**
* @tc.number : SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_PROMISE_01 * @tc.number : SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_PROMISE_01
* @tc.name : getAlbums * @tc.name : getPhotoAlbums
* @tc.desc : getAlbums(image) with no permission * @tc.desc : getPhotoAlbums with no permission
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_PROMISE_01', 0, async function (done) { it('SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_PROMISE_01', 0, async function (done) {
const testNum = 'SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_PROMISE_01'; const testNum = 'SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_PROMISE_01';
let media_type = [IMAGE_TYPE]; await getPhotoAlbumsTest(done, testNum);
await getAlbumsTest(done, testNum, media_type);
});
/**
* @tc.number : SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_PROMISE_02
* @tc.name : getAlbums
* @tc.desc : getAlbums(audio) with no permission
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_PROMISE_02', 0, async function (done) {
const testNum = 'SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_PROMISE_02';
let media_type = [AUDIO_TYPE];
await getAlbumsTest(done, testNum, media_type);
});
/**
* @tc.number : SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_PROMISE_03
* @tc.name : getAlbums
* @tc.desc : getAlbums(video) with no permission
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_PROMISE_03', 0, async function (done) {
const testNum = 'SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_PROMISE_03';
let media_type = [VIDEO_TYPE];
await getAlbumsTest(done, testNum, media_type);
}); });
}); });
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册