Kaleido/scripts/verify_library_jump.py
Elijah 30e0f30bca
All checks were successful
Validate and publish Kaleido / android (push) Successful in 2m24s
Release Kaleido 0.6.1 with smoother browsing
Home, Movies and TV stay composed once shown and are revealed instead of
rebuilt; hidden screens are unplaced, have no semantics and take no focus.
The hero stays composed as a zero-alpha layer. Lazy-list prefetch runs on
FramePrefetch, which uses only spare frame time (unlimited only when truly
idle) instead of Compose's scheduler, which gave late frames unlimited time
and composed whole rows mid-scroll. CacheWindows keeps Compose's cache-window
strategy on that scheduler and premeasures nested cards.

With any accessibility service enabled, Compose walked and sorted every
composed node every 100 ms while browsing; rows and cards outside the
viewport now carry no semantics. Cards use a lighter artwork path, lay out
both title weights up front, and models are @Immutable. Preview and hero copy
compose over the transparent start of their fade. Library sync applies its
snapshot after 2 s without input, and moveToRow retries focus so a refreshed
card is never left unfocused.

profile_transitions.py now counts frames actually dropped on the display.
On the onn the 42 measured transitions dropped 24-38 frames, versus 55 for
0.6.0; details are in docs/runtime-verification.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 00:24:07 -07:00

77 lines
4 KiB
Python

"""Read-only D-pad checks for exact search, scoped genres and jumps beyond the first catalog page."""
import json,time,urllib.parse,urllib.request
from device import ROOT,adb,screenshot
from verify_ui import launch,key,text,focused,focus,snapshot,labels,wait,passed
LETTERS=['#']+list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
def first_at_letter(section,media_type,letter,genre=''):
cfg=dict(l.split('=',1) for l in (ROOT/'.env').read_text().splitlines() if '=' in l and not l.startswith('#'))
base=cfg['PLEX_SERVER_URL'].strip('"\'').rstrip('/')
headers={'X-Plex-Token':cfg['PLEX_TOKEN'].strip('"\''),'Accept':'application/json'}
def get(path,params):
request=urllib.request.Request(base+path+'?'+urllib.parse.urlencode(params),headers=headers)
with urllib.request.urlopen(request,timeout=30) as response:return json.load(response)['MediaContainer']
sections=get('/library/sections',{})['Directory']
section=next(s['key'] for s in sections if s['type']==media_type)
params={'type':'1' if media_type=='movie' else '2'}
if genre:
genres=get('/library/sections/'+section+'/genre',{})['Directory']
params['genre']=next(g['key'] for g in genres if g['title']==genre)
chars=get('/library/sections/'+section+'/firstCharacter',params)['Directory']
offset=0
for item in chars:
if item['title']==letter:break
offset+=item['size']
params.update({'sort':'titleSort:asc','X-Plex-Container-Start':offset,'X-Plex-Container-Size':1})
return get('/library/sections/'+section+'/all',params)['Metadata'][0]['title'],offset
def enter_rail():
for _ in range(10):
# A rail entry reports its letter in more than one label, e.g. "# #".
value=(focus(snapshot()).split() or [''])[0]
if value in LETTERS:return value
key(22)
raise AssertionError('Right edge must enter letter bar; focus='+focus(snapshot()))
def jump(letter,expected):
current=enter_rail()
delta=LETTERS.index(letter)-LETTERS.index(current)
key(20 if delta>=0 else 19,abs(delta));focused(letter)
key(23)
# OK keeps the letter selected; Left explicitly enters the target title.
time.sleep(2);focused(letter);key(21);focused(expected)
key(23);wait(lambda r:any(s in labels(r) for s in ['Play','Resume','Seasons','Synopsis']),'Title details open')
key(4);focused(expected)
def section_check(tab,media_type):
launch();key(22,1 if tab=='Movies' else 2);focused(tab)
key(20);focused('Discover');key(22);focused('Library');key(23);focused('Library')
text('Z');screenshot('030-'+media_type+'-library')
key(20);key(20)
expected,offset=first_at_letter('',media_type,'S')
jump('S',expected)
passed(f'{tab} A-Z reaches S at absolute index {offset}, enters title and restores focus')
key(4);focused('Discover');key(22,2);focused('Categories');key(23)
# Genres are server-supplied and alphabetically ordered; move within the first row.
wait(lambda r:focus(r) not in ('','Categories'),'Category tile receives focus')
for _ in range(8):
if focus(snapshot())=='Animation':break
key(22)
focused('Animation');key(23);text('Animation ⌄');text('Z')
expected,offset=first_at_letter('',media_type,'S','Animation')
jump('S',expected)
screenshot('030-'+media_type+'-animation-jump')
key(4);focused('Animation');key(4);focused('Discover')
passed(f'{tab} Animation stays scoped and supports letter jump, details Back and category Back')
if __name__=='__main__':
for tab,kind in [('Movies','movie'),('TV Shows','show')]:section_check(tab,kind)
launch()
key(22,3);focused('Search');key(23);text('Search')
adb('shell','input','text','silo')
text('TV shows');key(66);focused('Silo')
# The first reachable result must be the exact series, never the unrelated movie row.
key(23);text('Seasons');screenshot('030-exact-silo-search')
key(4);focused('Silo');key(4);key(4)
passed('Silo search enters the exact series first and restores the result on Back')