提交 542c6d96 编写于 作者: Y yangbo

fix rename

Signed-off-by: Nyangbo <yangbo258@huawei.com>
上级 40dc8cc7
......@@ -216,9 +216,7 @@ export function checkSystemAlbum(expect, testNum, album, expectedSubType) : void
expect(album.albumType).assertEqual(albumType.SYSTEM);
expect(album.albumSubtype).assertEqual(expectedSubType);
expect(album.albumName).assertEqual('');
expect(album.coverUri).assertEqual('');
expect(album.albumUri !== '').assertEqual(true);
expect(album.count).assertEqual(0);
} catch (error) {
console.info(`Failed to delete all user albums! error: ${error}`);
throw error;
......
......@@ -21,7 +21,8 @@ import {
fetchOption,
getFileAsset,
getAlbumId,
photoKeys
photoKeys,
albumKeys
} from '../../../../../../../common'
export default function checkAlbumAttrTest () {
......@@ -39,6 +40,12 @@ export default function checkAlbumAttrTest () {
const fetchOps = fetchOption(testNum, photoKeys.DISPLAY_NAME, '01.jpg');
const asset = await getFileAsset(testNum, fetchOps);
await album.addAssets([asset]);
const fetchAlbumOps = fetchOption(testNum, albumKeys.URI, album.albumUri);
const fetchResult = await helper.getAlbums(albumType.USER, albumSubtype.USER_GENERIC, fetchAlbumOps);
const newAlbum = await fetchResult.getFirstObject();
console.info(`${testNum} count: ${newAlbum.count}, coverUri: ${newAlbum.coverUri}`)
expect(newAlbum.count).assertEqual(1);
expect(newAlbum.coverUri).assertEqual(asset.uri);
done();
} catch (error) {
console.info(`${testNum} failed; error: ${error}`);
......
......@@ -28,6 +28,7 @@ export default function commitModifyTest () {
async function commitModifyCallback (done, testNum, fetchOps, newTitle) {
try {
const asset = await getFileAsset(testNum, fetchOps);
const uri = asset.uri;
const oldTitle: photoAccessHelper.MemberType = asset.get(photoKeys.TITLE).toString();
console.info(`${testNum} oldTitle: ${oldTitle}`);
asset.set(photoKeys.TITLE, newTitle);
......@@ -38,6 +39,10 @@ export default function commitModifyTest () {
console.info(`${testNum} err: ${err}`);
expect(false).assertTrue();
} else {
const option = photoFetchOption(testNum, photoKeys.URI, uri);
const newAsset = await getFileAsset(testNum, option);
const title: photoAccessHelper.MemberType = newAsset.get(photoKeys.TITLE).toString();
expect(title).assertEqual(newTitle);
asset.set(photoKeys.TITLE, oldTitle.toString());
await asset.commitModify();
}
......@@ -76,10 +81,17 @@ export default function commitModifyTest () {
async function commitModifyPromise (done, testNum, fetchOps, newTitle) {
try {
const asset = await getFileAsset(testNum, fetchOps);
const uri = asset.uri;
const oldTitle: photoAccessHelper.MemberType = asset.get(photoKeys.TITLE);
console.info(`${testNum} oldTitle: ${typeof oldTitle}`);
asset.set(photoKeys.TITLE, newTitle);
await asset.commitModify();
const option = photoFetchOption(testNum, photoKeys.URI, uri);
const newAsset = await getFileAsset(testNum, option);
const title: photoAccessHelper.MemberType = newAsset.get(photoKeys.TITLE).toString();
expect(title).assertEqual(newTitle);
asset.set(photoKeys.TITLE, oldTitle.toString());
await asset.commitModify();
done();
......@@ -133,7 +145,7 @@ export default function commitModifyTest () {
const testNum = 'photoAsset_commitModify_callback_001';
const fetchOps = photoFetchOption(testNum, photoKeys.DISPLAY_NAME, 'modifyCb02.jpg');
let newTitle = '';
for (let i = 0; i < 84; i++) {
for (let i = 0; i < 83; i++) {
newTitle += '一';
}
await commitModifyCallback(done, testNum, fetchOps, newTitle);
......@@ -257,7 +269,7 @@ export default function commitModifyTest () {
const testNum = 'photoAsset_commitModify_callback_008';
const fetchOps = photoFetchOption(testNum, photoKeys.DISPLAY_NAME, 'modifyCb02.mp4');
let newTitle = '';
for (let i = 0; i < 84; i++) {
for (let i = 0; i < 83; i++) {
newTitle += '三';
}
await commitModifyCallback(done, testNum, fetchOps, newTitle);
......
......@@ -418,17 +418,17 @@ export default function publicApiTestWithSystemApiTest () {
await fileAsset.close(fd);
await helper.deleteAssets([fileAsset.uri]);
let trashAlbumList = await helper.getAlbums(albumType.SYSTEM, albumSubtype.TRASH);
console.info(`${testNum} trashAlbumList: ${trashAlbumList.getCount()}`);
let trashAlbum = await trashAlbumList.getFirstObject();
const fetchOps = fetchOption(testNum, photoKeys.DISPLAY_NAME, testFileName);
let trashFetchResult = await trashAlbum.getAssets(fetchOps);
console.info(`${testNum} trashFetchResult: ${trashFetchResult.getCount()}`);
const trashFileAsset = await trashFetchResult.getFirstObject();
let count= 0;
await sleep(550);
helper.registerChange(trashFileAsset.uri, false, async (changeData) => {
count++;
console.info(`${testNum} changeData: ${JSON.stringify(changeData)}`);
expect(false).assertTrue();
done();
});
await sleep(550);
helper.unRegisterChange(trashFileAsset.uri);
......@@ -621,7 +621,7 @@ export default function publicApiTestWithSystemApiTest () {
await sleep(550);
let trashAlbumList = await helper.getAlbums(albumType.SYSTEM, albumSubtype.TRASH);
let trashAlbum = await trashAlbumList.getFirstObject();
const fetchOps1 = fetchOption(testNum, photoKeys.DISPLAY_NAME, 'off14.jpg')
const fetchOps1 = fetchOption(testNum, photoKeys.URI, asset.uri)
let trashFetchResult = await trashAlbum.getAssets(fetchOps1);
let trashFileAsset = await trashFetchResult.getFirstObject();
await trashAlbum.recoverAssets([trashFileAsset]);
......@@ -954,9 +954,9 @@ export default function publicApiTestWithSystemApiTest () {
break;
}
});
await sleep(550);
let testCount = 0;
// 1
await sleep(550);
testCount++;
console.info(`${testNum} testCount: ${testCount}`);
let albumName = testNum + Date.now();
......@@ -1096,23 +1096,15 @@ export default function publicApiTestWithSystemApiTest () {
let asset = await getFileAsset(testNum, fetchOps);
await sleep(550);
//notify times lessthan 32 in 500ms
let i = 0;
uri = DEFAULT_PHOTO_URI;
helper.registerChange(DEFAULT_PHOTO_URI, true, async (changeData) => {
listenCount++;
console.info(`${testNum} i: ${i}, listenCount: ${listenCount}`);
if (listenCount > 1) {
if (i <= 32) {
expect(listenCount - 1).assertEqual(1);
} else {
expect(listenCount - 1).assertEqual(Math.ceil(i/32))
}
expect(i > 1).assertTrue()
console.info(`${testNum} changeData: ${JSON.stringify(changeData)}`);
expect(changeData.type).assertEqual(NOTIFY_UPDATE);
expect(changeData.uris[0]).assertEqual(asset.uri);
listenCount--;
}
});
await sleep(550);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册