未验证 提交 5e72cd63 编写于 作者: O openharmony_ci 提交者: Gitee

!5746 mediaLibrary 矫正预期资源数量

Merge pull request !5746 from caochuan/mediaLibrary
......@@ -18,15 +18,15 @@ import bundle from '@ohos.bundle';
const presetsCount = {
ActsMediaLibraryAlbumTest: { albumsCount: 7, assetsCount: 19 },
ActsMediaLibraryBaseTest: { albumsCount: 11, assetsCount: 14 },
ActsMediaLibraryFavoriteTest: { albumsCount: 6, assetsCount: 32 },
ActsMediaLibraryAlbumFileResultCb: { albumsCount: 5, assetsCount: 118 },
ActsMediaLibraryFileTest: { albumsCount: 6, assetsCount: 21 },
ActsMediaLibraryFileAssetTest: { albumsCount: 27, assetsCount: 72 },
ActsMediaLibraryFileAssetUri: { albumsCount: 3, assetsCount: 6 },
ActsMediaLibraryFileTest: { albumsCount: 6, assetsCount: 28 },
ActsMediaLibraryFileAssetTest: { albumsCount: 27, assetsCount: 100 },
ActsMediaLibraryFileKeyTest: { albumsCount: 2, assetsCount: 2 },
ActsMediaLibraryFileResultTest: { albumsCount: 4, assetsCount: 13 },
ActsMediaLibraryGetThumbnail: { albumsCount: 3, assetsCount: 3 },
ActsMediaLibraryBaseTest: { albumsCount: 11, assetsCount: 11 },
ActsMediaLibraryFileResultTest: { albumsCount: 3, assetsCount: 112 },
ActsMediaLibraryGetThumbnailTest: { albumsCount: 3, assetsCount: 3 },
ActsMediaLibraryMediafetchoptionsTest: { albumsCount: 3, assetsCount: 8 },
ActsMediaLibraryTrashJsTest: { albumsCount: 6, assetsCount: 24 },
}
const IMAGE_TYPE = mediaLibrary.MediaType.IMAGE;
......@@ -160,10 +160,15 @@ const checkPresetsAssets = async function (media, hapName) {
let albumsCount = albumList.length;
let fetchFileResult = await media.getFileAssets(allFetchOp());
let assetsCount = await fetchFileResult.getCount();
console.info(`${hapName}:: assetsCount: ${assetsCount} albumsCount: ${albumsCount},
presetsassetsCount: ${presetsCount[hapName].assetsCount}
presetsalbumsCount: ${presetsCount[hapName].albumsCount}`);
console.info('checkPresetsAssets end')
let presetsassetsCount = presetsCount[hapName].assetsCount;
let presetsalbumsCount = presetsCount[hapName].albumsCount;
if (assetsCount != presetsCount[hapName].assetsCount || albumsCount !=presetsCount[hapName].albumsCount) {
console.info(`${hapName} checkPresetsAssets failed;
assetsCount : presetsassetsCount = ${assetsCount} : ${presetsassetsCount}
albumsCount : presetsalbumsCount = ${albumsCount} : ${presetsalbumsCount}`)
} else {
console.info(`${hapName} checkPresetsAssets passed`)
}
}
const checkAssetsCount = async function (done, testNum, fetchFileResult, expectCount) {
......
......@@ -24,7 +24,6 @@ import {
albumFetchOps,
albumTwoTypesFetchOps,
albumThreeTypesFetchOps,
checkPresetsAssets,
checkAlbumsCount,
} from '../../../../../../common';
......@@ -33,7 +32,6 @@ export default function albumGetFileAssetsPromiseTest(abilityContext) {
const media = mediaLibrary.getMediaLibrary(abilityContext);
beforeAll(async function () {
console.info('beforeAll case');
await checkPresetsAssets(media, 'ActsMediaLibraryAlbumTest');
});
beforeEach(function () {
console.info('beforeEach case');
......
......@@ -22,22 +22,18 @@ import {
VIDEO_TYPE,
AUDIO_TYPE,
FILEKEY,
allFetchOp,
idFetchOps,
albumFetchOps,
albumTwoTypesFetchOps,
albumThreeTypesFetchOps,
checkPresetsAssets,
checkAlbumsCount,
} from '../../../../../../common';
export default function albumTestCallbackTest(abilityContext) {
describe('albumTestCallbackTest', function () {
const media = mediaLibrary.getMediaLibrary(abilityContext);
beforeAll(async function () {
console.info('beforeAll case');
await checkPresetsAssets(media, 'ActsMediaLibraryAlbumTest');
});
beforeEach(function () {
console.info('beforeEach case');
......
......@@ -22,12 +22,10 @@ import {
VIDEO_TYPE,
AUDIO_TYPE,
FILEKEY,
allFetchOp,
idFetchOps,
albumFetchOps,
albumTwoTypesFetchOps,
albumThreeTypesFetchOps,
checkPresetsAssets,
checkAlbumsCount,
} from '../../../../../../common';
......@@ -36,7 +34,6 @@ export default function albumTestPromiseTest(abilityContext) {
const media = mediaLibrary.getMediaLibrary(abilityContext);
beforeAll(async function () {
console.info('beforeAll case');
await checkPresetsAssets(media, 'ActsMediaLibraryAlbumTest');
});
beforeEach(function () {
console.info('beforeEach case');
......
......@@ -22,7 +22,6 @@ import {
AUDIO_TYPE,
FILE_TYPE,
FILEKEY,
checkPresetsAssets,
checkAssetsCount,
fetchOps,
getPermission,
......@@ -36,7 +35,6 @@ export default function mediaLibraryTestPromiseTest(abilityContext) {
beforeAll(async function () {
console.info('beforeAll case');
await getPermission();
await checkPresetsAssets(media, 'ActsMediaLibraryBaseTest');
});
beforeEach(function () {
console.info('beforeEach case');
......
......@@ -21,7 +21,6 @@ import {
VIDEO_TYPE,
AUDIO_TYPE,
FILE_TYPE,
checkPresetsAssets,
checkAssetsCount,
fetchOps,
albumFetchOps,
......@@ -35,7 +34,6 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext) {
beforeAll(async function () {
console.info('beforeAll case');
await getPermission();
await checkPresetsAssets(media, 'ActsMediaLibraryBaseTest');
});
beforeEach(function () {
console.info('beforeEach case');
......
......@@ -21,7 +21,6 @@ import {
VIDEO_TYPE,
AUDIO_TYPE,
FILE_TYPE,
checkPresetsAssets,
nameFetchOps,
checkAssetsCount,
} from '../../../../../../common';
......@@ -31,7 +30,6 @@ export default function favoriteTestPromiseTest(abilityContext) {
var media = mediaLibrary.getMediaLibrary(abilityContext);
beforeAll(async function () {
console.info('beforeAll case');
await checkPresetsAssets(media, 'ActsMediaLibraryFavoriteTest');
});
beforeEach(function () {
console.info('beforeEach case');
......
......@@ -23,7 +23,6 @@ import {
VIDEO_TYPE,
AUDIO_TYPE,
FILE_TYPE,
checkPresetsAssets,
nameFetchOps,
checkAssetsCount,
fetchOps,
......@@ -37,7 +36,6 @@ export default function fileTestPromiseTest(abilityContext) {
const media = mediaLibrary.getMediaLibrary(abilityContext);
beforeAll(async function () {
console.info('beforeAll case');
await checkPresetsAssets(media, 'ActsMediaLibraryFileTest')
});
beforeEach(function () {
console.info('beforeEach case');
......
......@@ -21,7 +21,6 @@ import {
sleep,
IMAGE_TYPE,
FILEKEY,
checkPresetsAssets,
checkAssetsCount,
nameFetchOps,
} from '../../../../../../common';
......@@ -31,7 +30,6 @@ export default function fileAssetPromise2Test(abilityContext) {
const media = mediaLibrary.getMediaLibrary(abilityContext);
beforeAll(async function () {
console.info('beforeAll case');
await checkPresetsAssets(media, 'ActsMediaLibraryFileAssetTest')
});
beforeEach(function () {
console.info('beforeEach case');
......
......@@ -22,7 +22,6 @@ import {
VIDEO_TYPE,
AUDIO_TYPE,
FILE_TYPE,
checkPresetsAssets,
checkAssetsCount,
fetchOps,
isNum,
......@@ -33,7 +32,6 @@ export default function fileAssetTestCallbackTest(abilityContext) {
const media = mediaLibrary.getMediaLibrary(abilityContext);
beforeAll(async function () {
console.info('beforeAll case');
await checkPresetsAssets(media, 'ActsMediaLibraryFileAssetTest')
});
beforeEach(function () {
console.info('beforeEach case');
......
......@@ -22,7 +22,6 @@ import {
VIDEO_TYPE,
AUDIO_TYPE,
FILE_TYPE,
checkPresetsAssets,
checkAssetsCount,
fetchOps,
isNum,
......@@ -33,7 +32,6 @@ export default function fileAssetTestPromiseTest(abilityContext) {
const media = mediaLibrary.getMediaLibrary(abilityContext);
beforeAll(async function () {
console.info('beforeAll case');
await checkPresetsAssets(media, 'ActsMediaLibraryFileAssetTest')
});
beforeEach(function () {
console.info('beforeEach case');
......
......@@ -23,7 +23,6 @@ import {
AUDIO_TYPE,
checkAlbumsCount,
FILEKEY,
checkPresetsAssets,
checkAssetsCount,
fetchOps,
} from '../../../../../../common';
......@@ -35,7 +34,6 @@ export default function filekeyTestPromiseTest(abilityContext) {
beforeAll(async function () {
console.info('beforeAll case');
await checkPresetsAssets(media, 'ActsMediaLibraryFileKeyTest')
});
beforeEach(function () {
console.info('beforeEach case');
......
......@@ -19,12 +19,8 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from
import {
sleep,
IMAGE_TYPE,
VIDEO_TYPE,
AUDIO_TYPE,
FILE_TYPE,
FILEKEY,
checkPresetsAssets,
nameFetchOps,
checkAssetsCount,
fetchOps,
} from '../../../../../../common';
......@@ -34,7 +30,6 @@ export default function fetchFileResultPromiseTest(abilityContext) {
const media = mediaLibrary.getMediaLibrary(abilityContext);
beforeAll(async function () {
console.info('beforeAll case');
await checkPresetsAssets(media, 'ActsMediaLibraryFileResultTest');
});
beforeEach(function () {
console.info('beforeEach case');
......
......@@ -22,7 +22,6 @@ import {
IMAGE_TYPE,
VIDEO_TYPE,
AUDIO_TYPE,
FILEKEY,
checkPresetsAssets,
checkAssetsCount,
fetchOps,
......@@ -35,7 +34,7 @@ export default function getThumbnailCallback(abilityContext) {
beforeAll(async function () {
console.info('beforeAll case');
await getPermission();
await checkPresetsAssets(media, 'ActsMediaLibraryGetThumbnail');
await checkPresetsAssets(media, 'ActsMediaLibraryGetThumbnailTest');
});
beforeEach(function () {
console.info('beforeEach case');
......
......@@ -21,8 +21,6 @@ import {
IMAGE_TYPE,
VIDEO_TYPE,
AUDIO_TYPE,
FILEKEY,
checkPresetsAssets,
checkAssetsCount,
fetchOps,
getPermission,
......@@ -35,7 +33,6 @@ export default function getThumbnailPromise(abilityContext) {
beforeAll(async function () {
console.info('beforeAll case');
await getPermission();
await checkPresetsAssets(media, 'ActsMediaLibraryGetThumbnail');
});
beforeEach(function () {
console.info('beforeEach case');
......
......@@ -23,7 +23,6 @@ import {
AUDIO_TYPE,
VIDEO_TYPE,
FILE_TYPE,
FILEKEY,
checkPresetsAssets,
checkAssetsCount,
fetchOps,
......@@ -36,7 +35,7 @@ export default function mediafetchoptionsCallback(abilityContext) {
beforeAll(async function () {
console.info('beforeAll case');
await getPermission();
await checkPresetsAssets(media, 'ActsMediaLibraryFileAssetUri');
await checkPresetsAssets(media, 'ActsMediaLibraryMediafetchoptionsTest');
});
beforeEach(function () {
console.info('beforeEach case');
......
......@@ -24,10 +24,8 @@ import {
VIDEO_TYPE,
FILE_TYPE,
FILEKEY,
checkPresetsAssets,
checkAssetsCount,
fetchOps,
getPermission,
} from '../../../../../../common';
export default function mediafetchoptionsPromise(abilityContext) {
......@@ -35,7 +33,6 @@ export default function mediafetchoptionsPromise(abilityContext) {
const media = mediaLibrary.getMediaLibrary(abilityContext);
beforeAll(async function () {
console.info('beforeAll case');
await checkPresetsAssets(media, 'ActsMediaLibraryFileAssetUri');
});
beforeEach(function () {
console.info('beforeEach case');
......
......@@ -25,6 +25,7 @@ import {
getPermission,
albumFetchOps,
fileIdFetchOps,
checkPresetsAssets,
} from "../../../../../../common";
export default function trashCallback(abilityContext) {
......@@ -32,6 +33,7 @@ export default function trashCallback(abilityContext) {
beforeAll(async function () {
await getPermission();
console.info("beforeAll case");
await checkPresetsAssets(media, 'ActsMediaLibraryTrashJsTest');
});
beforeEach(function () {
console.info("beforeEach case");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册