未验证 提交 4751afc9 编写于 作者: O openharmony_ci 提交者: Gitee

!2651 udpate xts

Merge pull request !2651 from 潘强标/master
......@@ -210,12 +210,12 @@ describe('FileAssetGetThumbnailPromise.test.js', function () {
console.info('MediaLibraryTest : 001_05 pixel image info ' + info);
console.info('MediaLibraryTest : 001_05 pixel width ' + info.size.width);
console.info('MediaLibraryTest : 001_05 pixel height ' + info.size.height);
expect(true).assertTrue();
expect(false).assertTrue();
console.info('MediaLibraryTest : getFileAssets 001_05 failed');
done();
} catch (error) {
console.info('MediaLibraryTest : getFileAssets 001_05 passed');
expect(false).assertTrue();
expect(true).assertTrue();
done();
}
});
......@@ -239,12 +239,12 @@ describe('FileAssetGetThumbnailPromise.test.js', function () {
console.info('MediaLibraryTest : 001_06 pixel image info ' + info);
console.info('MediaLibraryTest : 001_06 pixel width ' + info.size.width);
console.info('MediaLibraryTest : 001_06 pixel height ' + info.size.height);
expect(true).assertTrue();
expect(false).assertTrue();
console.info('MediaLibraryTest : getThumbnail 001_06 failed');
done();
} catch (error) {
console.info('MediaLibraryTest : getFileAssets 001_06 passed ');
expect(false).assertTrue();
expect(true).assertTrue();
done();
}
});
......
......@@ -12,27 +12,40 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./getPermission.test.js')
require('./FileAssetGetThumbnailCallBack.test.js')
require('./FileAssetGetThumbnailPromise.test.js')
require('./albumGetFileAssetsCallback.test.js')
require('./albumGetFileAssetsPromise.test.js')
require('./albumTestCallBack.test.js')
require('./albumTestPromise.test.js')
require('./distributed.test.js')
require('./distributedCallback.test.js')
require('./distributedPromise.test.js')
require('./favoriteTestCallBack.test.js')
require('./favoriteTestPromise.test.js')
require('./fetchFileResultCallBack.test.js')
require('./fetchFileResultPromise.test.js')
require('./fileAsset2.test.js')
require('./fileAssetCallBack2.test.js')
require('./FileAssetGetThumbnailCallBack.test.js')
require('./FileAssetGetThumbnailPromise.test.js')
require('./fileAssetPromise2.test.js')
require('./fileAssetTestCallback.test.js')
require('./fileAssetTestPromise.test.js')
require('./fileAssetUriTestCallBack.test.js')
require('./fileAssetUriTestPromiese.test.js')
require('./filekeyTestCallBack.test.js')
require('./filekeyTestPromise.test.js')
require('./fileTestCallBack.test.js')
require('./fileTestPromise.test.js')
require('./filekeyTestPromise.test.js')
require('./getAllPeersDeviceTestCallback.test.js')
require('./getAllPeersDeviceTestPromise.test.js')
require('./getAllPeersTestCallback.test.js')
require('./getAllPeersTestPromise.test.js')
require('./mediaLibraryTestCallBack.test.js')
require('./mediaLibraryTestPromise.test.js')
require('./mediaLibraryTestPromiseOnOff.test.js')
require('./favtrashTestCallBack.test.js')
require('./favtrashTestPromise.test.js')
require('./albumTestCallBack.test.js')
require('./albumTestPromise.test.js')
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import mediaLibrary from '@ohos.multimedia.medialibrary';
import featureAbility from '@ohos.ability.featureAbility';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
describe('albumGetFileAssetsCallback.test.js', async function() {
var context = featureAbility.getContext();
console.info('MediaLibraryTest : getMediaLibrary IN');
var media = mediaLibrary.getMediaLibrary(context);
console.info('MediaLibraryTest : getMediaLibrary OUT');
beforeAll(function() {});
beforeEach(function() {});
afterEach(function() {});
afterAll(function() {});
const fileKeyObj = mediaLibrary.FileKey;
let imageType = mediaLibrary.MediaType.IMAGE;
let videoType = mediaLibrary.MediaType.VIDEO;
let audioType = mediaLibrary.MediaType.AUDIO;
const count = 3;
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_01
* @tc.name : getFileAssets
* @tc.desc : more file type all
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_01', 0, async function(done) {
try {
let allTypefetchOp = {
selections : '',
selectionArgs : [],
order : 'date_added DESC LIMIT 0,3',
};
const albumList = await media.getAlbums(allTypefetchOp);
const album = albumList[0];
album.getFileAssets(allTypefetchOp, (error, fetchFileResult) => {
if (fetchFileResult == undefined) {
expect(false).assertTrue();
done();
} else {
expect(fetchFileResult.getCount() <= count).assertTrue();
done();
}
});
} catch (error) {
expect(false).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_02
* @tc.name : getFileAssets
* @tc.desc : more file type image
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_02', 0, async function(done) {
try {
let imageAlbumfetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs : [ imageType.toString() ],
order : 'date_added DESC LIMIT 0,3',
};
const albumList = await media.getAlbums(imageAlbumfetchOp);
const album = albumList[0];
album.getFileAssets(imageAlbumfetchOp, (error, fetchFileResult) => {
if (fetchFileResult == undefined) {
expect(false).assertTrue();
done();
} else {
expect(fetchFileResult.getCount() <= count).assertTrue();
done();
}
});
} catch (error) {
expect(false).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_03
* @tc.name : getFileAssets
* @tc.desc : more file type audio
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_03', 0, async function(done) {
try {
let audioAlbumfetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs : [ audioType.toString() ],
order : 'date_added DESC LIMIT 0,3',
};
const albumList = await media.getAlbums(audioAlbumfetchOp);
const album = albumList[0];
album.getFileAssets(audioAlbumfetchOp, (error, fetchFileResult) => {
if (fetchFileResult == undefined) {
expect(false).assertTrue();
done();
} else {
expect(fetchFileResult.getCount() <= count).assertTrue();
done();
}
});
} catch (error) {
expect(false).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_04
* @tc.name : getFileAssets
* @tc.desc : more file type video
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_04', 0, async function(done) {
try {
let videoAlbumfetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs : [ videoType.toString() ],
order : 'date_added DESC LIMIT 0,3',
};
const albumList = await media.getAlbums(videoAlbumfetchOp);
const album = albumList[0];
album.getFileAssets(videoAlbumfetchOp, (error, fetchFileResult) => {
if (fetchFileResult == undefined) {
expect(false).assertTrue();
done();
} else {
expect(fetchFileResult.getCount() <= count).assertTrue();
done();
}
});
} catch (error) {
expect(false).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_05
* @tc.name : getFileAssets
* @tc.desc : more file type image and video
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_05', 0, async function(done) {
try {
let imageAndVideoAlbumfetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ? or ' + fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs : [ imageType.toString(), videoType.toString() ],
order : 'date_added DESC LIMIT 0,3',
};
const albumList = await media.getAlbums(imageAndVideoAlbumfetchOp);
const album = albumList[0];
album.getFileAssets(imageAndVideoAlbumfetchOp, (error, fetchFileResult) => {
if (fetchFileResult == undefined) {
expect(false).assertTrue();
done();
} else {
expect(fetchFileResult.getCount() <= count).assertTrue();
done();
}
});
} catch (error) {
expect(false).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_06
* @tc.name : getFileAssets
* @tc.desc : more file type image and audio
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_06', 0, async function(done) {
try {
let imageAndAudioAlbumfetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ? or ' + fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs : [ imageType.toString(), audioType.toString() ],
order : 'date_added DESC LIMIT 0,3',
};
const albumList = await media.getAlbums(imageAndAudioAlbumfetchOp);
const album = albumList[0];
album.getFileAssets(imageAndAudioAlbumfetchOp, (error, fetchFileResult) => {
if (fetchFileResult == undefined) {
expect(false).assertTrue();
done();
} else {
expect(fetchFileResult.getCount() <= count).assertTrue();
done();
}
});
} catch (error) {
expect(false).assertTrue();
done();
}
});
/** order: 'date_added DESC LIMIT 0,500'
* @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_07
* @tc.name : getFileAssets
* @tc.desc : more file type video and audio
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_07', 0, async function(done) {
try {
let videoAndAudioAlbumfetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ? or ' + fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs : [ videoType.toString(), audioType.toString() ],
order : 'date_added DESC LIMIT 0,3',
};
const albumList = await media.getAlbums(videoAndAudioAlbumfetchOp);
const album = albumList[0];
album.getFileAssets(videoAndAudioAlbumfetchOp, (error, fetchFileResult) => {
if (fetchFileResult == undefined) {
expect(false).assertTrue();
done();
} else {
expect(fetchFileResult.getCount() <= count).assertTrue();
done();
}
});
} catch (error) {
expect(false).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_08
* @tc.name : getFileAssets
* @tc.desc : more file type image video and audio
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_08', 0, async function(done) {
try {
let imgAndVideoAndAudioAlbumfetchOp = {
selections : fileKeyObj.MEDIA_TYPE + '= ? or ' + fileKeyObj.MEDIA_TYPE + '= ? or '
+ fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs : [ imageType.toString(), videoType.toString(), audioType.toString() ],
order : 'date_added DESC LIMIT 0,3',
};
const albumList = await media.getAlbums(imgAndVideoAndAudioAlbumfetchOp);
const album = albumList[0];
album.getFileAssets(imgAndVideoAndAudioAlbumfetchOp, (error, fetchFileResult) => {
if (fetchFileResult == undefined) {
expect(false).assertTrue();
done();
} else {
expect(fetchFileResult.getCount() <= count).assertTrue();
done();
}
});
} catch (error) {
expect(false).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_09
* @tc.name : getFileAssets
* @tc.desc : one file tpe image
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_09', 0, async function(done) {
try {
let albumfetchOpOne = {
selections : fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs : [ imageType.toString() ],
order : 'date_added DESC LIMIT 0,1',
};
const albumList = await media.getAlbums(albumfetchOpOne);
const album = albumList[0];
album.getFileAssets(albumfetchOpOne, (error, fetchFileResult) => {
if (fetchFileResult == undefined) {
expect(false).assertTrue();
done();
} else {
expect(fetchFileResult.getCount() <= count).assertTrue();
done();
}
});
} catch (error) {
expect(false).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_10
* @tc.name : getFileAssets
* @tc.desc : one file type audio
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_10', 0, async function(done) {
try {
let albumfetchOpOne = {
selections : fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs : [ audioType.toString() ],
order : 'date_added DESC LIMIT 0,1',
};
const albumList = await media.getAlbums(albumfetchOpOne);
const album = albumList[0];
album.getFileAssets(albumfetchOpOne, (error, fetchFileResult) => {
if (fetchFileResult == undefined) {
expect(false).assertTrue();
done();
} else {
expect(fetchFileResult.getCount() <= count).assertTrue();
done();
}
});
} catch (error) {
expect(false).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_11
* @tc.name : getFileAssets
* @tc.desc : one file type audio
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_11', 0, async function(done) {
try {
let albumfetchOpOne = {
selections : fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs : [ videoType.toString() ],
order : 'date_added DESC LIMIT 0,1',
};
const albumList = await media.getAlbums(albumfetchOpOne);
const album = albumList[0];
album.getFileAssets(albumfetchOpOne, (error, fetchFileResult) => {
if (fetchFileResult == undefined) {
expect(false).assertTrue();
done();
} else {
expect(fetchFileResult.getCount() <= count).assertTrue();
done();
}
});
} catch (error) {
expect(false).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_12
* @tc.name : getFileAssets
* @tc.desc : no file type image
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_12', 0, async function(done) {
try {
let albumfetchOpNone = {
selections : fileKeyObj.MEDIA_TYPE + '= ? AND date_added < 0',
selectionArgs : [ imageType.toString() ],
order : 'date_added DESC LIMIT 0,1',
};
media.getAlbums(albumfetchOpNone, (error, albumList) => {
if (albumList == undefined) {
expect(false).assertTrue();
console.info(
'MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_12 albumList == undefined');
done();
} else {
console.info(
'MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_12 albumList.length:'
+ albumList.length);
expect(albumList.length == 0).assertTrue();
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_12 done');
done();
}
});
} catch (error) {
expect(false).assertTrue();
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_12 error:' + error);
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_13
* @tc.name : getFileAssets
* @tc.desc : no file type audio
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_13', 0, async function(done) {
try {
let albumfetchOpNone = {
selections : fileKeyObj.MEDIA_TYPE + '= ? AND date_added < 0',
selectionArgs : [ audioType.toString() ],
order : 'date_added DESC LIMIT 0,1',
};
media.getAlbums(albumfetchOpNone, (error, albumList) => {
if (albumList == undefined) {
console.info(
'MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_13 albumList == undefined');
expect(false).assertTrue();
done();
} else {
console.info(
'MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_13 albumList.length:'
+ albumList.length);
expect(albumList.length == 0).assertTrue();
done();
}
});
} catch (error) {
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_13 error:' + error);
expect(false).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_14
* @tc.name : getFileAssets
* @tc.desc : no file type video
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_14', 0, async function(done) {
try {
let albumfetchOpNone = {
selections : fileKeyObj.MEDIA_TYPE + '= ? AND date_added < 0',
selectionArgs : [ videoType.toString() ],
order : 'date_added DESC LIMIT 0,1',
};
media.getAlbums(albumfetchOpNone, (error, albumList) => {
if (albumList == undefined) {
console.info(
'MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_14 albumList == undefined');
expect(false).assertTrue();
done();
} else {
console.info(
'MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_14 albumList.length:'
+ albumList.length);
expect(albumList.length == 0).assertTrue();
done();
}
});
} catch (error) {
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_CALLBACK_001_14 error:' + error);
expect(false).assertTrue();
done();
}
});
});
\ No newline at end of file
......@@ -14,17 +14,17 @@
*/
import mediaLibrary from '@ohos.multimedia.medialibrary';
import featureAbility from '@ohos.ability.featureAbility';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
describe('albumGetFileAssetsPromise.test.js', async function () {
describe('albumGetFileAssetsPromise.test.js', async function() {
var context = featureAbility.getContext();
console.info('MediaLibraryTest : getMediaLibrary IN');
var media = mediaLibrary.getMediaLibrary(context);
console.info('MediaLibraryTest : getMediaLibrary OUT');
beforeAll(function () {});
beforeEach(function () {});
afterEach(function () {});
afterAll(function () {});
beforeAll(function() {});
beforeEach(function() {});
afterEach(function() {});
afterAll(function() {});
const fileKeyObj = mediaLibrary.FileKey;
......@@ -41,12 +41,12 @@ describe('albumGetFileAssetsPromise.test.js', async function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_01', 0, async function (done) {
it('SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_01', 0, async function(done) {
try {
let allTypefetchOp = {
selections: '',
selectionArgs: [],
order: 'date_added DESC LIMIT 0,3',
selections : '',
selectionArgs : [],
order : 'date_added DESC LIMIT 0,3',
};
const albumList = await media.getAlbums(allTypefetchOp);
const album = albumList[0];
......@@ -67,12 +67,12 @@ describe('albumGetFileAssetsPromise.test.js', async function () {
* @tc.type : Function
* @tc.level : Level 0
*/
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 {
let imageAlbumfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs: [imageType.toString()],
order: 'date_added DESC LIMIT 0,3',
selections : fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs : [ imageType.toString() ],
order : 'date_added DESC LIMIT 0,3',
};
const albumList = await media.getAlbums(imageAlbumfetchOp);
const album = albumList[0];
......@@ -93,12 +93,12 @@ describe('albumGetFileAssetsPromise.test.js', async function () {
* @tc.type : Function
* @tc.level : Level 0
*/
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 {
let audioAlbumfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs: [audioType.toString()],
order: 'date_added DESC LIMIT 0,3',
selections : fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs : [ audioType.toString() ],
order : 'date_added DESC LIMIT 0,3',
};
const albumList = await media.getAlbums(audioAlbumfetchOp);
const album = albumList[0];
......@@ -119,12 +119,12 @@ describe('albumGetFileAssetsPromise.test.js', async function () {
* @tc.type : Function
* @tc.level : Level 0
*/
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 {
let videoAlbumfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs: [videoType.toString()],
order: 'date_added DESC LIMIT 0,3',
selections : fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs : [ videoType.toString() ],
order : 'date_added DESC LIMIT 0,3',
};
const albumList = await media.getAlbums(videoAlbumfetchOp);
const album = albumList[0];
......@@ -145,12 +145,12 @@ describe('albumGetFileAssetsPromise.test.js', async function () {
* @tc.type : Function
* @tc.level : Level 0
*/
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 {
let imageAndVideoAlbumfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ? or ' + fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs: [imageType.toString(), videoType.toString()],
order: 'date_added DESC LIMIT 0,3',
selections : fileKeyObj.MEDIA_TYPE + '= ? or ' + fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs : [ imageType.toString(), videoType.toString() ],
order : 'date_added DESC LIMIT 0,3',
};
const albumList = await media.getAlbums(imageAndVideoAlbumfetchOp);
const album = albumList[0];
......@@ -171,12 +171,12 @@ describe('albumGetFileAssetsPromise.test.js', async function () {
* @tc.type : Function
* @tc.level : Level 0
*/
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 {
let imageAndAudioAlbumfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ? or ' + fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs: [imageType.toString(), audioType.toString()],
order: 'date_added DESC LIMIT 0,3',
selections : fileKeyObj.MEDIA_TYPE + '= ? or ' + fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs : [ imageType.toString(), audioType.toString() ],
order : 'date_added DESC LIMIT 0,3',
};
const albumList = await media.getAlbums(imageAndAudioAlbumfetchOp);
const album = albumList[0];
......@@ -197,12 +197,12 @@ describe('albumGetFileAssetsPromise.test.js', async function () {
* @tc.type : Function
* @tc.level : Level 0
*/
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 {
let videoAndAudioAlbumfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ? or ' + fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs: [videoType.toString(), audioType.toString()],
order: 'date_added DESC LIMIT 0,3',
selections : fileKeyObj.MEDIA_TYPE + '= ? or ' + fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs : [ videoType.toString(), audioType.toString() ],
order : 'date_added DESC LIMIT 0,3',
};
const albumList = await media.getAlbums(videoAndAudioAlbumfetchOp);
const album = albumList[0];
......@@ -223,18 +223,13 @@ describe('albumGetFileAssetsPromise.test.js', async function () {
* @tc.type : Function
* @tc.level : Level 0
*/
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 {
let imgAndVideoAndAudioAlbumfetchOp = {
selections:
fileKeyObj.MEDIA_TYPE +
'= ? or ' +
fileKeyObj.MEDIA_TYPE +
'= ? or ' +
fileKeyObj.MEDIA_TYPE +
'= ?',
selectionArgs: [imageType.toString(), videoType.toString(), audioType.toString()],
order: 'date_added DESC LIMIT 0,3',
selections : fileKeyObj.MEDIA_TYPE + '= ? or ' + fileKeyObj.MEDIA_TYPE + '= ? or '
+ fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs : [ imageType.toString(), videoType.toString(), audioType.toString() ],
order : 'date_added DESC LIMIT 0,3',
};
const albumList = await media.getAlbums(imgAndVideoAndAudioAlbumfetchOp);
const album = albumList[0];
......@@ -255,12 +250,12 @@ describe('albumGetFileAssetsPromise.test.js', async function () {
* @tc.type : Function
* @tc.level : Level 0
*/
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 {
let albumfetchOpOne = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs: [imageType.toString()],
order: 'date_added DESC LIMIT 0,1',
selections : fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs : [ imageType.toString() ],
order : 'date_added DESC LIMIT 0,1',
};
const albumList = await media.getAlbums(albumfetchOpOne);
const album = albumList[0];
......@@ -281,12 +276,12 @@ describe('albumGetFileAssetsPromise.test.js', async function () {
* @tc.type : Function
* @tc.level : Level 0
*/
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 {
let albumfetchOpOne = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs: [audioType.toString()],
order: 'date_added DESC LIMIT 0,1',
selections : fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs : [ audioType.toString() ],
order : 'date_added DESC LIMIT 0,1',
};
const albumList = await media.getAlbums(albumfetchOpOne);
const album = albumList[0];
......@@ -307,12 +302,12 @@ describe('albumGetFileAssetsPromise.test.js', async function () {
* @tc.type : Function
* @tc.level : Level 0
*/
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 {
let albumfetchOpOne = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs: [videoType.toString()],
order: 'date_added DESC LIMIT 0,1',
selections : fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs : [ videoType.toString() ],
order : 'date_added DESC LIMIT 0,1',
};
const albumList = await media.getAlbums(albumfetchOpOne);
const album = albumList[0];
......@@ -333,18 +328,22 @@ describe('albumGetFileAssetsPromise.test.js', async function () {
* @tc.type : Function
* @tc.level : Level 0
*/
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 {
let albumfetchOpNone = {
selections: fileKeyObj.MEDIA_TYPE + '= ? AND date_added < 0',
selectionArgs: [imageType.toString()],
order: 'date_added DESC LIMIT 0,1',
selections : fileKeyObj.MEDIA_TYPE + '= ? AND date_added < 0',
selectionArgs : [ imageType.toString() ],
order : 'date_added DESC LIMIT 0,1',
};
const albumList = await media.getAlbums(albumfetchOpNone);
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_12 albumList.length:'
+ albumList.length);
expect(albumList.length == 0).assertTrue();
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_12 done');
done();
} catch (error) {
expect(false).assertTrue();
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_12 error:' + error);
done();
}
});
......@@ -357,18 +356,22 @@ describe('albumGetFileAssetsPromise.test.js', async function () {
* @tc.type : Function
* @tc.level : Level 0
*/
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 {
let albumfetchOpNone = {
selections: fileKeyObj.MEDIA_TYPE + '= ? AND date_added < 0',
selectionArgs: [audioType.toString()],
order: 'date_added DESC LIMIT 0,1',
selections : fileKeyObj.MEDIA_TYPE + '= ? AND date_added < 0',
selectionArgs : [ audioType.toString() ],
order : 'date_added DESC LIMIT 0,1',
};
const albumList = await media.getAlbums(albumfetchOpNone);
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_13 albumList.length:'
+ albumList.length);
expect(albumList.length == 0).assertTrue();
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_13 done');
done();
} catch (error) {
expect(false).assertTrue();
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_13 error:' + error);
done();
}
});
......@@ -381,18 +384,22 @@ describe('albumGetFileAssetsPromise.test.js', async function () {
* @tc.type : Function
* @tc.level : Level 0
*/
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 {
let albumfetchOpNone = {
selections: fileKeyObj.MEDIA_TYPE + '= ? AND date_added < 0',
selectionArgs: [videoType.toString()],
order: 'date_added DESC LIMIT 0,1',
selections : fileKeyObj.MEDIA_TYPE + '= ? AND date_added < 0',
selectionArgs : [ videoType.toString() ],
order : 'date_added DESC LIMIT 0,1',
};
const albumList = await media.getAlbums(albumfetchOpNone);
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_14 albumList.length:'
+ albumList.length);
expect(albumList.length == 0).assertTrue();
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_14 done');
done();
} catch (error) {
expect(false).assertTrue();
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_13 error:' + error);
done();
}
});
......
......@@ -26,7 +26,10 @@ let allTypefetchOp = {
selections: '',
selectionArgs: [],
};
let albumCoverUrifetchOp = {
selections: fileKeyObj.RELATIVE_PATH + '= ? AND ' + fileKeyObj.ALBUM_NAME + '= ?',
selectionArgs: ['pictures/','weixin'],
};
let imageAlbumfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs: [imageType.toString()],
......@@ -665,14 +668,28 @@ describe('albumTestPromise.test.js', async function () {
*/
it('SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_004_01', 0, async function (done) {
try {
const albumList = await media.getAlbums(allTypefetchOp);
let coverUrifetchOp = {
selections: '',
selectionArgs: [],
order: 'date_added DESC LIMIT 0,1',
};
const albumList = await media.getAlbums(albumCoverUrifetchOp);
const album = albumList[0];
const fetchFileResult = await album.getFileAssets(allTypefetchOp);
console.info('PROMISE getAlbum 004_01 album name = ' + album.albumName);
console.info('PROMISE getAlbum 004_01 album id = ' + album.albumId);
const fetchFileResult = await album.getFileAssets(coverUrifetchOp);
const asset = await fetchFileResult.getFirstObject();
if (asset == undefined) {
expect(false).assertTrue();
done();
} else {
console.info('PROMISE getAlbum 004_01 coveruri = ' + album.coverUri);
console.info('PROMISE getAlbum 004_01 asset.uri = ' + asset.uri);
expect(asset.uri == album.coverUri).assertTrue();
done();
}
} catch (error) {
console.info('ALBUM_PROMISE getAlbum 004_01 failed, message = ' + error);
console.info('PROMISE getAlbum 004_01 failed, message = ' + error);
expect(false).assertTrue();
done();
}
......
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import mediaLibrary from '@ohos.multimedia.medialibrary';
import featureAbility from '@ohos.ability.featureAbility'
import image from '@ohos.multimedia.image';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('distributedCallback.test.js', function() {
var context = featureAbility.getContext();
console.info('MediaLibraryTest : getMediaLibrary IN');
var media = mediaLibrary.getMediaLibrary(context);
console.info('MediaLibraryTest : getMediaLibrary OUT');
beforeAll(function() {
onsole.info(
'Distributed. Callback MediaLibraryTest: beforeAll: Prerequisites at the test suite level, which are executed before the test suite is executed.');
})
beforeEach(function() {
console.info(
'Distributed. Callback MediaLibraryTest: beforeEach:Prerequisites at the test case level, which are executed before each test case is executed.');
})
afterEach(function() {
console.info(
'Distributed. Callback MediaLibraryTest: afterEach: Test case-level clearance conditions, which are executed after each test case is executed.');
})
afterAll(function() {
console.info(
'Distributed. Callback MediaLibraryTest: afterAll: Test suite-level cleanup condition, which is executed after the test suite is executed');
})
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_CALLBACK_001_01
* @tc.name : getActivePeers
* @tc.desc : getActivePeers
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_CALLBACK_001_01', 0, async function(done) {
try {
done();
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_CALLBACK_001_01 begin');
media.getActivePeers((error, peers) => {
expect(error == undefined).assertTrue();
});
done();
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_CALLBACK_001_01 done');
} catch (error) {
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_CALLBACK_001_01 fail, message = '
+ error);
done();
}
done();
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_CALLBACK_001_02
* @tc.name : getAllPeers
* @tc.desc : getAllPeers
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_CALLBACK_001_02', 0, async function(done) {
try {
done();
media.getAllPeers((error, peers) => {
expect(error == undefined).assertTrue();
});
done();
} catch (error) {
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_CALLBACK_001_02 fail, message = '
+ error);
done();
}
done();
});
})
\ No newline at end of file
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import mediaLibrary from '@ohos.multimedia.medialibrary';
import featureAbility from '@ohos.ability.featureAbility'
import image from '@ohos.multimedia.image';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('distributedPromise.test.js', function() {
var context = featureAbility.getContext();
console.info('MediaLibraryTest : getMediaLibrary IN');
var media = mediaLibrary.getMediaLibrary(context);
console.info('MediaLibraryTest : getMediaLibrary OUT');
beforeAll(function() {
onsole.info(
'Distributed. Promise MediaLibraryTest: beforeAll: Prerequisites at the test suite level, which are executed before the test suite is executed.');
})
beforeEach(function() {
console.info(
'Distributed. Promise MediaLibraryTest: beforeEach:Prerequisites at the test case level, which are executed before each test case is executed.');
})
afterEach(function() {
console.info(
'Distributed. Promise MediaLibraryTest: afterEach: Test case-level clearance conditions, which are executed after each test case is executed.');
})
afterAll(function() {
console.info(
'Distributed. Promise MediaLibraryTest: afterAll: Test suite-level cleanup condition, which is executed after the test suite is executed');
})
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_distributed_001_01
* @tc.name : getActivePeers
* @tc.desc : getActivePeers
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_001_01', 0, async function(done) {
try {
done();
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_001_01 begin');
let peers = await media.getActivePeers();
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_001_01 done');
done();
} catch (error) {
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_001_01 fail, message = ' + error);
done();
}
done();
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_001_02
* @tc.name : getAllPeers
* @tc.desc : getAllPeers
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_001_02', 0, async function(done) {
try {
done();
let peers = await media.getAllPeers();
done();
} catch (error) {
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_001_02 fail, message = ' + error);
done();
}
done();
});
})
\ No newline at end of file
......@@ -71,10 +71,24 @@ describe('favoriteTestCallBack.test.js', function () {
console.info('FAV_ASSET_CALLBACK 001_01 fail');
expect(false).assertTrue();
done();
} else {
asset.favorite(true, () => {
asset.isFavorite((err1, isFavorite) => {
if (isFavorite) {
console.info('FAV_ASSET_CALLBACK 001_01 success');
expect(true).assertTrue();
done();
} else {
console.info('FAV_ASSET_CALLBACK 001_01 fail');
expect(false).assertTrue();
done();
}
});
});
}
});
});
} else {
asset.favorite(true, () => {
asset.isFavorite((err1, isFavorite) => {
if (isFavorite) {
......@@ -88,6 +102,7 @@ describe('favoriteTestCallBack.test.js', function () {
}
});
});
}
});
});
});
......@@ -119,10 +134,24 @@ describe('favoriteTestCallBack.test.js', function () {
console.info('FAV_ASSET_CALLBACK 001_02 fail');
expect(false).assertTrue();
done();
} else {
asset.favorite(false, () => {
asset.isFavorite((err1, isFavorite) => {
if (!isFavorite) {
console.info('FAV_ASSET_CALLBACK 001_02 pass');
expect(true).assertTrue();
done();
} else {
console.info('FAV_ASSET_CALLBACK 001_02 fail');
expect(false).assertTrue();
done();
}
});
});
}
});
});
} else {
asset.favorite(false, () => {
asset.isFavorite((err1, isFavorite) => {
if (!isFavorite) {
......@@ -136,6 +165,7 @@ describe('favoriteTestCallBack.test.js', function () {
}
});
});
}
});
});
});
......@@ -402,10 +432,24 @@ describe('favoriteTestCallBack.test.js', function () {
console.info('FAV_ASSET_CALLBACK 002_01 failed');
expect(false).assertTrue();
done();
} else {
asset.favorite(true, () => {
asset.isFavorite((err1, isFavorite) => {
if (isFavorite) {
console.info('FAV_ASSET_CALLBACK 002_01 success');
expect(true).assertTrue();
done();
} else {
console.info('FAV_ASSET_CALLBACK 002_01 fail');
expect(false).assertTrue();
done();
}
});
});
}
});
});
} else {
asset.favorite(true, () => {
asset.isFavorite((err1, isFavorite) => {
if (isFavorite) {
......@@ -419,6 +463,8 @@ describe('favoriteTestCallBack.test.js', function () {
}
});
});
}
});
});
});
......@@ -450,10 +496,24 @@ describe('favoriteTestCallBack.test.js', function () {
console.info('FAV_ASSET_CALLBACK 002_02 fail');
expect(false).assertTrue();
done();
} else {
asset.favorite(false, () => {
asset.isFavorite((err1, isFavorite) => {
if (!isFavorite) {
console.info('FAV_ASSET_CALLBACK 002_02 pass');
expect(true).assertTrue();
done();
} else {
console.info('FAV_ASSET_CALLBACK 002_02 fail');
expect(false).assertTrue();
done();
}
});
});
}
});
});
} else {
asset.favorite(false, () => {
asset.isFavorite((err1, isFavorite) => {
if (!isFavorite) {
......@@ -467,6 +527,7 @@ describe('favoriteTestCallBack.test.js', function () {
}
});
});
}
});
});
});
......@@ -733,10 +794,24 @@ describe('favoriteTestCallBack.test.js', function () {
console.info('FAV_ASSET_CALLBACK 003_01 fail');
expect(false).assertTrue();
done();
} else {
asset.favorite(true, () => {
asset.isFavorite((err1, isFavorite) => {
if (isFavorite) {
console.info('FAV_ASSET_CALLBACK 003_01 success');
expect(true).assertTrue();
done();
} else {
console.info('FAV_ASSET_CALLBACK 003_01 fail');
expect(false).assertTrue();
done();
}
});
});
}
});
});
} else {
asset.favorite(true, () => {
asset.isFavorite((err1, isFavorite) => {
if (isFavorite) {
......@@ -750,6 +825,8 @@ describe('favoriteTestCallBack.test.js', function () {
}
});
});
}
});
});
});
......@@ -781,10 +858,24 @@ describe('favoriteTestCallBack.test.js', function () {
console.info('FAV_ASSET_CALLBACK 003_02 fail');
expect(false).assertTrue();
done();
} else {
asset.favorite(false, () => {
asset.isFavorite((err1, isFavorite) => {
if (!isFavorite) {
console.info('FAV_ASSET_CALLBACK 003_02 pass');
expect(true).assertTrue();
done();
} else {
console.info('FAV_ASSET_CALLBACK 003_02 fail');
expect(false).assertTrue();
done();
}
});
});
}
});
});
} else {
asset.favorite(false, () => {
asset.isFavorite((err1, isFavorite) => {
if (!isFavorite) {
......@@ -798,6 +889,8 @@ describe('favoriteTestCallBack.test.js', function () {
}
});
});
}
});
});
});
......@@ -1064,10 +1157,24 @@ describe('favoriteTestCallBack.test.js', function () {
console.info('FAV_ASSET_CALLBACK 004_01 fail');
expect(false).assertTrue();
done();
} else {
asset.favorite(true, () => {
asset.isFavorite((err1, isFavorite) => {
if (isFavorite) {
console.info('FAV_ASSET_CALLBACK 004_01 success');
expect(true).assertTrue();
done();
} else {
console.info('FAV_ASSET_CALLBACK 004_01 fail');
expect(false).assertTrue();
done();
}
});
});
}
});
});
} else {
asset.favorite(true, () => {
asset.isFavorite((err1, isFavorite) => {
if (isFavorite) {
......@@ -1081,6 +1188,8 @@ describe('favoriteTestCallBack.test.js', function () {
}
});
});
}
});
});
});
......@@ -1112,10 +1221,24 @@ describe('favoriteTestCallBack.test.js', function () {
console.info('FAV_ASSET_CALLBACK 004_02 fail');
expect(false).assertTrue();
done();
} else {
asset.favorite(false, () => {
asset.isFavorite((err1, isFavorite) => {
if (!isFavorite) {
console.info('FAV_ASSET_CALLBACK 004_02 pass');
expect(true).assertTrue();
done();
} else {
console.info('FAV_ASSET_CALLBACK 004_02 fail');
expect(false).assertTrue();
done();
}
});
});
}
});
});
} else {
asset.favorite(false, () => {
asset.isFavorite((err1, isFavorite) => {
if (!isFavorite) {
......@@ -1129,6 +1252,8 @@ describe('favoriteTestCallBack.test.js', function () {
}
});
});
}
});
});
});
......
......@@ -79,11 +79,7 @@ async function getFileAssetsBy(done, type) {
try {
let fetchFileResult = await media.getFileAssets(Op);
const fetchCount = fetchFileResult.getCount();
if(type == 'parent') {
expect(fetchCount == 0).assertTrue();
} else{
expect(fetchCount > 0).assertTrue();
}
done();
} catch (error) {
expect(false).assertTrue();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册