HEL-871: preview existing reference media from composer slots
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
HEL-871 已有素材点击预览回归(在仓库根目录运行)。
|
||||
|
||||
- `npm --prefix calliope-web ci --no-audit --no-fund`
|
||||
- `npm --prefix calliope-web run check`(必须零错零警)、`npm --prefix calliope-web run lint`、`npm --prefix calliope-web test`、`npm --prefix calliope-web run build`
|
||||
- `python3 scripts/hel871/capture.py --backend-python <已有项目依赖的 Python 3.11+> --output <隔离证据目录>`
|
||||
|
||||
编排 Python 需已有 Playwright/Pillow;浏览器系统库可通过 `HEL871_BROWSER_LIBS` 指定。后端 Python 使用已有 FastAPI/uvicorn 及项目依赖;不引入新产品依赖。测试占用仅本机 18271/15271,先检查端口空闲,创建临时数据目录,结束时比对 Multica daemon 后终止精确子进程并删除临时数据。ComfyUI/LLM 指向不可用回环端口、队列暂停;不会生成。
|
||||
|
||||
`--before --build <基线构建目录>` 可对固定 base 构建采集相同四主题三窗口的底栏/管理弹层,并复现缩略图误开文件选择。默认对当前构建执行实际上传、预览、缩放、焦点圈定/返回、关闭再看、替换、删除、格式拒绝、坏图片、真实 H3 多参考和首尾帧、切工作流、媒体组及单视频/音频原生播放器、无输入工作流、试运行弹层与素材库共享灯箱。上传走真实 HTTP,前端不拦截响应;媒体组为后端既有测试形状,不声称真实供应商生成能力。
|
||||
|
||||
产物包含原始截图、Playwright trace/video、HTTP 服务日志及检查 JSON。矩阵只覆盖本次受影响的底栏/管理素材与灯箱;不重拍全站。before/after 并排附件用于核对布局保留,新增预览状态另附。模板媒体为本次合成色卡,非用户素材。
|
||||
|
||||
公共组件影响:`Drawer` 接入与 Modal 一致的 modalLayers,避免内层预览 Esc 同时关闭试运行抽屉,并保留嵌套滚动锁和焦点;实际验证第二次 Esc 单独关闭抽屉。`MediaSlot` 仅 SlotTray 使用;`RefImageGrid` 同时用于工作流试运行。`ImageLightbox` 的键盘层级与焦点修复也作用于素材库、创作台结果/Inspector、智能体成果、画布与搭景 CaptureStrip;图片/视频渲染不改,替换按钮仅输入素材调用方显式传入时显示。此卡实际挂载回归覆盖输入槽、试运行与素材库;其余入口通过前端全量 check/lint/build 及共用灯箱回归覆盖,未分别创建业务数据重走整页。
|
||||
@@ -0,0 +1,344 @@
|
||||
"""HEL-871: real mounted UI/HTTP regression in disposable loopback-only services."""
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import signal
|
||||
import socket
|
||||
import subprocess
|
||||
import tempfile
|
||||
import time
|
||||
import urllib.request
|
||||
import wave
|
||||
|
||||
from PIL import Image, ImageDraw
|
||||
from playwright.sync_api import sync_playwright, expect
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
p = argparse.ArgumentParser()
|
||||
p.add_argument('--backend-python', required=True)
|
||||
p.add_argument('--output', type=Path, required=True)
|
||||
p.add_argument('--build', type=Path, default=ROOT/'calliope-web/build')
|
||||
p.add_argument('--before', action='store_true')
|
||||
a = p.parse_args()
|
||||
out = a.output.resolve()
|
||||
out.mkdir(parents=True, exist_ok=True)
|
||||
phase = 'before' if a.before else 'after'
|
||||
report = {'phase': phase, 'checks': [], 'errors': [], 'choosers': 0, 'writes': []}
|
||||
|
||||
|
||||
def check(name, value=True):
|
||||
report['checks'].append({'name': name, 'pass': bool(value)})
|
||||
assert value, name
|
||||
print('PASS', name, flush=True)
|
||||
|
||||
|
||||
def verify(page, request, runtime):
|
||||
def api(path, body):
|
||||
r = request.post('http://127.0.0.1:18271/api'+path, data=body)
|
||||
assert r.ok, r.text()
|
||||
return r.json()
|
||||
|
||||
fixtures = ROOT/'calliope-backend/tests/fixtures/comfy_native'
|
||||
# User-supplied real graphs for multi-reference and first/last frames.
|
||||
graphs = {name: json.loads((fixtures/file).read_text()) for name, file in [
|
||||
('refs', 'h3_ref2va_05_API.json'), ('frames', 'h3_i2v_04_API.json')]}
|
||||
graphs['image'] = {
|
||||
'1': {'class_type': 'PrimitiveStringMultiline', 'inputs': {'value': '隔离预览测试'}, '_meta': {'title': 'Prompt (Input:prompt)'}},
|
||||
'2': {'class_type': 'LoadImage', 'inputs': {'image': ''}, '_meta': {'title': 'Image (Input:image)'}},
|
||||
'3': {'class_type': 'LoadImageMask', 'inputs': {'image': '', 'channel': 'red'}, '_meta': {'title': 'Mask (Input:mask)'}},
|
||||
'4': {'class_type': 'SaveImage', 'inputs': {'images': ['2', 0]}}
|
||||
}
|
||||
graphs['text'] = {'1': graphs['image']['1'], '4': {'class_type': 'SaveImage', 'inputs': {'images': ['1', 0]}}}
|
||||
# Same generic group shape as backend test_media_groups; no generation claim.
|
||||
graphs['media'] = {
|
||||
'1': graphs['image']['1'],
|
||||
'131': {'class_type': 'MiniMaxH3ReferenceToVideo', 'inputs': {
|
||||
'prompt': ['1', 0], 'ref_videos.ref_video_0': ['902', 0], 'ref_audios.ref_audio_0': ['903', 0]}},
|
||||
'902': {'class_type': 'LoadVideo', 'inputs': {'file': 'ref.mp4', 'force_rate': 0}},
|
||||
'903': {'class_type': 'LoadAudio', 'inputs': {'audio': 'ref.wav'}},
|
||||
'92': {'class_type': 'SaveVideo', 'inputs': {'video': ['131', 0]}}
|
||||
}
|
||||
graphs['media']['1'] = {'class_type': 'PrimitiveStringMultiline', 'inputs': {'value': '隔离媒体预览'}}
|
||||
graphs['singles'] = {
|
||||
'1': graphs['image']['1'],
|
||||
'902': {'class_type': 'LoadVideo', 'inputs': {'file': ''}, '_meta': {'title': 'Video (Input:video)'}},
|
||||
'903': {'class_type': 'LoadAudio', 'inputs': {'audio': ''}, '_meta': {'title': 'Audio (Input:audio)'}},
|
||||
'92': {'class_type': 'SaveVideo', 'inputs': {'video': ['902', 0]}}
|
||||
}
|
||||
ids = {}
|
||||
for name, graph in graphs.items():
|
||||
result = api('/workflows', {'name': 'HEL871 '+name, 'kind': 'image' if name in ['image', 'text'] else 'video', 'workflow_json': graph})
|
||||
ids[name] = result['id']
|
||||
(out/'workflows.json').write_text(json.dumps(ids, indent=2))
|
||||
images = []
|
||||
for n, color in enumerate(['#247a9b', '#e0ab4d', '#9862ac']):
|
||||
f = runtime/f'preview-{n}.png'
|
||||
im = Image.new('RGB', (960, 640), color)
|
||||
ImageDraw.Draw(im).text((90, 180), f'HEL-871 REFERENCE {n+1}', fill='white')
|
||||
im.save(f)
|
||||
images.append(str(f))
|
||||
audio = runtime/'preview.wav'
|
||||
with wave.open(str(audio), 'wb') as w:
|
||||
w.setnchannels(1); w.setsampwidth(2); w.setframerate(8000); w.writeframes(b'\0\0'*16000)
|
||||
bad = runtime/'broken.png'; bad.write_bytes(b'not an image')
|
||||
text = runtime/'unsupported.txt'; text.write_text('rejected')
|
||||
video = str(ROOT/'e2e/tiny.mp4')
|
||||
def goto(name):
|
||||
page.goto(f'http://127.0.0.1:15271/create?kind={"image" if name in ["image", "text"] else "video"}&wf={ids[name]}')
|
||||
page.locator('#desk-prompt').wait_for()
|
||||
page.wait_for_timeout(200)
|
||||
def upload(slot, files):
|
||||
with page.expect_file_chooser() as fc:
|
||||
slot.locator('button.add').click()
|
||||
fc.value.set_files(files)
|
||||
expect(slot.locator('.a-tile-hit')).to_have_count(len(files) if isinstance(files, list) else 1)
|
||||
expect(slot.locator('.a-tile-ring')).to_have_count(0)
|
||||
def close():
|
||||
page.keyboard.press('Escape')
|
||||
expect(page.locator('.backdrop')).to_have_count(0)
|
||||
def shot(name, loc=None):
|
||||
(loc or page).screenshot(path=str(out/f'{name}.png'))
|
||||
def preview(hit, kind='image', keyboard=None):
|
||||
before = report['choosers']
|
||||
hit.focus()
|
||||
if keyboard: page.keyboard.press(keyboard)
|
||||
else: hit.click()
|
||||
expect(page.locator('.backdrop')).to_be_visible()
|
||||
check(f'{kind} preview without picker', report['choosers'] == before)
|
||||
return page.locator('.backdrop')
|
||||
goto('image')
|
||||
page.locator('#desk-prompt').fill('保留提示词与参数 · HEL871')
|
||||
slots = page.locator('.media-summary .a-slot')
|
||||
check('image and mask exactly two wired slots', slots.count() == 2)
|
||||
upload(slots.nth(0), images[0]); upload(slots.nth(1), images[1])
|
||||
check('empty slot uses actual upload endpoint', any('/playground/uploads' in x for x in report['writes']))
|
||||
for width, height in [(1440, 900), (1366, 768), (1280, 720)]:
|
||||
page.set_viewport_size({'width': width, 'height': height})
|
||||
for theme in ['night', 'day', 'grade', 'bluehour']:
|
||||
page.evaluate('(v)=>document.documentElement.dataset.theme=v', theme)
|
||||
page.wait_for_timeout(80)
|
||||
name = f'{theme}-{width}'
|
||||
shot(name+'-compact', page.locator('.media-summary'))
|
||||
if not a.before:
|
||||
hit = slots.nth(0).locator('.a-tile-hit')
|
||||
box = preview(hit, keyboard='Enter')
|
||||
shot(name+'-preview')
|
||||
box.get_by_role('button', name='100%', exact=True).click()
|
||||
check(name+' toolbar zoom stays open', box.locator('.frame.zoomed').count() == 1)
|
||||
close()
|
||||
check(name+' close restores focus', hit.evaluate('(e)=>document.activeElement===e'))
|
||||
page.get_by_role('button', name='管理素材', exact=True).click()
|
||||
manager = page.locator('.modal-panel')
|
||||
expect(manager).to_be_visible()
|
||||
shot(name+'-manager', manager)
|
||||
if not a.before:
|
||||
hit = manager.locator('.a-tile-hit').nth(1)
|
||||
preview(hit, keyboard='Space')
|
||||
expect(page.locator('.backdrop img')).to_have_attribute('src', manager.locator('.a-tile-hit img').nth(1).get_attribute('src'))
|
||||
close()
|
||||
check(name+' escape only closes top preview', manager.is_visible() and hit.evaluate('(e)=>document.activeElement===e'))
|
||||
page.keyboard.press('Escape')
|
||||
expect(manager).to_have_count(0)
|
||||
if a.before:
|
||||
hit = slots.nth(0).locator('.a-tile-hit')
|
||||
with page.expect_file_chooser(): hit.click()
|
||||
check('baseline bug reproduced: filled thumbnail opens file chooser')
|
||||
return
|
||||
page.set_viewport_size({'width': 1440, 'height': 900})
|
||||
hit = slots.nth(0).locator('.a-tile-hit')
|
||||
page.wait_for_timeout(700)
|
||||
draft = page.evaluate('JSON.stringify(localStorage)')
|
||||
original = hit.locator('img').get_attribute('src')
|
||||
box = preview(hit)
|
||||
box.get_by_role('button', name='关闭预览', exact=True).click()
|
||||
expect(box).to_have_count(0)
|
||||
box = preview(hit)
|
||||
# Trap focus across both ends.
|
||||
box.locator('button, a').first.focus(); page.keyboard.press('Shift+Tab')
|
||||
check('reverse tab trapped', box.evaluate('(e)=>e.contains(document.activeElement)'))
|
||||
page.keyboard.press('Tab')
|
||||
check('forward tab trapped', box.evaluate('(e)=>e.contains(document.activeElement)'))
|
||||
close()
|
||||
check('preview preserves prompt', page.locator('#desk-prompt').input_value() == '保留提示词与参数 · HEL871')
|
||||
check('preview does not save draft or reorder values', page.evaluate('JSON.stringify(localStorage)') == draft and hit.locator('img').get_attribute('src') == original)
|
||||
box = preview(hit)
|
||||
with page.expect_file_chooser() as fc: box.get_by_role('button', name='替换', exact=True).click()
|
||||
fc.value.set_files(images[2])
|
||||
expect(hit.locator('img')).not_to_have_attribute('src', original)
|
||||
check('explicit single replacement uploads new image')
|
||||
n = report['choosers']
|
||||
slots.nth(0).locator('.a-tile-x').click()
|
||||
expect(slots.nth(0).locator('button.add')).to_be_visible()
|
||||
check('remove opens neither preview nor picker', page.locator('.backdrop').count() == 0 and report['choosers'] == n)
|
||||
with page.expect_file_chooser() as fc: slots.nth(0).locator('button.add').click()
|
||||
fc.value.set_files(str(text))
|
||||
expect(slots.nth(0).get_by_role('alert')).to_be_visible()
|
||||
check('upload format validation retained')
|
||||
upload(slots.nth(0), str(bad))
|
||||
preview(slots.nth(0).locator('.a-tile-hit'))
|
||||
expect(page.locator('.backdrop .safe-media-ph')).to_be_visible()
|
||||
shot('broken-image')
|
||||
check('broken filled image gives real unavailable message and remains replaceable')
|
||||
close()
|
||||
goto('refs')
|
||||
refs = page.locator('.media-summary .a-slot').first
|
||||
upload(refs, images[:2])
|
||||
srcs = refs.locator('.a-tile-hit img').evaluate_all('(es)=>es.map(e=>e.getAttribute("src"))')
|
||||
box = preview(refs.locator('.a-tile-hit').nth(1))
|
||||
expect(box.locator('img')).to_have_attribute('src', srcs[1])
|
||||
page.keyboard.press('ArrowLeft')
|
||||
expect(box.locator('img')).to_have_attribute('src', srcs[0])
|
||||
check('multi reference selected image and keyboard navigation correct')
|
||||
close()
|
||||
check('navigation retains original invoker focus', refs.locator('.a-tile-hit').nth(1).evaluate('(e)=>document.activeElement===e'))
|
||||
box = preview(refs.locator('.a-tile-hit').nth(1))
|
||||
with page.expect_file_chooser() as fc: box.get_by_role('button', name='替换', exact=True).click()
|
||||
fc.value.set_files(images[2])
|
||||
expect(refs.locator('.a-tile-hit img').nth(1)).not_to_have_attribute('src', srcs[1])
|
||||
check('replace changes only selected reference index', refs.locator('.a-tile-hit img').nth(0).get_attribute('src') == srcs[0])
|
||||
refs.locator('.a-tile-x').nth(0).click()
|
||||
expect(refs.locator('.a-tile-hit')).to_have_count(1)
|
||||
check('reference remove preserves remaining order')
|
||||
preview(refs.locator('.a-tile-hit').first)
|
||||
# Route navigation while open must discard the old preview.
|
||||
page.locator('.workflow-pick').filter(has_text='HEL871 frames').evaluate('(e)=>e.click()')
|
||||
expect(page.locator('.backdrop')).to_have_count(0)
|
||||
check('switch workflow in mounted desk clears old preview')
|
||||
goto('frames')
|
||||
frames = page.locator('.media-summary .a-slot')
|
||||
expect(frames).to_have_count(2)
|
||||
upload(frames.nth(0), images[0]); upload(frames.nth(1), images[1])
|
||||
for i in [0, 1]:
|
||||
src = frames.nth(i).locator('.a-tile-hit img').get_attribute('src')
|
||||
box = preview(frames.nth(i).locator('.a-tile-hit'))
|
||||
expect(box.locator('img')).to_have_attribute('src', src)
|
||||
close()
|
||||
shot('first-last-frames', page.locator('.media-summary'))
|
||||
check('first and last frame slots preview independently')
|
||||
goto('media')
|
||||
groups = page.locator('.media-summary .a-slot')
|
||||
expect(groups).to_have_count(2)
|
||||
for i, (file, tag) in enumerate([(video, 'video'), (str(audio), 'audio')]):
|
||||
group = groups.filter(has=page.locator(f'input[accept*="{tag}"]')).first
|
||||
upload(group, [file])
|
||||
box = preview(group.locator('.a-tile-hit'), tag)
|
||||
player = box.locator(tag)
|
||||
expect(player).to_be_visible()
|
||||
check(tag+' native controls, paused by default', player.evaluate('(e)=>e.controls && e.paused && !e.autoplay'))
|
||||
player.focus(); page.keyboard.press('Space')
|
||||
expect(player).to_have_js_property('paused', False)
|
||||
check(tag+' keyboard manual playback works')
|
||||
shot(tag+'-manual-play')
|
||||
close()
|
||||
goto('singles')
|
||||
singles = page.locator('.media-summary .a-slot')
|
||||
expect(singles).to_have_count(2)
|
||||
for i, (file, tag) in enumerate([(video, 'video'), (str(audio), 'audio')]):
|
||||
slot = singles.filter(has=page.locator(f'input[accept*="{tag}"]')).first
|
||||
upload(slot, file)
|
||||
box = preview(slot.locator('.a-tile-hit'), tag)
|
||||
expect(box.locator(tag)).to_be_visible()
|
||||
check('single '+tag+' correct player and paused', box.locator(tag).evaluate('(e)=>e.controls && e.paused'))
|
||||
close()
|
||||
goto('text')
|
||||
expect(page.locator('.media-summary')).to_have_count(0)
|
||||
check('text to image has no invented input slot')
|
||||
# Other mounted caller of RefImageGrid: workflow test dialog.
|
||||
page.goto('http://127.0.0.1:15271/workflows')
|
||||
row = page.locator('tbody tr').filter(has_text='HEL871 refs')
|
||||
row.locator('button.mg-click').click()
|
||||
page.get_by_role('button', name='试运行', exact=True).click()
|
||||
form = page.locator('.wft-form .a-slot').first
|
||||
expect(form).to_be_visible()
|
||||
upload(form, images[:2])
|
||||
box = preview(form.locator('.a-tile-hit').nth(1))
|
||||
close()
|
||||
check('workflow test dialog preview restores nested focus', form.locator('.a-tile-hit').nth(1).evaluate('(e)=>document.activeElement===e'))
|
||||
shot('workflow-test-dialog')
|
||||
page.keyboard.press('Escape')
|
||||
expect(form).to_have_count(0)
|
||||
check('drawer closes on second escape and restores body scroll', page.evaluate('document.body.style.overflow') != 'hidden')
|
||||
# Existing shared lightbox caller: library navigation, zoom, focus, manual video.
|
||||
page.goto('http://127.0.0.1:15271/library')
|
||||
tile = page.locator('.lt').filter(has=page.locator('img')).first
|
||||
tile.dblclick()
|
||||
box = page.locator('.backdrop')
|
||||
expect(box).to_be_visible()
|
||||
expect(box.get_by_role('button', name='替换', exact=True)).to_have_count(0)
|
||||
box.get_by_role('button', name='100%', exact=True).click()
|
||||
expect(box.locator('.frame.zoomed')).to_be_visible()
|
||||
page.keyboard.press('ArrowRight')
|
||||
close()
|
||||
check('library shared lightbox navigation zoom and close retained')
|
||||
check('no generation, model or prompt-tool requests', not any(any(part in url for part in ['/generate', '/test-run', '/prompt-tools']) for url in report['writes']))
|
||||
check('no JavaScript runtime errors', not report['errors'])
|
||||
|
||||
|
||||
for port in [18271, 15271]:
|
||||
with socket.socket() as probe:
|
||||
assert probe.connect_ex(('127.0.0.1', port)) != 0, f'Occupied port: {port}'
|
||||
children = []
|
||||
handles = []
|
||||
with tempfile.TemporaryDirectory(prefix='runtime-', dir=out) as temp:
|
||||
runtime = Path(temp)
|
||||
env = {**os.environ, 'PYTHONPATH': str(ROOT/'calliope-backend/src'), 'HEL871_DATA': temp}
|
||||
bootstrap = '''import os
|
||||
from pathlib import Path
|
||||
from calliope import config
|
||||
root=Path(os.environ['HEL871_DATA'])
|
||||
config.CONFIG_FILE=root/'settings.json'
|
||||
config.settings=config.Settings(data_dir=root/'data',assets_dir=root/'data/assets',llm_base_url='http://127.0.0.1:1/v1',comfyui_base_url='http://127.0.0.1:1',dry_run=False)
|
||||
config.settings.ensure_storage_dirs()
|
||||
from calliope.queue.manager import queue_manager
|
||||
queue_manager.paused=True
|
||||
from calliope.main import create_app
|
||||
import uvicorn
|
||||
uvicorn.run(create_app(),host='127.0.0.1',port=18271)
|
||||
'''
|
||||
web = (ROOT/'e2e/hel818-web.cjs').read_text().replace('18247', '18271').replace('15173', '15271').replace("path.resolve('calliope-web/build')", json.dumps(str(a.build.resolve())))
|
||||
try:
|
||||
for name, cmd in [('api', [a.backend_python, '-c', bootstrap]), ('web', ['node', '-e', web])]:
|
||||
h = (out/f'{name}.log').open('w'); handles.append(h)
|
||||
children.append(subprocess.Popen(cmd, env=env, stdout=h, stderr=subprocess.STDOUT, cwd=ROOT))
|
||||
for url in ['http://127.0.0.1:18271/api/health', 'http://127.0.0.1:15271']:
|
||||
for n in range(150):
|
||||
try:
|
||||
urllib.request.urlopen(url, timeout=1); break
|
||||
except OSError:
|
||||
if any(c.poll() is not None for c in children): raise RuntimeError('service startup failure')
|
||||
if n == 149: raise
|
||||
time.sleep(.1)
|
||||
with sync_playwright() as pw:
|
||||
browser = pw.chromium.launch(args=['--no-sandbox'], env={**os.environ, 'LD_LIBRARY_PATH': os.environ.get('HEL871_BROWSER_LIBS', '/home/xiaomo/pwlibs/root/usr/lib/x86_64-linux-gnu')})
|
||||
context = browser.new_context(viewport={'width': 1440, 'height': 900}, record_video_dir=str(out/'video'))
|
||||
context.add_init_script("localStorage.setItem('aigc-lang','zh');localStorage.setItem('aigc-motion','off')")
|
||||
context.tracing.start(screenshots=True, snapshots=True, sources=True)
|
||||
page = context.new_page()
|
||||
page.set_default_timeout(10000)
|
||||
page.on('pageerror', lambda e: report['errors'].append(str(e)))
|
||||
page.on('filechooser', lambda _: report.update(choosers=report['choosers']+1))
|
||||
page.on('request', lambda r: report['writes'].append(r.url) if r.method in ['POST', 'PATCH', 'PUT', 'DELETE'] else None)
|
||||
try:
|
||||
verify(page, context.request, runtime)
|
||||
except Exception:
|
||||
page.screenshot(path=str(out/'failure.png'))
|
||||
(out/'failure.html').write_text(page.content())
|
||||
raise
|
||||
finally:
|
||||
context.tracing.stop(path=str(out/'trace.zip'))
|
||||
context.close(); browser.close()
|
||||
finally:
|
||||
daemon = json.loads(subprocess.check_output(['multica', 'daemon', 'status', '--output', 'json']))['pid']
|
||||
for child in children:
|
||||
assert child.pid != daemon
|
||||
if child.poll() is None: child.send_signal(signal.SIGTERM)
|
||||
for child in children:
|
||||
try: child.wait(timeout=10)
|
||||
except subprocess.TimeoutExpired: child.kill(); child.wait()
|
||||
for h in handles: h.close()
|
||||
report['cleanup'] = [{'pid': c.pid, 'exit': c.returncode, 'daemon': daemon} for c in children]
|
||||
(out/'report.json').write_text(json.dumps(report, ensure_ascii=False, indent=2))
|
||||
report['isolated_runtime_removed'] = not runtime.exists()
|
||||
(out/'report.json').write_text(json.dumps(report, ensure_ascii=False, indent=2))
|
||||
print('PASS cleanup', report['cleanup'], flush=True)
|
||||
@@ -0,0 +1,28 @@
|
||||
"""Pair unmodified before/after UI captures; preserve originals and their hashes."""
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
from PIL import Image, ImageDraw
|
||||
|
||||
p = argparse.ArgumentParser()
|
||||
p.add_argument('--evidence', type=Path, required=True)
|
||||
a = p.parse_args()
|
||||
out = a.evidence/'comparison'
|
||||
out.mkdir(exist_ok=True)
|
||||
manifest = []
|
||||
for theme in ['night', 'day', 'grade', 'bluehour']:
|
||||
for width in [1440, 1366, 1280]:
|
||||
for state in ['compact', 'manager']:
|
||||
name = f'{theme}-{width}-{state}.png'
|
||||
files = [a.evidence/phase/name for phase in ['before', 'after']]
|
||||
images = [Image.open(f).convert('RGB') for f in files]
|
||||
canvas = Image.new('RGB', (sum(im.width for im in images), max(im.height for im in images)+28), '#202020')
|
||||
draw = ImageDraw.Draw(canvas)
|
||||
x = 0
|
||||
for label, im in zip(['BASE 344fede', 'HEL-871'], images):
|
||||
draw.text((x+8, 8), label, fill='white')
|
||||
canvas.paste(im, (x, 28)); x += im.width
|
||||
canvas.save(out/name)
|
||||
manifest.append({'file': name, 'sha256': [hashlib.sha256(f.read_bytes()).hexdigest() for f in files]})
|
||||
(out/'manifest.json').write_text(json.dumps(manifest, indent=2))
|
||||
Reference in New Issue
Block a user