diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/Test.json b/multimedia/medialibrary/mediaLibrary_js_standard/Test.json index 29048639449896c82cc171fc706e42fa7ff8a6b9..01afeee3b21172287d2f5cbe9eb7662508026747 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/Test.json +++ b/multimedia/medialibrary/mediaLibrary_js_standard/Test.json @@ -17,7 +17,7 @@ { "type": "ShellKit", "run-command": [ - "chmod -R 666 /data/media/*", + "chmod -R 777 /storage/media/*", "setenforce 0" ], "teardown-command":[ diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/config.json b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/config.json index 62af78752f3dd05437a25b144db31fd13a773a98..fa910537386a17d6153f3db9638a7f1e4e5981c5 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/config.json +++ b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/config.json @@ -43,6 +43,12 @@ "launchType": "standard" } ], + "reqPermissions": [ + { + "name": "ohos.permission.GET_BUNDLE_INFO", + "reason": "request permission" + } + ], "deviceType": [ "phone", "tablet", diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/FileAssetGetThumbnail.js b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/FileAssetGetThumbnail.js index 06e8db91f77d64a7128a991699e3af23bd010d88..ccb44bc96fa5510db021a35a7e902b486db7a660 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/FileAssetGetThumbnail.js +++ b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/FileAssetGetThumbnail.js @@ -1,255 +1,269 @@ +/* + * 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.'); - -}) - -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(); - }); + 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 + + // 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.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) => { + 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(); } }); - } 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(); - }); + }) + + 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(); } }); - } 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(); - }); + }) + + 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(); } }); - } 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(); - }); + }) + + 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(); } }); - } 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(); - }); + }) + + 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(); } }); - } 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(); - }); + }) + + 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(); } }); - } else { - console.info('MediaLibraryTest : getFileAssets Unsuccessfull '+ error.message); - console.info('MediaLibraryTest : getFileAssets :FAIL'); - expect(false).assertTrue(); - done(); - } -}); -}) + }) }) \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/albumTestCallBack.test.js b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/albumTestCallBack.test.js index c9fc30bf94fab9c95d2cb823323cc7720a15d982..d0c0835707a8a176bcc44ef78fb19fcffda95700 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/albumTestCallBack.test.js +++ b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/albumTestCallBack.test.js @@ -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 @@ -163,4 +164,4 @@ describe('album.callback.test.js', function () { } } -}) +}) \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/albumTestPromise.test.js b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/albumTestPromise.test.js index fe207bd447c9fd41527ac954cc3aad0a9c22d1e3..07d0e9900eb815695036a13abf9b2e67dd857304 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/albumTestPromise.test.js +++ b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/albumTestPromise.test.js @@ -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 @@ -389,4 +390,4 @@ describe('album.promise.test.js', function () { } }); } -}) +}) \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/createFileAssets.test.js b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/createFileAssets.test.js index 43dfb42103317aae90d7084cda0a2dcce51e062f..0803af5642ccd304f03ce8c4c8bc4168c6803861 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/createFileAssets.test.js +++ b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/createFileAssets.test.js @@ -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) => { @@ -266,4 +270,4 @@ describe('Create_File_Assets.test.js', function () { }); console.info("==========================fileAsset.open end=======================>"); } -}); +}); \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/createFileAssetsPerformance.test.js b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/createFileAssetsPerformance.test.js index f08102c53b2f5bea4546e3074e883d43b889ec7b..c274ebebbad6190db75462d9e597c87d6290e92f 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/createFileAssetsPerformance.test.js +++ b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/createFileAssetsPerformance.test.js @@ -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(); } @@ -93,4 +93,4 @@ describe('createFileAssetsPerformance.test.js', function () { } }); console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_CREATE_FILE_PERFORMANCE_01 end'); -}); +}); \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/deleteFileAssetsPerformance.test.js b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/deleteFileAssetsPerformance.test.js index 3ef6275fd9272d38ade3a76d31d812c7db24a709..235bd2e3faad65f1d4d0ceaa437436bf4ecb9003 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/deleteFileAssetsPerformance.test.js +++ b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/deleteFileAssetsPerformance.test.js @@ -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(); @@ -136,4 +136,4 @@ describe('deleteFileAssetsPerformance.test.js', function () { } }); console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_DELETE_FILE_PERFORMANCE_01 end'); -}); +}); \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/favTestCallBack.test.js b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/favTestCallBack.test.js index 6fdaf528cb3ced9676858b7a54b370e7f8c5ead0..e20d07f49c45e84c1d7c7b34d8ceb1c5a7ade2e7 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/favTestCallBack.test.js +++ b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/favTestCallBack.test.js @@ -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 { @@ -114,4 +115,4 @@ describe('favSmartAlbum.promise.test.js', function () { done(); } } -}) +}) \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/favTestPromise.test.js b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/favTestPromise.test.js index 9958b8fd555f61564d33eddddb9dc8ad6685fbc9..3287b9d938df15f6e5470941a1ad46cf69775707 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/favTestPromise.test.js +++ b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/favTestPromise.test.js @@ -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 @@ -140,8 +141,8 @@ describe('favSmartAlbum.promise.test.js', function () { done(); } }); - - /* + + /** * @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 @@ -310,4 +311,4 @@ describe('favSmartAlbum.promise.test.js', function () { done(); } }); -}) +}) \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/fileTestCallBack.test.js b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/fileTestCallBack.test.js index 8c85a5ddc824e8c2b7640b0120b420d75b5f04cf..11d5fe3e311f7de69f32625f56529da597b41d72 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/fileTestCallBack.test.js +++ b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/fileTestCallBack.test.js @@ -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,9 +351,9 @@ describe('file.callback.test.js', function () { } }); - /* + /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRASH_ASSET_CALLBACK_008 - * @tc.name : Trash + * @tc.name : Trash * @tc.desc : Trash * @tc.size : MEDIUM * @tc.type : Function @@ -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(); @@ -799,4 +801,4 @@ describe('file.callback.test.js', function () { } } -}) +}) \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/fileTestPromise.test.js b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/fileTestPromise.test.js index 0f82e0f11bb4cdf86618959cfde324e6c5a3b6ae..4febdc629a4f5ed0769c19437db139b3c26ed855 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/fileTestPromise.test.js +++ b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/fileTestPromise.test.js @@ -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 @@ -298,8 +304,8 @@ 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 @@ -307,7 +313,7 @@ describe('file.promise.test.js', function () { * @tc.type : Function * @tc.level : Level 0 */ - + it('SUB_MEDIA_MEDIALIBRARY_GET_ASSET_PROMISE_004_01', 0, async function (done) { try { let fetchFileResult = await media.getFileAssets(fileHasArgsfetchOp); @@ -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 @@ -504,8 +510,8 @@ describe('file.promise.test.js', function () { console.info('MediaLibraryTest : ASSET_PROMISE close 005_05 success'); expect(false).assertTrue(); } catch (error) { - console.info('MediaLibraryTest : ASSET_PROMISE close 005_05 fail, message = ' + error); - expect(true).assertTrue(); + console.info('MediaLibraryTest : ASSET_PROMISE close 005_05 fail, message = ' + error); + expect(true).assertTrue(); } done(); }); @@ -516,15 +522,15 @@ describe('file.promise.test.js', function () { fd = await asset.open('Rw'); console.info('MediaLibraryTest : ASSET_PROMISE open 005_06 success, fd = ' + fd); } catch (error) { - console.info('MediaLibraryTest : ASSET_PROMISE open 005_06 fail, message = ' + error); + console.info('MediaLibraryTest : ASSET_PROMISE open 005_06 fail, message = ' + error); } try { asset.close(-1); console.info('MediaLibraryTest : ASSET_PROMISE close 005_06 success'); expect(false).assertTrue(); } catch (error) { - console.info('MediaLibraryTest : ASSET_PROMISE close 005_06 fail, message = ' + error); - expect(true).assertTrue(); + console.info('MediaLibraryTest : ASSET_PROMISE close 005_06 fail, message = ' + error); + expect(true).assertTrue(); } done(); }); @@ -535,15 +541,15 @@ describe('file.promise.test.js', function () { fd = await asset.open('Rw'); console.info('MediaLibraryTest : ASSET_PROMISE open 005_07 success, fd = ' + fd); } catch (error) { - console.info('MediaLibraryTest : ASSET_PROMISE open 005_005_0705 fail, message = ' + error); + console.info('MediaLibraryTest : ASSET_PROMISE open 005_005_0705 fail, message = ' + error); } try { asset.close(0); console.info('MediaLibraryTest : ASSET_PROMISE close 005_07 success'); expect(false).assertTrue(); } catch (error) { - console.info('MediaLibraryTest : ASSET_PROMISE close 005_07 fail, message = ' + error); - expect(true).assertTrue(); + console.info('MediaLibraryTest : ASSET_PROMISE close 005_07 fail, message = ' + error); + expect(true).assertTrue(); } done(); }); @@ -554,15 +560,15 @@ describe('file.promise.test.js', function () { fd = await asset.open('Rw'); console.info('MediaLibraryTest : ASSET_PROMISE open 005_08 success, fd = ' + fd); } catch (error) { - console.info('MediaLibraryTest : ASSET_PROMISE open 005_08 fail, message = ' + error); + console.info('MediaLibraryTest : ASSET_PROMISE open 005_08 fail, message = ' + error); } try { asset.close("666"); console.info('MediaLibraryTest : ASSET_PROMISE close 005_08 success'); expect(false).assertTrue(); } catch (error) { - console.info('MediaLibraryTest : ASSET_PROMISE close 005_08 fail, message = ' + error); - expect(true).assertTrue(); + console.info('MediaLibraryTest : ASSET_PROMISE close 005_08 fail, message = ' + error); + expect(true).assertTrue(); } done(); }); @@ -573,22 +579,22 @@ describe('file.promise.test.js', function () { fd = await asset.open('Rw'); console.info('MediaLibraryTest : ASSET_PROMISE open 005_09 success, fd = ' + fd); } catch (error) { - console.info('MediaLibraryTest : ASSET_PROMISE open 005_09 fail, message = ' + error); + console.info('MediaLibraryTest : ASSET_PROMISE open 005_09 fail, message = ' + error); } try { asset.close(); console.info('MediaLibraryTest : ASSET_PROMISE close 005_09 success'); expect(false).assertTrue(); } catch (error) { - console.info('MediaLibraryTest : ASSET_PROMISE close 005_09 fail, message = ' + error); - expect(true).assertTrue(); + console.info('MediaLibraryTest : ASSET_PROMISE close 005_09 fail, message = ' + error); + expect(true).assertTrue(); } done(); }); - /* + /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_AND_TRA_ASSET_PROMISE_006 - * @tc.name : Favourite and Trash + * @tc.name : Favourite and Trash * @tc.desc : Favourite and Trash * @tc.size : MEDIUM * @tc.type : Function @@ -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 @@ -629,10 +635,10 @@ describe('file.promise.test.js', function () { expect(true).assertTrue(); } catch (error) { console.info('MediaLibraryTest : ASSET_PROMISE close 007_03 fail, message = ' + error); - expect(false).assertTrue(); + expect(false).assertTrue(); } let isFavoriteChange = await asset.isFavorite(); - console.info('MediaLibraryTest : ASSET_PROMISE isFavoriteChange 007_03 = ' + isFavoriteChange); + console.info('MediaLibraryTest : ASSET_PROMISE isFavoriteChange 007_03 = ' + isFavoriteChange); done(); }); it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_007_02', 0, async function (done) { @@ -642,10 +648,10 @@ describe('file.promise.test.js', function () { expect(true).assertTrue(); } catch (error) { console.info('MediaLibraryTest : ASSET_PROMISE close 007_02 fail, message = ' + error); - expect(false).assertTrue(); + expect(false).assertTrue(); } let isFavoriteChange = await asset.isFavorite(); - console.info('MediaLibraryTest : ASSET_PROMISE isFavoriteChange 007_02 = ' + isFavoriteChange); + console.info('MediaLibraryTest : ASSET_PROMISE isFavoriteChange 007_02 = ' + isFavoriteChange); done(); }); it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_007_03', 0, async function (done) { @@ -655,10 +661,10 @@ describe('file.promise.test.js', function () { expect(false).assertTrue(); } catch (error) { console.info('MediaLibraryTest : ASSET_PROMISE close 007_03 fail, message = ' + error); - expect(true).assertTrue(); + expect(true).assertTrue(); } let isFavoriteChange = await asset.isFavorite(); - console.info('MediaLibraryTest : ASSET_PROMISE isFavoriteChange 007_03 = ' + isFavoriteChange); + console.info('MediaLibraryTest : ASSET_PROMISE isFavoriteChange 007_03 = ' + isFavoriteChange); done(); }); @@ -672,7 +678,7 @@ describe('file.promise.test.js', function () { expect(true).assertTrue(); } let isFavoriteChange = await asset.isFavorite(); - console.info('MediaLibraryTest : ASSET_PROMISE isFavoriteChange 007_04 = ' + isFavoriteChange); + console.info('MediaLibraryTest : ASSET_PROMISE isFavoriteChange 007_04 = ' + isFavoriteChange); done(); }); @@ -682,11 +688,11 @@ describe('file.promise.test.js', function () { console.info('MediaLibraryTest : ASSET_PROMISE favorite 007_05 success'); expect(false).assertTrue(); } catch (error) { - console.info('MediaLibraryTest : ASSET_PROMISE close 007_05 fail, message = ' + error); - expect(true).assertTrue(); + console.info('MediaLibraryTest : ASSET_PROMISE close 007_05 fail, message = ' + error); + expect(true).assertTrue(); } let isFavoriteChange = await asset.isFavorite(); - console.info('MediaLibraryTest : ASSET_PROMISE isFavoriteChange 007_05 = ' + isFavoriteChange); + console.info('MediaLibraryTest : ASSET_PROMISE isFavoriteChange 007_05 = ' + isFavoriteChange); done(); }); @@ -696,18 +702,18 @@ describe('file.promise.test.js', function () { console.info('MediaLibraryTest : ASSET_PROMISE favorite 007_06 success'); expect(false).assertTrue(); } catch (error) { - console.info('MediaLibraryTest : ASSET_PROMISE close 007_06 fail, message = ' + error); - expect(true).assertTrue(); + console.info('MediaLibraryTest : ASSET_PROMISE close 007_06 fail, message = ' + error); + expect(true).assertTrue(); } let isFavoriteChange = await asset.isFavorite(); console.info('MediaLibraryTest : ASSET_PROMISE isFavoriteChange 007_06 = ' + isFavoriteChange); 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 @@ -725,10 +731,10 @@ describe('file.promise.test.js', function () { } done(); }); - - /* + + /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRA_ASSET_PROMISE_009 - * @tc.name : Trash + * @tc.name : Trash * @tc.desc : Trash * @tc.size : MEDIUM * @tc.type : Function @@ -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); @@ -1097,4 +1114,4 @@ describe('file.promise.test.js', function () { } }); } -}) +}) \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/getAlbumsPerformance.test.js b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/getAlbumsPerformance.test.js index c59012c4e8d1e1f2920f49dd1cec9d40ab14623d..baefb1da3c49e6368dc4e9f6e8ad755c403173f8 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/getAlbumsPerformance.test.js +++ b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/getAlbumsPerformance.test.js @@ -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'); @@ -71,4 +71,4 @@ describe('getAlbumsPerformance.test.js', function () { done(); }); console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_GET_ALBUMS_PERFORMANCE_01 end'); -}); +}); \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/getFileAssetsPerformance.test.js b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/getFileAssetsPerformance.test.js index 73d4848f6be98ecf4ceeb9b136d8010ab92bfab1..1a87a92686976630b504564fd9892f8679a11ebb 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/getFileAssetsPerformance.test.js +++ b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/getFileAssetsPerformance.test.js @@ -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'); @@ -74,4 +74,4 @@ describe('getFileAssetsPerformance.test.js', function () { done(); }); console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_GET_FILE_ASSETS_PERFORMANCE_01 end'); -}); +}); \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/getFileAssetsPerformance_object.test.js b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/getFileAssetsPerformance_object.test.js index b9539f8c205e14fd91c18e705406335b810c6365..5df5e6bd9ac37d7a661dd7ade596adcd15e579d0 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/getFileAssetsPerformance_object.test.js +++ b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/getFileAssetsPerformance_object.test.js @@ -16,29 +16,29 @@ 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; let queryResultSet_; 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'); }) - + beforeEach(function () { console.info('MediaLibraryTest: beforeEach'); }) @@ -48,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'); @@ -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,10 +255,13 @@ 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(); }); -}); +}); \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/getPrivateAlbumsPerformance.test.js b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/getPrivateAlbumsPerformance.test.js index 7d1d67b9b111290d3e800e76e8cd49d168603ecf..767820f0a01e685793fca83c8ec073f65e069048 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/getPrivateAlbumsPerformance.test.js +++ b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/getPrivateAlbumsPerformance.test.js @@ -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'); @@ -66,4 +66,4 @@ describe('getPrivateAlbumsPerformance.test.js', function () { done(); }); console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_GET_ALBUMS_PERFORMANCE_01 end'); -}); +}); \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/smartAlbumOperatePerformance_object.test.js b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/smartAlbumOperatePerformance_object.test.js index 0140f18e2d3c780442e13e66f9e0891860c23608..0c41b61da97672d065255dc470324349cdb7d626 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/smartAlbumOperatePerformance_object.test.js +++ b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/smartAlbumOperatePerformance_object.test.js @@ -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) { @@ -68,4 +68,4 @@ describe('smartAlbumOperatePerformance_object.test.js', async function () { console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_CREATE_SMARTALBUM_PERFORMANCE_01 end'); done(); }); -}); +}); \ No newline at end of file