提交 0f7b47fa 编写于 作者: L lxq

<liuxueqi3@huawei.com>

Signed-off-by: Nlxq <liuxueqi3@huawei.com>
上级 1b448192
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
"type": "ShellKit", "type": "ShellKit",
"run-command": [ "run-command": [
"mkdir /data/accounts/account_0/appdata/image", "mkdir /data/accounts/account_0/appdata/image",
"chmod -R 666 /data/media/*",
"chmod -R 666 /data/accounts/account_0/appdata/image/*" "chmod -R 666 /data/accounts/account_0/appdata/image/*"
], ],
"teardown-command":[ "teardown-command":[
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import mediaLibrary from '@ohos.multimedia.medialibrary'; import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import image from '@ohos.multimedia.image'; import image from '@ohos.multimedia.image';
import featureAbility from '@ohos.ability.featureAbility'; import featureAbility from '@ohos.ability.featureAbility';
...@@ -29,19 +29,19 @@ describe('FileAssetGetThumbnailPromise.test.js', function () { ...@@ -29,19 +29,19 @@ describe('FileAssetGetThumbnailPromise.test.js', function () {
let videoType = mediaLibrary.MediaType.VIDEO; let videoType = mediaLibrary.MediaType.VIDEO;
let audioType = mediaLibrary.MediaType.AUDIO; let audioType = mediaLibrary.MediaType.AUDIO;
let imageFetchOp = { let imageFetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '=?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '=?',
selectionArgs: [imagetype.toString()], selectionArgs: [imagetype.toString()],
order: fileKeyObj.DATE_ADDED, order: mediaLibrary.FileKey.DATE_ADDED,
}; };
let videoFetchOp = { let videoFetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '=?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '=?',
selectionArgs: [videoType.toString()], selectionArgs: [videoType.toString()],
order: fileKeyObj.DATE_ADDED, order: mediaLibrary.FileKey.DATE_ADDED,
}; };
let audioFetchOp = { let audioFetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '=?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '=?',
selectionArgs: [audioType.toString()], selectionArgs: [audioType.toString()],
order: fileKeyObj.DATE_ADDED, order: mediaLibrary.FileKey.DATE_ADDED,
}; };
beforeAll(function () {}); beforeAll(function () {});
beforeEach(function () {}); beforeEach(function () {});
......
...@@ -29,19 +29,19 @@ describe('FileAssetGetThumbnailPromise.test.js', function () { ...@@ -29,19 +29,19 @@ describe('FileAssetGetThumbnailPromise.test.js', function () {
let videoType = mediaLibrary.MediaType.VIDEO; let videoType = mediaLibrary.MediaType.VIDEO;
let audioType = mediaLibrary.MediaType.AUDIO; let audioType = mediaLibrary.MediaType.AUDIO;
let imageFetchOp = { let imageFetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '=?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '=?',
selectionArgs: [imagetype.toString()], selectionArgs: [imagetype.toString()],
order: fileKeyObj.DATE_ADDED, order: mediaLibrary.FileKey.DATE_ADDED,
}; };
let videoFetchOp = { let videoFetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '=?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '=?',
selectionArgs: [videoType.toString()], selectionArgs: [videoType.toString()],
order: fileKeyObj.DATE_ADDED, order: mediaLibrary.FileKey.DATE_ADDED,
}; };
let audioFetchOp = { let audioFetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '=?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '=?',
selectionArgs: [audioType.toString()], selectionArgs: [audioType.toString()],
order: fileKeyObj.DATE_ADDED, order: mediaLibrary.FileKey.DATE_ADDED,
}; };
beforeAll(function () {}); beforeAll(function () {});
beforeEach(function () {}); beforeEach(function () {});
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import mediaLibrary from '@ohos.multimedia.medialibrary'; import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import featureAbility from '@ohos.ability.featureAbility'; 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';
...@@ -77,7 +77,7 @@ describe('albumGetFileAssetsCallback.test.js', async function() { ...@@ -77,7 +77,7 @@ describe('albumGetFileAssetsCallback.test.js', async function() {
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_02', 0, async function(done) { it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_02', 0, async function(done) {
try { try {
let imageAlbumfetchOp = { let imageAlbumfetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ imageType.toString() ], selectionArgs : [ imageType.toString() ],
order : 'date_added DESC LIMIT 0,3', order : 'date_added DESC LIMIT 0,3',
}; };
...@@ -110,7 +110,7 @@ describe('albumGetFileAssetsCallback.test.js', async function() { ...@@ -110,7 +110,7 @@ describe('albumGetFileAssetsCallback.test.js', async function() {
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_03', 0, async function(done) { it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_03', 0, async function(done) {
try { try {
let audioAlbumfetchOp = { let audioAlbumfetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ audioType.toString() ], selectionArgs : [ audioType.toString() ],
order : 'date_added DESC LIMIT 0,3', order : 'date_added DESC LIMIT 0,3',
}; };
...@@ -142,7 +142,7 @@ describe('albumGetFileAssetsCallback.test.js', async function() { ...@@ -142,7 +142,7 @@ describe('albumGetFileAssetsCallback.test.js', async function() {
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_04', 0, async function(done) { it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_04', 0, async function(done) {
try { try {
let videoAlbumfetchOp = { let videoAlbumfetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ videoType.toString() ], selectionArgs : [ videoType.toString() ],
order : 'date_added DESC LIMIT 0,3', order : 'date_added DESC LIMIT 0,3',
}; };
...@@ -174,7 +174,7 @@ describe('albumGetFileAssetsCallback.test.js', async function() { ...@@ -174,7 +174,7 @@ describe('albumGetFileAssetsCallback.test.js', async function() {
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_05', 0, async function(done) { it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_05', 0, async function(done) {
try { try {
let imageAndVideoAlbumfetchOp = { let imageAndVideoAlbumfetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ? or ' + fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ? or ' + mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ imageType.toString(), videoType.toString() ], selectionArgs : [ imageType.toString(), videoType.toString() ],
order : 'date_added DESC LIMIT 0,3', order : 'date_added DESC LIMIT 0,3',
}; };
...@@ -206,7 +206,7 @@ describe('albumGetFileAssetsCallback.test.js', async function() { ...@@ -206,7 +206,7 @@ describe('albumGetFileAssetsCallback.test.js', async function() {
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_06', 0, async function(done) { it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_06', 0, async function(done) {
try { try {
let imageAndAudioAlbumfetchOp = { let imageAndAudioAlbumfetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ? or ' + fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ? or ' + mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ imageType.toString(), audioType.toString() ], selectionArgs : [ imageType.toString(), audioType.toString() ],
order : 'date_added DESC LIMIT 0,3', order : 'date_added DESC LIMIT 0,3',
}; };
...@@ -238,7 +238,7 @@ describe('albumGetFileAssetsCallback.test.js', async function() { ...@@ -238,7 +238,7 @@ describe('albumGetFileAssetsCallback.test.js', async function() {
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_07', 0, async function(done) { it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_07', 0, async function(done) {
try { try {
let videoAndAudioAlbumfetchOp = { let videoAndAudioAlbumfetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ? or ' + fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ? or ' + mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ videoType.toString(), audioType.toString() ], selectionArgs : [ videoType.toString(), audioType.toString() ],
order : 'date_added DESC LIMIT 0,3', order : 'date_added DESC LIMIT 0,3',
}; };
...@@ -270,8 +270,8 @@ describe('albumGetFileAssetsCallback.test.js', async function() { ...@@ -270,8 +270,8 @@ describe('albumGetFileAssetsCallback.test.js', async function() {
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_08', 0, async function(done) { it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_08', 0, async function(done) {
try { try {
let imgAndVideoAndAudioAlbumfetchOp = { let imgAndVideoAndAudioAlbumfetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ? or ' + fileKeyObj.MEDIA_TYPE + '= ? or ' selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ? or ' + mediaLibrary.FileKey.MEDIA_TYPE + '= ? or '
+ fileKeyObj.MEDIA_TYPE + '= ?', + mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ imageType.toString(), videoType.toString(), audioType.toString() ], selectionArgs : [ imageType.toString(), videoType.toString(), audioType.toString() ],
order : 'date_added DESC LIMIT 0,3', order : 'date_added DESC LIMIT 0,3',
}; };
...@@ -303,7 +303,7 @@ describe('albumGetFileAssetsCallback.test.js', async function() { ...@@ -303,7 +303,7 @@ describe('albumGetFileAssetsCallback.test.js', async function() {
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_09', 0, async function(done) { it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_09', 0, async function(done) {
try { try {
let albumfetchOpOne = { let albumfetchOpOne = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ imageType.toString() ], selectionArgs : [ imageType.toString() ],
order : 'date_added DESC LIMIT 0,1', order : 'date_added DESC LIMIT 0,1',
}; };
...@@ -335,7 +335,7 @@ describe('albumGetFileAssetsCallback.test.js', async function() { ...@@ -335,7 +335,7 @@ describe('albumGetFileAssetsCallback.test.js', async function() {
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_10', 0, async function(done) { it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_10', 0, async function(done) {
try { try {
let albumfetchOpOne = { let albumfetchOpOne = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ audioType.toString() ], selectionArgs : [ audioType.toString() ],
order : 'date_added DESC LIMIT 0,1', order : 'date_added DESC LIMIT 0,1',
}; };
...@@ -367,7 +367,7 @@ describe('albumGetFileAssetsCallback.test.js', async function() { ...@@ -367,7 +367,7 @@ describe('albumGetFileAssetsCallback.test.js', async function() {
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_11', 0, async function(done) { it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_11', 0, async function(done) {
try { try {
let albumfetchOpOne = { let albumfetchOpOne = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ videoType.toString() ], selectionArgs : [ videoType.toString() ],
order : 'date_added DESC LIMIT 0,1', order : 'date_added DESC LIMIT 0,1',
}; };
...@@ -399,7 +399,7 @@ describe('albumGetFileAssetsCallback.test.js', async function() { ...@@ -399,7 +399,7 @@ describe('albumGetFileAssetsCallback.test.js', async function() {
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_12', 0, async function(done) { it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_12', 0, async function(done) {
try { try {
let albumfetchOpNone = { let albumfetchOpNone = {
selections : fileKeyObj.MEDIA_TYPE + '= ? AND date_added < 0', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ? AND date_added < 0',
selectionArgs : [ imageType.toString() ], selectionArgs : [ imageType.toString() ],
order : 'date_added DESC LIMIT 0,1', order : 'date_added DESC LIMIT 0,1',
}; };
...@@ -436,7 +436,7 @@ describe('albumGetFileAssetsCallback.test.js', async function() { ...@@ -436,7 +436,7 @@ describe('albumGetFileAssetsCallback.test.js', async function() {
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_13', 0, async function(done) { it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_13', 0, async function(done) {
try { try {
let albumfetchOpNone = { let albumfetchOpNone = {
selections : fileKeyObj.MEDIA_TYPE + '= ? AND date_added < 0', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ? AND date_added < 0',
selectionArgs : [ audioType.toString() ], selectionArgs : [ audioType.toString() ],
order : 'date_added DESC LIMIT 0,1', order : 'date_added DESC LIMIT 0,1',
}; };
...@@ -473,7 +473,7 @@ describe('albumGetFileAssetsCallback.test.js', async function() { ...@@ -473,7 +473,7 @@ describe('albumGetFileAssetsCallback.test.js', async function() {
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_14', 0, async function(done) { it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_14', 0, async function(done) {
try { try {
let albumfetchOpNone = { let albumfetchOpNone = {
selections : fileKeyObj.MEDIA_TYPE + '= ? AND date_added < 0', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ? AND date_added < 0',
selectionArgs : [ videoType.toString() ], selectionArgs : [ videoType.toString() ],
order : 'date_added DESC LIMIT 0,1', order : 'date_added DESC LIMIT 0,1',
}; };
......
...@@ -70,7 +70,7 @@ describe('albumGetFileAssetsPromise.test.js', async function() { ...@@ -70,7 +70,7 @@ describe('albumGetFileAssetsPromise.test.js', async function() {
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_02', 0, async function(done) { it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_02', 0, async function(done) {
try { try {
let imageAlbumfetchOp = { let imageAlbumfetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ imageType.toString() ], selectionArgs : [ imageType.toString() ],
order : 'date_added DESC LIMIT 0,3', order : 'date_added DESC LIMIT 0,3',
}; };
...@@ -96,7 +96,7 @@ describe('albumGetFileAssetsPromise.test.js', async function() { ...@@ -96,7 +96,7 @@ describe('albumGetFileAssetsPromise.test.js', async function() {
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_03', 0, async function(done) { it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_03', 0, async function(done) {
try { try {
let audioAlbumfetchOp = { let audioAlbumfetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ audioType.toString() ], selectionArgs : [ audioType.toString() ],
order : 'date_added DESC LIMIT 0,3', order : 'date_added DESC LIMIT 0,3',
}; };
...@@ -122,7 +122,7 @@ describe('albumGetFileAssetsPromise.test.js', async function() { ...@@ -122,7 +122,7 @@ describe('albumGetFileAssetsPromise.test.js', async function() {
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_04', 0, async function(done) { it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_04', 0, async function(done) {
try { try {
let videoAlbumfetchOp = { let videoAlbumfetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ videoType.toString() ], selectionArgs : [ videoType.toString() ],
order : 'date_added DESC LIMIT 0,3', order : 'date_added DESC LIMIT 0,3',
}; };
...@@ -148,7 +148,7 @@ describe('albumGetFileAssetsPromise.test.js', async function() { ...@@ -148,7 +148,7 @@ describe('albumGetFileAssetsPromise.test.js', async function() {
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_05', 0, async function(done) { it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_05', 0, async function(done) {
try { try {
let imageAndVideoAlbumfetchOp = { let imageAndVideoAlbumfetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ? or ' + fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ? or ' + mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ imageType.toString(), videoType.toString() ], selectionArgs : [ imageType.toString(), videoType.toString() ],
order : 'date_added DESC LIMIT 0,3', order : 'date_added DESC LIMIT 0,3',
}; };
...@@ -174,7 +174,7 @@ describe('albumGetFileAssetsPromise.test.js', async function() { ...@@ -174,7 +174,7 @@ describe('albumGetFileAssetsPromise.test.js', async function() {
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_06', 0, async function(done) { it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_06', 0, async function(done) {
try { try {
let imageAndAudioAlbumfetchOp = { let imageAndAudioAlbumfetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ? or ' + fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ? or ' + mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ imageType.toString(), audioType.toString() ], selectionArgs : [ imageType.toString(), audioType.toString() ],
order : 'date_added DESC LIMIT 0,3', order : 'date_added DESC LIMIT 0,3',
}; };
...@@ -200,7 +200,7 @@ describe('albumGetFileAssetsPromise.test.js', async function() { ...@@ -200,7 +200,7 @@ describe('albumGetFileAssetsPromise.test.js', async function() {
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_07', 0, async function(done) { it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_07', 0, async function(done) {
try { try {
let videoAndAudioAlbumfetchOp = { let videoAndAudioAlbumfetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ? or ' + fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ? or ' + mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ videoType.toString(), audioType.toString() ], selectionArgs : [ videoType.toString(), audioType.toString() ],
order : 'date_added DESC LIMIT 0,3', order : 'date_added DESC LIMIT 0,3',
}; };
...@@ -226,8 +226,8 @@ describe('albumGetFileAssetsPromise.test.js', async function() { ...@@ -226,8 +226,8 @@ describe('albumGetFileAssetsPromise.test.js', async function() {
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_08', 0, async function(done) { it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_08', 0, async function(done) {
try { try {
let imgAndVideoAndAudioAlbumfetchOp = { let imgAndVideoAndAudioAlbumfetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ? or ' + fileKeyObj.MEDIA_TYPE + '= ? or ' selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ? or ' + mediaLibrary.FileKey.MEDIA_TYPE + '= ? or '
+ fileKeyObj.MEDIA_TYPE + '= ?', + mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ imageType.toString(), videoType.toString(), audioType.toString() ], selectionArgs : [ imageType.toString(), videoType.toString(), audioType.toString() ],
order : 'date_added DESC LIMIT 0,3', order : 'date_added DESC LIMIT 0,3',
}; };
...@@ -253,7 +253,7 @@ describe('albumGetFileAssetsPromise.test.js', async function() { ...@@ -253,7 +253,7 @@ describe('albumGetFileAssetsPromise.test.js', async function() {
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_09', 0, async function(done) { it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_09', 0, async function(done) {
try { try {
let albumfetchOpOne = { let albumfetchOpOne = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ imageType.toString() ], selectionArgs : [ imageType.toString() ],
order : 'date_added DESC LIMIT 0,1', order : 'date_added DESC LIMIT 0,1',
}; };
...@@ -279,7 +279,7 @@ describe('albumGetFileAssetsPromise.test.js', async function() { ...@@ -279,7 +279,7 @@ describe('albumGetFileAssetsPromise.test.js', async function() {
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_10', 0, async function(done) { it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_10', 0, async function(done) {
try { try {
let albumfetchOpOne = { let albumfetchOpOne = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ audioType.toString() ], selectionArgs : [ audioType.toString() ],
order : 'date_added DESC LIMIT 0,1', order : 'date_added DESC LIMIT 0,1',
}; };
...@@ -305,7 +305,7 @@ describe('albumGetFileAssetsPromise.test.js', async function() { ...@@ -305,7 +305,7 @@ describe('albumGetFileAssetsPromise.test.js', async function() {
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_11', 0, async function(done) { it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_11', 0, async function(done) {
try { try {
let albumfetchOpOne = { let albumfetchOpOne = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ videoType.toString() ], selectionArgs : [ videoType.toString() ],
order : 'date_added DESC LIMIT 0,1', order : 'date_added DESC LIMIT 0,1',
}; };
...@@ -331,7 +331,7 @@ describe('albumGetFileAssetsPromise.test.js', async function() { ...@@ -331,7 +331,7 @@ describe('albumGetFileAssetsPromise.test.js', async function() {
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_12', 0, async function(done) { it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_12', 0, async function(done) {
try { try {
let albumfetchOpNone = { let albumfetchOpNone = {
selections : fileKeyObj.MEDIA_TYPE + '= ? AND date_added < 0', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ? AND date_added < 0',
selectionArgs : [ imageType.toString() ], selectionArgs : [ imageType.toString() ],
order : 'date_added DESC LIMIT 0,1', order : 'date_added DESC LIMIT 0,1',
}; };
...@@ -359,7 +359,7 @@ describe('albumGetFileAssetsPromise.test.js', async function() { ...@@ -359,7 +359,7 @@ describe('albumGetFileAssetsPromise.test.js', async function() {
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_13', 0, async function(done) { it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_13', 0, async function(done) {
try { try {
let albumfetchOpNone = { let albumfetchOpNone = {
selections : fileKeyObj.MEDIA_TYPE + '= ? AND date_added < 0', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ? AND date_added < 0',
selectionArgs : [ audioType.toString() ], selectionArgs : [ audioType.toString() ],
order : 'date_added DESC LIMIT 0,1', order : 'date_added DESC LIMIT 0,1',
}; };
...@@ -387,7 +387,7 @@ describe('albumGetFileAssetsPromise.test.js', async function() { ...@@ -387,7 +387,7 @@ describe('albumGetFileAssetsPromise.test.js', async function() {
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_14', 0, async function(done) { it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_14', 0, async function(done) {
try { try {
let albumfetchOpNone = { let albumfetchOpNone = {
selections : fileKeyObj.MEDIA_TYPE + '= ? AND date_added < 0', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ? AND date_added < 0',
selectionArgs : [ videoType.toString() ], selectionArgs : [ videoType.toString() ],
order : 'date_added DESC LIMIT 0,1', order : 'date_added DESC LIMIT 0,1',
}; };
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import mediaLibrary from '@ohos.multimedia.medialibrary'; import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import featureAbility from '@ohos.ability.featureAbility'; 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';
...@@ -27,35 +27,35 @@ let allTypefetchOp = { ...@@ -27,35 +27,35 @@ let allTypefetchOp = {
selectionArgs: [], selectionArgs: [],
}; };
let albumDeletefetchOp = { let albumDeletefetchOp = {
selections: fileKeyObj.RELATIVE_PATH + '= ? AND ' + fileKeyObj.ALBUM_NAME + '= ?', selections: mediaLibrary.FileKey.RELATIVE_PATH + '= ? AND ' + mediaLibrary.FileKey.ALBUM_NAME + '= ?',
selectionArgs: ['Pictures/','DeleteAlbumCallback'], selectionArgs: ['Pictures/', 'DeleteAlbumCallback'],
}; };
let albumCoverUrifetchOp = { let albumCoverUrifetchOp = {
selections: fileKeyObj.RELATIVE_PATH + '= ? AND ' + fileKeyObj.ALBUM_NAME + '= ?', selections: mediaLibrary.FileKey.RELATIVE_PATH + '= ? AND ' + mediaLibrary.FileKey.ALBUM_NAME + '= ?',
selectionArgs: ['Pictures/','weixin'], selectionArgs: ['Pictures/', 'weixin'],
}; };
let imageAlbumfetchOp = { let imageAlbumfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [imageType.toString()], selectionArgs: [imageType.toString()],
}; };
let videoAlbumfetchOp = { let videoAlbumfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [videoType.toString()], selectionArgs: [videoType.toString()],
}; };
let audioAlbumfetchOp = { let audioAlbumfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [audioType.toString()], selectionArgs: [audioType.toString()],
}; };
let imageAndVideoAlbumfetchOp = { let imageAndVideoAlbumfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ? or ' + fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? or ' + mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [imageType.toString(), videoType.toString()], selectionArgs: [imageType.toString(), videoType.toString()],
}; };
let imageAndAudioAlbumfetchOp = { let imageAndAudioAlbumfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ? or ' + fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? or ' + mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [imageType.toString(), audioType.toString()], selectionArgs: [imageType.toString(), audioType.toString()],
}; };
let videoAndAudioAlbumfetchOp = { let videoAndAudioAlbumfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ? or ' + fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? or ' + mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [videoType.toString(), audioType.toString()], selectionArgs: [videoType.toString(), audioType.toString()],
}; };
function printAlbumMessage(testNum, album) { function printAlbumMessage(testNum, album) {
...@@ -476,7 +476,7 @@ describe('albumTestCallBack.test.js', async function () { ...@@ -476,7 +476,7 @@ describe('albumTestCallBack.test.js', async function () {
*/ */
it('SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_CALLBACK_002_06', 0, async function (done) { it('SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_CALLBACK_002_06', 0, async function (done) {
let fileHasArgsfetchOp3 = { let fileHasArgsfetchOp3 = {
selections: fileKeyObj.MEDIA_TYPE + ' = ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + ' = ?',
selectionArgs: ['666'], selectionArgs: ['666'],
}; };
try { try {
...@@ -803,7 +803,7 @@ describe('albumTestCallBack.test.js', async function () { ...@@ -803,7 +803,7 @@ describe('albumTestCallBack.test.js', async function () {
selectionArgs: [], selectionArgs: [],
order: 'date_added DESC LIMIT 0,1', order: 'date_added DESC LIMIT 0,1',
}; };
media.getAlbums(albumCoverUrifetchOp, async(err, albumList) => { media.getAlbums(albumCoverUrifetchOp, async (err, albumList) => {
if (albumList == undefined) { if (albumList == undefined) {
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
...@@ -821,7 +821,7 @@ describe('albumTestCallBack.test.js', async function () { ...@@ -821,7 +821,7 @@ describe('albumTestCallBack.test.js', async function () {
console.info('ALBUM_CALLBACK getAlbum 004_01 asset.uri = ' + asset.uri); console.info('ALBUM_CALLBACK getAlbum 004_01 asset.uri = ' + asset.uri);
expect(asset.uri == album.coverUri).assertTrue(); expect(asset.uri == album.coverUri).assertTrue();
done(); done();
} }
} }
}); });
} catch (error) { } catch (error) {
......
...@@ -27,35 +27,35 @@ let allTypefetchOp = { ...@@ -27,35 +27,35 @@ let allTypefetchOp = {
selectionArgs: [], selectionArgs: [],
}; };
let albumDeletefetchOp = { let albumDeletefetchOp = {
selections: fileKeyObj.RELATIVE_PATH + '= ? AND ' + fileKeyObj.ALBUM_NAME + '= ?', selections: mediaLibrary.FileKey.RELATIVE_PATH + '= ? AND ' + mediaLibrary.FileKey.ALBUM_NAME + '= ?',
selectionArgs: ['Pictures/','DeleteAlbumPro'], selectionArgs: ['Pictures/', 'DeleteAlbumPro'],
}; };
let albumCoverUrifetchOp = { let albumCoverUrifetchOp = {
selections: fileKeyObj.RELATIVE_PATH + '= ? AND ' + fileKeyObj.ALBUM_NAME + '= ?', selections: mediaLibrary.FileKey.RELATIVE_PATH + '= ? AND ' + mediaLibrary.FileKey.ALBUM_NAME + '= ?',
selectionArgs: ['Pictures/','weixin'], selectionArgs: ['Pictures/', 'weixin'],
}; };
let imageAlbumfetchOp = { let imageAlbumfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [imageType.toString()], selectionArgs: [imageType.toString()],
}; };
let videoAlbumfetchOp = { let videoAlbumfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [videoType.toString()], selectionArgs: [videoType.toString()],
}; };
let audioAlbumfetchOp = { let audioAlbumfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [audioType.toString()], selectionArgs: [audioType.toString()],
}; };
let imageAndVideoAlbumfetchOp = { let imageAndVideoAlbumfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ? or ' + fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? or ' + mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [imageType.toString(), videoType.toString()], selectionArgs: [imageType.toString(), videoType.toString()],
}; };
let imageAndAudioAlbumfetchOp = { let imageAndAudioAlbumfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ? or ' + fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? or ' + mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [imageType.toString(), audioType.toString()], selectionArgs: [imageType.toString(), audioType.toString()],
}; };
let videoAndAudioAlbumfetchOp = { let videoAndAudioAlbumfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ? or ' + fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? or ' + mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [videoType.toString(), audioType.toString()], selectionArgs: [videoType.toString(), audioType.toString()],
}; };
function printAlbumMessage(testNum, album) { function printAlbumMessage(testNum, album) {
...@@ -85,10 +85,10 @@ function checkAlbumAttr(done, album) { ...@@ -85,10 +85,10 @@ function checkAlbumAttr(done, album) {
describe('albumTestPromise.test.js', async function () { describe('albumTestPromise.test.js', async function () {
var context = featureAbility.getContext(); var context = featureAbility.getContext();
var media = mediaLibrary.getMediaLibrary(context); var media = mediaLibrary.getMediaLibrary(context);
beforeAll(function () {}); beforeAll(function () { });
beforeEach(function () {}); beforeEach(function () { });
afterEach(function () {}); afterEach(function () { });
afterAll(function () {}); afterAll(function () { });
// ------------------------------ 001 test start ------------------------- // ------------------------------ 001 test start -------------------------
/** /**
...@@ -394,7 +394,7 @@ describe('albumTestPromise.test.js', async function () { ...@@ -394,7 +394,7 @@ describe('albumTestPromise.test.js', async function () {
*/ */
it('SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_PROMISE_002_06', 0, async function (done) { it('SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_PROMISE_002_06', 0, async function (done) {
let fileHasArgsfetchOp3 = { let fileHasArgsfetchOp3 = {
selections: fileKeyObj.MEDIA_TYPE + ' = ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + ' = ?',
selectionArgs: ['666'], selectionArgs: ['666'],
}; };
try { try {
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import mediaLibrary from '@ohos.multimedia.medialibrary'; import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import featureAbility from '@ohos.ability.featureAbility'; 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';
...@@ -23,19 +23,19 @@ const imageType = mediaLibrary.MediaType.IMAGE; ...@@ -23,19 +23,19 @@ const imageType = mediaLibrary.MediaType.IMAGE;
const videoType = mediaLibrary.MediaType.VIDEO; const videoType = mediaLibrary.MediaType.VIDEO;
const audioType = mediaLibrary.MediaType.AUDIO; const audioType = mediaLibrary.MediaType.AUDIO;
const fileFetchOp = { const fileFetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [fileType.toString()], selectionArgs: [fileType.toString()],
}; };
const imageFetchOp = { const imageFetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [imageType.toString()], selectionArgs: [imageType.toString()],
}; };
const videoFetchOp = { const videoFetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [videoType.toString()], selectionArgs: [videoType.toString()],
}; };
const audioFetchOp = { const audioFetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [audioType.toString()], selectionArgs: [audioType.toString()],
}; };
......
...@@ -23,19 +23,19 @@ const imageType = mediaLibrary.MediaType.IMAGE; ...@@ -23,19 +23,19 @@ const imageType = mediaLibrary.MediaType.IMAGE;
const videoType = mediaLibrary.MediaType.VIDEO; const videoType = mediaLibrary.MediaType.VIDEO;
const audioType = mediaLibrary.MediaType.AUDIO; const audioType = mediaLibrary.MediaType.AUDIO;
const fileFetchOp = { const fileFetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [fileType.toString()], selectionArgs: [fileType.toString()],
}; };
const imageFetchOp = { const imageFetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [imageType.toString()], selectionArgs: [imageType.toString()],
}; };
const videoFetchOp = { const videoFetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [videoType.toString()], selectionArgs: [videoType.toString()],
}; };
const audioFetchOp = { const audioFetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [audioType.toString()], selectionArgs: [audioType.toString()],
}; };
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import mediaLibrary from '@ohos.multimedia.medialibrary'; import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import featureAbility from '@ohos.ability.featureAbility'; 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';
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import mediaLibrary from '@ohos.multimedia.medialibrary'; import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import featureAbility from '@ohos.ability.featureAbility'; 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';
...@@ -24,71 +24,71 @@ let videoType = mediaLibrary.MediaType.VIDEO; ...@@ -24,71 +24,71 @@ let videoType = mediaLibrary.MediaType.VIDEO;
let audioType = mediaLibrary.MediaType.AUDIO; let audioType = mediaLibrary.MediaType.AUDIO;
let getFileCountOneOp = { let getFileCountOneOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ fileType.toString() ], selectionArgs : [ fileType.toString() ],
order : fileKeyObj.DATE_ADDED + " DESC LIMIT 0,1", order : mediaLibrary.FileKey.DATE_ADDED + " DESC LIMIT 0,1",
extendArgs : "",
}; };
let getFileCountTwoOp = { let getFileCountTwoOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ fileType.toString() ], selectionArgs : [ fileType.toString() ],
order : fileKeyObj.DATE_ADDED + " DESC LIMIT 0,2", order : mediaLibrary.FileKey.DATE_ADDED + " DESC LIMIT 0,2",
extendArgs : "",
}; };
let getFileCountTenOp = { let getFileCountTenOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ fileType.toString() ], selectionArgs : [ fileType.toString() ],
order : fileKeyObj.DATE_ADDED + " DESC LIMIT 0,10", order : mediaLibrary.FileKey.DATE_ADDED + " DESC LIMIT 0,10",
extendArgs : "",
}; };
let getFileCountOneHundredOp = { let getFileCountOneHundredOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ fileType.toString() ], selectionArgs : [ fileType.toString() ],
order : fileKeyObj.DATE_ADDED + " DESC LIMIT 0,100", order : mediaLibrary.FileKey.DATE_ADDED + " DESC LIMIT 0,100",
extendArgs : "",
}; };
let getFirstObjectOp = { let getFirstObjectOp = {
selections : fileKeyObj.RELATIVE_PATH + '= ?', selections : mediaLibrary.FileKey.RELATIVE_PATH + '= ?',
selectionArgs : [ 'Camera/' ], selectionArgs : [ 'Camera/' ],
order : fileKeyObj.ID + " DESC LIMIT 0,5", order : mediaLibrary.FileKey.ID + " DESC LIMIT 0,5",
extendArgs : "",
} }
let getAllObjectLimitOneOp = { let getAllObjectLimitOneOp = {
selections : fileKeyObj.RELATIVE_PATH + '= ?', selections : mediaLibrary.FileKey.RELATIVE_PATH + '= ?',
selectionArgs : [ 'Camera/' ], selectionArgs : [ 'Camera/' ],
order : fileKeyObj.ID + " DESC LIMIT 0,1", order : mediaLibrary.FileKey.ID + " DESC LIMIT 0,1",
extendArgs : "",
} }
let getAllObjectLimitTwoOp = { let getAllObjectLimitTwoOp = {
selections : fileKeyObj.RELATIVE_PATH + '= ?', selections : mediaLibrary.FileKey.RELATIVE_PATH + '= ?',
selectionArgs : [ 'Camera/' ], selectionArgs : [ 'Camera/' ],
order : fileKeyObj.ID + " DESC LIMIT 0,1", order : mediaLibrary.FileKey.ID + " DESC LIMIT 0,1",
extendArgs : "",
} }
let getAllObjectLimitOneHundredOp = { let getAllObjectLimitOneHundredOp = {
selections : fileKeyObj.RELATIVE_PATH + '= ?', selections : mediaLibrary.FileKey.RELATIVE_PATH + '= ?',
selectionArgs : [ 'Camera/' ], selectionArgs : [ 'Camera/' ],
order : fileKeyObj.ID + " DESC LIMIT 0,100", order : mediaLibrary.FileKey.ID + " DESC LIMIT 0,100",
extendArgs : "",
} }
let getFileCountZeroOp = { let getFileCountZeroOp = {
selections : fileKeyObj.DISPLAY_NAME + '=?', selections : mediaLibrary.FileKey.DISPLAY_NAME + '=?',
selectionArgs : [ 'The world has kissed my soul with its pain, asking for its return in songs.' ], selectionArgs : [ 'The world has kissed my soul with its pain, asking for its return in songs.' ],
}; };
let getFileOp = { let getFileOp = {
selections : fileKeyObj.DISPLAY_NAME + '= ? AND ' + fileKeyObj.RELATIVE_PATH + '= ?', selections : mediaLibrary.FileKey.DISPLAY_NAME + '= ? AND ' + mediaLibrary.FileKey.RELATIVE_PATH + '= ?',
selectionArgs : [ '01.jpg', 'Camera/' ], selectionArgs : [ '01.jpg', 'Camera/' ],
order : fileKeyObj.ID + " DESC LIMIT 0,100", order : mediaLibrary.FileKey.ID + " DESC LIMIT 0,100",
extendArgs : "",
} }
describe('fetchFileResultCallback.test.js', async function() { describe('fetchFileResultCallback.test.js', async function() {
......
...@@ -24,71 +24,71 @@ let videoType = mediaLibrary.MediaType.VIDEO; ...@@ -24,71 +24,71 @@ let videoType = mediaLibrary.MediaType.VIDEO;
let audioType = mediaLibrary.MediaType.AUDIO; let audioType = mediaLibrary.MediaType.AUDIO;
let getFileCountOneOp = { let getFileCountOneOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ fileType.toString() ], selectionArgs : [ fileType.toString() ],
order : fileKeyObj.DATE_ADDED + " DESC LIMIT 0,1", order : mediaLibrary.FileKey.DATE_ADDED + " DESC LIMIT 0,1",
extendArgs : "",
}; };
let getFileCountTwoOp = { let getFileCountTwoOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ fileType.toString() ], selectionArgs : [ fileType.toString() ],
order : fileKeyObj.DATE_ADDED + " DESC LIMIT 0,2", order : mediaLibrary.FileKey.DATE_ADDED + " DESC LIMIT 0,2",
extendArgs : "",
}; };
let getFileCountTenOp = { let getFileCountTenOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ fileType.toString() ], selectionArgs : [ fileType.toString() ],
order : fileKeyObj.DATE_ADDED + " DESC LIMIT 0,10", order : mediaLibrary.FileKey.DATE_ADDED + " DESC LIMIT 0,10",
extendArgs : "",
}; };
let getFileCountOneHundredOp = { let getFileCountOneHundredOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ fileType.toString() ], selectionArgs : [ fileType.toString() ],
order : fileKeyObj.DATE_ADDED + " DESC LIMIT 0,100", order : mediaLibrary.FileKey.DATE_ADDED + " DESC LIMIT 0,100",
extendArgs : "",
}; };
let getFirstObjectOp = { let getFirstObjectOp = {
selections : fileKeyObj.RELATIVE_PATH + '= ?', selections : mediaLibrary.FileKey.RELATIVE_PATH + '= ?',
selectionArgs : [ 'Camera/' ], selectionArgs : [ 'Camera/' ],
order : fileKeyObj.ID + " DESC LIMIT 0,5", order : mediaLibrary.FileKey.ID + " DESC LIMIT 0,5",
extendArgs : "",
} }
let getAllObjectLimitOneOp = { let getAllObjectLimitOneOp = {
selections : fileKeyObj.RELATIVE_PATH + '= ?', selections : mediaLibrary.FileKey.RELATIVE_PATH + '= ?',
selectionArgs : [ 'Camera/' ], selectionArgs : [ 'Camera/' ],
order : fileKeyObj.ID + " DESC LIMIT 0,1", order : mediaLibrary.FileKey.ID + " DESC LIMIT 0,1",
extendArgs : "",
} }
let getAllObjectLimitTwoOp = { let getAllObjectLimitTwoOp = {
selections : fileKeyObj.RELATIVE_PATH + '= ?', selections : mediaLibrary.FileKey.RELATIVE_PATH + '= ?',
selectionArgs : [ 'Camera/' ], selectionArgs : [ 'Camera/' ],
order : fileKeyObj.ID + " DESC LIMIT 0,1", order : mediaLibrary.FileKey.ID + " DESC LIMIT 0,1",
extendArgs : "",
} }
let getAllObjectLimitOneHundredOp = { let getAllObjectLimitOneHundredOp = {
selections : fileKeyObj.RELATIVE_PATH + '= ?', selections : mediaLibrary.FileKey.RELATIVE_PATH + '= ?',
selectionArgs : [ 'Camera/' ], selectionArgs : [ 'Camera/' ],
order : fileKeyObj.ID + " DESC LIMIT 0,100", order : mediaLibrary.FileKey.ID + " DESC LIMIT 0,100",
extendArgs : "",
} }
let getFileCountZeroOp = { let getFileCountZeroOp = {
selections : fileKeyObj.DISPLAY_NAME + '=?', selections : mediaLibrary.FileKey.DISPLAY_NAME + '=?',
selectionArgs : [ 'The world has kissed my soul with its pain, asking for its return in songs.' ], selectionArgs : [ 'The world has kissed my soul with its pain, asking for its return in songs.' ],
}; };
let getFileOp = { let getFileOp = {
selections : fileKeyObj.DISPLAY_NAME + '= ? AND ' + fileKeyObj.RELATIVE_PATH + '= ?', selections : mediaLibrary.FileKey.DISPLAY_NAME + '= ? AND ' + mediaLibrary.FileKey.RELATIVE_PATH + '= ?',
selectionArgs : [ '01.jpg', 'Camera/' ], selectionArgs : [ '01.jpg', 'Camera/' ],
order : fileKeyObj.ID + " DESC LIMIT 0,100", order : mediaLibrary.FileKey.ID + " DESC LIMIT 0,100",
extendArgs : "",
} }
describe('fetchFileResultPromise.test.js', async function() { describe('fetchFileResultPromise.test.js', async function() {
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import mediaLibrary from '@ohos.multimedia.medialibrary'; import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import featureAbility from '@ohos.ability.featureAbility'; 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';
...@@ -47,16 +47,16 @@ describe('fileAsset2.test.js', async function () { ...@@ -47,16 +47,16 @@ describe('fileAsset2.test.js', async function () {
let videoType = mediaLibrary.MediaType.VIDEO; let videoType = mediaLibrary.MediaType.VIDEO;
let audioType = mediaLibrary.MediaType.AUDIO; let audioType = mediaLibrary.MediaType.AUDIO;
let imagesfetchOp = { let imagesfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [imageType.toString()], selectionArgs: [imageType.toString()],
}; };
let videosfetchOp = { let videosfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [videoType.toString()], selectionArgs: [videoType.toString()],
}; };
let audiosfetchOp = { let audiosfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [audioType.toString()], selectionArgs: [audioType.toString()],
}; };
...@@ -66,10 +66,10 @@ describe('fileAsset2.test.js', async function () { ...@@ -66,10 +66,10 @@ describe('fileAsset2.test.js', async function () {
}; };
const context = featureAbility.getContext(); const context = featureAbility.getContext();
const media = mediaLibrary.getMediaLibrary(context); const media = mediaLibrary.getMediaLibrary(context);
beforeAll(function () {}); beforeAll(function () { });
beforeEach(function () {}); beforeEach(function () { });
afterEach(function () {}); afterEach(function () { });
afterAll(function () {}); afterAll(function () { });
/** /**
* @tc.number : SUB_MEDIA_FILEASSET_commitModify_promise_001 * @tc.number : SUB_MEDIA_FILEASSET_commitModify_promise_001
......
...@@ -47,16 +47,16 @@ describe('fileAssetCallBack2.test.js', async function () { ...@@ -47,16 +47,16 @@ describe('fileAssetCallBack2.test.js', async function () {
let videoType = mediaLibrary.MediaType.VIDEO; let videoType = mediaLibrary.MediaType.VIDEO;
let audioType = mediaLibrary.MediaType.AUDIO; let audioType = mediaLibrary.MediaType.AUDIO;
let imagesfetchOp = { let imagesfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [imageType.toString()], selectionArgs: [imageType.toString()],
}; };
let videosfetchOp = { let videosfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [videoType.toString()], selectionArgs: [videoType.toString()],
}; };
let audiosfetchOp = { let audiosfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [audioType.toString()], selectionArgs: [audioType.toString()],
}; };
...@@ -66,10 +66,10 @@ describe('fileAssetCallBack2.test.js', async function () { ...@@ -66,10 +66,10 @@ describe('fileAssetCallBack2.test.js', async function () {
}; };
const context = featureAbility.getContext(); const context = featureAbility.getContext();
const media = mediaLibrary.getMediaLibrary(context); const media = mediaLibrary.getMediaLibrary(context);
beforeAll(function () {}); beforeAll(function () { });
beforeEach(function () {}); beforeEach(function () { });
afterEach(function () {}); afterEach(function () { });
afterAll(function () {}); afterAll(function () { });
/** /**
* @tc.number : SUB_MEDIA_FILEASSET_commitModify_callback_001 * @tc.number : SUB_MEDIA_FILEASSET_commitModify_callback_001
...@@ -86,7 +86,7 @@ describe('fileAssetCallBack2.test.js', async function () { ...@@ -86,7 +86,7 @@ describe('fileAssetCallBack2.test.js', async function () {
const newName = 'newName'; const newName = 'newName';
asset.displayName = newName; asset.displayName = newName;
const id = asset.id; const id = asset.id;
asset.commitModify(async ()=>{ asset.commitModify(async () => {
const fetchFileResult2 = await media.getFileAssets(imagesfetchOp); const fetchFileResult2 = await media.getFileAssets(imagesfetchOp);
const dataList = await fetchFileResult2.getAllObject(); const dataList = await fetchFileResult2.getAllObject();
let passed = false; let passed = false;
...@@ -101,7 +101,7 @@ describe('fileAssetCallBack2.test.js', async function () { ...@@ -101,7 +101,7 @@ describe('fileAssetCallBack2.test.js', async function () {
done(); done();
}); });
} catch (error) { } catch (error) {
console.info('FileAsset commitModify 001 failed, message = ' + error); console.info('FileAsset commitModify 001 failed, message = ' + error);
expect(false).assertTrue(); expect(false).assertTrue();
...@@ -247,9 +247,9 @@ describe('fileAssetCallBack2.test.js', async function () { ...@@ -247,9 +247,9 @@ describe('fileAssetCallBack2.test.js', async function () {
asset.uri = newUri; asset.uri = newUri;
asset.commitModify(async (err) => { asset.commitModify(async (err) => {
if(err) { if (err) {
expect(true).assertTrue(); expect(true).assertTrue();
done(); done();
} else { } else {
console.info('FileAsset commitModify 005 failed'); console.info('FileAsset commitModify 005 failed');
expect(false).assertTrue(); expect(false).assertTrue();
...@@ -257,7 +257,7 @@ describe('fileAssetCallBack2.test.js', async function () { ...@@ -257,7 +257,7 @@ describe('fileAssetCallBack2.test.js', async function () {
} }
}); });
} catch (error) { } catch (error) {
console.info('FileAsset commitModify 005 passed'); console.info('FileAsset commitModify 005 passed');
expect(true).assertTrue(); expect(true).assertTrue();
...@@ -283,7 +283,7 @@ describe('fileAssetCallBack2.test.js', async function () { ...@@ -283,7 +283,7 @@ describe('fileAssetCallBack2.test.js', async function () {
asset.mediaType = newMediaType; asset.mediaType = newMediaType;
asset.commitModify(async (err) => { asset.commitModify(async (err) => {
if(err) { if (err) {
expect(true).assertTrue(); expect(true).assertTrue();
done(); done();
} else { } else {
...@@ -312,7 +312,7 @@ describe('fileAssetCallBack2.test.js', async function () { ...@@ -312,7 +312,7 @@ describe('fileAssetCallBack2.test.js', async function () {
const fetchFileResult = await media.getFileAssets(imagesfetchOp); const fetchFileResult = await media.getFileAssets(imagesfetchOp);
const asset = await fetchFileResult.getFirstObject(); const asset = await fetchFileResult.getFirstObject();
asset.isDirectory((err, isDir) => { asset.isDirectory((err, isDir) => {
if(isDir == undefined) { if (isDir == undefined) {
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} else { } else {
...@@ -339,7 +339,7 @@ describe('fileAssetCallBack2.test.js', async function () { ...@@ -339,7 +339,7 @@ describe('fileAssetCallBack2.test.js', async function () {
try { try {
const fetchFileResult = await media.getFileAssets(imagesfetchOp); const fetchFileResult = await media.getFileAssets(imagesfetchOp);
fetchFileResult.getFirstObject((err, asset) => { fetchFileResult.getFirstObject((err, asset) => {
if(asset == undefined) { if (asset == undefined) {
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} else { } else {
...@@ -366,7 +366,7 @@ describe('fileAssetCallBack2.test.js', async function () { ...@@ -366,7 +366,7 @@ describe('fileAssetCallBack2.test.js', async function () {
try { try {
const fetchFileResult = await media.getFileAssets(videosfetchOp); const fetchFileResult = await media.getFileAssets(videosfetchOp);
fetchFileResult.getFirstObject((err, asset) => { fetchFileResult.getFirstObject((err, asset) => {
if(asset == undefined) { if (asset == undefined) {
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} else { } else {
...@@ -392,8 +392,8 @@ describe('fileAssetCallBack2.test.js', async function () { ...@@ -392,8 +392,8 @@ describe('fileAssetCallBack2.test.js', async function () {
it('SUB_MEDIA_FILEASSET_checkAttr_callback_003', 0, async function (done) { it('SUB_MEDIA_FILEASSET_checkAttr_callback_003', 0, async function (done) {
try { try {
const fetchFileResult = await media.getFileAssets(audiosfetchOp); const fetchFileResult = await media.getFileAssets(audiosfetchOp);
fetchFileResult.getFirstObject((err, asset)=>{ fetchFileResult.getFirstObject((err, asset) => {
if(asset == undefined) { if (asset == undefined) {
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} else { } else {
...@@ -421,8 +421,8 @@ describe('fileAssetCallBack2.test.js', async function () { ...@@ -421,8 +421,8 @@ describe('fileAssetCallBack2.test.js', async function () {
const albumList = await media.getAlbums(allTypefetchOp); const albumList = await media.getAlbums(allTypefetchOp);
const album = albumList[0]; const album = albumList[0];
const fetchFileResult = await album.getFileAssets(allTypefetchOp); const fetchFileResult = await album.getFileAssets(allTypefetchOp);
fetchFileResult.getFirstObject((err, asset) => { fetchFileResult.getFirstObject((err, asset) => {
if(asset == undefined) { if (asset == undefined) {
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} else { } else {
...@@ -430,7 +430,7 @@ describe('fileAssetCallBack2.test.js', async function () { ...@@ -430,7 +430,7 @@ describe('fileAssetCallBack2.test.js', async function () {
checkAttrs(done, asset, '004'); checkAttrs(done, asset, '004');
} }
}); });
} catch (error) { } catch (error) {
console.info('FileAsset checkAttr 003 failed, message = ' + error); console.info('FileAsset checkAttr 003 failed, message = ' + error);
expect(false).assertTrue(); expect(false).assertTrue();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import mediaLibrary from '@ohos.multimedia.medialibrary'; import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import featureAbility from '@ohos.ability.featureAbility'; 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';
...@@ -47,16 +47,16 @@ describe('fileAssetPromise2.test.js', async function () { ...@@ -47,16 +47,16 @@ describe('fileAssetPromise2.test.js', async function () {
let videoType = mediaLibrary.MediaType.VIDEO; let videoType = mediaLibrary.MediaType.VIDEO;
let audioType = mediaLibrary.MediaType.AUDIO; let audioType = mediaLibrary.MediaType.AUDIO;
let imagesfetchOp = { let imagesfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [imageType.toString()], selectionArgs: [imageType.toString()],
}; };
let videosfetchOp = { let videosfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [videoType.toString()], selectionArgs: [videoType.toString()],
}; };
let audiosfetchOp = { let audiosfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [audioType.toString()], selectionArgs: [audioType.toString()],
}; };
...@@ -66,10 +66,10 @@ describe('fileAssetPromise2.test.js', async function () { ...@@ -66,10 +66,10 @@ describe('fileAssetPromise2.test.js', async function () {
}; };
const context = featureAbility.getContext(); const context = featureAbility.getContext();
const media = mediaLibrary.getMediaLibrary(context); const media = mediaLibrary.getMediaLibrary(context);
beforeAll(function () {}); beforeAll(function () { });
beforeEach(function () {}); beforeEach(function () { });
afterEach(function () {}); afterEach(function () { });
afterAll(function () {}); afterAll(function () { });
/** /**
* @tc.number : SUB_MEDIA_FILEASSET_commitModify_promise_001 * @tc.number : SUB_MEDIA_FILEASSET_commitModify_promise_001
......
...@@ -42,7 +42,7 @@ describe('fileAssetTestCallback.test.js', async function() { ...@@ -42,7 +42,7 @@ describe('fileAssetTestCallback.test.js', async function() {
try { try {
let fileType = mediaLibrary.MediaType.FILE; let fileType = mediaLibrary.MediaType.FILE;
let fileFetchOp = { let fileFetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ fileType.toString() ], selectionArgs : [ fileType.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fileFetchOp); let fetchFileResult = await media.getFileAssets(fileFetchOp);
...@@ -109,7 +109,7 @@ describe('fileAssetTestCallback.test.js', async function() { ...@@ -109,7 +109,7 @@ describe('fileAssetTestCallback.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.FILE; let type = mediaLibrary.MediaType.FILE;
let fetchOp = { let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
...@@ -173,7 +173,7 @@ describe('fileAssetTestCallback.test.js', async function() { ...@@ -173,7 +173,7 @@ describe('fileAssetTestCallback.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.FILE; let type = mediaLibrary.MediaType.FILE;
let fetchOp = { let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
...@@ -243,7 +243,7 @@ describe('fileAssetTestCallback.test.js', async function() { ...@@ -243,7 +243,7 @@ describe('fileAssetTestCallback.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.ALBUM; let type = mediaLibrary.MediaType.ALBUM;
let fetchOp = { let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
...@@ -278,7 +278,7 @@ describe('fileAssetTestCallback.test.js', async function() { ...@@ -278,7 +278,7 @@ describe('fileAssetTestCallback.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.ALBUM; let type = mediaLibrary.MediaType.ALBUM;
let fetchOp = { let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
...@@ -313,7 +313,7 @@ describe('fileAssetTestCallback.test.js', async function() { ...@@ -313,7 +313,7 @@ describe('fileAssetTestCallback.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.ALBUM; let type = mediaLibrary.MediaType.ALBUM;
let fetchOp = { let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
...@@ -352,7 +352,7 @@ describe('fileAssetTestCallback.test.js', async function() { ...@@ -352,7 +352,7 @@ describe('fileAssetTestCallback.test.js', async function() {
try { try {
let fileType = mediaLibrary.MediaType.IMAGE; let fileType = mediaLibrary.MediaType.IMAGE;
let fileFetchOp = { let fileFetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ fileType.toString() ], selectionArgs : [ fileType.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fileFetchOp); let fetchFileResult = await media.getFileAssets(fileFetchOp);
...@@ -412,7 +412,7 @@ describe('fileAssetTestCallback.test.js', async function() { ...@@ -412,7 +412,7 @@ describe('fileAssetTestCallback.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.IMAGE; let type = mediaLibrary.MediaType.IMAGE;
let fetchOp = { let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
...@@ -472,7 +472,7 @@ describe('fileAssetTestCallback.test.js', async function() { ...@@ -472,7 +472,7 @@ describe('fileAssetTestCallback.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.IMAGE; let type = mediaLibrary.MediaType.IMAGE;
let fetchOp = { let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
...@@ -545,7 +545,7 @@ describe('fileAssetTestCallback.test.js', async function() { ...@@ -545,7 +545,7 @@ describe('fileAssetTestCallback.test.js', async function() {
try { try {
let fileType = mediaLibrary.MediaType.AUDIO; let fileType = mediaLibrary.MediaType.AUDIO;
let fileFetchOp = { let fileFetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ fileType.toString() ], selectionArgs : [ fileType.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fileFetchOp); let fetchFileResult = await media.getFileAssets(fileFetchOp);
...@@ -606,7 +606,7 @@ describe('fileAssetTestCallback.test.js', async function() { ...@@ -606,7 +606,7 @@ describe('fileAssetTestCallback.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.AUDIO; let type = mediaLibrary.MediaType.AUDIO;
let fetchOp = { let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
...@@ -673,7 +673,7 @@ describe('fileAssetTestCallback.test.js', async function() { ...@@ -673,7 +673,7 @@ describe('fileAssetTestCallback.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.AUDIO; let type = mediaLibrary.MediaType.AUDIO;
let fetchOp = { let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
...@@ -746,7 +746,7 @@ describe('fileAssetTestCallback.test.js', async function() { ...@@ -746,7 +746,7 @@ describe('fileAssetTestCallback.test.js', async function() {
try { try {
let fileType = mediaLibrary.MediaType.VIDEO; let fileType = mediaLibrary.MediaType.VIDEO;
let fileFetchOp = { let fileFetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ fileType.toString() ], selectionArgs : [ fileType.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fileFetchOp); let fetchFileResult = await media.getFileAssets(fileFetchOp);
...@@ -815,7 +815,7 @@ describe('fileAssetTestCallback.test.js', async function() { ...@@ -815,7 +815,7 @@ describe('fileAssetTestCallback.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.VIDEO; let type = mediaLibrary.MediaType.VIDEO;
let fetchOp = { let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
...@@ -880,7 +880,7 @@ describe('fileAssetTestCallback.test.js', async function() { ...@@ -880,7 +880,7 @@ describe('fileAssetTestCallback.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.VIDEO; let type = mediaLibrary.MediaType.VIDEO;
let fetchOp = { let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
...@@ -952,7 +952,7 @@ describe('fileAssetTestCallback.test.js', async function() { ...@@ -952,7 +952,7 @@ describe('fileAssetTestCallback.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.FILE; let type = mediaLibrary.MediaType.FILE;
let fetchOp = { let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
...@@ -1000,7 +1000,7 @@ describe('fileAssetTestCallback.test.js', async function() { ...@@ -1000,7 +1000,7 @@ describe('fileAssetTestCallback.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.IMAGE; let type = mediaLibrary.MediaType.IMAGE;
let fetchOp = { let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
...@@ -1048,7 +1048,7 @@ describe('fileAssetTestCallback.test.js', async function() { ...@@ -1048,7 +1048,7 @@ describe('fileAssetTestCallback.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.AUDIO; let type = mediaLibrary.MediaType.AUDIO;
let fetchOp = { let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
...@@ -1096,7 +1096,7 @@ describe('fileAssetTestCallback.test.js', async function() { ...@@ -1096,7 +1096,7 @@ describe('fileAssetTestCallback.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.VIDEO; let type = mediaLibrary.MediaType.VIDEO;
let fetchOp = { let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import mediaLibrary from '@ohos.multimedia.medialibrary'; import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import featureAbility from '@ohos.ability.featureAbility'; import featureAbility from '@ohos.ability.featureAbility';
import fileio from '@ohos.fileio'; import fileio from '@ohos.fileio';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
...@@ -42,7 +42,7 @@ describe('fileAssetTestPromise.test.js', async function() { ...@@ -42,7 +42,7 @@ describe('fileAssetTestPromise.test.js', async function() {
try { try {
let fileType = mediaLibrary.MediaType.FILE; let fileType = mediaLibrary.MediaType.FILE;
let fileFetchOp = { let fileFetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ fileType.toString() ], selectionArgs : [ fileType.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fileFetchOp); let fetchFileResult = await media.getFileAssets(fileFetchOp);
...@@ -95,7 +95,7 @@ describe('fileAssetTestPromise.test.js', async function() { ...@@ -95,7 +95,7 @@ describe('fileAssetTestPromise.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.FILE; let type = mediaLibrary.MediaType.FILE;
let fetchOp = { let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
...@@ -136,7 +136,7 @@ describe('fileAssetTestPromise.test.js', async function() { ...@@ -136,7 +136,7 @@ describe('fileAssetTestPromise.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.FILE; let type = mediaLibrary.MediaType.FILE;
let fetchOp = { let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
...@@ -180,7 +180,7 @@ describe('fileAssetTestPromise.test.js', async function() { ...@@ -180,7 +180,7 @@ describe('fileAssetTestPromise.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.ALBUM; let type = mediaLibrary.MediaType.ALBUM;
let fetchOp = { let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
...@@ -212,7 +212,7 @@ describe('fileAssetTestPromise.test.js', async function() { ...@@ -212,7 +212,7 @@ describe('fileAssetTestPromise.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.ALBUM; let type = mediaLibrary.MediaType.ALBUM;
let fetchOp = { let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
...@@ -244,7 +244,7 @@ describe('fileAssetTestPromise.test.js', async function() { ...@@ -244,7 +244,7 @@ describe('fileAssetTestPromise.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.ALBUM; let type = mediaLibrary.MediaType.ALBUM;
let fetchOp = { let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
...@@ -281,7 +281,7 @@ describe('fileAssetTestPromise.test.js', async function() { ...@@ -281,7 +281,7 @@ describe('fileAssetTestPromise.test.js', async function() {
try { try {
let fileType = mediaLibrary.MediaType.IMAGE; let fileType = mediaLibrary.MediaType.IMAGE;
let fileFetchOp = { let fileFetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ fileType.toString() ], selectionArgs : [ fileType.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fileFetchOp); let fetchFileResult = await media.getFileAssets(fileFetchOp);
...@@ -332,7 +332,7 @@ describe('fileAssetTestPromise.test.js', async function() { ...@@ -332,7 +332,7 @@ describe('fileAssetTestPromise.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.IMAGE; let type = mediaLibrary.MediaType.IMAGE;
let fetchOp = { let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
...@@ -373,7 +373,7 @@ describe('fileAssetTestPromise.test.js', async function() { ...@@ -373,7 +373,7 @@ describe('fileAssetTestPromise.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.IMAGE; let type = mediaLibrary.MediaType.IMAGE;
let fetchOp = { let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
...@@ -419,7 +419,7 @@ describe('fileAssetTestPromise.test.js', async function() { ...@@ -419,7 +419,7 @@ describe('fileAssetTestPromise.test.js', async function() {
try { try {
let fileType = mediaLibrary.MediaType.AUDIO; let fileType = mediaLibrary.MediaType.AUDIO;
let fileFetchOp = { let fileFetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ fileType.toString() ], selectionArgs : [ fileType.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fileFetchOp); let fetchFileResult = await media.getFileAssets(fileFetchOp);
...@@ -470,7 +470,7 @@ describe('fileAssetTestPromise.test.js', async function() { ...@@ -470,7 +470,7 @@ describe('fileAssetTestPromise.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.AUDIO; let type = mediaLibrary.MediaType.AUDIO;
let fetchOp = { let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
...@@ -511,7 +511,7 @@ describe('fileAssetTestPromise.test.js', async function() { ...@@ -511,7 +511,7 @@ describe('fileAssetTestPromise.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.AUDIO; let type = mediaLibrary.MediaType.AUDIO;
let fetchOp = { let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
...@@ -557,7 +557,7 @@ describe('fileAssetTestPromise.test.js', async function() { ...@@ -557,7 +557,7 @@ describe('fileAssetTestPromise.test.js', async function() {
try { try {
let fileType = mediaLibrary.MediaType.VIDEO; let fileType = mediaLibrary.MediaType.VIDEO;
let fileFetchOp = { let fileFetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ fileType.toString() ], selectionArgs : [ fileType.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fileFetchOp); let fetchFileResult = await media.getFileAssets(fileFetchOp);
...@@ -616,7 +616,7 @@ describe('fileAssetTestPromise.test.js', async function() { ...@@ -616,7 +616,7 @@ describe('fileAssetTestPromise.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.VIDEO; let type = mediaLibrary.MediaType.VIDEO;
let fetchOp = { let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
...@@ -660,7 +660,7 @@ describe('fileAssetTestPromise.test.js', async function() { ...@@ -660,7 +660,7 @@ describe('fileAssetTestPromise.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.VIDEO; let type = mediaLibrary.MediaType.VIDEO;
let fetchOp = { let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
...@@ -709,7 +709,7 @@ describe('fileAssetTestPromise.test.js', async function() { ...@@ -709,7 +709,7 @@ describe('fileAssetTestPromise.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.FILE; let type = mediaLibrary.MediaType.FILE;
let fetchOp = { let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
...@@ -753,7 +753,7 @@ describe('fileAssetTestPromise.test.js', async function() { ...@@ -753,7 +753,7 @@ describe('fileAssetTestPromise.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.IMAGE; let type = mediaLibrary.MediaType.IMAGE;
let fetchOp = { let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
...@@ -797,7 +797,7 @@ describe('fileAssetTestPromise.test.js', async function() { ...@@ -797,7 +797,7 @@ describe('fileAssetTestPromise.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.AUDIO; let type = mediaLibrary.MediaType.AUDIO;
let fetchOp = { let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
...@@ -841,7 +841,7 @@ describe('fileAssetTestPromise.test.js', async function() { ...@@ -841,7 +841,7 @@ describe('fileAssetTestPromise.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.VIDEO; let type = mediaLibrary.MediaType.VIDEO;
let fetchOp = { let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString() ],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
......
...@@ -41,7 +41,7 @@ describe('fileAssetUriTestCallback.test.js', async function() { ...@@ -41,7 +41,7 @@ describe('fileAssetUriTestCallback.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.IMAGE; let type = mediaLibrary.MediaType.IMAGE;
let fetchOp = { let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString() ],
}; };
const fetchFileResult = await media.getFileAssets(fetchOp); const fetchFileResult = await media.getFileAssets(fetchOp);
...@@ -57,7 +57,7 @@ describe('fileAssetUriTestCallback.test.js', async function() { ...@@ -57,7 +57,7 @@ describe('fileAssetUriTestCallback.test.js', async function() {
let serchfetchOp = { let serchfetchOp = {
uri:serachUri.toString(), uri:serachUri.toString(),
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ type.toString()], selectionArgs : [ type.toString()],
}; };
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import mediaLibrary from '@ohos.multimedia.medialibrary'; import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import featureAbility from '@ohos.ability.featureAbility' import featureAbility from '@ohos.ability.featureAbility'
import fileio from '@ohos.fileio'; import fileio from '@ohos.fileio';
import {describe, it, expect} from 'deccjsunit/index'; import {describe, it, expect} from 'deccjsunit/index';
...@@ -41,7 +41,7 @@ describe('fileAssetUriTestPromise.test.js', async function() { ...@@ -41,7 +41,7 @@ describe('fileAssetUriTestPromise.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.IMAGE; let type = mediaLibrary.MediaType.IMAGE;
let fetchOp = { let fetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString() ],
}; };
const fetchFileResult = await media.getFileAssets(fetchOp); const fetchFileResult = await media.getFileAssets(fetchOp);
...@@ -56,7 +56,7 @@ describe('fileAssetUriTestPromise.test.js', async function() { ...@@ -56,7 +56,7 @@ describe('fileAssetUriTestPromise.test.js', async function() {
let serchfetchOp = { let serchfetchOp = {
uri : serachUri.toString(), uri : serachUri.toString(),
selections : fileKeyObj.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString() ],
}; };
......
...@@ -25,19 +25,19 @@ let videoType = mediaLibrary.MediaType.VIDEO; ...@@ -25,19 +25,19 @@ let videoType = mediaLibrary.MediaType.VIDEO;
let audioType = mediaLibrary.MediaType.AUDIO; let audioType = mediaLibrary.MediaType.AUDIO;
let imagesfetchOp = { let imagesfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [imageType.toString()], selectionArgs: [imageType.toString()],
}; };
let videosfetchOp = { let videosfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [videoType.toString()], selectionArgs: [videoType.toString()],
}; };
let audiosfetchOp = { let audiosfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [audioType.toString()], selectionArgs: [audioType.toString()],
}; };
let filesfetchOp = { let filesfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [fileType.toString()], selectionArgs: [fileType.toString()],
}; };
...@@ -138,7 +138,7 @@ describe('fileTestCallBack.test.js', function () { ...@@ -138,7 +138,7 @@ describe('fileTestCallBack.test.js', function () {
*/ */
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_CALLBACK_001_02', 0, async function (done) { it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_CALLBACK_001_02', 0, async function (done) {
try { try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP); const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject(); const asset = await fileAssets.getFirstObject();
...@@ -159,7 +159,7 @@ describe('fileTestCallBack.test.js', function () { ...@@ -159,7 +159,7 @@ describe('fileTestCallBack.test.js', function () {
*/ */
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_CALLBACK_001_03', 0, async function (done) { it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_CALLBACK_001_03', 0, async function (done) {
try { try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP); const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject(); const asset = await fileAssets.getFirstObject();
expect(asset.relativePath == path).assertTrue(); expect(asset.relativePath == path).assertTrue();
...@@ -185,7 +185,7 @@ describe('fileTestCallBack.test.js', function () { ...@@ -185,7 +185,7 @@ describe('fileTestCallBack.test.js', function () {
asset.title = `title_${new Date().getTime()}`; asset.title = `title_${new Date().getTime()}`;
asset.commitModify(async () => { asset.commitModify(async () => {
const id = asset.id; const id = asset.id;
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const newAssets = await media.getFileAssets(idOP); const newAssets = await media.getFileAssets(idOP);
const newdataList = await newAssets.getAllObject(); const newdataList = await newAssets.getAllObject();
const newAsset = newdataList[0]; const newAsset = newdataList[0];
...@@ -225,7 +225,7 @@ describe('fileTestCallBack.test.js', function () { ...@@ -225,7 +225,7 @@ describe('fileTestCallBack.test.js', function () {
*/ */
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_CALLBACK_001_08', 0, async function (done) { it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_CALLBACK_001_08', 0, async function (done) {
try { try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP); const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject(); const asset = await fileAssets.getFirstObject();
expect(asset.mediaType == mediaType).assertTrue(); expect(asset.mediaType == mediaType).assertTrue();
...@@ -245,7 +245,7 @@ describe('fileTestCallBack.test.js', function () { ...@@ -245,7 +245,7 @@ describe('fileTestCallBack.test.js', function () {
*/ */
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_CALLBACK_001_11', 0, async function (done) { it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_CALLBACK_001_11', 0, async function (done) {
try { try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP); const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject(); const asset = await fileAssets.getFirstObject();
expect(asset.orientation == orientation).assertTrue(); expect(asset.orientation == orientation).assertTrue();
...@@ -319,7 +319,7 @@ describe('fileTestCallBack.test.js', function () { ...@@ -319,7 +319,7 @@ describe('fileTestCallBack.test.js', function () {
*/ */
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_CALLBACK_002_02', 0, async function (done) { it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_CALLBACK_002_02', 0, async function (done) {
try { try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP); const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject(); const asset = await fileAssets.getFirstObject();
...@@ -340,7 +340,7 @@ describe('fileTestCallBack.test.js', function () { ...@@ -340,7 +340,7 @@ describe('fileTestCallBack.test.js', function () {
*/ */
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_CALLBACK_002_03', 0, async function (done) { it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_CALLBACK_002_03', 0, async function (done) {
try { try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP); const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject(); const asset = await fileAssets.getFirstObject();
...@@ -367,7 +367,7 @@ describe('fileTestCallBack.test.js', function () { ...@@ -367,7 +367,7 @@ describe('fileTestCallBack.test.js', function () {
asset.title = `title_${new Date().getTime()}`; asset.title = `title_${new Date().getTime()}`;
asset.commitModify(async () => { asset.commitModify(async () => {
const id = asset.id; const id = asset.id;
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const newAssets = await media.getFileAssets(idOP); const newAssets = await media.getFileAssets(idOP);
const newdataList = await newAssets.getAllObject(); const newdataList = await newAssets.getAllObject();
const newAsset = newdataList[0]; const newAsset = newdataList[0];
...@@ -407,7 +407,7 @@ describe('fileTestCallBack.test.js', function () { ...@@ -407,7 +407,7 @@ describe('fileTestCallBack.test.js', function () {
*/ */
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_CALLBACK_002_08', 0, async function (done) { it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_CALLBACK_002_08', 0, async function (done) {
try { try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP); const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject(); const asset = await fileAssets.getFirstObject();
expect(asset.mediaType == mediaType).assertTrue(); expect(asset.mediaType == mediaType).assertTrue();
...@@ -427,7 +427,7 @@ describe('fileTestCallBack.test.js', function () { ...@@ -427,7 +427,7 @@ describe('fileTestCallBack.test.js', function () {
*/ */
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_CALLBACK_002_11', 0, async function (done) { it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_CALLBACK_002_11', 0, async function (done) {
try { try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP); const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject(); const asset = await fileAssets.getFirstObject();
expect(asset.orientation == orientation).assertTrue(); expect(asset.orientation == orientation).assertTrue();
...@@ -495,7 +495,7 @@ describe('fileTestCallBack.test.js', function () { ...@@ -495,7 +495,7 @@ describe('fileTestCallBack.test.js', function () {
*/ */
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_CALLBACK_003_02', 0, async function (done) { it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_CALLBACK_003_02', 0, async function (done) {
try { try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP); const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject(); const asset = await fileAssets.getFirstObject();
expect(asset.displayName == displayName).assertTrue(); expect(asset.displayName == displayName).assertTrue();
...@@ -516,7 +516,7 @@ describe('fileTestCallBack.test.js', function () { ...@@ -516,7 +516,7 @@ describe('fileTestCallBack.test.js', function () {
*/ */
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_CALLBACK_003_03', 0, async function (done) { it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_CALLBACK_003_03', 0, async function (done) {
try { try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP); const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject(); const asset = await fileAssets.getFirstObject();
expect(asset.relativePath == path).assertTrue(); expect(asset.relativePath == path).assertTrue();
...@@ -542,7 +542,7 @@ describe('fileTestCallBack.test.js', function () { ...@@ -542,7 +542,7 @@ describe('fileTestCallBack.test.js', function () {
asset.title = `title_${new Date().getTime()}`; asset.title = `title_${new Date().getTime()}`;
asset.commitModify(async () => { asset.commitModify(async () => {
const id = asset.id; const id = asset.id;
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const newAssets = await media.getFileAssets(idOP); const newAssets = await media.getFileAssets(idOP);
const newdataList = await newAssets.getAllObject(); const newdataList = await newAssets.getAllObject();
const newAsset = newdataList[0]; const newAsset = newdataList[0];
...@@ -582,7 +582,7 @@ describe('fileTestCallBack.test.js', function () { ...@@ -582,7 +582,7 @@ describe('fileTestCallBack.test.js', function () {
*/ */
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_CALLBACK_003_08', 0, async function (done) { it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_CALLBACK_003_08', 0, async function (done) {
try { try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP); const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject(); const asset = await fileAssets.getFirstObject();
expect(asset.mediaType == mediaType).assertTrue(); expect(asset.mediaType == mediaType).assertTrue();
...@@ -650,7 +650,7 @@ describe('fileTestCallBack.test.js', function () { ...@@ -650,7 +650,7 @@ describe('fileTestCallBack.test.js', function () {
*/ */
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_CALLBACK_004_02', 0, async function (done) { it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_CALLBACK_004_02', 0, async function (done) {
try { try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP); const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject(); const asset = await fileAssets.getFirstObject();
expect(asset.displayName == displayName).assertTrue(); expect(asset.displayName == displayName).assertTrue();
...@@ -670,7 +670,7 @@ describe('fileTestCallBack.test.js', function () { ...@@ -670,7 +670,7 @@ describe('fileTestCallBack.test.js', function () {
*/ */
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_CALLBACK_004_03', 0, async function (done) { it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_CALLBACK_004_03', 0, async function (done) {
try { try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP); const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject(); const asset = await fileAssets.getFirstObject();
expect(asset.relativePath == path).assertTrue(); expect(asset.relativePath == path).assertTrue();
...@@ -696,7 +696,7 @@ describe('fileTestCallBack.test.js', function () { ...@@ -696,7 +696,7 @@ describe('fileTestCallBack.test.js', function () {
asset.title = `title_${new Date().getTime()}`; asset.title = `title_${new Date().getTime()}`;
asset.commitModify(async ()=> { asset.commitModify(async ()=> {
const id = asset.id; const id = asset.id;
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const newAssets = await media.getFileAssets(idOP); const newAssets = await media.getFileAssets(idOP);
const newdataList = await newAssets.getAllObject(); const newdataList = await newAssets.getAllObject();
const newAsset = newdataList[0]; const newAsset = newdataList[0];
...@@ -736,7 +736,7 @@ describe('fileTestCallBack.test.js', function () { ...@@ -736,7 +736,7 @@ describe('fileTestCallBack.test.js', function () {
*/ */
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_CALLBACK_004_08', 0, async function (done) { it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_CALLBACK_004_08', 0, async function (done) {
try { try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP); const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject(); const asset = await fileAssets.getFirstObject();
expect(asset.mediaType == mediaType).assertTrue(); expect(asset.mediaType == mediaType).assertTrue();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import mediaLibrary from '@ohos.multimedia.medialibrary'; import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import featureAbility from '@ohos.ability.featureAbility'; import featureAbility from '@ohos.ability.featureAbility';
import fileio from '@ohos.fileio'; import fileio from '@ohos.fileio';
...@@ -25,19 +25,19 @@ let videoType = mediaLibrary.MediaType.VIDEO; ...@@ -25,19 +25,19 @@ let videoType = mediaLibrary.MediaType.VIDEO;
let audioType = mediaLibrary.MediaType.AUDIO; let audioType = mediaLibrary.MediaType.AUDIO;
let imagesfetchOp = { let imagesfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [imageType.toString()], selectionArgs: [imageType.toString()],
}; };
let videosfetchOp = { let videosfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [videoType.toString()], selectionArgs: [videoType.toString()],
}; };
let audiosfetchOp = { let audiosfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [audioType.toString()], selectionArgs: [audioType.toString()],
}; };
let filesfetchOp = { let filesfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [fileType.toString()], selectionArgs: [fileType.toString()],
}; };
...@@ -131,7 +131,7 @@ describe('fileTestPromise.test.js', function () { ...@@ -131,7 +131,7 @@ describe('fileTestPromise.test.js', function () {
*/ */
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_001_02', 0, async function (done) { it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_001_02', 0, async function (done) {
try { try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP); const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject(); const asset = await fileAssets.getFirstObject();
...@@ -152,7 +152,7 @@ describe('fileTestPromise.test.js', function () { ...@@ -152,7 +152,7 @@ describe('fileTestPromise.test.js', function () {
*/ */
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_001_03', 0, async function (done) { it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_001_03', 0, async function (done) {
try { try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP); const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject(); const asset = await fileAssets.getFirstObject();
expect(asset.relativePath == path).assertTrue(); expect(asset.relativePath == path).assertTrue();
...@@ -178,7 +178,7 @@ describe('fileTestPromise.test.js', function () { ...@@ -178,7 +178,7 @@ describe('fileTestPromise.test.js', function () {
asset.title = `title_${new Date().getTime()}`; asset.title = `title_${new Date().getTime()}`;
await asset.commitModify(); await asset.commitModify();
const id = asset.id; const id = asset.id;
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const newAssets = await media.getFileAssets(idOP); const newAssets = await media.getFileAssets(idOP);
const newdataList = await newAssets.getAllObject(); const newdataList = await newAssets.getAllObject();
const newAsset = newdataList[0]; const newAsset = newdataList[0];
...@@ -217,7 +217,7 @@ describe('fileTestPromise.test.js', function () { ...@@ -217,7 +217,7 @@ describe('fileTestPromise.test.js', function () {
*/ */
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_001_08', 0, async function (done) { it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_001_08', 0, async function (done) {
try { try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP); const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject(); const asset = await fileAssets.getFirstObject();
expect(asset.mediaType == mediaType).assertTrue(); expect(asset.mediaType == mediaType).assertTrue();
...@@ -237,7 +237,7 @@ describe('fileTestPromise.test.js', function () { ...@@ -237,7 +237,7 @@ describe('fileTestPromise.test.js', function () {
*/ */
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_001_11', 0, async function (done) { it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_001_11', 0, async function (done) {
try { try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP); const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject(); const asset = await fileAssets.getFirstObject();
expect(asset.orientation == orientation).assertTrue(); expect(asset.orientation == orientation).assertTrue();
...@@ -304,7 +304,7 @@ describe('fileTestPromise.test.js', function () { ...@@ -304,7 +304,7 @@ describe('fileTestPromise.test.js', function () {
*/ */
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_002_02', 0, async function (done) { it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_002_02', 0, async function (done) {
try { try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP); const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject(); const asset = await fileAssets.getFirstObject();
...@@ -325,7 +325,7 @@ describe('fileTestPromise.test.js', function () { ...@@ -325,7 +325,7 @@ describe('fileTestPromise.test.js', function () {
*/ */
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_002_03', 0, async function (done) { it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_002_03', 0, async function (done) {
try { try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP); const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject(); const asset = await fileAssets.getFirstObject();
...@@ -352,7 +352,7 @@ describe('fileTestPromise.test.js', function () { ...@@ -352,7 +352,7 @@ describe('fileTestPromise.test.js', function () {
asset.title = `title_${new Date().getTime()}`; asset.title = `title_${new Date().getTime()}`;
await asset.commitModify(); await asset.commitModify();
const id = asset.id; const id = asset.id;
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const newAssets = await media.getFileAssets(idOP); const newAssets = await media.getFileAssets(idOP);
const newdataList = await newAssets.getAllObject(); const newdataList = await newAssets.getAllObject();
const newAsset = newdataList[0]; const newAsset = newdataList[0];
...@@ -391,7 +391,7 @@ describe('fileTestPromise.test.js', function () { ...@@ -391,7 +391,7 @@ describe('fileTestPromise.test.js', function () {
*/ */
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_002_08', 0, async function (done) { it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_002_08', 0, async function (done) {
try { try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP); const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject(); const asset = await fileAssets.getFirstObject();
expect(asset.mediaType == mediaType).assertTrue(); expect(asset.mediaType == mediaType).assertTrue();
...@@ -411,7 +411,7 @@ describe('fileTestPromise.test.js', function () { ...@@ -411,7 +411,7 @@ describe('fileTestPromise.test.js', function () {
*/ */
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_002_11', 0, async function (done) { it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_002_11', 0, async function (done) {
try { try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP); const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject(); const asset = await fileAssets.getFirstObject();
expect(asset.orientation == orientation).assertTrue(); expect(asset.orientation == orientation).assertTrue();
...@@ -476,7 +476,7 @@ describe('fileTestPromise.test.js', function () { ...@@ -476,7 +476,7 @@ describe('fileTestPromise.test.js', function () {
*/ */
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_003_02', 0, async function (done) { it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_003_02', 0, async function (done) {
try { try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP); const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject(); const asset = await fileAssets.getFirstObject();
expect(asset.displayName == displayName).assertTrue(); expect(asset.displayName == displayName).assertTrue();
...@@ -497,7 +497,7 @@ describe('fileTestPromise.test.js', function () { ...@@ -497,7 +497,7 @@ describe('fileTestPromise.test.js', function () {
*/ */
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_003_03', 0, async function (done) { it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_003_03', 0, async function (done) {
try { try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP); const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject(); const asset = await fileAssets.getFirstObject();
expect(asset.relativePath == path).assertTrue(); expect(asset.relativePath == path).assertTrue();
...@@ -524,7 +524,7 @@ describe('fileTestPromise.test.js', function () { ...@@ -524,7 +524,7 @@ describe('fileTestPromise.test.js', function () {
await asset.commitModify(); await asset.commitModify();
const id = asset.id; const id = asset.id;
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const newAssets = await media.getFileAssets(idOP); const newAssets = await media.getFileAssets(idOP);
const newdataList = await newAssets.getAllObject(); const newdataList = await newAssets.getAllObject();
const newAsset = newdataList[0]; const newAsset = newdataList[0];
...@@ -563,7 +563,7 @@ describe('fileTestPromise.test.js', function () { ...@@ -563,7 +563,7 @@ describe('fileTestPromise.test.js', function () {
*/ */
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_003_08', 0, async function (done) { it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_003_08', 0, async function (done) {
try { try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP); const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject(); const asset = await fileAssets.getFirstObject();
expect(asset.mediaType == mediaType).assertTrue(); expect(asset.mediaType == mediaType).assertTrue();
...@@ -629,7 +629,7 @@ describe('fileTestPromise.test.js', function () { ...@@ -629,7 +629,7 @@ describe('fileTestPromise.test.js', function () {
*/ */
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_004_02', 0, async function (done) { it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_004_02', 0, async function (done) {
try { try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP); const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject(); const asset = await fileAssets.getFirstObject();
expect(asset.displayName == displayName).assertTrue(); expect(asset.displayName == displayName).assertTrue();
...@@ -649,7 +649,7 @@ describe('fileTestPromise.test.js', function () { ...@@ -649,7 +649,7 @@ describe('fileTestPromise.test.js', function () {
*/ */
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_004_03', 0, async function (done) { it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_004_03', 0, async function (done) {
try { try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP); const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject(); const asset = await fileAssets.getFirstObject();
expect(asset.relativePath == path).assertTrue(); expect(asset.relativePath == path).assertTrue();
...@@ -675,7 +675,7 @@ describe('fileTestPromise.test.js', function () { ...@@ -675,7 +675,7 @@ describe('fileTestPromise.test.js', function () {
asset.title = `title_${new Date().getTime()}`; asset.title = `title_${new Date().getTime()}`;
await asset.commitModify(); await asset.commitModify();
const id = asset.id; const id = asset.id;
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const newAssets = await media.getFileAssets(idOP); const newAssets = await media.getFileAssets(idOP);
const newdataList = await newAssets.getAllObject(); const newdataList = await newAssets.getAllObject();
const newAsset = newdataList[0]; const newAsset = newdataList[0];
...@@ -714,7 +714,7 @@ describe('fileTestPromise.test.js', function () { ...@@ -714,7 +714,7 @@ describe('fileTestPromise.test.js', function () {
*/ */
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_004_08', 0, async function (done) { it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_004_08', 0, async function (done) {
try { try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] }; const idOP = { selections: mediaLibrary.FileKey.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP); const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject(); const asset = await fileAssets.getFirstObject();
expect(asset.mediaType == mediaType).assertTrue(); expect(asset.mediaType == mediaType).assertTrue();
......
...@@ -25,17 +25,17 @@ let videoType = mediaLibrary.MediaType.VIDEO; ...@@ -25,17 +25,17 @@ let videoType = mediaLibrary.MediaType.VIDEO;
let audioType = mediaLibrary.MediaType.AUDIO; let audioType = mediaLibrary.MediaType.AUDIO;
let imagesfetchOp = { let imagesfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [imageType.toString()], selectionArgs: [imageType.toString()],
}; };
let videosfetchOp = { let videosfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [videoType.toString()], selectionArgs: [videoType.toString()],
}; };
let audiosfetchOp = { let audiosfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [audioType.toString()], selectionArgs: [audioType.toString()],
}; };
let allsfetchOp = { let allsfetchOp = {
...@@ -72,7 +72,7 @@ async function getFileAssetsBy(done, type) { ...@@ -72,7 +72,7 @@ async function getFileAssetsBy(done, type) {
const fetchFileResult = await media.getFileAssets(assetOp); const fetchFileResult = await media.getFileAssets(assetOp);
const asset = await fetchFileResult.getFirstObject(); const asset = await fetchFileResult.getFirstObject();
let Op = { let Op = {
selections: fileKeyObj[filekeys[type]] + '= ?', selections: mediaLibrary.FileKey[filekeys[type]] + '= ?',
selectionArgs: [asset[type] + ''], selectionArgs: [asset[type] + ''],
}; };
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import mediaLibrary from '@ohos.multimedia.medialibrary'; import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import featureAbility from '@ohos.ability.featureAbility'; 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';
...@@ -25,17 +25,17 @@ let videoType = mediaLibrary.MediaType.VIDEO; ...@@ -25,17 +25,17 @@ let videoType = mediaLibrary.MediaType.VIDEO;
let audioType = mediaLibrary.MediaType.AUDIO; let audioType = mediaLibrary.MediaType.AUDIO;
let imagesfetchOp = { let imagesfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [imageType.toString()], selectionArgs: [imageType.toString()],
}; };
let videosfetchOp = { let videosfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [videoType.toString()], selectionArgs: [videoType.toString()],
}; };
let audiosfetchOp = { let audiosfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [audioType.toString()], selectionArgs: [audioType.toString()],
}; };
let allsfetchOp = { let allsfetchOp = {
...@@ -72,7 +72,7 @@ async function getFileAssetsBy(done, type) { ...@@ -72,7 +72,7 @@ async function getFileAssetsBy(done, type) {
const fetchFileResult = await media.getFileAssets(assetOp); const fetchFileResult = await media.getFileAssets(assetOp);
const asset = await fetchFileResult.getFirstObject(); const asset = await fetchFileResult.getFirstObject();
let Op = { let Op = {
selections: fileKeyObj[filekeys[type]] + '= ?', selections: mediaLibrary.FileKey[filekeys[type]] + '= ?',
selectionArgs: [asset[type] + ''], selectionArgs: [asset[type] + ''],
}; };
......
...@@ -18,9 +18,9 @@ import fileio from '@ohos.fileio'; ...@@ -18,9 +18,9 @@ import fileio from '@ohos.fileio';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
let fileKeyObj = mediaLibrary.FileKey; let fileKeyObj = mediaLibrary.FileKey;
let fetchOp = { let fetchOp = {
selections: fileKeyObj.PATH + ' LIKE ? ', selections: mediaLibrary.FileKey.PATH + ' LIKE ? ',
selectionArgs: ['/data/media/%'], selectionArgs: ['/data/media/%'],
order: fileKeyObj.PATH, order: mediaLibrary.FileKey.PATH,
}; };
// let directoryTypeObj = mediaLibrary.DirectoryType; // let directoryTypeObj = mediaLibrary.DirectoryType;
...@@ -36,45 +36,45 @@ let audioType = mediaLibrary.MediaType.AUDIO; ...@@ -36,45 +36,45 @@ let audioType = mediaLibrary.MediaType.AUDIO;
let fileType = mediaLibrary.MediaType.FILE; let fileType = mediaLibrary.MediaType.FILE;
let imagesfetchOp = { let imagesfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [imageType.toString()], selectionArgs: [imageType.toString()],
}; };
let videosfetchOp = { let videosfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [videoType.toString()], selectionArgs: [videoType.toString()],
}; };
let audiosfetchOp = { let audiosfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [audioType.toString()], selectionArgs: [audioType.toString()],
}; };
let filesfetchOp = { let filesfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [fileType.toString()], selectionArgs: [fileType.toString()],
}; };
let imageAndVideofetchOp = { let imageAndVideofetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ? or ' + fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? or ' + mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [imageType.toString(), videoType.toString()], selectionArgs: [imageType.toString(), videoType.toString()],
}; };
let imageAndVideoAndfilefetchOp = { let imageAndVideoAndfilefetchOp = {
selections: selections:
fileKeyObj.MEDIA_TYPE + mediaLibrary.FileKey.MEDIA_TYPE +
'= ? or ' + '= ? or ' +
fileKeyObj.MEDIA_TYPE + mediaLibrary.FileKey.MEDIA_TYPE +
'= ? or ' + '= ? or ' +
fileKeyObj.MEDIA_TYPE + mediaLibrary.FileKey.MEDIA_TYPE +
'= ?', '= ?',
selectionArgs: [imageType.toString(), videoType.toString(), fileType.toString()], selectionArgs: [imageType.toString(), videoType.toString(), fileType.toString()],
}; };
let imageAndVideoAndfileAndAudiofetchOp = { let imageAndVideoAndfileAndAudiofetchOp = {
selections: selections:
fileKeyObj.MEDIA_TYPE + mediaLibrary.FileKey.MEDIA_TYPE +
'= ? or ' + '= ? or ' +
fileKeyObj.MEDIA_TYPE + mediaLibrary.FileKey.MEDIA_TYPE +
'= ? or ' + '= ? or ' +
fileKeyObj.MEDIA_TYPE + mediaLibrary.FileKey.MEDIA_TYPE +
'= ? or ' + '= ? or ' +
fileKeyObj.MEDIA_TYPE + mediaLibrary.FileKey.MEDIA_TYPE +
'= ?', '= ?',
selectionArgs: [ selectionArgs: [
imageType.toString(), imageType.toString(),
...@@ -267,7 +267,7 @@ describe('mediaLibraryTestCallBack.test.js', function () { ...@@ -267,7 +267,7 @@ describe('mediaLibraryTestCallBack.test.js', function () {
*/ */
it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_008', 0, async function (done) { it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_008', 0, async function (done) {
let fetchOp = { let fetchOp = {
selections: fileKeyObj.MEDIA_TYPE + 'abc= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + 'abc= ?',
selectionArgs: ['abc'], selectionArgs: ['abc'],
}; };
try { try {
...@@ -292,7 +292,7 @@ describe('mediaLibraryTestCallBack.test.js', function () { ...@@ -292,7 +292,7 @@ describe('mediaLibraryTestCallBack.test.js', function () {
*/ */
it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_009', 0, async function (done) { it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_009', 0, async function (done) {
let fetchOp = { let fetchOp = {
selections: fileKeyObj.MEDIA_TYPE + 'abc= ? or ' + fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + 'abc= ? or ' + mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: ['abc', audioType.toString()], selectionArgs: ['abc', audioType.toString()],
}; };
try { try {
...@@ -318,11 +318,11 @@ describe('mediaLibraryTestCallBack.test.js', function () { ...@@ -318,11 +318,11 @@ describe('mediaLibraryTestCallBack.test.js', function () {
it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_010', 0, async function (done) { it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_010', 0, async function (done) {
let fetchOp = { let fetchOp = {
selections: selections:
fileKeyObj.MEDIA_TYPE + mediaLibrary.FileKey.MEDIA_TYPE +
'abc= ? or ' + 'abc= ? or ' +
fileKeyObj.MEDIA_TYPE + mediaLibrary.FileKey.MEDIA_TYPE +
'= ? or ' + '= ? or ' +
fileKeyObj.MEDIA_TYPE + mediaLibrary.FileKey.MEDIA_TYPE +
'= ?', '= ?',
selectionArgs: ['abc', videoType.toString(), fileType.toString()], selectionArgs: ['abc', videoType.toString(), fileType.toString()],
}; };
...@@ -349,13 +349,13 @@ describe('mediaLibraryTestCallBack.test.js', function () { ...@@ -349,13 +349,13 @@ describe('mediaLibraryTestCallBack.test.js', function () {
it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_011', 0, async function (done) { it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_011', 0, async function (done) {
let fetchOp = { let fetchOp = {
selections: selections:
fileKeyObj.MEDIA_TYPE + mediaLibrary.FileKey.MEDIA_TYPE +
'abc= ? or ' + 'abc= ? or ' +
fileKeyObj.MEDIA_TYPE + mediaLibrary.FileKey.MEDIA_TYPE +
'= ? or ' + '= ? or ' +
fileKeyObj.MEDIA_TYPE + mediaLibrary.FileKey.MEDIA_TYPE +
'= ? or ' + '= ? or ' +
fileKeyObj.MEDIA_TYPE + mediaLibrary.FileKey.MEDIA_TYPE +
'= ?', '= ?',
selectionArgs: ['abc', videoType.toString(), fileType.toString(), audioType.toString()], selectionArgs: ['abc', videoType.toString(), fileType.toString(), audioType.toString()],
}; };
......
...@@ -12,15 +12,15 @@ ...@@ -12,15 +12,15 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import mediaLibrary from '@ohos.multimedia.medialibrary'; import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import featureAbility from '@ohos.ability.featureAbility'; import featureAbility from '@ohos.ability.featureAbility';
import fileio from '@ohos.fileio'; import fileio from '@ohos.fileio';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
let fileKeyObj = mediaLibrary.FileKey; let fileKeyObj = mediaLibrary.FileKey;
let fetchOp = { let fetchOp = {
selections: fileKeyObj.PATH + ' LIKE ? ', selections: mediaLibrary.FileKey.PATH + ' LIKE ? ',
selectionArgs: ['/data/media/%'], selectionArgs: ['/data/media/%'],
order: fileKeyObj.PATH, order: mediaLibrary.FileKey.PATH,
}; };
// let directoryTypeObj = mediaLibrary.DirectoryType; // let directoryTypeObj = mediaLibrary.DirectoryType;
...@@ -36,45 +36,45 @@ let audioType = mediaLibrary.MediaType.AUDIO; ...@@ -36,45 +36,45 @@ let audioType = mediaLibrary.MediaType.AUDIO;
let fileType = mediaLibrary.MediaType.FILE; let fileType = mediaLibrary.MediaType.FILE;
let imagesfetchOp = { let imagesfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [imageType.toString()], selectionArgs: [imageType.toString()],
}; };
let videosfetchOp = { let videosfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [videoType.toString()], selectionArgs: [videoType.toString()],
}; };
let audiosfetchOp = { let audiosfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [audioType.toString()], selectionArgs: [audioType.toString()],
}; };
let filesfetchOp = { let filesfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [fileType.toString()], selectionArgs: [fileType.toString()],
}; };
let imageAndVideofetchOp = { let imageAndVideofetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ? or ' + fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? or ' + mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [imageType.toString(), videoType.toString()], selectionArgs: [imageType.toString(), videoType.toString()],
}; };
let imageAndVideoAndfilefetchOp = { let imageAndVideoAndfilefetchOp = {
selections: selections:
fileKeyObj.MEDIA_TYPE + mediaLibrary.FileKey.MEDIA_TYPE +
'= ? or ' + '= ? or ' +
fileKeyObj.MEDIA_TYPE + mediaLibrary.FileKey.MEDIA_TYPE +
'= ? or ' + '= ? or ' +
fileKeyObj.MEDIA_TYPE + mediaLibrary.FileKey.MEDIA_TYPE +
'= ?', '= ?',
selectionArgs: [imageType.toString(), videoType.toString(), fileType.toString()], selectionArgs: [imageType.toString(), videoType.toString(), fileType.toString()],
}; };
let imageAndVideoAndfileAndAudiofetchOp = { let imageAndVideoAndfileAndAudiofetchOp = {
selections: selections:
fileKeyObj.MEDIA_TYPE + mediaLibrary.FileKey.MEDIA_TYPE +
'= ? or ' + '= ? or ' +
fileKeyObj.MEDIA_TYPE + mediaLibrary.FileKey.MEDIA_TYPE +
'= ? or ' + '= ? or ' +
fileKeyObj.MEDIA_TYPE + mediaLibrary.FileKey.MEDIA_TYPE +
'= ? or ' + '= ? or ' +
fileKeyObj.MEDIA_TYPE + mediaLibrary.FileKey.MEDIA_TYPE +
'= ?', '= ?',
selectionArgs: [ selectionArgs: [
imageType.toString(), imageType.toString(),
...@@ -100,10 +100,10 @@ describe('mediaLibraryTestPromise.test.js', function () { ...@@ -100,10 +100,10 @@ describe('mediaLibraryTestPromise.test.js', function () {
const context = featureAbility.getContext(); const context = featureAbility.getContext();
const media = mediaLibrary.getMediaLibrary(context); const media = mediaLibrary.getMediaLibrary(context);
beforeAll(function () {}); beforeAll(function () { });
beforeEach(function () {}); beforeEach(function () { });
afterEach(function () {}); afterEach(function () { });
afterAll(function () {}); afterAll(function () { });
var timestamp = new Date().getTime(); var timestamp = new Date().getTime();
var jpgName = timestamp + '.jpg'; var jpgName = timestamp + '.jpg';
...@@ -280,7 +280,7 @@ describe('mediaLibraryTestPromise.test.js', function () { ...@@ -280,7 +280,7 @@ describe('mediaLibraryTestPromise.test.js', function () {
*/ */
it('SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_008', 0, async function (done) { it('SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_008', 0, async function (done) {
let fetchOp = { let fetchOp = {
selections: fileKeyObj.MEDIA_TYPE + 'abc= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + 'abc= ?',
selectionArgs: ['abc'], selectionArgs: ['abc'],
}; };
try { try {
...@@ -305,7 +305,7 @@ describe('mediaLibraryTestPromise.test.js', function () { ...@@ -305,7 +305,7 @@ describe('mediaLibraryTestPromise.test.js', function () {
*/ */
it('SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_009', 0, async function (done) { it('SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_009', 0, async function (done) {
let fetchOp = { let fetchOp = {
selections: fileKeyObj.MEDIA_TYPE + 'abc= ? or ' + fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + 'abc= ? or ' + mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: ['abc', audioType.toString()], selectionArgs: ['abc', audioType.toString()],
}; };
try { try {
...@@ -331,11 +331,11 @@ describe('mediaLibraryTestPromise.test.js', function () { ...@@ -331,11 +331,11 @@ describe('mediaLibraryTestPromise.test.js', function () {
it('SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_010', 0, async function (done) { it('SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_010', 0, async function (done) {
let fetchOp = { let fetchOp = {
selections: selections:
fileKeyObj.MEDIA_TYPE + mediaLibrary.FileKey.MEDIA_TYPE +
'abc= ? or ' + 'abc= ? or ' +
fileKeyObj.MEDIA_TYPE + mediaLibrary.FileKey.MEDIA_TYPE +
'= ? or ' + '= ? or ' +
fileKeyObj.MEDIA_TYPE + mediaLibrary.FileKey.MEDIA_TYPE +
'= ?', '= ?',
selectionArgs: ['abc', videoType.toString(), fileType.toString()], selectionArgs: ['abc', videoType.toString(), fileType.toString()],
}; };
...@@ -362,13 +362,13 @@ describe('mediaLibraryTestPromise.test.js', function () { ...@@ -362,13 +362,13 @@ describe('mediaLibraryTestPromise.test.js', function () {
it('SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_011', 0, async function (done) { it('SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_011', 0, async function (done) {
let fetchOp = { let fetchOp = {
selections: selections:
fileKeyObj.MEDIA_TYPE + mediaLibrary.FileKey.MEDIA_TYPE +
'abc= ? or ' + 'abc= ? or ' +
fileKeyObj.MEDIA_TYPE + mediaLibrary.FileKey.MEDIA_TYPE +
'= ? or ' + '= ? or ' +
fileKeyObj.MEDIA_TYPE + mediaLibrary.FileKey.MEDIA_TYPE +
'= ? or ' + '= ? or ' +
fileKeyObj.MEDIA_TYPE + mediaLibrary.FileKey.MEDIA_TYPE +
'= ?', '= ?',
selectionArgs: ['abc', videoType.toString(), fileType.toString(), audioType.toString()], selectionArgs: ['abc', videoType.toString(), fileType.toString(), audioType.toString()],
}; };
...@@ -769,18 +769,18 @@ describe('mediaLibraryTestPromise.test.js', function () { ...@@ -769,18 +769,18 @@ describe('mediaLibraryTestPromise.test.js', function () {
} }
}); });
/** /**
* @tc.number : SUB__MEDIA_MIDIALIBRARY_PROMISE_CREATEASSET_001 * @tc.number : SUB__MEDIA_MIDIALIBRARY_PROMISE_CREATEASSET_001
* @tc.name : createAsset * @tc.name : createAsset
* @tc.desc : Create File Asset image (does not exist) * @tc.desc : Create File Asset image (does not exist)
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB__MEDIA_MIDIALIBRARY_PROMISE_CREATEASSET_009', 0, async function (done) { it('SUB__MEDIA_MIDIALIBRARY_PROMISE_CREATEASSET_009', 0, async function (done) {
try { try {
const path = await media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_IMAGE); const path = await media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_IMAGE);
const filePath = path + "image/"; const filePath = path + "image/";
const fileAssets = await media.getFileAssets(videosfetchOp); const fileAssets = await media.getFileAssets(videosfetchOp);
const dataList = await fileAssets.getAllObject(); const dataList = await fileAssets.getAllObject();
const asset1 = dataList[0]; const asset1 = dataList[0];
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import mediaLibrary from '@ohos.multimedia.medialibrary'; import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import featureAbility from '@ohos.ability.featureAbility'; import featureAbility from '@ohos.ability.featureAbility';
import fileio from '@ohos.fileio'; import fileio from '@ohos.fileio';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
...@@ -31,19 +31,19 @@ describe('mediaLibraryTestPromiseOnOff.test.js', async function () { ...@@ -31,19 +31,19 @@ describe('mediaLibraryTestPromiseOnOff.test.js', async function () {
let fileType = mediaLibrary.MediaType.FILE; let fileType = mediaLibrary.MediaType.FILE;
let imagesfetchOp = { let imagesfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [imageType.toString()], selectionArgs: [imageType.toString()],
}; };
let videosfetchOp = { let videosfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [videoType.toString()], selectionArgs: [videoType.toString()],
}; };
let audiosfetchOp = { let audiosfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [audioType.toString()], selectionArgs: [audioType.toString()],
}; };
let filesfetchOp = { let filesfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs: [fileType.toString()], selectionArgs: [fileType.toString()],
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册