Build menu: hover popup with full info, top-left card hidden while building
The short description row became a status row for the selected piece (variant, Replace, ghosts, messages). Gamepad shows the selected tile's popup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+19
-2
@@ -208,6 +208,23 @@ with sync_playwright() as p:
|
||||
ok = select('3', "piece().id === 'wall'")
|
||||
ev('GAME.wallMat = RSTONE; hudDirty = true')
|
||||
check('build tool starts on wall blocks', ok)
|
||||
settle(150)
|
||||
check('the build tool hides the top-left card', not pg.is_visible('#selcard'))
|
||||
check('the build menu has no short description row', pg.locator('.bb-tip').count() == 0)
|
||||
for id in ['wall', 'grate']:
|
||||
pg.hover(f'#buildbar [data-piece="{id}"]'); settle(120)
|
||||
check(f'hover shows the full {id} description and name', pg.is_visible('#bb-pop') and pg.inner_text('#bb-pop .bb-title') == ev(f'PIECE_BY_ID.{id}.name') and pg.inner_text('#bb-pop .bb-desc') == ev(f'PIECE_BY_ID.{id}.desc'))
|
||||
pg.mouse.move(400, 250); settle(120)
|
||||
check('leaving the build bar hides the popup', not pg.is_visible('#bb-pop'))
|
||||
ev('GAME.usingPad = true; renderBuildBar()')
|
||||
check('gamepad shows the selected piece popup', pg.is_visible('#bb-pop') and pg.inner_text('#bb-pop .bb-title') == ev('piece().name'))
|
||||
ev('GAME.usingPad = false; renderBuildBar()')
|
||||
for key in ['1', '2']:
|
||||
pg.keyboard.press(key); settle(150)
|
||||
check(f'tool {key} restores the top-left card', pg.is_visible('#selcard'))
|
||||
pg.keyboard.press('3'); settle(150)
|
||||
pg.mouse.click(*cell_to_screen(bx, gy - 20), button='middle'); settle(120)
|
||||
check('empty middle-click pick shows its status in the build bar', 'Nothing built here to pick.' in pg.inner_text('#buildbar .bb-status'))
|
||||
c0 = ev('GAME.buildCat != null ? GAME.buildCat : catOf(piece().id)')
|
||||
pg.keyboard.press('Shift+E')
|
||||
check('Shift+E switches build tabs and selects a piece in the tab', ev('GAME.buildCat') == (c0 + 1) % ev('BUILD_CATS.length') and ev('BUILD_CATS[GAME.buildCat][1].includes(piece().id)'))
|
||||
@@ -291,7 +308,7 @@ with sync_playwright() as p:
|
||||
check('belts dragged to the right run right', ev(f'(() => {{ for (let bx = {bbx} - 6; bx <= {bbx} + 2; bx++) if (blockV[{bby} * BW + bx] !== 1) return false; return true; }})()'))
|
||||
# copy: hold C and drag a box over them
|
||||
pg.mouse.move(*blk(bbx - 6, bby)); settle(300); pg.keyboard.down('c'); settle(200)
|
||||
check('holding C shows copy on the card', 'Copy' in ev("$('selcard').textContent") and ev("selModeHeld()") == 'copy', ev("$('selcard').textContent")[:80])
|
||||
check('holding C shows copy on the card', pg.is_visible('#selcard') and 'Copy' in ev("$('selcard').textContent") and ev("selModeHeld()") == 'copy', ev("$('selcard').textContent")[:80])
|
||||
pg.keyboard.up('c'); settle(100)
|
||||
drag(lambda: cell_to_screen((bbx - 6) * 4 + 1, bby * 4 + 1), lambda: cell_to_screen((bbx + 2) * 4 + 2, bby * 4 + 2), 5, hold_key='c')
|
||||
check('blueprint copied', ev('!!GAME.clip && GAME.paste && GAME.clip.blocks.length === 9'), ev('GAME.status'))
|
||||
@@ -324,7 +341,7 @@ with sync_playwright() as p:
|
||||
pg.mouse.down(); pg.mouse.up(); settle(100)
|
||||
check('a fan on a belt says to hold Ctrl', 'Ctrl' in ev('GAME.status'), ev('GAME.status'))
|
||||
pg.keyboard.down('Control'); settle(100); pg.mouse.move(*blk(bbx - 4, bby + 1)); settle(200)
|
||||
check('holding Ctrl shows replace mode', 'Replace' in ev("$('selcard').textContent"))
|
||||
check('holding Ctrl shows replace mode', 'Replace' in ev("$('buildbar').textContent"))
|
||||
pg.screenshot(path=str(out / '07g-replace-fan.png'))
|
||||
pg.mouse.down(); pg.mouse.up(); settle(100); pg.keyboard.up('Control'); settle(100)
|
||||
check('Ctrl-click puts the fan in place of the belt', ev(f"machines.some(m => m && m.type === 'fan' && m.x === ({bbx} - 4) * 4 && m.y === ({bby} + 1) * 4)") and ev(f'blockP[({bby} + 1) * BW + {bbx} - 4]') == 0, ev('GAME.status'))
|
||||
|
||||
Reference in New Issue
Block a user