1
This commit is contained in:
@@ -3,6 +3,7 @@ import { afterEach, describe, expect, test, vi } from 'vitest';
|
||||
import { setStoredAccessToken, clearStoredAccessToken } from './apiClient';
|
||||
import {
|
||||
clearMatch3DGeneratedModelBytesCache,
|
||||
getMatch3DGeneratedImageViewSources,
|
||||
getMatch3DGeneratedModelAssetSources,
|
||||
preloadMatch3DGeneratedModelAssets,
|
||||
readMatch3DGeneratedModelBytes,
|
||||
@@ -113,4 +114,35 @@ describe('match3dGeneratedModelCache', () => {
|
||||
'generated-match3d-assets/session/profile/items/match3d-item-legacy/model.glb',
|
||||
]);
|
||||
});
|
||||
|
||||
test('多视角图片源优先使用 imageViews,兼容首图只做兜底', () => {
|
||||
const sources = getMatch3DGeneratedImageViewSources({
|
||||
itemId: 'match3d-item-1',
|
||||
itemName: '草莓',
|
||||
imageSrc:
|
||||
'/generated-match3d-assets/session/profile/items/item-1/legacy-primary.png',
|
||||
imageObjectKey:
|
||||
'generated-match3d-assets/session/profile/items/item-1/legacy-primary.png',
|
||||
imageViews: [1, 2, 3, 4, 5].map((viewIndex) => ({
|
||||
viewId: `view-${String(viewIndex).padStart(2, '0')}`,
|
||||
viewIndex,
|
||||
imageSrc: `/generated-match3d-assets/session/profile/items/item-1/views/view-${String(viewIndex).padStart(2, '0')}.png`,
|
||||
imageObjectKey: null,
|
||||
})),
|
||||
modelSrc: null,
|
||||
modelObjectKey: null,
|
||||
modelFileName: null,
|
||||
taskUuid: null,
|
||||
subscriptionKey: null,
|
||||
status: 'image_ready',
|
||||
error: null,
|
||||
});
|
||||
|
||||
expect(sources).toHaveLength(5);
|
||||
expect(sources[0]).toContain('views/view-01.png');
|
||||
expect(sources[4]).toContain('views/view-05.png');
|
||||
expect(sources.some((source) => source.includes('legacy-primary'))).toBe(
|
||||
false,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user