AkurAI Build
Menu

cosmic-mobile

public

Latest change a079e83f216bc411c5db498b393ba7aa41c01317 - Add live window lifecycle regression by AkurAI Build

"""Run against booted disposable VM: python test_multitasking.py."""
import subprocess
import time
from emu import call
windows = call('windows')
apps = [w for w in windows if w['app_id'] == 'Alacritty']
assert len(apps) >= 2, 'Open two terminals first'
a, b = apps[:2]
call('focus', str(a['id']))
subprocess.run(['python','qmp.py','key','esc'],check=True)
for key in ['m','o','b','i','l','e']:
    subprocess.run(['python','qmp.py','key',key],check=True)
call('focus', str(b['id']))
call('home')
assert next(w for w in call('windows') if w['is_focused'])['title'] == 'cosmic-mobile'
call('focus', str(a['id']))
state = {w['id']: w for w in call('windows')}
assert state[a['id']]['pid'] == a['pid'] and state[b['id']]['pid'] == b['pid']
assert state[a['id']]['is_focused']
assert state[a['id']]['layout']['window_size'] == [402,900]
call('shot','restored-terminal')
call('close', str(b['id']))
time.sleep(.5)
state = {w['id']: w for w in call('windows')}
assert b['id'] not in state and a['id'] in state
call('home')
call('shot','multitask-home')
print('PASS: Home, switch, process preservation, app bounds, close isolation')