提交 50e882d6 编写于 作者: Z zhang-daiyue

Add MediaLibrary XTS testcases

Signed-off-by: Nzhang-daiyue <zhangdaiyue1@huawei.com>
Change-Id: Ieea606b6cf646b07b1647e9ba5b970c93d1701f7
上级 59cca3d6
import mediaLibrary from '@ohos.multimedia.medialibrary';
import image from '@@ohos.multimedia.image';
import featureAbility from '@ohos.ability.featureAbility'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('GetFileAssets_GetCount_GetAllObjects', function () {
var context = featureAbility.getContext();
console.info('MediaLibraryTest : getMediaLibrary IN');
var media = mediaLibrary.getMediaLibrary(context);
console.info('MediaLibraryTest : getMediaLibrary OUT');
var URI;
var name;
var result1;
var name_URI;
var albumName;
var albumId;
var i;
var fileAsset;
var MAXNUM = 100;
var PATH = 'data';
var MEDIA_TYPE = 'media_type';
let fileKeyObj = mediaLibrary.FileKey
/*
let fetchOp = {
selections : mediaLibrary.PATH + "= ? OR " + mediaLibrary.MEDIA_TYPE + "=?",
selectionArgs : ["/data/media/images", "IMAGE"],
order : "ASC",
}
let fetchOp = {
selections : mediaLibrary.FileKey.PATH + "= ? OR " + mediaLibrary.FileKey.MEDIA_TYPE + "=?",
selectionArgs : ["/data/media/images", "IMAGE"],
order : "ASC",
}
*/
let type = mediaLibrary.MediaType.IMAGE
let videoType = mediaLibrary.MediaType.VIDEO
let audioType = mediaLibrary.MediaType.AUDIO
let fetchOp = {
selections : fileKeyObj.PATH + " LIKE ? AND " + fileKeyObj.MEDIA_TYPE + "=?",
selectionArgs : ["/data/media/%", type.toString()],
order : fileKeyObj.PATH,
}
let videoFetchOp = {
selections : fileKeyObj.PATH + " LIKE ? AND " + fileKeyObj.MEDIA_TYPE + "=?",
selectionArgs : ["/data/media/%", videoType.toString()],
order : fileKeyObj.PATH,
}
let audioFetchOp = {
selections : fileKeyObj.PATH + " LIKE ? AND " + fileKeyObj.MEDIA_TYPE + "=?",
selectionArgs : ["/data/media/%", audioType.toString()],
order : fileKeyObj.PATH,
}
beforeAll(function () {
//onsole.info('beforeAll: Prerequisites at the test suite level, which are executed before the test suite is executed.');
})
beforeEach(function () {
//console.info('MediaLibraryTest: beforeEach:Prerequisites at the test case level, which are executed before each test case is executed.');
})
afterEach(function () {
//console.info('MediaLibraryTest: afterEach: Test case-level clearance conditions, which are executed after each test case is executed.');
})
afterAll(function () {
//console.info('MediaLibraryTest: afterAll: Test suite-level cleanup condition, which is executed after the test suite is executed');
})
it('SUB_MEDIA_MEDIALIBRARY_GET_getThumbnail_01', 0, async function (done) {
media.getFileAssets(fetchOp, (error, data) => {
if (data != undefined) {
console.info('MediaLibraryTest : getFileAssets Successfull '+ data.getCount());
data.getFirstObject((err1, data1) => {
if (data1 != undefined) {
let size = { width:80, height:80 }
data1.getThumbnail(size, (err2, pixelmap) => {
console.info('MediaLibraryTest : getThumbnail Successfull '+ pixelmap);
pixelmap.getImageInfo((error, info) => {
console.info('MediaLibraryTest : pixel image info ' + info);
console.info('MediaLibraryTest : pixel width ' + info.size.width);
console.info('MediaLibraryTest : pixel height ' + info.size.height);
expect(info.size.width == 80).assertTrue();
expect(info.size.height == 80).assertTrue();
done();
});
});
}
});
} else {
console.info('MediaLibraryTest : getFileAssets Unsuccessfull '+ error.message);
console.info('MediaLibraryTest : getFileAssets :FAIL');
expect(false).assertTrue();
done();
}
});
})
it('SUB_MEDIA_MEDIALIBRARY_GET_getThumbnail_02', 0, async function (done) {
media.getFileAssets(fetchOp, (error, data) => {
if (data != undefined) {
console.info('MediaLibraryTest : getFileAssets Successfull '+ data.getCount());
data.getFirstObject((err1, data1) => {
if (data1 != undefined) {
let size = { width:400, height:400 }
data1.getThumbnail(size, (err2, pixelmap) => {
console.info('MediaLibraryTest : getThumbnail Successfull '+ pixelmap);
pixelmap.getImageInfo((error, info) => {
console.info('MediaLibraryTest : pixel image info ' + info);
console.info('MediaLibraryTest : pixel width ' + info.size.width);
console.info('MediaLibraryTest : pixel height ' + info.size.height);
expect(info.size.width == 400).assertTrue();
expect(info.size.height == 400).assertTrue();
done();
});
});
}
});
} else {
console.info('MediaLibraryTest : getFileAssets Unsuccessfull '+ error.message);
console.info('MediaLibraryTest : getFileAssets :FAIL');
expect(false).assertTrue();
done();
}
});
})
it('SUB_MEDIA_MEDIALIBRARY_GET_getThumbnail_03', 0, async function (done) {
media.getFileAssets(videoFetchOp, (error, data) => {
if (data != undefined) {
console.info('MediaLibraryTest : getFileAssets Successfull '+ data.getCount());
data.getFirstObject((err1, data1) => {
if (data1 != undefined) {
let size = { width:80, height:80 }
data1.getThumbnail(size, (err2, pixelmap) => {
console.info('MediaLibraryTest : getThumbnail Successfull '+ pixelmap);
pixelmap.getImageInfo((error, info) => {
console.info('MediaLibraryTest : pixel image info ' + info);
console.info('MediaLibraryTest : pixel width ' + info.size.width);
console.info('MediaLibraryTest : pixel height ' + info.size.height);
expect(info.size.width == 80).assertTrue();
expect(info.size.height == 80).assertTrue();
done();
});
});
}
});
} else {
console.info('MediaLibraryTest : getFileAssets Unsuccessfull '+ error.message);
console.info('MediaLibraryTest : getFileAssets :FAIL');
expect(false).assertTrue();
done();
}
});
})
it('SUB_MEDIA_MEDIALIBRARY_GET_getThumbnail_04', 0, async function (done) {
media.getFileAssets(videoFetchOp, (error, data) => {
if (data != undefined) {
console.info('MediaLibraryTest : getFileAssets Successfull '+ data.getCount());
data.getFirstObject((err1, data1) => {
if (data1 != undefined) {
let size = { width:400, height:400 }
data1.getThumbnail(size, (err2, pixelmap) => {
console.info('MediaLibraryTest : getThumbnail Successfull '+ pixelmap);
pixelmap.getImageInfo((error, info) => {
console.info('MediaLibraryTest : pixel image info ' + info);
console.info('MediaLibraryTest : pixel width ' + info.size.width);
console.info('MediaLibraryTest : pixel height ' + info.size.height);
expect(info.size.width == 400).assertTrue();
expect(info.size.height == 400).assertTrue();
done();
});
});
}
});
} else {
console.info('MediaLibraryTest : getFileAssets Unsuccessfull '+ error.message);
console.info('MediaLibraryTest : getFileAssets :FAIL');
expect(false).assertTrue();
done();
}
});
})
it('SUB_MEDIA_MEDIALIBRARY_GET_getThumbnail_05', 0, async function (done) {
media.getFileAssets(audioFetchOp, (error, data) => {
if (data != undefined) {
console.info('MediaLibraryTest : getFileAssets Successfull '+ data.getCount());
data.getFirstObject((err1, data1) => {
if (data1 != undefined) {
let size = { width:80, height:80 }
data1.getThumbnail(size, (err2, pixelmap) => {
console.info('MediaLibraryTest : getThumbnail Successfull '+ pixelmap);
pixelmap.getImageInfo((error, info) => {
console.info('MediaLibraryTest : pixel image info ' + info);
console.info('MediaLibraryTest : pixel width ' + info.size.width);
console.info('MediaLibraryTest : pixel height ' + info.size.height);
expect(info.size.width == 80).assertTrue();
expect(info.size.height == 80).assertTrue();
done();
});
});
}
});
} else {
console.info('MediaLibraryTest : getFileAssets Unsuccessfull '+ error.message);
console.info('MediaLibraryTest : getFileAssets :FAIL');
expect(false).assertTrue();
done();
}
});
})
it('SUB_MEDIA_MEDIALIBRARY_GET_getThumbnail_06', 0, async function (done) {
media.getFileAssets(audioFetchOp, (error, data) => {
if (data != undefined) {
console.info('MediaLibraryTest : getFileAssets Successfull '+ data.getCount());
data.getFirstObject((err1, data1) => {
if (data1 != undefined) {
let size = { width:400, height:400 }
data1.getThumbnail(size, (err2, pixelmap) => {
console.info('MediaLibraryTest : getThumbnail Successfull '+ pixelmap);
pixelmap.getImageInfo((error, info) => {
console.info('MediaLibraryTest : pixel image info ' + info);
console.info('MediaLibraryTest : pixel width ' + info.size.width);
console.info('MediaLibraryTest : pixel height ' + info.size.height);
expect(info.size.width == 400).assertTrue();
expect(info.size.height == 400).assertTrue();
done();
});
});
}
});
} else {
console.info('MediaLibraryTest : getFileAssets Unsuccessfull '+ error.message);
console.info('MediaLibraryTest : getFileAssets :FAIL');
expect(false).assertTrue();
done();
}
});
})
})
\ No newline at end of file
......@@ -13,9 +13,13 @@
* limitations under the License.
*/
require('./fileTestPromise.test.js')
require('./favTestPromise.test.js')
require('./albumTestPromise.test.js')
require('./fileTestCallBack.test.js')
require('./favTestCallBack.test.js')
require('./albumTestCallBack.test.js')
require('./getMediaFileAssetStatus.test.js')
require('./favTestPromise.test.js')
require('./fileTestCallBack.test.js')
require('./favTestCallBack.test.js')
require('./albumTestCallBack.test.js')
require('./FileAssetGetThumbnail.js')
......@@ -13,17 +13,18 @@
* limitations under the License.
*/
import mediaLibrary from '@ohos.multimedia.medialibrary';
import featureAbility from '@ohos.ability.featureAbility'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
let fileKeyObj = mediaLibrary.FileKey
let mediaType = mediaLibrary.MediaType.IMAGE;
let AlbumNoArgsfetchOp = {
selections: "",
selectionArgs: [],
}
let AlbumHasArgsfetchOp = {
selections: fileKeyObj.PATH + " LIKE ? ",
selectionArgs: ["/data/media%"],
selections: fileKeyObj.MEDIA_TYPE + "= ?",
selectionArgs: [mediaType.toString()],
}
let type1 = mediaLibrary.MediaType.IMAGE
let fileHasArgsfetchOp = {
......@@ -36,11 +37,11 @@ let fileNoArgsfetchOp = {
}
describe('album.callback.test.js', function () {
let mediaType = mediaLibrary.MediaType.IMAGE;
let path = "Pictures/"
var asset;
var media = mediaLibrary.getMediaLibrary();
var context = featureAbility.getContext();
console.info('MediaLibraryTest : getMediaLibrary IN');
var media = mediaLibrary.getMediaLibrary(context);
console.info('MediaLibraryTest : getMediaLibrary OUT');
var album;
beforeAll(function () {
console.info('Album Callback MediaLibraryTest: beforeAll.');
......@@ -70,7 +71,6 @@ describe('album.callback.test.js', function () {
*/
it('SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_001', 0, async function (done) {
asset = await media.createAsset(mediaType, "image0003Callback.jpg", path);
media.getAlbums(AlbumNoArgsfetchOp, getAlbumsCallBack);
done();
});
......@@ -102,6 +102,18 @@ describe('album.callback.test.js', function () {
}
}
function getAlbumsNoArgsCallBack(err, albumList) {
if (albumList != undefined) {
console.info('MediaLibraryTest : ALBUM_CALLBACK getAlbumsCallBack success');
done();
} else {
console.info('MediaLibraryTest : ASSET_CALLBACK getAlbumsCallBack Unsuccessfull ' + err);
console.info('MediaLibraryTest : ASSET_CALLBACK getAlbumsCallBack : FAIL');
done();
}
}
function getAlbumsCallBack(err, albumList) {
if (albumList != undefined) {
album = albumList[0];
......
......@@ -13,22 +13,24 @@
* limitations under the License.
*/
import mediaLibrary from '@ohos.multimedia.medialibrary';
import featureAbility from '@ohos.ability.featureAbility'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
let fileKeyObj = mediaLibrary.FileKey
let mediaType = mediaLibrary.MediaType.IMAGE;
let mediaType2 = mediaLibrary.MediaType.VIDEO;
let AlbumNoArgsfetchOp = {
selections: "",
selectionArgs: [],
}
let AlbumHasArgsfetchOp = {
selections: fileKeyObj.PATH + " LIKE ? ",
selectionArgs: ["/storage/media%"],
elections: fileKeyObj.MEDIA_TYPE + "= ?",
selectionArgs: [mediaType.toString()],
}
let type1 = mediaLibrary.MediaType.IMAGE
let fileHasArgsfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + "= ?",
selectionArgs: [type1.toString()],
selectionArgs: [mediaType.toString()],
}
let fileNoArgsfetchOp = {
selections: "",
......@@ -37,10 +39,12 @@ let fileNoArgsfetchOp = {
describe('album.promise.test.js', function () {
let mediaType = mediaLibrary.MediaType.IMAGE;
let path = "Pictures/"
var asset;
var media = mediaLibrary.getMediaLibrary();
var context = featureAbility.getContext();
console.info('MediaLibraryTest : getMediaLibrary IN');
var media = mediaLibrary.getMediaLibrary(context);
console.info('MediaLibraryTest : getMediaLibrary OUT');
var album;
beforeAll(function () {
onsole.info('Album Promise MediaLibraryTest: beforeAll.');
......@@ -69,12 +73,40 @@ describe('album.promise.test.js', function () {
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_001', 0, async function (done) {
asset = await media.createAsset(mediaType, "image0003.jpg", path);
let albumList = await media.getAlbums(AlbumNoArgsfetchOp);
album = albumList[0];
console.info('MediaLibraryTest : ALBUM_PROMISE album.albumName = ' + album.albumName);
done();
it('SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_001_01', 0, async function (done) {
try {
console.info('MediaLibraryTest : Delete begin');
let fetchFileResult = await media.getFileAssets(fileNoArgsfetchOp);
let assetList = await fetchFileResult.getAllObject();
assetList.forEach(getAllObjectInfoDelete);
console.info('MediaLibraryTest : Delete end');
asset = await media.createAsset(mediaType, "imageAlbum0003.jpg", path);
asset = await media.createAsset(mediaType2, "imageAlbum0004.avi", path);
let albumList = await media.getAlbums(AlbumNoArgsfetchOp);
album = albumList[0];
console.info('MediaLibraryTest : ALBUM_PROMISE getAlbum 001_01 album.albumName = ' + album.albumName);
console.info('MediaLibraryTest : ALBUM_PROMISE getAlbum 001_01 album.count = ' + album.count);
expect(true).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : ALBUM_PROMISE getAlbum 001_01 fail, message = ' + error);
expect(false).assertTrue();
done();
}
});
it('SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_001_02', 0, async function (done) {
try {
let albumList = await media.getAlbums();
album = albumList[0];
console.info('MediaLibraryTest : ALBUM_PROMISE getAlbum 001_02 album.albumName = ' + album.albumName);
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : ALBUM_PROMISE getAlbum 001_02 fail, message = ' + error);
expect(true).assertTrue();
done();
}
});
/*
......@@ -86,11 +118,67 @@ describe('album.promise.test.js', function () {
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_002', 0, async function (done) {
let albumHasList = await media.getAlbums(AlbumHasArgsfetchOp);
let albumHas = albumHasList[0];
console.info('MediaLibraryTest : ALBUM_PROMISE albumHas.albumName = ' + albumHas.albumName);
done();
it('SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_002_01', 0, async function (done) {
try {
let albumHasList = await media.getAlbums(AlbumHasArgsfetchOp);
let albumHas = albumHasList[0];
console.info('MediaLibraryTest : ALBUM_PROMISE getalbum 002_01 albumHas.albumName = ' + albumHas.albumName);
console.info('MediaLibraryTest : ALBUM_PROMISE getAlbum 001_01 album.count = ' + album.count);
expect(true).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : ALBUM_PROMISE getalbum 002_01 fail, message = ' + error);
expect(false).assertTrue();
done();
}
});
it('SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_002_02', 0, async function (done) {
try {
let albumHasList = await media.getAlbums(666);
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : ALBUM_PROMISE getalbum 002_02 fail, message = ' + error);
expect(true).assertTrue();
done();
}
});
it('SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_002_03', 0, async function (done) {
try {
let albumHasList = await media.getAlbums("666");
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : ALBUM_PROMISE getalbum 002_03 fail, message = ' + error);
expect(true).assertTrue();
done();
}
});
it('SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_002_04', 0, async function (done) {
try {
let albumHasList = await media.getAlbums(0.666);
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : ALBUM_PROMISE getalbum 002_04 fail, message = ' + error);
expect(true).assertTrue();
done();
}
});
it('SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_002_05', 0, async function (done) {
try {
let albumHasList = await media.getAlbums();
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : ALBUM_PROMISE getalbum 002_05 fail, message = ' + error);
expect(true).assertTrue();
done();
}
});
/*
......@@ -102,10 +190,43 @@ describe('album.promise.test.js', function () {
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_PROMISE_003', 0, async function (done) {
album.albumName = "hello";
await album.commitModify();
console.info('MediaLibraryTest : ALBUM_PROMISE Modify album.albumName = ' + album.albumName);
it('SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_PROMISE_003_01', 0, async function (done) {
try {
album.albumName = "hello";
await album.commitModify();
expect(true).assertTrue();
console.info('MediaLibraryTest : ALBUM_PROMISE Modify 003_01 album.albumName = ' + album.albumName);
done();
} catch (error) {
console.info('MediaLibraryTest : ALBUM_PROMISE Modify 003_01 fail, message = ' + error);
expect(false).assertTrue();
}
done();
});
it('SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_PROMISE_003_02', 0, async function (done) {
try {
album.albumName = "";
await album.commitModify();
console.info('MediaLibraryTest : ALBUM_PROMISE Modify 003_02 album.albumName = ' + album.albumName);
expect(false).assertTrue();
} catch (error) {
console.info('MediaLibraryTest : ALBUM_PROMISE Modify 003_02 fail, message = ' + error);
expect(true).assertTrue();
}
done();
});
it('SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_PROMISE_003_03', 0, async function (done) {
try {
album.albumName = "?*hello";
await album.commitModify();
console.info('MediaLibraryTest : ALBUM_PROMISE Modify 003_02 album.albumName = ' + album.albumName);
expect(false).assertTrue();
} catch (error) {
console.info('MediaLibraryTest : ALBUM_PROMISE Modify 003_02 fail, message = ' + error);
expect(true).assertTrue();
}
done();
});
......@@ -118,10 +239,31 @@ describe('album.promise.test.js', function () {
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_PROMISE_004', 0, async function (done) {
let albumFetchFileResult = await album.getFileAssets(fileNoArgsfetchOp);
let albumAssetList = await albumFetchFileResult.getAllObject();
albumAssetList.forEach(getAllObjectInfo);
it('SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_PROMISE_004_01', 0, async function (done) {
try {
let albumFetchFileResult = await album.getFileAssets(fileNoArgsfetchOp);
let albumAssetList = await albumFetchFileResult.getAllObject();
albumAssetList.forEach(getAllObjectInfo);
console.info('MediaLibraryTest : ALBUM_PROMISE getFileAssets 004_01 success');
expect(true).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : ALBUM_PROMISE getFileAssets 004_01 fail, message = ' + error);
expect(false).assertTrue();
}
done();
});
it('SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_PROMISE_004_02', 0, async function (done) {
try {
let albumFetchFileResult = await album.getFileAssets();
console.info('MediaLibraryTest : ALBUM_PROMISE getFileAssets 004_02 success');
expect(false).assertTrue();
} catch (error) {
console.info('MediaLibraryTest : ALBUM_PROMISE getFileAssets 004_02 fail, message = ' + error);
expect(true).assertTrue();
done();
}
done();
});
......@@ -134,14 +276,91 @@ describe('album.promise.test.js', function () {
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_005', 0, async function (done) {
let albumFetchFileResult = await album.getFileAssets(fileHasArgsfetchOp);
let albumAssetList = await albumFetchFileResult.getAllObject();
albumAssetList.forEach(getAllObjectInfo);
await media.deleteAsset(asset.uri);
it('SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_PROMISE_005_01', 0, async function (done) {
try {
let albumFetchFileResult = await album.getFileAssets(fileHasArgsfetchOp);
let albumAssetList = await albumFetchFileResult.getAllObject();
albumAssetList.forEach(getAllObjectInfo);
console.info('MediaLibraryTest : ALBUM_PROMISE getFileAssets 005_01 success');
expect(true).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : ALBUM_PROMISE getFileAssets 005_01 fail, message = ' + error);
expect(false).assertTrue();
}
done();
});
it('SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_PROMISE_005_02', 0, async function (done) {
let type2 = mediaLibrary.MediaType.VIDEO
let fileHasArgsfetchOp2 = {
selections: fileKeyObj.MEDIA_TYPE + " = ?",
selectionArgs: [type2.toString()],
}
try {
await album.getFileAssets(fileHasArgsfetchOp2);
console.info('MediaLibraryTest : ALBUM_PROMISE getFileAssets 005_02 success');
expect(true).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : ALBUM_PROMISE getFileAssets 005_02 fail, message = ' + error);
expect(false).assertTrue();
done();
}
});
it('SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_PROMISE_005_03', 0, async function (done) {
let fileHasArgsfetchOp3 = {
selections: fileKeyObj.MEDIA_TYPE + " = ?",
selectionArgs: ["666"],
}
try {
await album.getFileAssets(fileHasArgsfetchOp3);
console.info('MediaLibraryTest : ALBUM_PROMISE getFileAssets 005_03 success');
expect(true).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : ALBUM_PROMISE getFileAssets 005_03 fail, message = ' + error);
expect(false).assertTrue();
done();
}
});
it('SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_PROMISE_005_04', 0, async function (done) {
let type4 = mediaLibrary.MediaType.VIDEO
let fileHasArgsfetchOp4 = {
selections: "666" + "= ?",
selectionArgs: [type4.toString()],
}
try {
await album.getFileAssets(fileHasArgsfetchOp4);
console.info('MediaLibraryTest : ALBUM_PROMISE getFileAssets 005_04 success');
expect(true).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : ALBUM_PROMISE getFileAssets 005_04 fail, message = ' + error);
expect(false).assertTrue();
done();
}
});
it('SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_PROMISE_005_05', 0, async function (done) {
let fileHasArgsfetchOp5 = {
selections: "666" + "= ?",
selectionArgs: ["666"],
}
try {
await album.getFileAssets(fileHasArgsfetchOp5);
console.info('MediaLibraryTest : ALBUM_PROMISE getFileAssets 005_05 success');
expect(true).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : ALBUM_PROMISE getFileAssets 005_05 fail, message = ' + error);
expect(false).assertTrue();
done();
}
});
function getAllObjectInfo(data) {
if (data != undefined) {
console.info('MediaLibraryTest : ALBUM_PROMISE id is ' + data.id);
......@@ -153,4 +372,21 @@ describe('album.promise.test.js', function () {
console.info('MediaLibraryTest : ALBUM_PROMISE getAllObjectInfo no album');
}
}
function getAllObjectInfoDelete(data3) {
console.info('MediaLibraryTest : id is ' + data3.id);
console.info('MediaLibraryTest : uri is ' + data3.uri);
console.info('MediaLibraryTest : displayName is ' + data3.displayName);
console.info('MediaLibraryTest : mediaType is ' + data3.mediaType);
media.deleteAsset(data3.uri, (err4, data4) => {
if (data4 == 0) {
console.info('MediaLibraryTest : Delete Album Successfull ' + data4);
console.info('MediaLibraryTest : Delete Asset : PASS');
} else {
console.info('MediaLibraryTest : Album is not modified ' + err4.message);
console.info('MediaLibraryTest : Modify Asset : FAIL');
}
});
}
})
......@@ -14,16 +14,16 @@
*/
import mediaLibrary from '@ohos.multimedia.medialibrary';
import featureAbility from '@ohos.ability.featureAbility'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('Create_File_Assets.test.js', function () {
console.info("mediaLibrary Instance before");
const media = mediaLibrary.getMediaLibrary();
console.info("mediaLibrary Instance after");
var context = featureAbility.getContext();
console.info('MediaLibraryTest : getMediaLibrary IN');
const media = mediaLibrary.getMediaLibrary(context);
console.info('MediaLibraryTest : getMediaLibrary OUT');
beforeAll(function () {
onsole.info('MediaLibraryTest: beforeAll');
......
......@@ -14,15 +14,16 @@
*/
import mediaLibrary from '@ohos.multimedia.medialibrary';
import featureAbility from '@ohos.ability.featureAbility'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('createFileAssetsPerformance.test.js', function () {
console.info("mediaLibrary Instance before");
const media = mediaLibrary.getMediaLibrary();
console.info("mediaLibrary Instance after");
var context = featureAbility.getContext();
console.info('MediaLibraryTest : getMediaLibrary IN');
const media = mediaLibrary.getMediaLibrary(context);
console.info('MediaLibraryTest : getMediaLibrary OUT');
let times = 100;
beforeAll(function () {
......
......@@ -14,15 +14,16 @@
*/
import mediaLibrary from '@ohos.multimedia.medialibrary';
import featureAbility from '@ohos.ability.featureAbility'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('deleteFileAssetsPerformance.test.js', function () {
console.info("mediaLibrary Instance before");
const media = mediaLibrary.getMediaLibrary();
console.info("mediaLibrary Instance after");
var context = featureAbility.getContext();
console.info('MediaLibraryTest : getMediaLibrary IN');
const media = mediaLibrary.getMediaLibrary(context);
console.info('MediaLibraryTest : getMediaLibrary OUT');
let fileList_;
let fileKeyObj = mediaLibrary.FileKey
......
......@@ -13,33 +13,18 @@
* limitations under the License.
*/
import mediaLibrary from '@ohos.multimedia.medialibrary';
import featureAbility from '@ohos.ability.featureAbility'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
let fileKeyObj = mediaLibrary.FileKey
let AlbumNoArgsfetchOp = {
selections: "",
selectionArgs: [],
}
let AlbumHasArgsfetchOp = {
selections: fileKeyObj.PATH + " LIKE ? ",
selectionArgs: ["/data/media%"],
}
let type1 = mediaLibrary.MediaType.IMAGE
let fileHasArgsfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + "= ?",
selectionArgs: [type1.toString()],
}
let fileNoArgsfetchOp = {
selections: "",
selectionArgs: [],
}
describe('favSmartAlbum.promise.test.js', function () {
let mediaType = mediaLibrary.MediaType.IMAGE;
let path = "Pictures/"
var media = mediaLibrary.getMediaLibrary();
var context = featureAbility.getContext();
console.info('MediaLibraryTest : getMediaLibrary IN');
var media = mediaLibrary.getMediaLibrary(context);
console.info('MediaLibraryTest : getMediaLibrary OUT');
var asset;
var favSmartAlbum;
beforeAll(function () {
......@@ -70,9 +55,14 @@ describe('favSmartAlbum.promise.test.js', function () {
*/
it('SUB_MEDIA_MEDIALIBRARY_GETPRIVATEALBUM_CALLBACK_001', 0, async function (done) {
asset = await media.createAsset(mediaType, "image0002.jpg", path);
media.getPrivateAlbum(mediaLibrary.PrivateAlbumType.TYPE_FAVORITE, getPrivateAlbumCallBack);
done();
try {
asset = await media.createAsset(mediaType, "imagefavtest.jpg", path);
media.getPrivateAlbum(mediaLibrary.PrivateAlbumType.TYPE_FAVORITE, getPrivateAlbumCallBack);
done();
} catch (error) {
console.info('MediaLibraryTest : CALLBACK_001 getPrivateAlbum fail, message = '+ error);
done();
}
});
function getPrivateAlbumCallBack(err, favSmartAlbums) {
......
......@@ -13,35 +13,21 @@
* limitations under the License.
*/
import mediaLibrary from '@ohos.multimedia.medialibrary';
import featureAbility from '@ohos.ability.featureAbility'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
let fileKeyObj = mediaLibrary.FileKey
let AlbumNoArgsfetchOp = {
selections: "",
selectionArgs: [],
}
let AlbumHasArgsfetchOp = {
selections: fileKeyObj.PATH + " LIKE ? ",
selectionArgs: ["/data/media%"],
}
let type1 = mediaLibrary.MediaType.IMAGE
let fileHasArgsfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + "= ?",
selectionArgs: [type1.toString()],
}
let fileNoArgsfetchOp = {
selections: "",
selectionArgs: [],
}
describe('favSmartAlbum.promise.test.js', function () {
let mediaType = mediaLibrary.MediaType.IMAGE;
let path = "Pictures/"
var media = mediaLibrary.getMediaLibrary();
var context = featureAbility.getContext();
console.info('MediaLibraryTest : getMediaLibrary IN');
var media = mediaLibrary.getMediaLibrary(context);
console.info('MediaLibraryTest : getMediaLibrary OUT');
var asset;
var favSmartAlbum;
var trashSmartAlbum;
beforeAll(function () {
onsole.info('Smart Album Promise MediaLibraryTest: beforeAll.');
......@@ -69,16 +55,92 @@ describe('favSmartAlbum.promise.test.js', function () {
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_GETPRIVATEALBUM_PROMISE_001', 0, async function (done) {
asset = await media.createAsset(mediaType, "image002.jpg", path);
const favSmartAlbums = await media.getPrivateAlbum(mediaLibrary.PrivateAlbumType.TYPE_FAVORITE);
console.info('MediaLibraryTest : SMARTALBUM_PROMISE getPrivateAlbum favSmartAlbums');
console.info('MediaLibraryTest : SMARTALBUM_PROMISE favSmartAlbums ' + favSmartAlbums[0].albumName);
console.info('MediaLibraryTest : SMARTALBUM_PROMISE favSmartAlbums ' + favSmartAlbums[0].albumCapacity);
favSmartAlbum = favSmartAlbums[0];
it('SUB_MEDIA_MEDIALIBRARY_GETPRIVATEALBUM_PROMISE_001_01', 0, async function (done) {
try {
asset = await media.createAsset(mediaType, "imageGetPrivatealbum002.jpg", path);
const favSmartAlbums = await media.getPrivateAlbum(mediaLibrary.PrivateAlbumType.TYPE_FAVORITE);
console.info('MediaLibraryTest : SMARTALBUM_PROMISE getPrivateAlbum favSmartAlbums 001_01');
console.info('MediaLibraryTest : SMARTALBUM_PROMISE favSmartAlbums 001_01 ' + favSmartAlbums[0].albumName);
console.info('MediaLibraryTest : SMARTALBUM_PROMISE favSmartAlbums 001_01 ' + favSmartAlbums[0].albumCapacity);
favSmartAlbum = favSmartAlbums[0];
expect(true).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : SMARTALBUM_PROMISE getPrivateAlbum 001_01 fail, message = ' + error);
expect(false).assertTrue();
done();
}
done();
});
it('SUB_MEDIA_MEDIALIBRARY_GETPRIVATEALBUM_PROMISE_001_02', 0, async function (done) {
try {
const trashSmartAlbums = await media.getPrivateAlbum(mediaLibrary.PrivateAlbumType.TYPE_TRASH);
console.info('MediaLibraryTest : SMARTALBUM_PROMISE getPrivateAlbum trashSmartAlbums 001_02');
console.info('MediaLibraryTest : SMARTALBUM_PROMISE trashSmartAlbums 001_02 ' + trashSmartAlbums[0].albumName);
console.info('MediaLibraryTest : SMARTALBUM_PROMISE trashSmartAlbums 001_02 ' + trashSmartAlbums[0].albumCapacity);
trashSmartAlbum = trashSmartAlbums[0];
expect(true).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : SMARTALBUM_PROMISE getPrivateAlbum 001_02 fail, message = ' + error);
expect(false).assertTrue();
done();
}
});
it('SUB_MEDIA_MEDIALIBRARY_GETPRIVATEALBUM_PROMISE_001_03', 0, async function (done) {
try {
const favSmartAlbums = await media.getPrivateAlbum(666);
console.info('MediaLibraryTest : SMARTALBUM_PROMISE getPrivateAlbum 001_03 success');
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : SMARTALBUM_PROMISE getPrivateAlbum 001_03 fail, message = ' + error);
expect(true).assertTrue();
done();
}
});
it('SUB_MEDIA_MEDIALIBRARY_GETPRIVATEALBUM_PROMISE_001_04', 0, async function (done) {
try {
const favSmartAlbums = await media.getPrivateAlbum("666");
console.info('MediaLibraryTest : SMARTALBUM_PROMISE getPrivateAlbum success 001_04');
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : SMARTALBUM_PROMISE getPrivateAlbum 001_04 fail, message = ' + error);
expect(true).assertTrue();
done();
}
});
it('SUB_MEDIA_MEDIALIBRARY_GETPRIVATEALBUM_PROMISE_001_05', 0, async function (done) {
try {
const favSmartAlbums = await media.getPrivateAlbum(6.66666);
console.info('MediaLibraryTest : SMARTALBUM_PROMISE getPrivateAlbum success 001_05');
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : SMARTALBUM_PROMISE getPrivateAlbum 001_05 fail, message = ' + error);
expect(true).assertTrue();
done();
}
});
it('SUB_MEDIA_MEDIALIBRARY_GETPRIVATEALBUM_PROMISE_001_06', 0, async function (done) {
try {
const favSmartAlbums = await media.getPrivateAlbum();
console.info('MediaLibraryTest : SMARTALBUM_PROMISE getPrivateAlbum success 001_06');
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : SMARTALBUM_PROMISE getPrivateAlbum 001_06 fail, message = ' + error);
expect(true).assertTrue();
done();
}
});
/*
* @tc.number : SUB_MEDIA_MEDIALIBRARY_ADDASSET_PROMISE_002
* @tc.name : Add asset
......@@ -88,13 +150,68 @@ describe('favSmartAlbum.promise.test.js', function () {
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_ADDASSET_PROMISE_002', 0, async function (done) {
await favSmartAlbum.addAsset(asset.uri);
console.info('MediaLibraryTest : SMARTALBUM_PROMISE fav addAsset = ', asset.uri);
let fSmartFetchFileResult = await favSmartAlbum.getFileAssets();
console.info('MediaLibraryTest : SMARTALBUM_PROMISE getFileAssets Successfull fSmartFetchFileResult = '
+ fSmartFetchFileResult.getCount());
done();
it('SUB_MEDIA_MEDIALIBRARY_ADDASSET_PROMISE_002_01', 0, async function (done) {
try {
await favSmartAlbum.addAsset(asset.uri);
console.info('MediaLibraryTest : SMARTALBUM_PROMISE fav addAsset 002_01 uri = ', asset.uri);
let fSmartFetchFileResult = await favSmartAlbum.getFileAssets();
console.info('MediaLibraryTest : SMARTALBUM_PROMISE getFileAssets 002_01 Successfull fSmartFetchFileResult = '
+ fSmartFetchFileResult.getCount());
expect(true).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : SMARTALBUM_PROMISE fav addAsset 002_01 fail, message = ' + error);
expect(false).assertTrue();
done();
}
});
it('SUB_MEDIA_MEDIALIBRARY_ADDASSET_PROMISE_002_02', 0, async function (done) {
try {
await favSmartAlbum.addAsset(666);
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : SMARTALBUM_PROMISE fav addAsset 002_02 fail, message = ' + error);
expect(true).assertTrue();
done();
}
});
it('SUB_MEDIA_MEDIALIBRARY_ADDASSET_PROMISE_002_03', 0, async function (done) {
try {
await favSmartAlbum.addAsset("666");
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : SMARTALBUM_PROMISE fav addAsset 002_03 fail, message = ' + error);
expect(true).assertTrue();
done();
}
});
it('SUB_MEDIA_MEDIALIBRARY_ADDASSET_PROMISE_002_04', 0, async function (done) {
try {
await favSmartAlbum.addAsset(0.666);
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : SMARTALBUM_PROMISE fav addAsset 002_04 fail, message = ' + error);
expect(true).assertTrue();
done();
}
});
it('SUB_MEDIA_MEDIALIBRARY_ADDASSET_PROMISE_002_05', 0, async function (done) {
try {
await favSmartAlbum.addAsset();
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : SMARTALBUM_PROMISE fav addAsset 002_05 fail, message = ' + error);
expect(true).assertTrue();
done();
}
});
/*
......@@ -106,12 +223,91 @@ describe('favSmartAlbum.promise.test.js', function () {
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_REMOVEASSET_PROMISE_003', 0, async function (done) {
await favSmartAlbum.removeAsset(asset.uri);
let fSmartFetchFileResultNew = await favSmartAlbum.getFileAssets();
console.info('MediaLibraryTest : SMARTALBUM_PROMISE getFileAssets Successfull remove fSmartFetchFileResultNew = '
+ fSmartFetchFileResultNew.getCount());
await media.deleteAsset(asset.uri);
done();
it('SUB_MEDIA_MEDIALIBRARY_REMOVEASSET_PROMISE_003_01', 0, async function (done) {
try {
await favSmartAlbum.removeAsset(asset.uri);
let fSmartFetchFileResultNew = await favSmartAlbum.getFileAssets();
console.info('MediaLibraryTest : SMARTALBUM_PROMISE getFileAssets Successfull removeAsset 003_01 fSmartFetchFileResultNew = '
+ fSmartFetchFileResultNew.getCount());
await media.deleteAsset(asset.uri);
done();
} catch (error) {
console.info('MediaLibraryTest : SMARTALBUM_PROMISE fav removeAsset 003_01 fail, message = ' + error);
}
});
it('SUB_MEDIA_MEDIALIBRARY_REMOVEASSET_PROMISE_003_02', 0, async function (done) {
try {
await favSmartAlbum.removeAsset(666);
console.info('MediaLibraryTest : SMARTALBUM_PROMISE fav removeAsset 003_02 success');
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : SMARTALBUM_PROMISE fav removeAsset 003_02 fail, message = ' + error);
expect(true).assertTrue();
done();
}
});
it('SUB_MEDIA_MEDIALIBRARY_REMOVEASSET_PROMISE_003_03', 0, async function (done) {
try {
await favSmartAlbum.removeAsset("666");
console.info('MediaLibraryTest : SMARTALBUM_PROMISE fav removeAsset 003_03 success');
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : SMARTALBUM_PROMISE fav removeAsset 003_03 fail, message = ' + error);
expect(true).assertTrue();
done();
}
});
it('SUB_MEDIA_MEDIALIBRARY_REMOVEASSET_PROMISE_003_04', 0, async function (done) {
try {
await favSmartAlbum.removeAsset(0.666);
console.info('MediaLibraryTest : SMARTALBUM_PROMISE fav removeAsset 003_04 success');
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : SMARTALBUM_PROMISE fav removeAsset 003_04 fail, message = ' + error);
expect(true).assertTrue();
done();
}
});
it('SUB_MEDIA_MEDIALIBRARY_REMOVEASSET_PROMISE_003_05', 0, async function (done) {
try {
await favSmartAlbum.removeAsset();
console.info('MediaLibraryTest : SMARTALBUM_PROMISE fav removeAsset 003_05 success');
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : SMARTALBUM_PROMISE fav removeAsset 003_05 fail, message = ' + error);
expect(true).assertTrue();
done();
}
});
/*
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETASSET_PROMISE_004
* @tc.name : get FileAssets
* @tc.desc : get FileAssets
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_GETASSET_PROMISE_004_01', 0, async function (done) {
try {
let fSmartFetchFileResultGet = await favSmartAlbum.getFileAssets();
console.info('MediaLibraryTest : SMARTALBUM_PROMISE getFileAssets Successfull 004_01 fSmartFetchFileResultGet = '
+ fSmartFetchFileResultGet.getCount());
expect(true).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : SMARTALBUM_PROMISE fav getFileAssets 004_01 fail, message = ' + error);
expect(false).assertTrue();
done();
}
});
})
......@@ -14,15 +14,16 @@
*/
import mediaLibrary from '@ohos.multimedia.medialibrary';
import featureAbility from '@ohos.ability.featureAbility'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('getAlbumsPerformance.test.js', function () {
console.info("mediaLibrary Instance before");
const media = mediaLibrary.getMediaLibrary();
console.info("mediaLibrary Instance after");
var context = featureAbility.getContext();
console.info('MediaLibraryTest : getMediaLibrary IN');
const media = mediaLibrary.getMediaLibrary(context);
console.info('MediaLibraryTest : getMediaLibrary OUT');
let times = 25;
......
......@@ -14,15 +14,16 @@
*/
import mediaLibrary from '@ohos.multimedia.medialibrary';
import featureAbility from '@ohos.ability.featureAbility'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('getFileAssetsPerformance.test.js', function () {
console.info("mediaLibrary Instance before");
const media = mediaLibrary.getMediaLibrary();
console.info("mediaLibrary Instance after");
var context = featureAbility.getContext();
console.info('MediaLibraryTest : getMediaLibrary IN');
const media = mediaLibrary.getMediaLibrary(context);
console.info('MediaLibraryTest : getMediaLibrary OUT');
let times = 25;
let queryResultSet_;
......
......@@ -14,16 +14,17 @@
*/
import mediaLibrary from '@ohos.multimedia.medialibrary';
import featureAbility from '@ohos.ability.featureAbility'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('getFileAssetsPerformance_object.test.js', function () {
console.info("mediaLibrary Instance before");
const media = mediaLibrary.getMediaLibrary();
console.info("mediaLibrary Instance after");
var context = featureAbility.getContext();
console.info('MediaLibraryTest : getMediaLibrary IN');
const media = mediaLibrary.getMediaLibrary(context);
console.info('MediaLibraryTest : getMediaLibrary OUT');
let times = 100;
let queryResultSet_;
let fileList_;
......@@ -37,7 +38,7 @@ describe('getFileAssetsPerformance_object.test.js', function () {
beforeAll(function () {
onsole.info('MediaLibraryTest: beforeAll');
})
beforeEach(function () {
console.info('MediaLibraryTest: beforeEach');
})
......@@ -47,16 +48,16 @@ describe('getFileAssetsPerformance_object.test.js', function () {
afterAll(function () {
console.info('MediaLibraryTest: afterAll');
})
/*
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GET_ALL_OBJECT_PERFORMANCE_01
* @tc.name :
* @tc.desc :
* @tc.name :
* @tc.desc :
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_GET_ALL_OBJECT_PERFORMANCE_01 begin');
it('SUB_MEDIA_MEDIALIBRARY_GET_ALL_OBJECT_PERFORMANCE_01', 0, async function (done) {
console.info('MediaLibraryTest : getFileAssets begin');
......
......@@ -14,15 +14,16 @@
*/
import mediaLibrary from '@ohos.multimedia.medialibrary';
import featureAbility from '@ohos.ability.featureAbility'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('getPrivateAlbumsPerformance.test.js', function () {
console.info("mediaLibrary Instance before");
const media = mediaLibrary.getMediaLibrary();
console.info("mediaLibrary Instance after");
var context = featureAbility.getContext();
console.info('MediaLibraryTest : getMediaLibrary IN');
const media = mediaLibrary.getMediaLibrary(context);
console.info('MediaLibraryTest : getMediaLibrary OUT');
let times = 50;
......
......@@ -14,15 +14,16 @@
*/
import mediaLibrary from '@ohos.multimedia.medialibrary';
import featureAbility from '@ohos.ability.featureAbility'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('smartAlbumOperatePerformance_object.test.js', async function () {
console.info("mediaLibrary Instance before");
const media = mediaLibrary.getMediaLibrary();
console.info("mediaLibrary Instance after");
var context = featureAbility.getContext();
console.info('MediaLibraryTest : getMediaLibrary IN');
const media = mediaLibrary.getMediaLibrary(context);
console.info('MediaLibraryTest : getMediaLibrary OUT');
let times = 50;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册