Rearrange landscape puzzle layout
Landscape leaves now lay the puzzle out in two columns: the whole grid keeps one column (square, sized to the page) with the heading, area totals, hint/undo and notes beside it, and the leaf navigation folds into a single row. The game leaf also keeps its actions in a compact bottom bar, so the board and controls are visible without scrolling. - Leaf gains an optional wideBody used on landscape pages. - Board gains maxWidth, defaulting to the previous 350. - Split the puzzle body into area, board and note builders so both layouts share the same controls. - Add a landscape widget regression test and document the layout. This snapshot also carries the pending 2.0.2 notebook work already in the tree: read-ahead restore, bundled PCM WAV narration assets, the audio consistency comment, version 2.0.2+11, and the related unit, integration and script updates.
This commit is contained in:
@@ -24,10 +24,29 @@ launch();time.sleep(2)
|
||||
# Leave the player's actual consent decision to them if UMP requires it.
|
||||
root=dump()
|
||||
assert not any('Welcome to Publisher Test Ads' in value(n) for n in root.iter('node')),'Consent form is awaiting the player’s choice.'
|
||||
if any('Close book' in value(n) for n in root.iter('node')):tap('Close book')
|
||||
for attempt in range(8):
|
||||
root=dump()
|
||||
if any('Open Mara’s notebook' in value(n) for n in root.iter('node')):break
|
||||
if any('Close book' in value(n) for n in root.iter('node')):tap('Close book')
|
||||
else:adb('shell','input','keyevent','4')
|
||||
else:raise AssertionError('Could not return to the home screen')
|
||||
if a.expect_fresh:find('0 / 12');find('0\nPATTERNS FOUND')
|
||||
shot('main-home.png');tap('Open Mara’s notebook');find('For you, when you are ready');tap('Next leaf');find('By the cottage window')
|
||||
play=find('Play this reading');tapnode(play);time.sleep(2);shot('main-recording.png');tapnode(play);find('Resume recording')
|
||||
shot('main-home.png');tap('Open Mara’s notebook');tap('Contents');tap('1 · For you, when you are ready')
|
||||
def swipe_text(text,dx):
|
||||
n=find(text);x1,y1,x2,y2=map(int,re.findall(r'\d+',n.get('bounds')));x=(x1+x2)//2;y=(y1+y2)//2
|
||||
adb('shell','input','swipe',str(x),str(y),str(x+dx),str(y),'350')
|
||||
swipe_text('For you, when you are ready',-360);find('By the cottage window')
|
||||
swipe_text('By the cottage window',360);find('For you, when you are ready')
|
||||
tap('Next leaf');find('By the cottage window')
|
||||
play=find('Play this reading');tapnode(play);time.sleep(2)
|
||||
# A clock can advance even when the decoder creates no audio track. Inspect
|
||||
# the real mixer while playback is active (verified on the API 26 tablet).
|
||||
pid=adb('shell','pidof',a.package).decode().strip().split()[0]
|
||||
mixer=adb('shell','dumpsys','media.audio_flinger').decode(errors='replace')
|
||||
(out/'active-audio-track.txt').write_text(mixer)
|
||||
tracks=[line.split() for line in mixer.splitlines()]
|
||||
assert any(len(t)>13 and t[1]=='yes' and t[2]==pid and t[3]=='3' and t[8]=='A' and t[10]=='24000' and all(v!='-inf' for v in t[11:14]) for t in tracks),'The timer is not enough: no active, unmuted 24 kHz media track for this app'
|
||||
shot('main-recording.png');tapnode(play);find('Resume recording')
|
||||
def seconds():
|
||||
n=find('Paused ·');m=re.search(r'(\d+):(\d+)',value(n));return int(m[1])*60+int(m[2])
|
||||
first=seconds();assert first>=1
|
||||
@@ -36,5 +55,5 @@ tap('Stop');find('Play this reading')
|
||||
adb('shell','am','force-stop',a.package);launch();find('By the cottage window');find('Play this reading');shot('main-restored-page.png')
|
||||
tap('Close book')
|
||||
if a.expect_fresh:find('0 / 12');find('0\nPATTERNS FOUND')
|
||||
print('PASS: optimized app launches, starts fresh, plays through its UI, resumes audio, restores the reading place after process restart and leaves puzzle counts unchanged.')
|
||||
(out/'release-smoke.txt').write_text('PASS: fresh Flutter progress; release startup; UI FLAC playback/pause/resume/stop; process restart restores page; 0 puzzles awarded by reading.\n')
|
||||
print('PASS: optimized app launches, swipes over the writing in both directions, plays through its UI, resumes audio and restores the reading place after process restart.')
|
||||
(out/'release-smoke.txt').write_text('PASS: '+('fresh Flutter progress; ' if a.expect_fresh else '')+'release startup; writing-area swipes both ways; active PCM audio track; UI WAV playback/pause/resume/stop; process restart restores page.\n')
|
||||
|
||||
@@ -18,7 +18,9 @@ for record in canonical:
|
||||
for cue in track['cues']:
|
||||
assert previous<=cue['startMs']<cue['endMs']<=track['durationMs']
|
||||
previous=cue['endMs']
|
||||
wav=source/'wav'/(record['resource']+'.wav');flac=raw/track['file']
|
||||
wav=source/'wav'/(record['resource']+'.wav');flac=raw/track['flacFile']
|
||||
assert (raw/track['file']).read_bytes()==wav.read_bytes(),'Runtime WAV differs from its reviewed master'
|
||||
assert track['wavSha256']==hashlib.sha256(wav.read_bytes()).hexdigest()
|
||||
with wave.open(str(wav),'rb') as reader:
|
||||
assert reader.getnchannels()==1 and reader.getsampwidth()==2 and reader.getframerate()==24000
|
||||
assert reader.getnframes()==track['frames']
|
||||
@@ -28,7 +30,7 @@ for record in canonical:
|
||||
decoded=subprocess.check_output(['ffmpeg','-v','error','-i',str(flac),'-f','s16le','-acodec','pcm_s16le','-'])
|
||||
assert decoded==master,'Runtime FLAC must preserve the WAV master exactly'
|
||||
assert track['flacSha256']==hashlib.sha256(flac.read_bytes()).hexdigest()
|
||||
print(f"PASS {record['pageId']}: {track['durationMs']/1000:.1f}s, lossless, text/cues match")
|
||||
print(f"PASS {record['pageId']}: {track['durationMs']/1000:.1f}s, WAV/master match, FLAC lossless, text/cues match")
|
||||
for p in (root/'lib').rglob('*.dart'):
|
||||
assert 'flutter_tts' not in p.read_text(),f'Device reader reintroduced in {p}'
|
||||
print('All five recordings verified; bundled file playback only.')
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Prepare immutable WAV masters and bundled FLACs; Android performs no speech synthesis."""
|
||||
import argparse, hashlib, importlib.metadata, json, subprocess
|
||||
import argparse, hashlib, importlib.metadata, json, subprocess, shutil
|
||||
from pathlib import Path
|
||||
import numpy as np
|
||||
import soundfile as sf
|
||||
@@ -46,10 +46,11 @@ for record in json.loads((source/'scripts.json').read_text()):
|
||||
audio*=.86/peak
|
||||
wav=source/'wav'/f"{record['resource']}.wav";flac=raw/f"{record['resource']}.flac"
|
||||
sf.write(wav,audio,rate,subtype='PCM_16')
|
||||
shutil.copyfile(wav,raw/wav.name)
|
||||
subprocess.run(['ffmpeg','-v','error','-y','-i',str(wav),'-c:a','flac','-compression_level','8',str(flac)],check=True)
|
||||
decoded,check_rate=sf.read(flac,dtype='int16');master,_=sf.read(wav,dtype='int16')
|
||||
assert check_rate==rate and np.array_equal(decoded,master)
|
||||
tracks[record['pageId']]={**record,'file':flac.name,'sampleRate':rate,'channels':1,'frames':len(audio),
|
||||
tracks[record['pageId']]={**record,'file':wav.name,'flacFile':flac.name,'wavSha256':hashlib.sha256(wav.read_bytes()).hexdigest(),'sampleRate':rate,'channels':1,'frames':len(audio),
|
||||
'durationMs':round(len(audio)*1000/rate),'textSha256':hashlib.sha256(record['text'].encode()).hexdigest(),
|
||||
'flacSha256':hashlib.sha256(flac.read_bytes()).hexdigest(),'cues':cues}
|
||||
print(f"Saved {wav.name}: {len(audio)/rate:.1f}s; lossless FLAC verified",flush=True)
|
||||
|
||||
Reference in New Issue
Block a user