fix(report): cap dimension scores and match zoom crops to thumbnails
This commit is contained in:
@@ -40,7 +40,9 @@ try {
|
||||
assert(offset!=null&&Number(offset)>=0&&Number(offset)<=.090001);
|
||||
const fullFront=await page.locator('#ditem-img1').getAttribute('src');
|
||||
await page.locator('#ditem-img1').click();
|
||||
assert.equal(await page.locator('#zoom-img').getAttribute('src'),fullFront,'front zoom still uses uncropped source');
|
||||
assert.notEqual(await page.locator('#zoom-img').getAttribute('src'),fullFront,'front zoom follows clipped thumbnail');
|
||||
await page.waitForFunction(()=>document.querySelector('#zoom-img').complete);
|
||||
assert(Math.abs(await page.locator('#zoom-img').evaluate(e=>e.naturalWidth/e.naturalHeight)-215/250.2)<.003);
|
||||
await page.locator('#p-zoom').click();
|
||||
const geo=await page.locator('.contour-side-photo').first().evaluate(e=>{const r=e.getBoundingClientRect();return{w:r.width,h:r.height,fit:getComputedStyle(e.querySelector('img')).objectFit};});
|
||||
assert(Math.abs(geo.h/geo.w-92.25/104.35)<.002);assert.equal(geo.fit,'cover');
|
||||
@@ -60,11 +62,12 @@ try {
|
||||
assert(Math.abs(spacing.vertical/spacing.u-7.56)<.1);
|
||||
await page.getByRole('button',{name:'查看左脸完整大图'}).click();
|
||||
assert(await page.locator('#p-zoom').evaluate(e=>e.classList.contains('show')));
|
||||
assert.equal(await page.locator('#zoom-img').getAttribute('src'),left);
|
||||
assert.equal(await page.locator('#zoom-img').evaluate(e=>e.naturalWidth/e.naturalHeight),4/3);
|
||||
assert.notEqual(await page.locator('#zoom-img').getAttribute('src'),left);
|
||||
await page.waitForFunction(()=>document.querySelector('#zoom-img').complete);
|
||||
assert(Math.abs(await page.locator('#zoom-img').evaluate(e=>e.naturalWidth/e.naturalHeight)-geo.w/geo.h)<.003);
|
||||
await page.locator('#p-zoom').click();
|
||||
await page.getByRole('button',{name:'查看右脸完整大图'}).click();
|
||||
assert.equal(await page.locator('#zoom-img').getAttribute('src'),right);
|
||||
assert.notEqual(await page.locator('#zoom-img').getAttribute('src'),right);
|
||||
await page.keyboard.press('Escape');
|
||||
assert(!await page.locator('#p-zoom').evaluate(e=>e.classList.contains('show')));
|
||||
await page.locator('.card-detail').first().locator('[data-tab="1"]').click();
|
||||
|
||||
Reference in New Issue
Block a user