"""Check immediate tab/Down input and entry after the catalog was scrolled.""" from device import adb,screenshot from verify_ui import launch,key,focused,wait,focus,labels launch() # Keep both events in one shell command: a pending two-frame tab activation must # not let Down enter the old Home hero or get lost during composition. adb('shell','input','keyevent','22','20') wait(lambda r:'Recently released' in labels(r),'Rapid entry must load Movies') focused('Discover') key(20);wait(lambda r:focus(r) not in ('','Home','Movies','Discover','Play','Resume'),'Movies first poster') key(20);wait(lambda r:focus(r) not in ('','Home','Movies','Discover'),'Movies second row') key(19);key(19);focused('Discover');key(19);focused('Movies') key(20);focused('Discover');key(20) wait(lambda r:focus(r) not in ('','Home','Movies','Discover'),'Re-enter scrolled catalog') screenshot('navigation-entry') key(4);focused('Home') adb('shell','input','keyevent','22','22','20') wait(lambda r:'Next episodes' in labels(r),'Rapid double-tab entry must load TV') focused('Discover') key(4);focused('Home');key(20) wait(lambda r:focus(r) in ('Play','Resume'),'Home hero') key(20);root=wait(lambda r:focus(r) not in ('','Home','Play','Resume'),'Continue Watching card') first=focus(root) adb('shell','input','keyevent',*(['22']*4)) wait(lambda r:bool(focus(r)) and focus(r)!=first,'Rapid horizontal navigation') adb('shell','input','keyevent',*(['21']*4)) focused(first) print('PASS rapid Movies/Down and TV/Down, direct Discover entry, scrolled catalog re-entry, and rapid horizontal round-trip',flush=True)