/** The asset panel: placing from the context menu, creating through "+", and resetting an asset value. */ export async function assets(t) { const { check, sleep, evaluate, json, shot, click, clickText, undo, select, objects, asset } = t; // 8. Context menu on the Crate asset → menu shows "Place in scene". await clickText('Crate', 'right'); check('asset context menu opens', Boolean(await evaluate(`__gm.locate('Place in scene')`))); await shot('11-context-menu'); await clickText('Place in scene'); await sleep(100); const count = (await objects()).length; check('placing from the menu adds an object', count === 8, `objects=${count}`); // 9. Create a new asset through the + menu. await clickText('+'); await clickText('Sprite'); await sleep(100); const names = await json('__gm.state.project.assets.map(a => a.name)'); check('+ menu creates a sprite asset', names.includes('Sprite'), JSON.stringify(names)); await shot('12-new-asset'); // 12. Asset defaults: the Crate asset has height 60 (schema default 100), width and color at // their defaults → exactly one reset button is visible. Clicking it puts height back to // 100 and hides the button; undo brings 60 back. await select({ kind: 'asset', assetId: 'crate' }); await sleep(200); const resetButton = await evaluate(`__gm.locate('↺')`); check('asset inspector shows a reset for the non-default height', Boolean(resetButton)); await click(resetButton.x, resetButton.y); await sleep(100); check('reset puts the asset property back to its default', (await asset('crate')).props.height === 100, `height=${(await asset('crate')).props.height}`); check('reset button hidden once the value is at default', !(await evaluate(`__gm.locate('↺')`))); await shot('15-asset-reset'); await undo(); check('undo restores the asset value', (await asset('crate')).props.height === 60, `height=${(await asset('crate')).props.height}`); check('reset button visible again after undo', Boolean(await evaluate(`__gm.locate('↺')`))); }