未验证 提交 4ca18047 编写于 作者: O openharmony_ci 提交者: Gitee

!4233 Fix build ERRORs

Merge pull request !4233 from 张代曰/build_errors
......@@ -354,147 +354,6 @@ export default function albumTestCallBackTest(abilityContext){
// ------------------------------ 001 test end -------------------------
// ------------------------------ 002 test start -------------------------
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_002_01
* @tc.name : getAlbums
* @tc.desc : Get Album by 666
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_002_01', 0, async function (done) {
try {
media.getAlbums(666, (err, albumList) => {
if (albumList == undefined) {
console.info('ALBUM_CALLBACK getalbum 002_01 passed');
expect(true).assertTrue();
done();
} else {
expect(false).assertTrue();
console.info('ALBUM_CALLBACK getalbum 002_01 failed');
done();
}
});
} catch (error) {
console.info('ALBUM_CALLBACK getalbum 002_01 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_002_02
* @tc.name : getAlbums
* @tc.desc : Get Album by '666'
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_002_02', 0, async function (done) {
try {
media.getAlbums('666', (err, albumList) => {
if (albumList == undefined) {
console.info('ALBUM_CALLBACK getalbum 002_02 passed');
expect(true).assertTrue();
done();
} else {
expect(false).assertTrue();
console.info('ALBUM_CALLBACK getalbum 002_02 failed');
done();
}
});
} catch (error) {
console.info('ALBUM_CALLBACK getalbum 002_02 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_002_03
* @tc.name : getAlbums
* @tc.desc : Get Album by 0
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_002_03', 0, async function (done) {
try {
media.getAlbums(0, (err, albumList) => {
if (albumList == undefined) {
console.info('ALBUM_CALLBACK getalbum 002_03 passed');
expect(true).assertTrue();
done();
} else {
expect(false).assertTrue();
console.info('ALBUM_CALLBACK getalbum 002_03 failed');
done();
}
});
} catch (error) {
console.info('ALBUM_CALLBACK getalbum 002_03 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_002_04
* @tc.name : getAlbums
* @tc.desc : Get Album by true
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_002_04', 0, async function (done) {
try {
media.getAlbums(true, (err, albumList) => {
if (albumList == undefined) {
console.info('ALBUM_CALLBACK getalbum 002_04 passed');
expect(true).assertTrue();
done();
} else {
expect(false).assertTrue();
console.info('ALBUM_CALLBACK getalbum 002_04 failed');
done();
}
});
} catch (error) {
console.info('ALBUM_CALLBACK getalbum 002_04 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_002_05
* @tc.name : getAlbums
* @tc.desc : Get Album by false
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_002_05', 0, async function (done) {
try {
media.getAlbums(false, (err, albumList) => {
if (albumList == undefined) {
console.info('ALBUM_CALLBACK getalbum 002_05 passed');
expect(true).assertTrue();
done();
} else {
expect(false).assertTrue();
console.info('ALBUM_CALLBACK getalbum 002_05 failed');
done();
}
});
} catch (error) {
console.info('ALBUM_CALLBACK getalbum 002_05 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_CALLBACK_002_06
* @tc.name : album.getFileAssets
......@@ -685,9 +544,9 @@ export default function albumTestCallBackTest(abilityContext){
const albumId = album.albumId;
console.info('ALBUM_CALLBACK Modify 003_03 album.albumName(old) = ' + album.albumName);
let newName = true;
let newName = "";
for (var i = 0; i < 1200; i++) {
newName += 'i';
newName += i.toString();
}
album.albumName = newName;
......@@ -712,83 +571,6 @@ export default function albumTestCallBackTest(abilityContext){
}
done();
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_CALLBACK_003_04
* @tc.name : commitModify
* @tc.desc : Modify Album name true
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_CALLBACK_003_04', 0, async function (done) {
try {
const albumList = await media.getAlbums(allTypefetchOp);
const album = albumList[0];
const albumId = album.albumId;
console.info('ALBUM_CALLBACK Modify 003_04 album.albumName(old) = ' + album.albumName);
const newName = true;
album.albumName = newName;
album.commitModify(async () => {
try {
let currentfetchOp = {
selections: fileKeyObj.ALBUM_ID + '= ?',
selectionArgs: [albumId + ''],
};
const newAlbumList = await media.getAlbums(currentfetchOp);
expect(newAlbumList[0].albumName == newName).assertFalse();
done();
} catch (error) {
console.info('ALBUM_CALLBACK Modify 003_04 commitModify failed, message = ' + error);
}
});
} catch (error) {
console.info('ALBUM_CALLBACK Modify 003_04 passed');
expect(true).assertTrue();
}
done();
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_CALLBACK_003_05
* @tc.name : commitModify
* @tc.desc : Modify Album name false
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_CALLBACK_003_05', 0, async function (done) {
try {
const albumList = await media.getAlbums(allTypefetchOp);
const album = albumList[0];
const albumId = album.albumId;
console.info('ALBUM_CALLBACK Modify 003_05 album.albumName(old) = ' + album.albumName);
const newName = false;
album.albumName = newName;
album.commitModify(async () => {
try {
let currentfetchOp = {
selections: fileKeyObj.ALBUM_ID + '= ?',
selectionArgs: [albumId + ''],
};
const newAlbumList = await media.getAlbums(currentfetchOp);
expect(newAlbumList[0].albumName == newName).assertFalse();
done();
} catch (error) {
console.info('ALBUM_CALLBACK Modify 003_05 commitModify failed, message = ' + error);
}
});
} catch (error) {
console.info('ALBUM_CALLBACK Modify 003_05 passed');
expect(true).assertTrue();
}
done();
});
// ------------------------------ 003 test end -------------------------
// ------------------------------ 004 test start -------------------------
......@@ -835,52 +617,6 @@ export default function albumTestCallBackTest(abilityContext){
}
});
// ------------------------------ 004 test end -------------------------
// ------------------------------ 006 test start -------------------------
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_CALLBACK_006_01
* @tc.name : commitModify
* @tc.desc : Modify Album albumUri
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_CALLBACK_006_01', 0, async function (done) {
const albumList = await media.getAlbums(allTypefetchOp);
const album = albumList[0];
try {
album.albumUri = 'testalbumUri';
expect(false).assertTrue();
done();
} catch (error) {
expect(true).assertTrue();
done();
console.info('ALBUM_CALLBACK Modify 006_01 003 album.albumUri error = album.albumUri has no setter');
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_CALLBACK_006_02
* @tc.name : commitModify
* @tc.desc : Modify Album name false
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_CALLBACK_006_02', 0, async function (done) {
const albumList = await media.getAlbums(allTypefetchOp);
const album = albumList[0];
try {
album.coverUri = 'testcoverUri';
expect(false).assertTrue();
done();
} catch (error) {
expect(true).assertTrue();
console.info('ALBUM_CALLBACK Modify 006_01 003 album.albumUri error = album.coverUri has no setter');
done();
}
});
// ------------------------------ 006 test end -------------------------
});
}
......
......@@ -313,111 +313,6 @@ export default function albumTestPromiseTest(abilityContext){
// ------------------------------ 001 test end -------------------------
// ------------------------------ 002 test start -------------------------
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_002_01
* @tc.name : getAlbums
* @tc.desc : Get Album by 666
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_002_01', 0, async function (done) {
try {
await media.getAlbums(666);
expect(false).assertTrue();
console.info('ALBUM_PROMISE getalbum 002_01 failed');
done();
} catch (error) {
console.info('ALBUM_PROMISE getalbum 002_01 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_002_02
* @tc.name : getAlbums
* @tc.desc : Get Album by '666'
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_002_02', 0, async function (done) {
try {
await media.getAlbums('666');
console.info('ALBUM_PROMISE getalbum 002_02 failed');
expect(false).assertTrue();
done();
} catch (error) {
console.info('ALBUM_PROMISE getalbum 002_02 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_002_03
* @tc.name : getAlbums
* @tc.desc : Get Album by 0
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_002_03', 0, async function (done) {
try {
await media.getAlbums(0);
console.info('ALBUM_PROMISE getalbum 002_03 failed');
expect(false).assertTrue();
done();
} catch (error) {
console.info('ALBUM_PROMISE getalbum 002_03 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_002_04
* @tc.name : getAlbums
* @tc.desc : Get Album by true
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_002_04', 0, async function (done) {
try {
await media.getAlbums(true);
console.info('ALBUM_PROMISE getalbum 002_04 failed');
expect(false).assertTrue();
done();
} catch (error) {
console.info('ALBUM_PROMISE getalbum 002_04 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_002_05
* @tc.name : getAlbums
* @tc.desc : Get Album by false
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_002_05', 0, async function (done) {
try {
await media.getAlbums(false);
console.info('ALBUM_PROMISE getalbum 002_05 failed');
expect(false).assertTrue();
done();
} catch (error) {
console.info('ALBUM_PROMISE getalbum 002_05 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_PROMISE_002_06
* @tc.name : album.getFileAssets
......@@ -581,9 +476,9 @@ export default function albumTestPromiseTest(abilityContext){
const albumId = album.albumId;
console.info('ALBUM_PROMISE Modify 003_04 album.albumName(old) = ' + album.albumName);
let newName = true;
let newName = "";
for (var i = 0; i < 1200; i++) {
newName += 'i';
newName += i.toString();
}
album.albumName = newName;
......@@ -603,76 +498,6 @@ export default function albumTestPromiseTest(abilityContext){
}
done();
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_PROMISE_003_05
* @tc.name : commitModify
* @tc.desc : Modify Album name true
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_PROMISE_003_05', 0, async function (done) {
try {
const albumList = await media.getAlbums(allTypefetchOp);
const album = albumList[0];
const albumId = album.albumId;
console.info('ALBUM_PROMISE Modify 003_05 album.albumName(old) = ' + album.albumName);
const newName = true;
album.albumName = newName;
await album.commitModify();
let currentfetchOp = {
selections: fileKeyObj.ALBUM_ID + '= ?',
selectionArgs: [albumId + ''],
};
const newAlbumList = await media.getAlbums(currentfetchOp);
expect(newAlbumList[0].albumName === newName).assertFalse();
done();
} catch (error) {
console.info('ALBUM_PROMISE Modify 003_05 passed');
expect(true).assertTrue();
}
done();
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_PROMISE_003_06
* @tc.name : commitModify
* @tc.desc : Modify Album name false
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_PROMISE_003_06', 0, async function (done) {
try {
const albumList = await media.getAlbums(allTypefetchOp);
const album = albumList[0];
const albumId = album.albumId;
console.info('ALBUM_PROMISE Modify 003_06 album.albumName(old) = ' + album.albumName);
const newName = false;
album.albumName = newName;
await album.commitModify();
let currentfetchOp = {
selections: fileKeyObj.ALBUM_ID + '= ?',
selectionArgs: [albumId + ''],
};
const newAlbumList = await media.getAlbums(currentfetchOp);
expect(newAlbumList[0].albumName === newName).assertFalse();
done();
} catch (error) {
console.info('ALBUM_PROMISE Modify 003_06 passed');
expect(true).assertTrue();
}
done();
});
// ------------------------------ 003 test end -------------------------
// ------------------------------ 004 test start -------------------------
......@@ -713,54 +538,6 @@ export default function albumTestPromiseTest(abilityContext){
}
});
// ------------------------------ 004 test end -------------------------
// ------------------------------ 006 test start -------------------------
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_PROMISE_006_01
* @tc.name : commitModify
* @tc.desc : Modify Album albumUri
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_PROMISE_006_01', 0, async function (done) {
try {
const albumList = await media.getAlbums(allTypefetchOp);
const album = albumList[0];
album.albumUri = 'testalbumUri';
await album.commitModify();
console.info('ALBUM_PROMISE Modify 006_01 failed');
expect(false).assertTrue();
} catch (error) {
console.info('ALBUM_PROMISE Modify 006_01 passed');
expect(true).assertTrue();
}
done();
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_PROMISE_006_02
* @tc.name : commitModify
* @tc.desc : Modify Album name false
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_PROMISE_006_02', 0, async function (done) {
try {
const albumList = await media.getAlbums(allTypefetchOp);
const album = albumList[0];
album.coverUri = 'testcoverUri';
await album.commitModify();
console.info('ALBUM_PROMISE Modify 006_02 failed');
expect(false).assertTrue();
} catch (error) {
console.info('ALBUM_PROMISE Modify 006_02 passed');
expect(true).assertTrue();
}
done();
});
// ------------------------------ 006 test end -------------------------
});
}
......
......@@ -180,171 +180,6 @@ export default function favoriteTestCallBackTest(abilityContext) {
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_001_03
* @tc.name : favorite
* @tc.desc : favorite(file) by 'true'
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_001_03', 0, async function (done) {
try {
media.getFileAssets(fileFetchOp, (error, fileAssets) => {
fileAssets.getAllObject((error, dataList) => {
const asset = dataList[0];
try {
asset.favorite('true', () => {
console.info('FAV_ASSET_CALLBACK 001_03 fail');
expect(false).assertTrue();
done();
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 001_03 pass');
expect(true).assertTrue();
done();
}
});
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 001_03 pass');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_001_04
* @tc.name : favorite
* @tc.desc : favorite(file) by 'false'
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_001_04', 0, async function (done) {
try {
media.getFileAssets(fileFetchOp, (error, fileAssets) => {
fileAssets.getAllObject((error, dataList) => {
const asset = dataList[0];
try {
asset.favorite('false', () => {
console.info('FAV_ASSET_CALLBACK 001_04 fail');
expect(false).assertTrue();
done();
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 001_04 pass');
expect(true).assertTrue();
done();
}
});
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 001_04 pass');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_001_05
* @tc.name : favorite
* @tc.desc : favorite(file) by 'fav'
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_001_05', 0, async function (done) {
try {
media.getFileAssets(fileFetchOp, (error, fileAssets) => {
fileAssets.getAllObject((error, dataList) => {
const asset = dataList[0];
try {
asset.favorite('fav', () => {
console.info('FAV_ASSET_CALLBACK 001_05 fail');
expect(false).assertTrue();
done();
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 001_05 pass');
expect(true).assertTrue();
done();
}
});
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 001_05 pass');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_001_06
* @tc.name : favorite
* @tc.desc : favorite(file) by 666
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_001_06', 0, async function (done) {
try {
media.getFileAssets(fileFetchOp, (error, fileAssets) => {
fileAssets.getAllObject((error, dataList) => {
const asset = dataList[0];
try {
asset.favorite(666, () => {
console.info('FAV_ASSET_CALLBACK 001_06 fail');
expect(false).assertTrue();
done();
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 001_06 pass');
expect(true).assertTrue();
done();
}
});
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 001_06 pass');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_001_07
* @tc.name : favorite
* @tc.desc : favorite(file) by no arg
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_001_07', 0, async function (done) {
try {
media.getFileAssets(fileFetchOp, (error, fileAssets) => {
fileAssets.getAllObject((error, dataList) => {
const asset = dataList[0];
try {
asset.favorite(() => {
console.info('FAV_ASSET_CALLBACK 001_07 fail');
expect(false).assertTrue();
done();
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 001_07 pass');
expect(true).assertTrue();
done();
}
});
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 001_07 pass');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_001_08
* @tc.name : isFavorite
......@@ -542,171 +377,6 @@ export default function favoriteTestCallBackTest(abilityContext) {
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_002_03
* @tc.name : favorite
* @tc.desc : favorite(image) by 'true'
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_002_03', 0, async function (done) {
try {
media.getFileAssets(imageFetchOp, (error, fileAssets) => {
fileAssets.getAllObject((error, dataList) => {
const asset = dataList[0];
try {
asset.favorite('true', () => {
console.info('FAV_ASSET_CALLBACK 002_03 fail');
expect(false).assertTrue();
done();
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 002_03 passed');
expect(true).assertTrue();
done();
}
});
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 002_03 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_002_04
* @tc.name : favorite
* @tc.desc : favorite(image) by 'false'
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_002_04', 0, async function (done) {
try {
media.getFileAssets(imageFetchOp, (error, fileAssets) => {
fileAssets.getAllObject((error, dataList) => {
const asset = dataList[0];
try {
asset.favorite('false', () => {
console.info('FAV_ASSET_CALLBACK 002_04 fail');
expect(false).assertTrue();
done();
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 002_04 passed');
expect(true).assertTrue();
done();
}
});
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 002_04 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_002_05
* @tc.name : favorite
* @tc.desc : favorite(image) by 'fav'
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_002_05', 0, async function (done) {
try {
media.getFileAssets(imageFetchOp, (error, fileAssets) => {
fileAssets.getAllObject((error, dataList) => {
const asset = dataList[0];
try {
asset.favorite('fav', () => {
console.info('FAV_ASSET_CALLBACK 002_05 fail');
expect(false).assertTrue();
done();
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 002_05 passed');
expect(true).assertTrue();
done();
}
});
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 002_05 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_002_06
* @tc.name : favorite
* @tc.desc : favorite(image) by 666
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_002_06', 0, async function (done) {
try {
media.getFileAssets(imageFetchOp, (error, fileAssets) => {
fileAssets.getAllObject((error, dataList) => {
const asset = dataList[0];
try {
asset.favorite(666, () => {
console.info('FAV_ASSET_CALLBACK 002_06 fail');
expect(false).assertTrue();
done();
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 002_06 passed');
expect(true).assertTrue();
done();
}
});
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 002_06 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_002_07
* @tc.name : favorite
* @tc.desc : favorite(image) by no arg
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_002_07', 0, async function (done) {
try {
media.getFileAssets(imageFetchOp, (error, fileAssets) => {
fileAssets.getAllObject((error, dataList) => {
const asset = dataList[0];
try {
asset.favorite(() => {
console.info('FAV_ASSET_CALLBACK 002_07 fail');
expect(false).assertTrue();
done();
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 002_07 passed');
expect(true).assertTrue();
done();
}
});
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 002_07 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_002_08
* @tc.name : isFavorite
......@@ -905,171 +575,6 @@ export default function favoriteTestCallBackTest(abilityContext) {
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_003_03
* @tc.name : favorite
* @tc.desc : favorite(video) by 'true'
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_003_03', 0, async function (done) {
try {
media.getFileAssets(videoFetchOp, (error, fileAssets) => {
fileAssets.getAllObject((error, dataList) => {
const asset = dataList[0];
try {
asset.favorite('true', () => {
console.info('FAV_ASSET_CALLBACK 003_03 fail');
expect(false).assertTrue();
done();
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 003_03 passed');
expect(true).assertTrue();
done();
}
});
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 003_03 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_003_04
* @tc.name : favorite
* @tc.desc : favorite(video) by 'false'
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_003_04', 0, async function (done) {
try {
media.getFileAssets(videoFetchOp, (error, fileAssets) => {
fileAssets.getAllObject((error, dataList) => {
const asset = dataList[0];
try {
asset.favorite('false', () => {
console.info('FAV_ASSET_CALLBACK 003_04 fail');
expect(false).assertTrue();
done();
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 003_04 passed');
expect(true).assertTrue();
done();
}
});
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 003_04 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_003_05
* @tc.name : favorite
* @tc.desc : favorite(video) by 'fav'
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_003_05', 0, async function (done) {
try {
media.getFileAssets(videoFetchOp, (error, fileAssets) => {
fileAssets.getAllObject((error, dataList) => {
const asset = dataList[0];
try {
asset.favorite('fav', () => {
console.info('FAV_ASSET_CALLBACK 003_05 fail');
expect(false).assertTrue();
done();
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 003_05 passed');
expect(true).assertTrue();
done();
}
});
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 003_05 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_003_06
* @tc.name : favorite
* @tc.desc : favorite(video) by 666
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_003_06', 0, async function (done) {
try {
media.getFileAssets(videoFetchOp, (error, fileAssets) => {
fileAssets.getAllObject((error, dataList) => {
const asset = dataList[0];
try {
asset.favorite(666, () => {
console.info('FAV_ASSET_CALLBACK 003_06 fail');
expect(false).assertTrue();
done();
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 003_06 passed');
expect(true).assertTrue();
done();
}
});
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 003_06 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_003_07
* @tc.name : favorite
* @tc.desc : favorite(video) by no arg
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_003_07', 0, async function (done) {
try {
media.getFileAssets(videoFetchOp, (error, fileAssets) => {
fileAssets.getAllObject((error, dataList) => {
const asset = dataList[0];
try {
asset.favorite(() => {
console.info('FAV_ASSET_CALLBACK 003_07 fail');
expect(false).assertTrue();
done();
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 003_07 passed');
expect(true).assertTrue();
done();
}
});
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 003_07 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_003_08
* @tc.name : isFavorite
......@@ -1268,171 +773,6 @@ export default function favoriteTestCallBackTest(abilityContext) {
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_004_03
* @tc.name : favorite
* @tc.desc : favorite(audio) by 'true'
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_004_03', 0, async function (done) {
try {
media.getFileAssets(audioFetchOp, (error, fileAssets) => {
fileAssets.getAllObject((error, dataList) => {
const asset = dataList[0];
try {
asset.favorite('true', () => {
console.info('FAV_ASSET_CALLBACK 004_03 fail');
expect(false).assertTrue();
done();
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 004_03 passed');
expect(true).assertTrue();
done();
}
});
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 004_03 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_004_04
* @tc.name : favorite
* @tc.desc : favorite(audio) by 'false'
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_004_04', 0, async function (done) {
try {
media.getFileAssets(audioFetchOp, (error, fileAssets) => {
fileAssets.getAllObject((error, dataList) => {
const asset = dataList[0];
try {
asset.favorite('false', () => {
console.info('FAV_ASSET_CALLBACK 004_04 fail');
expect(false).assertTrue();
done();
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 004_04 passed');
expect(true).assertTrue();
done();
}
});
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 004_04 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_004_05
* @tc.name : favorite
* @tc.desc : favorite(audio) by 'fav'
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_004_05', 0, async function (done) {
try {
media.getFileAssets(audioFetchOp, (error, fileAssets) => {
fileAssets.getAllObject((error, dataList) => {
const asset = dataList[0];
try {
asset.favorite('fav', () => {
console.info('FAV_ASSET_CALLBACK 004_05 fail');
expect(false).assertTrue();
done();
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 004_05 passed');
expect(true).assertTrue();
done();
}
});
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 004_05 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_004_06
* @tc.name : favorite
* @tc.desc : favorite(audio) by 666
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_004_06', 0, async function (done) {
try {
media.getFileAssets(audioFetchOp, (error, fileAssets) => {
fileAssets.getAllObject((error, dataList) => {
const asset = dataList[0];
try {
asset.favorite(666, () => {
console.info('FAV_ASSET_CALLBACK 004_06 fail');
expect(false).assertTrue();
done();
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 004_06 passed');
expect(true).assertTrue();
done();
}
});
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 004_06 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_004_07
* @tc.name : favorite
* @tc.desc : favorite(audio) by no arg
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_004_07', 0, async function (done) {
try {
media.getFileAssets(audioFetchOp, (error, fileAssets) => {
fileAssets.getAllObject((error, dataList) => {
const asset = dataList[0];
try {
asset.favorite(() => {
console.info('FAV_ASSET_CALLBACK 004_07 fail');
expect(false).assertTrue();
done();
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 004_07 passed');
expect(true).assertTrue();
done();
}
});
});
} catch (error) {
console.info('FAV_ASSET_CALLBACK 004_07 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_004_08
* @tc.name : isFavorite
......
......@@ -137,126 +137,6 @@ export default function favoriteTestPromiseTest(abilityContext) {
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_001_03
* @tc.name : favorite
* @tc.desc : favorite(file) by 'true'
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_001_03', 0, async function (done) {
try {
const fileAssets = await media.getFileAssets(fileFetchOp);
const dataList = await fileAssets.getAllObject();
const asset = dataList[0];
await asset.favorite('true');
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 001_03 failed');
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 001_03 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_001_04
* @tc.name : favorite
* @tc.desc : favorite(file) by 'false'
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_001_04', 0, async function (done) {
try {
const fileAssets = await media.getFileAssets(fileFetchOp);
const dataList = await fileAssets.getAllObject();
const asset = dataList[0];
await asset.favorite('false');
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 001_04 failed');
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 001_04 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_001_05
* @tc.name : favorite
* @tc.desc : favorite(file) by 'fav'
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_001_05', 0, async function (done) {
try {
const fileAssets = await media.getFileAssets(fileFetchOp);
const dataList = await fileAssets.getAllObject();
const asset = dataList[0];
await asset.favorite('fav');
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 001_05 failed');
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 001_05 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_001_06
* @tc.name : favorite
* @tc.desc : favorite(file) by 666
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_001_06', 0, async function (done) {
try {
const fileAssets = await media.getFileAssets(fileFetchOp);
const dataList = await fileAssets.getAllObject();
const asset = dataList[0];
await asset.favorite(666);
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 001_06 failed');
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 001_06 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_001_07
* @tc.name : favorite
* @tc.desc : favorite(file) by no arg
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_001_07', 0, async function (done) {
try {
const fileAssets = await media.getFileAssets(fileFetchOp);
const dataList = await fileAssets.getAllObject();
const asset = dataList[0];
await asset.favorite();
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 001_07 failed');
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 001_07 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_001_08
* @tc.name : isFavorite
......@@ -403,126 +283,6 @@ export default function favoriteTestPromiseTest(abilityContext) {
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_002_03
* @tc.name : favorite
* @tc.desc : favorite(image) by 'true'
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_002_03', 0, async function (done) {
try {
const fileAssets = await media.getFileAssets(imageFetchOp);
const dataList = await fileAssets.getAllObject();
const asset = dataList[0];
await asset.favorite('true');
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 002_03 failed');
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 002_03 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_002_04
* @tc.name : favorite
* @tc.desc : favorite(image) by 'false'
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_002_04', 0, async function (done) {
try {
const fileAssets = await media.getFileAssets(imageFetchOp);
const dataList = await fileAssets.getAllObject();
const asset = dataList[0];
await asset.favorite('false');
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 002_04 failed');
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 002_04 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_002_05
* @tc.name : favorite
* @tc.desc : favorite(image) by 'fav'
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_002_05', 0, async function (done) {
try {
const fileAssets = await media.getFileAssets(imageFetchOp);
const dataList = await fileAssets.getAllObject();
const asset = dataList[0];
await asset.favorite('fav');
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 002_05 failed');
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 002_05 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_002_06
* @tc.name : favorite
* @tc.desc : favorite(image) by 666
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_002_06', 0, async function (done) {
try {
const fileAssets = await media.getFileAssets(imageFetchOp);
const dataList = await fileAssets.getAllObject();
const asset = dataList[0];
await asset.favorite(666);
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 002_06 failed');
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 002_06 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_002_07
* @tc.name : favorite
* @tc.desc : favorite(image) by no arg
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_002_07', 0, async function (done) {
try {
const fileAssets = await media.getFileAssets(imageFetchOp);
const dataList = await fileAssets.getAllObject();
const asset = dataList[0];
await asset.favorite();
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 002_07 failed');
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 002_07 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_002_08
* @tc.name : isFavorite
......@@ -668,126 +428,6 @@ export default function favoriteTestPromiseTest(abilityContext) {
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_003_03
* @tc.name : favorite
* @tc.desc : favorite(video) by 'true'
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_003_03', 0, async function (done) {
try {
const fileAssets = await media.getFileAssets(videoFetchOp);
const dataList = await fileAssets.getAllObject();
const asset = dataList[0];
await asset.favorite('true');
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 003_03 failed');
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 003_03 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_003_04
* @tc.name : favorite
* @tc.desc : favorite(video) by 'false'
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_003_04', 0, async function (done) {
try {
const fileAssets = await media.getFileAssets(videoFetchOp);
const dataList = await fileAssets.getAllObject();
const asset = dataList[0];
await asset.favorite('false');
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 003_04 failed');
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 003_04 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_003_05
* @tc.name : favorite
* @tc.desc : favorite(video) by 'fav'
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_003_05', 0, async function (done) {
try {
const fileAssets = await media.getFileAssets(videoFetchOp);
const dataList = await fileAssets.getAllObject();
const asset = dataList[0];
await asset.favorite('fav');
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 003_05 failed');
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 003_05 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_003_06
* @tc.name : favorite
* @tc.desc : favorite(video) by 666
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_003_06', 0, async function (done) {
try {
const fileAssets = await media.getFileAssets(videoFetchOp);
const dataList = await fileAssets.getAllObject();
const asset = dataList[0];
await asset.favorite(666);
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 003_06 failed');
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 003_06 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_003_07
* @tc.name : favorite
* @tc.desc : favorite(video) by no arg
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_003_07', 0, async function (done) {
try {
const fileAssets = await media.getFileAssets(videoFetchOp);
const dataList = await fileAssets.getAllObject();
const asset = dataList[0];
await asset.favorite();
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 003_07 failed');
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 003_07 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_003_08
* @tc.name : isFavorite
......@@ -933,126 +573,6 @@ export default function favoriteTestPromiseTest(abilityContext) {
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_004_03
* @tc.name : favorite
* @tc.desc : favorite(audio) by 'true'
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_004_03', 0, async function (done) {
try {
const fileAssets = await media.getFileAssets(audioFetchOp);
const dataList = await fileAssets.getAllObject();
const asset = dataList[0];
await asset.favorite('true');
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 004_03 failed');
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 004_03 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_004_04
* @tc.name : favorite
* @tc.desc : favorite(audio) by 'false'
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_004_04', 0, async function (done) {
try {
const fileAssets = await media.getFileAssets(audioFetchOp);
const dataList = await fileAssets.getAllObject();
const asset = dataList[0];
await asset.favorite('false');
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 004_04 failed');
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 004_04 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_004_05
* @tc.name : favorite
* @tc.desc : favorite(audio) by 'fav'
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_004_05', 0, async function (done) {
try {
const fileAssets = await media.getFileAssets(audioFetchOp);
const dataList = await fileAssets.getAllObject();
const asset = dataList[0];
await asset.favorite('fav');
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 004_05 failed');
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 004_05 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_004_06
* @tc.name : favorite
* @tc.desc : favorite(audio) by 666
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_004_06', 0, async function (done) {
try {
const fileAssets = await media.getFileAssets(audioFetchOp);
const dataList = await fileAssets.getAllObject();
const asset = dataList[0];
await asset.favorite(666);
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 004_06 failed');
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 004_06 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_004_07
* @tc.name : favorite
* @tc.desc : favorite(audio) by no arg
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_004_07', 0, async function (done) {
try {
const fileAssets = await media.getFileAssets(audioFetchOp);
const dataList = await fileAssets.getAllObject();
const asset = dataList[0];
await asset.favorite();
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 004_07 failed');
expect(false).assertTrue();
done();
} catch (error) {
console.info('MediaLibraryTest : FAV_ASSET_PROMISE 004_07 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_004_08
* @tc.name : isFavorite
......@@ -1115,4 +635,4 @@ export default function favoriteTestPromiseTest(abilityContext) {
});
// ------------------------------ audio type end ------------------------
});
}
\ No newline at end of file
}
......@@ -381,7 +381,8 @@ export default function fetchFileResultCallBackTest(abilityContext) {
console.info('MediaLibraryTest : FETCHRESULT getNextObject 008_01 fail');
done();
} else {
expect(0 < targetObjects.length <= 1).assertTrue();
expect(targetObjects.length > 0).assertTrue();
expect(targetObjects.length <= 1).assertTrue();
console.info('MediaLibraryTest : FETCHRESULT getPositionObject 008_01 end');
done();
}
......@@ -412,7 +413,8 @@ export default function fetchFileResultCallBackTest(abilityContext) {
console.info('MediaLibraryTest : FETCHRESULT getNextObject 008_01 fail');
done();
} else {
expect(0 < targetObjects.length <= 2).assertTrue();
expect(targetObjects.length > 0).assertTrue();
expect(targetObjects.length <= 2).assertTrue();
console.info('MediaLibraryTest : FETCHRESULT getAllObject 008_02 targetObjects.length:'
+ targetObjects.length);
console.info('MediaLibraryTest : FETCHRESULT getAllObject 008_02 end');
......@@ -445,7 +447,8 @@ export default function fetchFileResultCallBackTest(abilityContext) {
console.info('MediaLibraryTest : FETCHRESULT getNextObject 008_03 fail');
done();
} else {
expect(0 < targetObjects.length <= 100).assertTrue();
expect(targetObjects.length > 0).assertTrue();
expect(targetObjects.length <= 100).assertTrue();
console.info('MediaLibraryTest : FETCHRESULT getAllObject 008_03 end');
done();
}
......@@ -591,4 +594,4 @@ export default function fetchFileResultCallBackTest(abilityContext) {
}
});
});
}
\ No newline at end of file
}
......@@ -270,7 +270,6 @@ export default function fetchFileResultPromiseTest(abilityContext){
let targetObject = await fetchFileResult.getPositionObject(0);
expect(false).assertTrue();
console.info('MediaLibraryTest : FETCHRESULT close getPositionObject 003 failed');
s
done();
} catch {
console.info('MediaLibraryTest : FETCHRESULT close 003 closed');
......
......@@ -204,76 +204,6 @@ export default function fileAssetCallBack2Test(abilityContext){
}
});
/**
* @tc.number : SUB_MEDIA_FILEASSET_commitModify_callback_005
* @tc.name : commitModify
* @tc.desc : Modify uri
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_FILEASSET_commitModify_callback_005', 0, async function (done) {
try {
const fetchFileResult = await media.getFileAssets(imagesfetchOp);
const asset = await fetchFileResult.getFirstObject();
const id = asset.id;
const newUri = 'newUri';
asset.uri = newUri;
asset.commitModify(async (err) => {
if (err) {
expect(true).assertTrue();
done();
} else {
console.info('FileAsset commitModify 005 failed');
expect(false).assertTrue();
done();
}
});
} catch (error) {
console.info('FileAsset commitModify 005 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_FILEASSET_commitModify_callback_006
* @tc.name : commitModify
* @tc.desc : Modify mediaType
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_FILEASSET_commitModify_callback_006', 0, async function (done) {
try {
const fetchFileResult = await media.getFileAssets(imagesfetchOp);
const asset = await fetchFileResult.getFirstObject();
const id = asset.id;
const newMediaType = 'newMediaType';
asset.mediaType = newMediaType;
asset.commitModify(async (err) => {
if (err) {
expect(true).assertTrue();
done();
} else {
console.info('FileAsset commitModify 006 failed');
expect(false).assertTrue();
done();
}
});
} catch (error) {
console.info('FileAsset commitModify 006 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_FILEASSET_isDirectory_callback_001
* @tc.name : isDirectory
......
......@@ -206,64 +206,6 @@ export default function fileAssetPromise2Test(abilityContext){
}
});
/**
* @tc.number : SUB_MEDIA_FILEASSET_commitModify_promise_005
* @tc.name : commitModify
* @tc.desc : Modify uri
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_FILEASSET_commitModify_promise_005', 0, async function (done) {
try {
const fetchFileResult = await media.getFileAssets(imagesfetchOp);
const asset = await fetchFileResult.getFirstObject();
const id = asset.id;
const newUri = 'newUri';
asset.uri = newUri;
await asset.commitModify();
console.info('FileAsset commitModify 005 failed');
expect(false).assertTrue();
done();
} catch (error) {
console.info('FileAsset commitModify 005 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_FILEASSET_commitModify_promise_006
* @tc.name : commitModify
* @tc.desc : Modify mediaType
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_FILEASSET_commitModify_promise_006', 0, async function (done) {
try {
const fetchFileResult = await media.getFileAssets(imagesfetchOp);
const asset = await fetchFileResult.getFirstObject();
const id = asset.id;
const newMediaType = 'newMediaType';
asset.mediaType = newMediaType;
await asset.commitModify();
console.info('FileAsset commitModify 006 failed');
expect(false).assertTrue();
done();
} catch (error) {
console.info('FileAsset commitModify 006 passed');
expect(true).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MEDIA_FILEASSET_isDirectory_promise_001
* @tc.name : isDirectory
......
......@@ -180,6 +180,9 @@ export default function fileAssetTestCallbackTest(abilityContext){
let asset1;
let fd;
let fd1;
let assetProps = {
write: 4096,
}
try {
let type = mediaLibrary.MediaType.FILE;
let fetchOp = {
......@@ -238,113 +241,6 @@ export default function fileAssetTestCallbackTest(abilityContext){
//======================== FILE END ==================================
//======================== ALBUM BEGIN ==================================
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_CALLBACK_005_04
* @tc.name : open('rw')
* @tc.desc : open -rw the type of ALBUM
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_CALLBACK_005_04', 0, async function (done) {
let asset;
let fd;
try {
let type = mediaLibrary.MediaType.ALBUM;
let fetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs: [type.toString()],
};
let fetchFileResult = await media.getFileAssets(fetchOp);
const dataList = await fetchFileResult.getAllObject();
asset = dataList[0];
asset.open('rw', async (error, fd) => {
expect(false).assertTrue();
done();
});
} catch (error) {
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_CALLBACK_005_04 error:'
+ error);
expect(true).assertTrue();
if (isNum(fd)) {
asset.close(fd);
}
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_CALLBACK_005_05
* @tc.name : open('r')
* @tc.desc : open -r the type of ALBUM
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_CALLBACK_005_05', 0, async function (done) {
let asset;
let fd;
try {
let type = mediaLibrary.MediaType.ALBUM;
let fetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs: [type.toString()],
};
let fetchFileResult = await media.getFileAssets(fetchOp);
const dataList = await fetchFileResult.getAllObject();
asset = dataList[0];
asset.open('r', async (error, fd) => {
expect(false).assertTrue();
done();
});
} catch (error) {
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_CALLBACK_005_05 error:'
+ error);
expect(true).assertTrue();
if (isNum(fd)) {
asset.close(fd);
}
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_CALLBACK_005_06
* @tc.name : open('w')
* @tc.desc : open -w the type of ALBUM
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_CALLBACK_005_06', 0, async function (done) {
let asset;
let fd;
try {
let type = mediaLibrary.MediaType.ALBUM;
let fetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs: [type.toString()],
};
let fetchFileResult = await media.getFileAssets(fetchOp);
const dataList = await fetchFileResult.getAllObject();
asset = dataList[0];
asset.open('w', (error, fd) => {
expect(false).assertTrue();
});
} catch (error) {
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_CALLBACK_005_06 error:'
+ error);
expect(true).assertTrue();
if (isNum(fd)) {
asset.close(fd);
}
done();
}
});
//======================== ALBUM END ==================================
//======================== IMAGE BEGIN ==================================
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_CALLBACK_005_07
......@@ -700,6 +596,9 @@ export default function fileAssetTestCallbackTest(abilityContext){
let asset1;
let fd;
let fd1;
let assetProps = {
write: 4096,
}
try {
let type = mediaLibrary.MediaType.AUDIO;
let fetchOp = {
......@@ -915,6 +814,9 @@ export default function fileAssetTestCallbackTest(abilityContext){
let asset1;
let fd;
let fd1;
let assetProps = {
write: 4096,
}
try {
let type = mediaLibrary.MediaType.VIDEO;
let fetchOp = {
......
......@@ -186,106 +186,6 @@ export default function fileAssetTestPromiseTest(abilityContext){
//======================== FILE END ==================================
//======================== ALBUM BEGIN ==================================
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_PROMISE_005_04
* @tc.name : open('rw')
* @tc.desc : open -rw the type of ALBUM
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_PROMISE_005_04', 0, async function (done) {
let asset;
let fd;
try {
let type = mediaLibrary.MediaType.ALBUM;
let fetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs: [type.toString()],
};
let fetchFileResult = await media.getFileAssets(fetchOp);
const dataList = await fetchFileResult.getAllObject();
asset = dataList[0];
fd = await asset.open('rw');
done();
} catch (error) {
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_PROMISE_005_03 error:' + error);
expect(true).assertTrue();
if (isNum(fd)) {
asset.close(fd);
}
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_PROMISE_005_05
* @tc.name : open('r')
* @tc.desc : open -r the type of ALBUM
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_PROMISE_005_05', 0, async function (done) {
let asset;
let fd;
try {
let type = mediaLibrary.MediaType.ALBUM;
let fetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs: [type.toString()],
};
let fetchFileResult = await media.getFileAssets(fetchOp);
const dataList = await fetchFileResult.getAllObject();
asset = dataList[0];
fd = await asset.open('r');
done();
} catch (error) {
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_PROMISE_005_05 error:' + error);
expect(true).assertTrue();
if (isNum(fd)) {
asset.close(fd);
}
done();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_PROMISE_005_05
* @tc.name : open('w')
* @tc.desc : open -w the type of ALBUM
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_PROMISE_005_06', 0, async function (done) {
let asset;
let fd;
try {
let type = mediaLibrary.MediaType.IMAGE;
let fetchOp = {
selections: fileKeyObj.RELATIVE_PATH + '= ? AND ' + fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs: ['Pictures/Dynamic02/', type.toString()],
};
let fetchFileResult = await media.getFileAssets(fetchOp);
const dataList = await fetchFileResult.getAllObject();
asset = dataList[0];
fd = await asset.open('w');
done();
} catch (error) {
console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_PROMISE_005_06 error:' + error);
expect(true).assertTrue();
if (isNum(fd)) {
asset.close(fd);
}
done();
}
});
//======================== ALBUM END ==================================
//======================== IMAGE BEGIN ==================================
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_PROMISE_005_07
......
......@@ -17,13 +17,6 @@ import featureAbility from '@ohos.ability.featureAbility';
import fileio from '@ohos.fileio';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
let fileKeyObj = mediaLibrary.FileKey;
let fetchOp = {
selections: fileKeyObj.PATH + ' LIKE ? ',
selectionArgs: ['/data/media/%'],
order: fileKeyObj.PATH,
};
// let directoryTypeObj = mediaLibrary.DirectoryType;
let DIR_CAMERA = mediaLibrary.DirectoryType.DIR_CAMERA;
let DIR_VIDEO = mediaLibrary.DirectoryType.DIR_VIDEO;
let DIR_IMAGE = mediaLibrary.DirectoryType.DIR_IMAGE;
......@@ -227,7 +220,7 @@ export default function mediaLibraryTestCallBackTest(abilityContext){
media.getFileAssets(imageRelativefetchOp, async (err, fetchFileResult) => {
let count = 1;
let type = 'image';
await checkFileAssetAttr(done, fetchFileResult, type, count)
await checkFileAssetAttr(done, fetchFileResult, type, count, null)
done();
});
} catch (error) {
......@@ -250,7 +243,7 @@ export default function mediaLibraryTestCallBackTest(abilityContext){
media.getFileAssets(videoRelativefetchOp, async (err, fetchFileResult) => {
let count = 1;
let type = 'video';
await checkFileAssetAttr(done, fetchFileResult, type, count)
await checkFileAssetAttr(done, fetchFileResult, type, count, null)
done();
});
} catch (error) {
......@@ -273,7 +266,7 @@ export default function mediaLibraryTestCallBackTest(abilityContext){
media.getFileAssets(audioRelativefetchOp, async (err, fetchFileResult) => {
let count = 1;
let type = 'audio';
await checkFileAssetAttr(done, fetchFileResult, type, count)
await checkFileAssetAttr(done, fetchFileResult, type, count, null)
done();
});
} catch (error) {
......@@ -296,7 +289,7 @@ export default function mediaLibraryTestCallBackTest(abilityContext){
media.getFileAssets(fileRelativefetchOp, async (err, fetchFileResult) => {
let count = 1;
let type = 'file';
await checkFileAssetAttr(done, fetchFileResult, type, count)
await checkFileAssetAttr(done, fetchFileResult, type, count, null)
done();
});
} catch (error) {
......
......@@ -17,13 +17,6 @@ import featureAbility from '@ohos.ability.featureAbility';
import fileio from '@ohos.fileio';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
let fileKeyObj = mediaLibrary.FileKey;
let fetchOp = {
selections: fileKeyObj.PATH + ' LIKE ? ',
selectionArgs: ['/data/media/%'],
order: fileKeyObj.PATH,
};
// let directoryTypeObj = mediaLibrary.DirectoryType;
let DIR_CAMERA = mediaLibrary.DirectoryType.DIR_CAMERA;
let DIR_VIDEO = mediaLibrary.DirectoryType.DIR_VIDEO;
let DIR_IMAGE = mediaLibrary.DirectoryType.DIR_IMAGE;
......@@ -248,7 +241,7 @@ export default function mediaLibraryTestPromiseTest(abilityContext){
const fetchFileResult = await media.getFileAssets(imageRelativefetchOp);
let count = 1;
let type = 'image';
await checkFileAssetAttr(done, fetchFileResult, type, count)
await checkFileAssetAttr(done, fetchFileResult, type, count, null)
done();
} catch (error) {
console.info(`MediaLibraryTest : getFileAssets 001 failed, error: ${error}`);
......@@ -270,7 +263,7 @@ export default function mediaLibraryTestPromiseTest(abilityContext){
const fetchFileResult = await media.getFileAssets(videoRelativefetchOp);
let count = 1;
let type = 'video';
await checkFileAssetAttr(done, fetchFileResult, type, count)
await checkFileAssetAttr(done, fetchFileResult, type, count, null)
done();
} catch (error) {
console.info(`MediaLibraryTest : getFileAssets 002 failed, error: ${error}`);
......@@ -292,7 +285,7 @@ export default function mediaLibraryTestPromiseTest(abilityContext){
const fetchFileResult = await media.getFileAssets(audioRelativefetchOp);
let count = 1;
let type = 'audio';
await checkFileAssetAttr(done, fetchFileResult, type, count)
await checkFileAssetAttr(done, fetchFileResult, type, count, null)
done();
} catch (error) {
console.info(`MediaLibraryTest : getFileAssets 003 failed, error: ${error}`);
......@@ -314,7 +307,7 @@ export default function mediaLibraryTestPromiseTest(abilityContext){
const fetchFileResult = await media.getFileAssets(fileRelativefetchOp);
let count = 1;
let type = 'file';
await checkFileAssetAttr(done, fetchFileResult, type, count)
await checkFileAssetAttr(done, fetchFileResult, type, count, null)
done();
} catch (error) {
console.info(`MediaLibraryTest : getFileAssets 004 failed, error: ${error}`);
......
......@@ -70,7 +70,7 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){
await asset.commitModify();
await new Promise(res => {
setTimeout(() => {
res()
res(true)
}, 1000)
})
expect(conut > 0).assertTrue();
......@@ -104,7 +104,7 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){
await asset.commitModify();
await new Promise(res => {
setTimeout(() => {
res()
res(true)
}, 1000)
})
expect(conut > 0).assertTrue();
......@@ -138,7 +138,7 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){
await asset.commitModify();
await new Promise(res => {
setTimeout(() => {
res()
res(true)
}, 1000)
})
expect(conut > 0).assertTrue();
......@@ -172,7 +172,7 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){
await asset.commitModify();
await new Promise(res => {
setTimeout(() => {
res()
res(true)
}, 1000)
})
expect(conut > 0).assertTrue();
......@@ -206,7 +206,7 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){
await asset.commitModify();
await new Promise(res => {
setTimeout(() => {
res()
res(true)
}, 1000)
})
expect(conut == 0).assertTrue();
......@@ -242,7 +242,7 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){
await asset.commitModify();
await new Promise(res => {
setTimeout(() => {
res()
res(true)
}, 1000)
})
expect(conut == 0).assertTrue();
......@@ -278,7 +278,7 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){
await asset.commitModify();
await new Promise(res => {
setTimeout(() => {
res()
res(true)
}, 1000)
})
expect(conut == 0).assertTrue();
......@@ -309,7 +309,7 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){
});
await new Promise(res => {
setTimeout(() => {
res()
res(true)
}, 300)
})
const fetchFileResult = await media.getFileAssets(imagesfetchOp);
......@@ -318,13 +318,13 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){
media.off('imageChange');
await new Promise(res => {
setTimeout(() => {
res()
res(true)
}, 600)
})
await asset.commitModify();
await new Promise(res => {
setTimeout(() => {
res()
res(true)
}, 1000)
})
console.info('MediaLibraryTest : off 001 passed');
......@@ -356,7 +356,7 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){
});
await new Promise(res => {
setTimeout(() => {
res()
res(true)
}, 300)
})
const fetchFileResult = await media.getFileAssets(videosfetchOp);
......@@ -365,13 +365,13 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){
media.off('videoChange');
await new Promise(res => {
setTimeout(() => {
res()
res(true)
}, 600)
})
await asset.commitModify();
await new Promise(res => {
setTimeout(() => {
res()
res(true)
}, 1000)
})
console.info('MediaLibraryTest : off 002 passed');
......@@ -403,7 +403,7 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){
});
await new Promise(res => {
setTimeout(() => {
res()
res(true)
}, 300)
})
const fetchFileResult = await media.getFileAssets(audiosfetchOp);
......@@ -412,13 +412,13 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){
media.off('audioChange');
await new Promise(res => {
setTimeout(() => {
res()
res(true)
}, 600)
})
await asset.commitModify();
await new Promise(res => {
setTimeout(() => {
res()
res(true)
}, 1000)
})
console.info('MediaLibraryTest : off 003 passed');
......@@ -450,7 +450,7 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){
});
await new Promise(res => {
setTimeout(() => {
res()
res(true)
}, 300)
})
const fetchFileResult = await media.getFileAssets(videosfetchOp);
......@@ -459,13 +459,13 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){
media.off('fileChange');
await new Promise(res => {
setTimeout(() => {
res()
res(true)
}, 600)
})
await asset.commitModify();
await new Promise(res => {
setTimeout(() => {
res()
res(true)
}, 1000)
})
console.info('MediaLibraryTest : off 004 passed');
......@@ -497,7 +497,7 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){
});
await new Promise(res => {
setTimeout(() => {
res()
res(true)
}, 300)
})
const fetchFileResult = await media.getFileAssets(videosfetchOp);
......@@ -506,13 +506,13 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){
media.off('albumChange');
await new Promise(res => {
setTimeout(() => {
res()
res(true)
}, 600)
})
await asset.commitModify();
await new Promise(res => {
setTimeout(() => {
res()
res(true)
}, 1000)
})
console.info('MediaLibraryTest : off 005 passed');
......@@ -544,7 +544,7 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){
});
await new Promise(res => {
setTimeout(() => {
res()
res(true)
}, 300)
})
const fetchFileResult = await media.getFileAssets(videosfetchOp);
......@@ -553,13 +553,13 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){
media.off('deviceChange');
await new Promise(res => {
setTimeout(() => {
res()
res(true)
}, 600)
})
await asset.commitModify();
await new Promise(res => {
setTimeout(() => {
res()
res(true)
}, 1000)
})
console.info('MediaLibraryTest : off 006 passed');
......@@ -591,7 +591,7 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){
});
await new Promise(res => {
setTimeout(() => {
res()
res(true)
}, 300)
})
......@@ -601,13 +601,13 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){
asset.title = asset.title + 'remoteFileChange';
await new Promise(res => {
setTimeout(() => {
res()
res(true)
}, 600)
})
await asset.commitModify();
await new Promise(res => {
setTimeout(() => {
res()
res(true)
}, 1000)
})
console.info('MediaLibraryTest : off 007 passed');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册