test(image-vectorize): 真站 e2e 补缩放/平移断言(比换算比例,不比容器宽度)
This commit is contained in:
1 parent
32363d8c9b
commit
b299895730
1 file changed
+5
-2
@@ -189,12 +189,15 @@ const pvBox = await page.locator('.vz-preview').boundingBox()
|
||||
await page.mouse.move(pvBox.x + pvBox.width / 2 + 40, pvBox.y + pvBox.height / 2 - 20)
|
||||
await page.mouse.wheel(0, -300)
|
||||
await sleep(220)
|
||||
// 断言「换算比例」而不是「比容器大」:正方形图 fit 进宽屏预览后本来就比容器窄,
|
||||
// 拿 rect.width > clientWidth 会比较,放大了也可能不成立(实测真站 549 vs 1011)
|
||||
check('滚轮放大预览、倍率胶囊出现', await page.evaluate(() => {
|
||||
const p = document.querySelector('.vz-preview')
|
||||
const v = document.querySelector('[data-stage="vector"]')
|
||||
const z = Number(p.style.getPropertyValue('--vz-zoom') || 1)
|
||||
const chip = document.querySelector('[data-zoom-chip]')
|
||||
const rect = document.querySelector('[data-stage="vector"]').getBoundingClientRect()
|
||||
return z > 1.1 && Boolean(chip) && !chip.hidden && rect.width > p.clientWidth
|
||||
const ratio = v.getBoundingClientRect().width / v.clientWidth
|
||||
return z > 1.1 && Boolean(chip) && !chip.hidden && Math.abs(ratio - z) < 0.02
|
||||
}))
|
||||
await page.mouse.dblclick(pvBox.x + pvBox.width / 2, pvBox.y + pvBox.height / 2)
|
||||
await sleep(220)
|
||||
|
||||
Reference in new issue
Block a user