提交 16d8be51 编写于 作者: Z zhang-daiyue

Fix coding style check.

Signed-off-by: Nzhang-daiyue <zhangdaiyue1@huawei.com>
Change-Id: I83aca65905a8d15c1ce910720330523e31b1f6cd
上级 50e882d6
......@@ -17,7 +17,7 @@
{
"type": "ShellKit",
"run-command": [
"chmod -R 666 /data/media/*",
"chmod -R 777 /storage/media/*",
"setenforce 0"
],
"teardown-command":[
......
......@@ -43,6 +43,12 @@
"launchType": "standard"
}
],
"reqPermissions": [
{
"name": "ohos.permission.GET_BUNDLE_INFO",
"reason": "request permission"
}
],
"deviceType": [
"phone",
"tablet",
......
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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'
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.');
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 albumName;
var albumId;
var i;
var fileAsset;
var MAXNUM = 100;
var PATH = 'data';
var MEDIA_TYPE = 'media_type';
let fileKeyObj = mediaLibrary.FileKey
beforeEach(function () {
//console.info('MediaLibraryTest: beforeEach:Prerequisites at the test case level, which are executed before each test case is executed.');
// let fetchOp = {
// selections : mediaLibrary.PATH + "= ? OR " + mediaLibrary.MEDIA_TYPE + "=?",
// selectionArgs : ["/data/media/images", "IMAGE"],
// order : "ASC",
// }
})
afterEach(function () {
//console.info('MediaLibraryTest: afterEach: Test case-level clearance conditions, which are executed after each test case is executed.');
// let fetchOp = {
// selections : mediaLibrary.FileKey.PATH + "= ? OR " + mediaLibrary.FileKey.MEDIA_TYPE + "=?",
// selectionArgs : ["/data/media/images", "IMAGE"],
// order : "ASC",
// }
})
afterAll(function () {
//console.info('MediaLibraryTest: afterAll: Test suite-level cleanup condition, which is executed after the test suite is executed');
let type = mediaLibrary.MediaType.IMAGE
let videoType = mediaLibrary.MediaType.VIDEO
let audioType = mediaLibrary.MediaType.AUDIO
let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + "=?",
selectionArgs : [type.toString()],
order: fileKeyObj.PATH,
}
let videoFetchOp = {
selections : fileKeyObj.MEDIA_TYPE + "=?",
selectionArgs : [videoType.toString()],
order: fileKeyObj.PATH,
}
let audioFetchOp = {
selections : fileKeyObj.MEDIA_TYPE + "=?",
selectionArgs : [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) => {
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());
console.info('MediaLibraryTest : getFileAssets Successfull ' + data.getCount());
data.getFirstObject((err1, data1) => {
if (data1 != undefined) {
let size = { width:80, height:80 }
let size = { width: 80, height: 80 }
data1.getThumbnail(size, (err2, pixelmap) => {
console.info('MediaLibraryTest : getThumbnail Successfull '+ 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);
......@@ -94,24 +108,24 @@ media.getFileAssets(fetchOp, (error, data) => {
}
});
} else {
console.info('MediaLibraryTest : getFileAssets Unsuccessfull '+ error.message);
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) {
it('SUB_MEDIA_MEDIALIBRARY_GET_getThumbnail_02', 0, async function (done) {
media.getFileAssets(fetchOp, (error, data) => {
media.getFileAssets(fetchOp, (error, data) => {
if (data != undefined) {
console.info('MediaLibraryTest : getFileAssets Successfull '+ data.getCount());
console.info('MediaLibraryTest : getFileAssets Successfull ' + data.getCount());
data.getFirstObject((err1, data1) => {
if (data1 != undefined) {
let size = { width:400, height:400 }
let size = { width: 400, height: 400 }
data1.getThumbnail(size, (err2, pixelmap) => {
console.info('MediaLibraryTest : getThumbnail Successfull '+ 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);
......@@ -124,24 +138,24 @@ media.getFileAssets(fetchOp, (error, data) => {
}
});
} else {
console.info('MediaLibraryTest : getFileAssets Unsuccessfull '+ error.message);
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) {
it('SUB_MEDIA_MEDIALIBRARY_GET_getThumbnail_03', 0, async function (done) {
media.getFileAssets(videoFetchOp, (error, data) => {
media.getFileAssets(videoFetchOp, (error, data) => {
if (data != undefined) {
console.info('MediaLibraryTest : getFileAssets Successfull '+ data.getCount());
console.info('MediaLibraryTest : getFileAssets Successfull ' + data.getCount());
data.getFirstObject((err1, data1) => {
if (data1 != undefined) {
let size = { width:80, height:80 }
let size = { width: 80, height: 80 }
data1.getThumbnail(size, (err2, pixelmap) => {
console.info('MediaLibraryTest : getThumbnail Successfull '+ 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);
......@@ -154,24 +168,24 @@ media.getFileAssets(videoFetchOp, (error, data) => {
}
});
} else {
console.info('MediaLibraryTest : getFileAssets Unsuccessfull '+ error.message);
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) {
it('SUB_MEDIA_MEDIALIBRARY_GET_getThumbnail_04', 0, async function (done) {
media.getFileAssets(videoFetchOp, (error, data) => {
media.getFileAssets(videoFetchOp, (error, data) => {
if (data != undefined) {
console.info('MediaLibraryTest : getFileAssets Successfull '+ data.getCount());
console.info('MediaLibraryTest : getFileAssets Successfull ' + data.getCount());
data.getFirstObject((err1, data1) => {
if (data1 != undefined) {
let size = { width:400, height:400 }
let size = { width: 400, height: 400 }
data1.getThumbnail(size, (err2, pixelmap) => {
console.info('MediaLibraryTest : getThumbnail Successfull '+ 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);
......@@ -184,24 +198,24 @@ media.getFileAssets(videoFetchOp, (error, data) => {
}
});
} else {
console.info('MediaLibraryTest : getFileAssets Unsuccessfull '+ error.message);
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) {
it('SUB_MEDIA_MEDIALIBRARY_GET_getThumbnail_05', 0, async function (done) {
media.getFileAssets(audioFetchOp, (error, data) => {
media.getFileAssets(audioFetchOp, (error, data) => {
if (data != undefined) {
console.info('MediaLibraryTest : getFileAssets Successfull '+ data.getCount());
console.info('MediaLibraryTest : getFileAssets Successfull ' + data.getCount());
data.getFirstObject((err1, data1) => {
if (data1 != undefined) {
let size = { width:80, height:80 }
let size = { width: 80, height: 80 }
data1.getThumbnail(size, (err2, pixelmap) => {
console.info('MediaLibraryTest : getThumbnail Successfull '+ 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);
......@@ -214,24 +228,24 @@ media.getFileAssets(audioFetchOp, (error, data) => {
}
});
} else {
console.info('MediaLibraryTest : getFileAssets Unsuccessfull '+ error.message);
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) {
it('SUB_MEDIA_MEDIALIBRARY_GET_getThumbnail_06', 0, async function (done) {
media.getFileAssets(audioFetchOp, (error, data) => {
media.getFileAssets(audioFetchOp, (error, data) => {
if (data != undefined) {
console.info('MediaLibraryTest : getFileAssets Successfull '+ data.getCount());
console.info('MediaLibraryTest : getFileAssets Successfull ' + data.getCount());
data.getFirstObject((err1, data1) => {
if (data1 != undefined) {
let size = { width:400, height:400 }
let size = { width: 400, height: 400 }
data1.getThumbnail(size, (err2, pixelmap) => {
console.info('MediaLibraryTest : getThumbnail Successfull '+ 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);
......@@ -244,12 +258,12 @@ media.getFileAssets(audioFetchOp, (error, data) => {
}
});
} else {
console.info('MediaLibraryTest : getFileAssets Unsuccessfull '+ error.message);
console.info('MediaLibraryTest : getFileAssets Unsuccessfull ' + error.message);
console.info('MediaLibraryTest : getFileAssets :FAIL');
expect(false).assertTrue();
done();
}
});
})
});
})
})
\ No newline at end of file
......@@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import mediaLibrary from '@ohos.multimedia.medialibrary';
import featureAbility from '@ohos.ability.featureAbility'
......@@ -44,24 +45,24 @@ describe('album.callback.test.js', function () {
console.info('MediaLibraryTest : getMediaLibrary OUT');
var album;
beforeAll(function () {
console.info('Album Callback MediaLibraryTest: beforeAll.');
onsole.info('Album Callback MediaLibraryTest: beforeAll: Prerequisites at the test suite level, which are executed before the test suite is executed.');
})
beforeEach(function () {
console.info('Album Callback MediaLibraryTest: beforeEach.');
console.info('Album Callback MediaLibraryTest: beforeEach:Prerequisites at the test case level, which are executed before each test case is executed.');
})
afterEach(function () {
console.info('Album Callback MediaLibraryTest: afterEach.');
console.info('Album Callback MediaLibraryTest: afterEach: Test case-level clearance conditions, which are executed after each test case is executed.');
})
afterAll(function () {
console.info('Album Callback MediaLibraryTest: afterAll.');
console.info('Album Callback MediaLibraryTest: afterAll: Test suite-level cleanup condition, which is executed after the test suite is executed');
})
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_001
* @tc.name : Get Album by AlbumNoArgsfetchOp
* @tc.desc : Get Album by AlbumNoArgsfetchOp
......@@ -75,7 +76,7 @@ describe('album.callback.test.js', function () {
done();
});
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_002
* @tc.name : Get Album by AlbumHasArgsfetchOp
* @tc.desc : Get Album by AlbumHasArgsfetchOp
......
......@@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import mediaLibrary from '@ohos.multimedia.medialibrary';
import featureAbility from '@ohos.ability.featureAbility'
......@@ -47,24 +48,24 @@ describe('album.promise.test.js', function () {
console.info('MediaLibraryTest : getMediaLibrary OUT');
var album;
beforeAll(function () {
onsole.info('Album Promise MediaLibraryTest: beforeAll.');
onsole.info('Album Promise MediaLibraryTest: beforeAll: Prerequisites at the test suite level, which are executed before the test suite is executed.');
})
beforeEach(function () {
console.info('Album Promise MediaLibraryTest: beforeEach.');
console.info('Album Promise MediaLibraryTest: beforeEach:Prerequisites at the test case level, which are executed before each test case is executed.');
})
afterEach(function () {
console.info('Album Promise MediaLibraryTest: afterEach.');
console.info('Album Promise MediaLibraryTest: afterEach: Test case-level clearance conditions, which are executed after each test case is executed.');
})
afterAll(function () {
console.info('Album Promise MediaLibraryTest: afterAll.');
console.info('Album Promise MediaLibraryTest: afterAll: Test suite-level cleanup condition, which is executed after the test suite is executed');
})
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_001
* @tc.name : Get Album by AlbumNoArgsfetchOp
* @tc.desc : Get Album by AlbumNoArgsfetchOp
......@@ -109,7 +110,7 @@ describe('album.promise.test.js', function () {
}
});
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_002
* @tc.name : Get Album by AlbumHasArgsfetchOp
* @tc.desc : Get Album by AlbumHasArgsfetchOp
......@@ -181,7 +182,7 @@ describe('album.promise.test.js', function () {
}
});
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_PROMISE_003
* @tc.name : Modify Album
* @tc.desc : Modify Album
......@@ -230,7 +231,7 @@ describe('album.promise.test.js', function () {
done();
});
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_PROMISE_004
* @tc.name : Get Album Assets by fileNoArgsfetchOp
* @tc.desc : Get Album Assets by fileNoArgsfetchOp
......@@ -267,8 +268,8 @@ describe('album.promise.test.js', function () {
done();
});
/*
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_005
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_PROMISE_005
* @tc.name : Get Album Assets by fileHasArgsfetchOp
* @tc.desc : Get Album Assets by fileHasArgsfetchOp
* @tc.size : MEDIUM
......
......@@ -16,15 +16,16 @@
import mediaLibrary from '@ohos.multimedia.medialibrary';
import featureAbility from '@ohos.ability.featureAbility'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
describe('Create_File_Assets.test.js', function () {
var context = featureAbility.getContext();
console.info('MediaLibraryTest : getMediaLibrary IN');
const media = mediaLibrary.getMediaLibrary(context);
var media = mediaLibrary.getMediaLibrary(context);
console.info('MediaLibraryTest : getMediaLibrary OUT');
beforeAll(function () {
onsole.info('MediaLibraryTest: beforeAll');
......@@ -47,7 +48,7 @@ describe('Create_File_Assets.test.js', function () {
console.info('MediaLibraryTest : createAsset : release end');
})
/*
/**
* @tc.number : 01
* @tc.name : SUB_MEDIA_MEDIALIBRARY_CREATE_FILE_01
* @tc.desc : Create an image file asset in predefined relative path
......@@ -84,7 +85,7 @@ describe('Create_File_Assets.test.js', function () {
});
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_CREATE_FILE_01 end');
/*
/**
* @tc.number : 02
* @tc.name : SUB_MEDIA_MEDIALIBRARY_CREATE_FILE_02
* @tc.desc : Create an image file asset in not predefined relative path
......@@ -121,7 +122,7 @@ describe('Create_File_Assets.test.js', function () {
});
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_CREATE_FILE_02 end');
/*
/**
* @tc.number : 03
* @tc.name : SUB_MEDIA_MEDIALIBRARY_CREATE_FILE_03
* @tc.desc : Repeat to create same image file asset expect return error
......@@ -157,7 +158,7 @@ describe('Create_File_Assets.test.js', function () {
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_CREATE_FILE_03 end');
/*
/**
* @tc.number : 04
* @tc.name : SUB_MEDIA_MEDIALIBRARY_CREATE_FILE_04
* @tc.desc : Create image file asset in invalid relative path expect return error
......@@ -192,7 +193,7 @@ describe('Create_File_Assets.test.js', function () {
});
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_CREATE_FILE_04 end');
/*
/**
* @tc.number : 07
* @tc.name : SUB_MEDIA_MEDIALIBRARY_CREATE_FILE_07
* @tc.desc : After create an image file asset, open and close it
......@@ -217,6 +218,7 @@ describe('Create_File_Assets.test.js', function () {
if (data != undefined) {
console.info('MediaLibraryTest : createAsset Successfull ');
getObjectInfo(data);
} else {
console.info('MediaLibraryTest : createAsset Unsuccessfull ' + createAssetErr.message);
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_CREATE_FILE_07 : FAIL');
......@@ -225,6 +227,7 @@ describe('Create_File_Assets.test.js', function () {
}
});
console.info('MediaLibraryTest : createAsset end');
} else {
console.info('MediaLibraryTest : getPublicDirectory : FAIL');
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_CREATE_FILE_07 : FAIL');
......@@ -232,12 +235,13 @@ describe('Create_File_Assets.test.js', function () {
done();
}
});
}
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_CREATE_FILE_07 end');
});
function getObjectInfo(fileAsset){
console.info('MediaLibraryTest : getObjectInfo uri is '+ fileAsset.uri);
function getObjectInfo(fileAsset) {
console.info('MediaLibraryTest : getObjectInfo uri is ' + fileAsset.uri);
console.info("==========================fileAsset.open begin=======================>");
fileAsset.open('Rw').then((openError, fd) => {
......
......@@ -16,13 +16,13 @@
import mediaLibrary from '@ohos.multimedia.medialibrary';
import featureAbility from '@ohos.ability.featureAbility'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
describe('createFileAssetsPerformance.test.js', function () {
var context = featureAbility.getContext();
console.info('MediaLibraryTest : getMediaLibrary IN');
const media = mediaLibrary.getMediaLibrary(context);
var media = mediaLibrary.getMediaLibrary(context);
console.info('MediaLibraryTest : getMediaLibrary OUT');
let times = 100;
......@@ -43,7 +43,7 @@ describe('createFileAssetsPerformance.test.js', function () {
console.info('MediaLibraryTest: afterAll');
})
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_CREATE_FILE_03
* @tc.name : Create an image file asset in predefined path
* @tc.desc : Create an image file asset in predefined path
......@@ -71,13 +71,13 @@ describe('createFileAssetsPerformance.test.js', function () {
if (fileObj != undefined) {
console.info('MediaLibraryTest : createAsset Successfull file uri = ' + fileObj.uri);
conteEnd++;
if (conteEnd == times){
if (conteEnd == times) {
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_CREATE_FILE_PERFORMANCE_01 : PASS');
expect(true).assertTrue();
done();
} else if (i == times) {
console.info('MediaLibraryTest : createAsset has error');
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_CREATE_FILE_PERFORMANCE_01:Partial');
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_CREATE_FILE_PERFORMANCE_01 :Partial success');
expect(false).assertTrue();
done();
}
......
......@@ -16,22 +16,22 @@
import mediaLibrary from '@ohos.multimedia.medialibrary';
import featureAbility from '@ohos.ability.featureAbility'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
describe('deleteFileAssetsPerformance.test.js', function () {
var context = featureAbility.getContext();
console.info('MediaLibraryTest : getMediaLibrary IN');
const media = mediaLibrary.getMediaLibrary(context);
var media = mediaLibrary.getMediaLibrary(context);
console.info('MediaLibraryTest : getMediaLibrary OUT');
let fileList_;
let fileKeyObj = mediaLibrary.FileKey
let type = mediaLibrary.MediaType.IMAGE
let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + " = ? ",
selectionArgs : [type.toString()],
order : fileKeyObj.DATE_ADDED,
selections: fileKeyObj.MEDIA_TYPE + " = ? ",
selectionArgs: [type.toString()],
order: fileKeyObj.DATE_ADDED,
}
beforeAll(function () {
onsole.info('MediaLibraryTest: beforeAll');
......@@ -47,7 +47,7 @@ describe('deleteFileAssetsPerformance.test.js', function () {
console.info('MediaLibraryTest: afterAll');
})
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GET_FILE_ASSETS_FOR_DELETE_01
* @tc.name : Create an image file asset in predefined path
* @tc.desc : Create an image file asset in predefined path
......@@ -60,7 +60,7 @@ describe('deleteFileAssetsPerformance.test.js', function () {
it('SUB_MEDIA_MEDIALIBRARY_GET_FILE_ASSETS_FOR_DELETE_01', 0, async function (done) {
media.getFileAssets(fetchOp, (getFileAssetsErr, queryResultSet) => {
if (queryResultSet != undefined) {
console.info('MediaLibraryTest : getAllObject Successfull '+ queryResultSet.getCount());
console.info('MediaLibraryTest : getAllObject Successfull ' + queryResultSet.getCount());
if (queryResultSet.getCount() > 0) {
queryResultSet.getAllObject((getAllObjectErr, fileList) => {
if (fileList != undefined) {
......@@ -81,7 +81,7 @@ describe('deleteFileAssetsPerformance.test.js', function () {
done();
}
} else {
console.info('MediaLibraryTest : getFileAssets Unsuccessfull '+ getFileAssetsErr.message);
console.info('MediaLibraryTest : getFileAssets Unsuccessfull ' + getFileAssetsErr.message);
console.info('MediaLibraryTest : getFileAssets :FAIL');
expect(false).assertTrue();
done();
......@@ -90,7 +90,7 @@ describe('deleteFileAssetsPerformance.test.js', function () {
});
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_GET_FILE_ASSETS_FOR_DELETE_01 end');
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_DELETE_FILE_ASSET_01
* @tc.name : Create an image file asset in predefined path
* @tc.desc : Create an image file asset in predefined path
......@@ -105,23 +105,23 @@ describe('deleteFileAssetsPerformance.test.js', function () {
let counteEnd = 0;
for (let i = 0; i < fileList_.length; i++) {
let fileAsset = fileList_[i];
console.info('MediaLibraryTest : uri is '+ fileAsset.uri);
console.info('MediaLibraryTest : uri is ' + fileAsset.uri);
media.deleteAsset(fileAsset.uri, (deleteAssetErr, deleteRows) => {
if (deleteRows >= 0) {
console.info('MediaLibraryTest : Delete Asset Successfull '+ deleteRows);
console.info('MediaLibraryTest : Delete Asset Successfull ' + deleteRows);
counteEnd++;
if (counteEnd == fileList_.length){
if (counteEnd == fileList_.length) {
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_DELETE_FILE_PERFORMANCE_01 : PASS');
expect(true).assertTrue();
done();
} else if (i == fileList_.length - 1) {
console.info('MediaLibraryTest : delete has error');
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_DELETE_FILE_PERFORMANCE_01 :Partial');
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_DELETE_FILE_PERFORMANCE_01 :Partial success');
expect(false).assertTrue();
done();
}
} else {
console.info('MediaLibraryTest : delete error '+ deleteAssetErr.message);
console.info('MediaLibraryTest : delete error ' + deleteAssetErr.message);
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_DELETE_FILE_PERFORMANCE_01 :FAIL');
expect(false).assertTrue();
done();
......
......@@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import mediaLibrary from '@ohos.multimedia.medialibrary';
import featureAbility from '@ohos.ability.featureAbility'
......@@ -28,24 +29,24 @@ describe('favSmartAlbum.promise.test.js', function () {
var asset;
var favSmartAlbum;
beforeAll(function () {
onsole.info('Smart Album Callback MediaLibraryTest: beforeAll.');
onsole.info('Smart Album Callback MediaLibraryTest: beforeAll: Prerequisites at the test suite level, which are executed before the test suite is executed.');
})
beforeEach(function () {
console.info('Smart Album Callback MediaLibraryTest: beforeEach.');
console.info('Smart Album Callback MediaLibraryTest: beforeEach:Prerequisites at the test case level, which are executed before each test case is executed.');
})
afterEach(function () {
console.info('Smart Album Callback MediaLibraryTest: afterEach.');
console.info('Smart Album Callback MediaLibraryTest: afterEach: Test case-level clearance conditions, which are executed after each test case is executed.');
})
afterAll(function () {
console.info('Smart Album Callback MediaLibraryTest: afterAll.');
console.info('Smart Album Callback MediaLibraryTest: afterAll: Test suite-level cleanup condition, which is executed after the test suite is executed');
})
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETPRIVATEALBUM_CALLBACK_001
* @tc.name : Get PrivateSmartAlbum by fav
* @tc.desc : Get PrivateSmartAlbum by fav
......@@ -60,7 +61,7 @@ describe('favSmartAlbum.promise.test.js', function () {
media.getPrivateAlbum(mediaLibrary.PrivateAlbumType.TYPE_FAVORITE, getPrivateAlbumCallBack);
done();
} catch (error) {
console.info('MediaLibraryTest : CALLBACK_001 getPrivateAlbum fail, message = '+ error);
console.info('MediaLibraryTest : CALLBACK_001 getPrivateAlbum fail, message = ' + error);
done();
}
});
......@@ -105,7 +106,7 @@ describe('favSmartAlbum.promise.test.js', function () {
}
function getFileAssetsCallBack(err, fSmartFetchFileResult) {
if (fSmartFetchFileResult != undefined) {
console.info('MediaLibraryTest : SMARTALBUM_CALLBACK getFileAssetsCallBack Success fSmartFetchFileResult = '
console.info('MediaLibraryTest : SMARTALBUM_CALLBACK getFileAssetsCallBack Successfull fSmartFetchFileResult = '
+ fSmartFetchFileResult.getCount());
done();
} else {
......
......@@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import mediaLibrary from '@ohos.multimedia.medialibrary';
import featureAbility from '@ohos.ability.featureAbility'
......@@ -29,24 +30,24 @@ describe('favSmartAlbum.promise.test.js', function () {
var favSmartAlbum;
var trashSmartAlbum;
beforeAll(function () {
onsole.info('Smart Album Promise MediaLibraryTest: beforeAll.');
onsole.info('Smart Album Promise MediaLibraryTest: beforeAll: Prerequisites at the test suite level, which are executed before the test suite is executed.');
})
beforeEach(function () {
console.info('Smart Album Promise MediaLibraryTest: beforeEach.');
console.info('Smart Album Promise MediaLibraryTest: beforeEach:Prerequisites at the test case level, which are executed before each test case is executed.');
})
afterEach(function () {
console.info('Smart Album Promise MediaLibraryTest: afterEach.');
console.info('Smart Album Promise MediaLibraryTest: afterEach: Test case-level clearance conditions, which are executed after each test case is executed.');
})
afterAll(function () {
console.info('Smart Album Promise MediaLibraryTest: afterAll.');
console.info('Smart Album Promise MediaLibraryTest: afterAll: Test suite-level cleanup condition, which is executed after the test suite is executed');
})
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETPRIVATEALBUM_PROMISE_001
* @tc.name : Get PrivateSmartAlbum by fav
* @tc.desc : Get PrivateSmartAlbum by fav
......@@ -141,7 +142,7 @@ describe('favSmartAlbum.promise.test.js', function () {
}
});
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_ADDASSET_PROMISE_002
* @tc.name : Add asset
* @tc.desc : Add asset
......@@ -214,7 +215,7 @@ describe('favSmartAlbum.promise.test.js', function () {
}
});
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_REMOVEASSET_PROMISE_003
* @tc.name : Remove asset
* @tc.desc : Remove asset
......@@ -288,7 +289,7 @@ describe('favSmartAlbum.promise.test.js', function () {
}
});
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETASSET_PROMISE_004
* @tc.name : get FileAssets
* @tc.desc : get FileAssets
......
......@@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import mediaLibrary from '@ohos.multimedia.medialibrary';
import featureAbility from '@ohos.ability.featureAbility'
......@@ -38,22 +39,23 @@ describe('file.callback.test.js', function () {
console.info('MediaLibraryTest : getMediaLibrary OUT');
beforeAll(function () {
console.info('File Callback MediaLibraryTest: beforeAll : Prerequisites at the test suite level, which are executed before the test suite is executed.');
})
beforeEach(function () {
console.info('File Callback MediaLibraryTest: beforeEach.');
console.info('File Callback MediaLibraryTest: beforeEach:Prerequisites at the test case level, which are executed before each test case is executed.');
})
afterEach(function () {
console.info('File Callback MediaLibraryTest: afterEach.');
console.info('File Callback MediaLibraryTest: afterEach: Test case-level clearance conditions, which are executed after each test case is executed.');
})
afterAll(function () {
console.info('File Callback MediaLibraryTest: afterAll.');
console.info('File Callback MediaLibraryTest: afterAll: Test suite-level cleanup condition, which is executed after the test suite is executed');
})
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_CREATEASSET_CALLBACK_001
* @tc.name : Create an asset in predefined path
* @tc.desc : Create an asset in predefined path
......@@ -78,7 +80,7 @@ describe('file.callback.test.js', function () {
done();
});
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_MODIFY_ASSET_CALLBACK_002
* @tc.name : Modify asset
* @tc.desc : Modify asset
......@@ -158,7 +160,7 @@ describe('file.callback.test.js', function () {
}
});
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GET_ASSET_CALLBACK_003
* @tc.name : Get assetList By NoArgsfetchOp
* @tc.desc : Get assetList By NoArgsfetchOp
......@@ -172,7 +174,7 @@ describe('file.callback.test.js', function () {
done();
});
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GET_ASSET_CALLBACK_004
* @tc.name : Get assetList By HasArgsfetchOp
* @tc.desc : Get assetList By HasArgsfetchOp
......@@ -186,10 +188,10 @@ describe('file.callback.test.js', function () {
done();
});
/*
* @tc.number : SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_CALLBACK_005
* @tc.name : Open and Close asset
* @tc.desc : Open and Close asset
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_OPEN_ASSET_CALLBACK_005
* @tc.name : Open asset
* @tc.desc : Open asset
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
......@@ -259,7 +261,7 @@ describe('file.callback.test.js', function () {
}
});
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_CLOSE_ASSET_CALLBACK_006
* @tc.name : Close asset
* @tc.desc : Close asset
......@@ -329,10 +331,10 @@ describe('file.callback.test.js', function () {
}
});
/*
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_AND_TRA_ASSET_CALLBACK_006
* @tc.name : Favourite and Trash
* @tc.desc : Favourite and Trash
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_007
* @tc.name : Favourite
* @tc.desc : Favourite
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
......@@ -349,7 +351,7 @@ describe('file.callback.test.js', function () {
}
});
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_TRASH_ASSET_CALLBACK_008
* @tc.name : Trash
* @tc.desc : Trash
......@@ -369,10 +371,10 @@ describe('file.callback.test.js', function () {
}
});
/*
* @tc.number : SUB_MEDIA_MEDIALIBRARY_DIR_ASSET_CALLBACK_007
* @tc.name : Favourite and Trash
* @tc.desc : Favourite and Trash
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_DIR_ASSET_CALLBACK_009
* @tc.name : dir
* @tc.desc : dir
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
......@@ -389,7 +391,7 @@ describe('file.callback.test.js', function () {
}
});
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_ON_CALLBACK_010
* @tc.name : On
* @tc.desc : On
......@@ -470,7 +472,7 @@ describe('file.callback.test.js', function () {
}
});
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_OFF_CALLBACK_011
* @tc.name : Off
* @tc.desc : Off
......@@ -539,7 +541,7 @@ describe('file.callback.test.js', function () {
it('SUB_MEDIA_MEDIALIBRARY_OFF_CALLBACK_011_05', 0, async function (done) {
try {
media.off(['666'],function (mediaChangeListener) {
media.off(['666'], function (mediaChangeListener) {
console.log('MediaLibraryTest off mediaChangeListener 011_05 success');
});
//expect(false).assertTrue();
......
......@@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import mediaLibrary from '@ohos.multimedia.medialibrary';
import featureAbility from '@ohos.ability.featureAbility'
......@@ -43,22 +44,23 @@ describe('file.promise.test.js', function () {
console.info('MediaLibraryTest : getMediaLibrary OUT');
beforeAll(function () {
console.info('File Promise MediaLibraryTest: beforeAll : Prerequisites at the test suite level, which are executed before the test suite is executed.');
})
beforeEach(function () {
console.info('File Promise MediaLibraryTest: beforeEach.');
console.info('File Promise MediaLibraryTest: beforeEach:Prerequisites at the test case level, which are executed before each test case is executed.');
})
afterEach(function () {
console.info('File Promise MediaLibraryTest: afterEach.');
console.info('File Promise MediaLibraryTest: afterEach: Test case-level clearance conditions, which are executed after each test case is executed.');
})
afterAll(function () {
console.info('File Promise MediaLibraryTest: afterAll.');
console.info('File Promise MediaLibraryTest: afterAll: Test suite-level cleanup condition, which is executed after the test suite is executed');
})
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_001
* @tc.name : Create an asset in predefined path
* @tc.desc : Create an asset in predefined path
......@@ -145,7 +147,7 @@ describe('file.promise.test.js', function () {
done();
});
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_MODIFY_ASSET_PROMISE_002
* @tc.name : Modify asset
* @tc.desc : Modify asset
......@@ -252,7 +254,11 @@ describe('file.promise.test.js', function () {
it('SUB_MEDIA_MEDIALIBRARY_MODIFY_ASSET_PROMISE_002_08', 0, async function (done) {
try {
asset.title = "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii";
var title = "i";
for (var i = 0; i < 120; i++) {
title += "i";
}
asset.title = title;
await asset.commitModify();
console.info('MediaLibraryTest : ASSET_PROMISE modify asset 002_08 success');
expect(false).assertTrue();
......@@ -264,7 +270,7 @@ describe('file.promise.test.js', function () {
done();
});
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GET_ASSET_PROMISE_003
* @tc.name : Get assetList By NoArgsfetchOp
* @tc.desc : Get assetList By NoArgsfetchOp
......@@ -299,7 +305,7 @@ describe('file.promise.test.js', function () {
done();
});
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GET_ASSET_PROMISE_004
* @tc.name : Get assetList By HasArgsfetchOp
* @tc.desc : Get assetList By HasArgsfetchOp
......@@ -396,7 +402,7 @@ describe('file.promise.test.js', function () {
done();
});
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_PROMISE_005
* @tc.name : Open and Close asset
* @tc.desc : Open and Close asset
......@@ -586,7 +592,7 @@ describe('file.promise.test.js', function () {
done();
});
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_AND_TRA_ASSET_PROMISE_006
* @tc.name : Favourite and Trash
* @tc.desc : Favourite and Trash
......@@ -613,8 +619,8 @@ describe('file.promise.test.js', function () {
done();
});
/*
* @tc.number : SUB_MEDIA_MEDIALIBRARY_DIR_ASSET_PROMISE_007
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_007
* @tc.name : Favourite
* @tc.desc : Favourite
* @tc.size : MEDIUM
......@@ -704,10 +710,10 @@ describe('file.promise.test.js', function () {
done();
});
/*
* @tc.number : SUB_MEDIA_MEDIALIBRARY_DELETE_ASSET_PROMISE_008
* @tc.name : Delete asset
* @tc.desc : Delete asset
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_ISFAV_ASSET_PROMISE_008
* @tc.name : Is Favourite
* @tc.desc : Is Favourite
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
......@@ -726,7 +732,7 @@ describe('file.promise.test.js', function () {
done();
});
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_TRA_ASSET_PROMISE_009
* @tc.name : Trash
* @tc.desc : Trash
......@@ -867,7 +873,7 @@ describe('file.promise.test.js', function () {
done();
});
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_ISTRASH_ASSET_PROMISE_0010
* @tc.name : Is trash
* @tc.desc : Is trash
......@@ -889,7 +895,7 @@ describe('file.promise.test.js', function () {
done();
});
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETPUBLICDIRECTORY_PROMISE 0011
* @tc.name : getPublicDirectory
* @tc.desc : getPublicDirectory
......@@ -963,7 +969,7 @@ describe('file.promise.test.js', function () {
done();
});
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_ISDIR_ASSET_PROMISE_0012
* @tc.name : Is Directory
* @tc.desc : Is Directory
......@@ -985,7 +991,7 @@ describe('file.promise.test.js', function () {
done();
});
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_DELETE_ASSET_PROMISE_0013
* @tc.name : Delete asset
* @tc.desc : Delete asset
......@@ -1036,7 +1042,7 @@ describe('file.promise.test.js', function () {
it('SUB_MEDIA_MEDIALIBRARY_DELETE_ASSET_PROMISE_0013_04', 0, async function (done) {
try {
await media.deleteAsset(0.666);
console.info('MediaLibraryTest : ASSET_PROMISE deleteAsset 0014_04 SUCCESS ');
console.info('MediaLibraryTest : ASSET_PROMISE deleteAsset 0013_04 SUCCESS ');
expect(false).assertTrue();
done();
} catch (error) {
......@@ -1060,7 +1066,7 @@ describe('file.promise.test.js', function () {
});
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_RELEASE_PROMISE_0014
* @tc.name : Release
* @tc.desc : Release
......@@ -1069,6 +1075,17 @@ describe('file.promise.test.js', function () {
* @tc.level : Level 0
*/
// it('SUB_MEDIA_MEDIALIBRARY_RELEASE_PROMISE_0014_01', 0, async function (done) {
// try {
// await media.release();
// console.info('MediaLibraryTest : ASSET_PROMISE release 0014_01 SUCCESS ');
// done();
// } catch (error) {
// console.info('MediaLibraryTest : ASSET_PROMISE release 0014_01 file, message = ' + error);
// done();
// }
// });
function getAllObjectInfo(data) {
if (data != undefined) {
console.info('MediaLibraryTest : ASSET_PROMISE id is ' + data.id);
......
......@@ -16,13 +16,13 @@
import mediaLibrary from '@ohos.multimedia.medialibrary';
import featureAbility from '@ohos.ability.featureAbility'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
describe('getAlbumsPerformance.test.js', function () {
var context = featureAbility.getContext();
console.info('MediaLibraryTest : getMediaLibrary IN');
const media = mediaLibrary.getMediaLibrary(context);
var media = mediaLibrary.getMediaLibrary(context);
console.info('MediaLibraryTest : getMediaLibrary OUT');
let times = 25;
......@@ -46,7 +46,7 @@ describe('getAlbumsPerformance.test.js', function () {
console.info('MediaLibraryTest: afterAll');
})
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GET_ALBUMS_PERFORMANCE_01
* @tc.name :
* @tc.desc :
......@@ -60,7 +60,7 @@ describe('getAlbumsPerformance.test.js', function () {
for (let i = 0; i < times; i++) {
const albumArray = await media.getAlbums(AlbumNoArgsfetchOp);
if (albumArray != undefined) {
console.info('MediaLibraryTest : getAlbums : PASS '+ albumArray.length);
console.info('MediaLibraryTest : getAlbums : PASS ' + albumArray.length);
expect(true).assertTrue();
} else {
console.info('MediaLibraryTest : getAlbums : FAIL');
......
......@@ -16,13 +16,13 @@
import mediaLibrary from '@ohos.multimedia.medialibrary';
import featureAbility from '@ohos.ability.featureAbility'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
describe('getFileAssetsPerformance.test.js', function () {
var context = featureAbility.getContext();
console.info('MediaLibraryTest : getMediaLibrary IN');
const media = mediaLibrary.getMediaLibrary(context);
var media = mediaLibrary.getMediaLibrary(context);
console.info('MediaLibraryTest : getMediaLibrary OUT');
let times = 25;
......@@ -31,9 +31,9 @@ describe('getFileAssetsPerformance.test.js', function () {
let fileKeyObj = mediaLibrary.FileKey
let type = mediaLibrary.MediaType.IMAGE
let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + " = ? ",
selectionArgs : [type.toString()],
order : fileKeyObj.DATE_ADDED,
selections: fileKeyObj.MEDIA_TYPE + " = ? ",
selectionArgs: [type.toString()],
order: fileKeyObj.DATE_ADDED,
}
beforeAll(function () {
onsole.info('MediaLibraryTest: beforeAll');
......@@ -49,7 +49,7 @@ describe('getFileAssetsPerformance.test.js', function () {
console.info('MediaLibraryTest: afterAll');
})
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GET_FILE_ASSETS_PERFORMANCE_01
* @tc.name : Create an image file asset in predefined path
* @tc.desc : Create an image file asset in predefined path
......@@ -63,7 +63,7 @@ describe('getFileAssetsPerformance.test.js', function () {
for (let i = 0; i < times; i++) {
const queryResultSet = await media.getFileAssets(fetchOp);
if (queryResultSet != undefined) {
console.info('MediaLibraryTest : getFileAssets : PASS '+ queryResultSet.getCount());
console.info('MediaLibraryTest : getFileAssets : PASS ' + queryResultSet.getCount());
expect(true).assertTrue();
} else {
console.info('MediaLibraryTest : getFileAssets : FAIL');
......
......@@ -16,13 +16,13 @@
import mediaLibrary from '@ohos.multimedia.medialibrary';
import featureAbility from '@ohos.ability.featureAbility'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
describe('getFileAssetsPerformance_object.test.js', function () {
var context = featureAbility.getContext();
console.info('MediaLibraryTest : getMediaLibrary IN');
const media = mediaLibrary.getMediaLibrary(context);
var media = mediaLibrary.getMediaLibrary(context);
console.info('MediaLibraryTest : getMediaLibrary OUT');
let times = 100;
......@@ -31,9 +31,9 @@ describe('getFileAssetsPerformance_object.test.js', function () {
let fileKeyObj = mediaLibrary.FileKey
let type = mediaLibrary.MediaType.IMAGE
let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + " = ? ",
selectionArgs : [type.toString()],
order : fileKeyObj.DATE_ADDED,
selections: fileKeyObj.MEDIA_TYPE + " = ? ",
selectionArgs: [type.toString()],
order: fileKeyObj.DATE_ADDED,
}
beforeAll(function () {
onsole.info('MediaLibraryTest: beforeAll');
......@@ -49,7 +49,7 @@ describe('getFileAssetsPerformance_object.test.js', function () {
console.info('MediaLibraryTest: afterAll');
})
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GET_ALL_OBJECT_PERFORMANCE_01
* @tc.name :
* @tc.desc :
......@@ -69,7 +69,7 @@ describe('getFileAssetsPerformance_object.test.js', function () {
expect(false).assertTrue();
done();
} else {
for(let i = 0; i < 3; i++) {
for (let i = 0; i < 3; i++) {
console.info('MediaLibraryTest : getAllObject begin :times: ' + i);
const data1 = await queryResultSet_.getAllObject();
if (data1 != undefined) {
......@@ -79,14 +79,17 @@ describe('getFileAssetsPerformance_object.test.js', function () {
console.info('MediaLibraryTest : getAllObject :FAIL times: ' + i);
expect(false).assertTrue();
}
console.info('MediaLibraryTest : getAllObject after :times: ' + i);
}
}
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_GET_ALL_OBJECT_PERFORMANCE_01 end');
done();
});
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GET_FIRST_OBJECT_PERFORMANCE_01
* @tc.name :
* @tc.desc :
......@@ -102,7 +105,7 @@ describe('getFileAssetsPerformance_object.test.js', function () {
expect(false).assertTrue();
done();
} else {
for(let i = 0; i < times; i++) {
for (let i = 0; i < times; i++) {
console.info('MediaLibraryTest : getFirstObject begin :times: ' + i);
const fileAsset = await queryResultSet_.getFirstObject();
if (fileAsset != undefined) {
......@@ -112,14 +115,17 @@ describe('getFileAssetsPerformance_object.test.js', function () {
console.info('MediaLibraryTest : getFirstObject :FAIL times: ' + i);
expect(false).assertTrue();
}
console.info('MediaLibraryTest : getFirstObject after :times: ' + i);
}
}
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_GET_FIRST_OBJECT_PERFORMANCE_01 end');
done();
});
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_IS_AFTER_LAST_PERFORMANCE_01
* @tc.name :
* @tc.desc :
......@@ -135,10 +141,11 @@ describe('getFileAssetsPerformance_object.test.js', function () {
expect(false).assertTrue();
done();
} else {
for(let i = 0; i < times; i++) {
for (let i = 0; i < times; i++) {
console.info('MediaLibraryTest : isAfterLast begin :times: ' + i);
const isAfterLastBool = queryResultSet_.isAfterLast();
expect(!isAfterLastBool).assertTrue();
console.info('MediaLibraryTest : isAfterLast after :times: ' + i);
}
}
......@@ -146,7 +153,7 @@ describe('getFileAssetsPerformance_object.test.js', function () {
done();
});
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GET_LAST_OBJECT_PERFORMANCE_01
* @tc.name :
* @tc.desc :
......@@ -162,7 +169,7 @@ describe('getFileAssetsPerformance_object.test.js', function () {
expect(false).assertTrue();
done();
} else {
for(let i = 0; i < times; i++) {
for (let i = 0; i < times; i++) {
console.info('MediaLibraryTest : getLastObject begin :times: ' + i);
const fileAsset = await queryResultSet_.getLastObject();
if (fileAsset != undefined) {
......@@ -172,14 +179,17 @@ describe('getFileAssetsPerformance_object.test.js', function () {
console.info('MediaLibraryTest : getLastObject :FAIL times: ' + i);
expect(false).assertTrue();
}
console.info('MediaLibraryTest : getLastObject after :times: ' + i);
}
}
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_GET_LAST_OBJECT_PERFORMANCE_01 end');
done();
});
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GET_POSITION_OBJECT_PERFORMANCE_01
* @tc.name :
* @tc.desc :
......@@ -195,7 +205,7 @@ describe('getFileAssetsPerformance_object.test.js', function () {
expect(false).assertTrue();
done();
} else {
for(let i = 0; i < times; i++) {
for (let i = 0; i < times; i++) {
console.info('MediaLibraryTest : getPositionObject begin :times: ' + i);
const fileAsset = await queryResultSet_.getPositionObject(i);
if (fileAsset != undefined) {
......@@ -205,14 +215,17 @@ describe('getFileAssetsPerformance_object.test.js', function () {
console.info('MediaLibraryTest : getPositionObject :FAIL times: ' + i);
expect(false).assertTrue();
}
console.info('MediaLibraryTest : getPositionObject after :times: ' + i);
}
}
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_GET_POSITION_OBJECT_PERFORMANCE_01 end');
done();
});
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GET_NEXT_OBJECT_PERFORMANCE_01
* @tc.name :
* @tc.desc :
......@@ -231,7 +244,7 @@ describe('getFileAssetsPerformance_object.test.js', function () {
expect(false).assertTrue();
done();
} else {
for(let i = 0; i < times; i++) {
for (let i = 0; i < times; i++) {
console.info('MediaLibraryTest : getNextObject begin :times: ' + i);
const fileAsset = await queryResultSet.getNextObject();
if (fileAsset != undefined) {
......@@ -242,9 +255,12 @@ describe('getFileAssetsPerformance_object.test.js', function () {
console.info('MediaLibraryTest : getNextObject :FAIL times: ' + i);
expect(false).assertTrue();
}
console.info('MediaLibraryTest : getNextObject after :times: ' + i);
}
}
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_GET_NEXT_OBJECT_PERFORMANCE_01 end');
done();
});
......
......@@ -16,13 +16,13 @@
import mediaLibrary from '@ohos.multimedia.medialibrary';
import featureAbility from '@ohos.ability.featureAbility'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
describe('getPrivateAlbumsPerformance.test.js', function () {
var context = featureAbility.getContext();
console.info('MediaLibraryTest : getMediaLibrary IN');
const media = mediaLibrary.getMediaLibrary(context);
var media = mediaLibrary.getMediaLibrary(context);
console.info('MediaLibraryTest : getMediaLibrary OUT');
let times = 50;
......@@ -41,7 +41,7 @@ describe('getPrivateAlbumsPerformance.test.js', function () {
console.info('MediaLibraryTest: afterAll');
})
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GET_ALBUMS_PERFORMANCE_01
* @tc.name :
* @tc.desc :
......@@ -55,7 +55,7 @@ describe('getPrivateAlbumsPerformance.test.js', function () {
for (let i = 0; i < times; i++) {
const albums = await media.getPrivateAlbum(mediaLibrary.PrivateAlbumType.TYPE_TRASH);
if (albums != undefined) {
console.info('MediaLibraryTest : getAlbums : PASS '+ albums[0].albumName);
console.info('MediaLibraryTest : getAlbums : PASS ' + albums[0].albumName);
expect(true).assertTrue();
} else {
console.info('MediaLibraryTest : getAlbums : FAIL');
......
......@@ -16,13 +16,13 @@
import mediaLibrary from '@ohos.multimedia.medialibrary';
import featureAbility from '@ohos.ability.featureAbility'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
describe('smartAlbumOperatePerformance_object.test.js', async function () {
var context = featureAbility.getContext();
console.info('MediaLibraryTest : getMediaLibrary IN');
const media = mediaLibrary.getMediaLibrary(context);
var media = mediaLibrary.getMediaLibrary(context);
console.info('MediaLibraryTest : getMediaLibrary OUT');
let times = 50;
......@@ -41,7 +41,7 @@ describe('smartAlbumOperatePerformance_object.test.js', async function () {
console.info('MediaLibraryTest: afterAll');
})
/*
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_CREATE_SMARTALBUM_PERFORMANCE_01
* @tc.name :
* @tc.desc :
......@@ -52,7 +52,7 @@ describe('smartAlbumOperatePerformance_object.test.js', async function () {
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_CREATE_SMARTALBUM_PERFORMANCE_01 begin');
it('SUB_MEDIA_MEDIALIBRARY_CREATE_SMARTALBUM_PERFORMANCE_01', 0, async function (done) {
for(let i = 0; i < times; i++) {
for (let i = 0; i < times; i++) {
console.info('MediaLibraryTest : createSmartAlbum begin :times: ' + i);
const smartAlbum = await media.createSmartAlbum("laoxu886");
if (smartAlbum != undefined) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册