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

!5746 mediaLibrary 矫正预期资源数量

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