test: 补充形态生图模型配置
This commit is contained in:
1 parent
cebe6cbb81
commit
ad279f5556
1 file changed
+20
-4
@@ -8,6 +8,22 @@ import { coverImage, hasRunningImages, primaryImage, validImageSize } from '@/fe
|
||||
import { formFixture, imageFixture } from '@/features/subject-images/testing/fixtures'
|
||||
import { expandSections } from '@/testing/naive'
|
||||
|
||||
const imageCatalog = {
|
||||
defaults: { imageProvider: 'qwen-image', videoProvider: 'seedance' },
|
||||
images: [{
|
||||
type: 'image' as const, provider: 'qwen-image', providerLabel: 'Qwen', model: 'qwen-image-3.0-pro',
|
||||
modelLabel: 'Qwen Image', supported: true as const, enabled: true, isDefault: true, capabilities: {},
|
||||
generationOptions: [{ key: 'size', label: '图片尺寸', type: 'size' as const, required: true,
|
||||
options: [{ label: '1:1 · 2048×2048', value: '2048*2048' }] }],
|
||||
defaults: { size: '2048*2048' }, projectConstraints: []
|
||||
}],
|
||||
videos: []
|
||||
}
|
||||
const creativeProfile = {
|
||||
projectId: 'gallery-test', aspectRatio: '1:1' as const, imageProvider: 'qwen-image',
|
||||
imageModel: 'qwen-image-3.0-pro', imageOptions: { size: '2048*2048' },
|
||||
videoProvider: 'seedance', videoModel: 'seedance', videoOptions: {}
|
||||
}
|
||||
let wrapper: VueWrapper | undefined
|
||||
/** Naive 将弹窗挂载到 body,需要从实际弹窗找到按钮。 */
|
||||
function button(label: string): HTMLButtonElement {
|
||||
@@ -65,7 +81,7 @@ describe('形态图片选择与操作', () => {
|
||||
it.each(['character', 'scene', 'prop'])('按后端最新 %s 模块展示母版继承范围', async module => {
|
||||
const form = formFixture()
|
||||
form.subject.module = module
|
||||
wrapper = mount(GenerateImageDialog, { attachTo: document.body, props: { open: true, form, disabled: false } })
|
||||
wrapper = mount(GenerateImageDialog, { attachTo: document.body, props: { open: true, form, disabled: false, catalog: imageCatalog, profile: creativeProfile } })
|
||||
await flushPromises()
|
||||
expect(document.body.textContent).toContain('母版')
|
||||
expect(document.body.textContent).not.toContain('道具形态生图暂不自动引用')
|
||||
@@ -95,7 +111,7 @@ describe('形态图片选择与操作', () => {
|
||||
vi.stubGlobal('fetch', fetcher)
|
||||
wrapper = mount(GenerateImageDialog, {
|
||||
attachTo: document.body,
|
||||
props: { open: true, form: formFixture(), disabled: false }
|
||||
props: { open: true, form: formFixture(), disabled: false, catalog: imageCatalog, profile: creativeProfile }
|
||||
})
|
||||
await flushPromises()
|
||||
button('预览实际生成输入').click()
|
||||
@@ -136,7 +152,7 @@ describe('形态图片选择与操作', () => {
|
||||
it('生图确认发送正式形态 ID,不覆盖后端模型,默认不替换已有主图', async () => {
|
||||
wrapper = mount(GenerateImageDialog, {
|
||||
attachTo: document.body,
|
||||
props: { open: true, form: formFixture(), disabled: false }
|
||||
props: { open: true, form: formFixture(), disabled: false, catalog: imageCatalog, profile: creativeProfile }
|
||||
})
|
||||
await flushPromises()
|
||||
expect(button('确认生成图片').disabled).toBe(true)
|
||||
@@ -150,7 +166,7 @@ describe('形态图片选择与操作', () => {
|
||||
it('新形态默认设主图,填写一侧尺寸时不能提交,切换形态清空自定义提示词', async () => {
|
||||
const form = formFixture()
|
||||
form.images = []
|
||||
wrapper = mount(GenerateImageDialog, { attachTo: document.body, props: { open: true, form, disabled: false } })
|
||||
wrapper = mount(GenerateImageDialog, { attachTo: document.body, props: { open: true, form, disabled: false, catalog: imageCatalog, profile: creativeProfile } })
|
||||
await flushPromises()
|
||||
const width = document.querySelector<HTMLInputElement>('#image-width')!
|
||||
width.value = '2048'
|
||||
|
||||
Reference in new issue
Block a user