feat(image-annotate): 1.2.1 默认不预建画笔层(按需自动落标注层)+ 侧栏硬度/透明去重
This commit is contained in:
1 parent
d8e4e0cb26
commit
1bf8220c05
10 files changed
+124
-114
No files matched your search
@@ -96,7 +96,7 @@ const boot = await page.evaluate((png) => {
|
||||
window.__commands['annotate-selected'].run().catch(() => {})
|
||||
return { version: window.__manifest.version, settingsSchema: Object.keys(window.__manifest.settings || {}) }
|
||||
}, PNG)
|
||||
check('产物可执行(循环打包未炸)', boot.version === '1.2.0', 'version=' + boot.version)
|
||||
check('产物可执行(循环打包未炸)', boot.version === '1.2.1', 'version=' + boot.version)
|
||||
check('manifest 声明输出预设设置项', boot.settingsSchema.includes('exportPreset') && boot.settingsSchema.includes('panelsCollapsed'), boot.settingsSchema.join(','))
|
||||
|
||||
await page.locator('#iwb-editor-overlay').waitFor({ state: 'visible', timeout: 15000 })
|
||||
@@ -128,6 +128,23 @@ check('modal 铺满视口、状态栏贴在 modal 底部(防多余 </div> 把
|
||||
}))
|
||||
|
||||
const imgBox = await page.locator('.iwb-editor-layer-canvas').first().boundingBox()
|
||||
|
||||
// ---------- 默认图层结构(用户裁定:默认不预建画笔标注层) ----------
|
||||
check('打开编辑器默认只有「原图」1 层,且状态栏不再写「画笔标注」',
|
||||
(await dbg()).layers.length === 1 &&
|
||||
(await dbg()).layers[0].id === 'base' &&
|
||||
!(await page.locator('.iwb-editor-status-layer').textContent()).includes('画笔标注'),
|
||||
JSON.stringify((await dbg()).layers.map(l => l.name)))
|
||||
|
||||
check('侧栏保留调色板 + 笔刷大小(滑杆/数字/快捷点),硬度/透明滑杆已移除(只在选项栏)',
|
||||
await page.evaluate(() => {
|
||||
const q = (s) => Boolean(document.querySelector(s))
|
||||
return q('.iwb-editor-color-panel') && q('.iwb-color-sv') &&
|
||||
q('.iwb-editor-brush-size') && q('.iwb-editor-brush-num') &&
|
||||
document.querySelectorAll('.iwb-editor-brush-preset').length >= 6 &&
|
||||
!q('.iwb-editor-brush-hardness') && !q('.iwb-editor-brush-opacity')
|
||||
}))
|
||||
|
||||
const drag = async (x1, y1, x2, y2) => {
|
||||
await page.mouse.move(x1, y1)
|
||||
await page.mouse.down()
|
||||
@@ -152,6 +169,9 @@ const afterFill = await pixel(cx, cy)
|
||||
check('填充只写当前层(base 像素不变)',
|
||||
afterFill.draw && afterFill.draw[3] > 0 && JSON.stringify(afterFill.base) === JSON.stringify(beforeFill.base),
|
||||
'draw=' + JSON.stringify(afterFill.draw) + ' base=' + JSON.stringify(afterFill.base))
|
||||
check('原图锁定时填充自动落「标注」层(不写进原图)',
|
||||
(await dbg()).layers.some(l => l.id === 'draw' && l.name.indexOf('标注') === 0),
|
||||
JSON.stringify((await dbg()).layers.map(l => l.name)))
|
||||
|
||||
const layersBeforeCopy = (await dbg()).layers.length
|
||||
await page.locator('.iwb-editor-sel-bar button[data-sel-cmd="sel.copy"]').click()
|
||||
@@ -189,8 +209,8 @@ await page.keyboard.press('Control+j') // 制造一个额外的选区副本层
|
||||
const beforeReset = await dbg()
|
||||
await page.locator('[data-action="reset"]').click()
|
||||
const afterReset = await dbg()
|
||||
check('还原原图:只剩「原图 + 空画笔层」,无空白粘贴层',
|
||||
afterReset.layers.length === 2 && afterReset.layers.some(l => l.id === 'base') && afterReset.layers.some(l => l.id === 'draw'),
|
||||
check('还原原图:只剩「原图」单层(默认不再预建画笔层)',
|
||||
afterReset.layers.length === 1 && afterReset.layers.some(l => l.id === 'base'),
|
||||
JSON.stringify(afterReset.layers.map(l => l.name)))
|
||||
check('还原原图清空矢量/选区但保留 base 像素',
|
||||
!afterReset.selection && JSON.stringify((await pixel(cx, cy)).base) === JSON.stringify(beforeFill.base))
|
||||
|
||||
Reference in new issue
Block a user