Choose generation mode automatically from starting image
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import test from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import { readFileSync } from 'node:fs'
|
||||
import ts from 'typescript'
|
||||
const source = readFileSync(new URL('../utils/generationInput.ts', import.meta.url), 'utf8')
|
||||
const code = ts.transpileModule(source, {compilerOptions:{module:ts.ModuleKind.CommonJS}}).outputText
|
||||
const api = {}
|
||||
new Function('exports', code)(api)
|
||||
|
||||
test('image generation follows adding and removing the starting image, regardless of saved basic mode', () => {
|
||||
for (const saved of ['edit','generate']) {
|
||||
assert.equal(api.imageModeForInput(saved,false),'generate')
|
||||
assert.equal(api.imageModeForInput(saved,true),'edit')
|
||||
assert.equal(api.imageModeForInput(saved,false),'generate')
|
||||
}
|
||||
})
|
||||
test('video generation follows the starting image', () => {
|
||||
assert.equal(api.videoStartForInput(false),'text')
|
||||
assert.equal(api.videoStartForInput(true),'still')
|
||||
assert.equal(api.videoStartForInput(false),'text')
|
||||
})
|
||||
test('removing a batch input preserves the batch as text-based iterations', () => {
|
||||
assert.equal(api.imageModeForInput('edit',false,true),'iterate')
|
||||
assert.equal(api.imageModeForInput('edit',true,true),'edit')
|
||||
})
|
||||
test('explicit compose, refine and iterate modes remain explicit', () => {
|
||||
for (const mode of ['compose','refine','iterate']) {
|
||||
assert.equal(api.imageModeForInput(mode,false),mode)
|
||||
assert.equal(api.imageModeForInput(mode,true),mode)
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user