/** 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 deviates in height (60 against the schema's 100) and colour, // so two rows carry a reset. Rows run Enabled, Width, Height, Color, Texture, so height's // reset is the first on screen and colour's the last. await select({ kind: 'asset', assetId: 'crate' }); await sleep(200); const heightReset = await evaluate(`__gm.locate('↺')`); const colorReset = await evaluate(`__gm.locate('↺', true)`); check('asset inspector shows a reset per deviating property', Boolean(heightReset)); check( 'the two deviations have two separate resets', Boolean(colorReset) && colorReset.y > heightReset.y, JSON.stringify({ heightReset, colorReset }), ); await click(heightReset.x, heightReset.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}`, ); const remaining = await evaluate(`__gm.locate('↺')`); check( 'the reset of the property now at its default is gone, the other one stays', Boolean(remaining) && remaining.y === colorReset.y && remaining.y === (await evaluate(`__gm.locate('↺', true)`)).y, JSON.stringify({ remaining, colorReset }), ); 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( 'the height reset is back after undo', (await evaluate(`__gm.locate('↺')`))?.y === heightReset.y, JSON.stringify(await evaluate(`__gm.locate('↺')`)), ); }