mirror of
https://github.com/juanjiant-bit/JIANT.git
synced 2026-12-06 21:04:32 +01:00
- browser-additive-test.py: V10.8.87's engine order ends STRING ADD WAVE INPUT, so two steps back from DRUM landed on WAVE (9), not ADD (13), and run 47552111627 failed. KNOB 2 now steps one detent at a time, asking the device after each, until it reports 13 (the engines passed are printed; same checks after: ADD, keyboard audio, edition, storage). - wt-api.h (appended to a pin with editor_wt.c, as pm-api.h): the emulator never ran wt_boot (main.c does, FELUCCA_OTA only), so every WT_LIST / WT_BEGIN answered rc 4 and Studio could not upload a table; and WAVE reads the tables through hostsim.c's host_wt[], not the emulator's NOR, so a table stored there played silent. web_wt_boot after web_boot, web_wt_sync (host_wt = NOR 0xD0000..0xD7FFF when the flash was written) before each render. - wavetable-test.mjs: a .jwt uploaded (102..104), listed, read back (106), played by WAVE from U1 (not as SINE), kept and played after a reboot; run by emulator.yml / emulator-beta.yml. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KMHk6yH4XbP1xxHYKCo9Mh
65 lines
4.5 KiB
Python
65 lines
4.5 KiB
Python
"""Real Chromium: ADD selection, keyboard audio, edition guard and storage isolation."""
|
|
from pathlib import Path
|
|
from functools import partial
|
|
from http.server import ThreadingHTTPServer, SimpleHTTPRequestHandler
|
|
from threading import Thread
|
|
import shutil,sys
|
|
from playwright.sync_api import sync_playwright
|
|
|
|
root=Path(sys.argv[1]).resolve()
|
|
server=ThreadingHTTPServer(('127.0.0.1',0),partial(SimpleHTTPRequestHandler,directory=str(root)))
|
|
Thread(target=server.serve_forever,daemon=True).start()
|
|
try:
|
|
with sync_playwright() as p:
|
|
browser=p.chromium.launch(executable_path=shutil.which('google-chrome') or shutil.which('chromium'),args=['--no-sandbox','--autoplay-policy=no-user-gesture-required'])
|
|
page=browser.new_page(viewport={'width':412,'height':900});errors=[];requests=[]
|
|
page.on('pageerror',lambda e:errors.append(str(e)));page.on('request',lambda r:requests.append(r.url))
|
|
page.add_init_script("""localStorage.setItem('felucca-emu-flash','legacy-sample-bank-preserved');
|
|
const Original=window.AudioWorkletNode;
|
|
window.AudioWorkletNode=class extends Original {constructor(...a){super(...a);window.__node=this;window.__audioErrors=[];
|
|
this.addEventListener('processorerror',()=>__audioErrors.push('processorerror'));
|
|
this.port.addEventListener('message',e=>{if(e.data.type==='error')__audioErrors.push(e.data.message);if(e.data.type==='diagnostics')window.__edition=e.data;});this.port.start();}};""")
|
|
page.goto(f'http://127.0.0.1:{server.server_port}/')
|
|
assert 'V10' in page.locator('.version').inner_text()
|
|
assert page.locator('#sample-bank-controls').count()==0
|
|
page.click('#go');page.wait_for_function("document.querySelector('#go').textContent==='On'",timeout=30000)
|
|
page.wait_for_timeout(4200)
|
|
# Tap SAVE (V10.2: TIMELINE), then SELECT to the chain's last page, PRESETS; KNOB 2 selects the engine.
|
|
page.locator('[role="button"][aria-label="SAVE"]').click(delay=100)
|
|
page.wait_for_timeout(150)
|
|
page.locator('[role="slider"][aria-label="SELECT"]').focus()
|
|
for _ in range(12): # (to the chain's last page whatever its length: SELECT stops there; V10.7.23 needs 7, later 6)
|
|
page.keyboard.press('ArrowRight');page.wait_for_timeout(150)
|
|
# KNOB 2 steps back through the engines one detent at a time until the firmware itself reports ADD (13):
|
|
# the display order's tail moves between releases (V10.54: .. ADD INPUT; V10.8.87: .. STRING ADD WAVE INPUT),
|
|
# so the test asks the firmware after each step instead of counting detents. 20 steps cover the whole list
|
|
# (it wraps); every engine the knob passes is recorded so a failure says where it went.
|
|
knob=page.locator('[role="slider"][aria-label="KNOB 2"]');seen=[]
|
|
def diag():
|
|
page.evaluate("window.__edition=null;__node.port.postMessage({type:'diagnostics'})")
|
|
page.wait_for_function('window.__edition',timeout=5000)
|
|
return page.evaluate('__edition')
|
|
for _ in range(20):
|
|
knob.focus();page.keyboard.press('ArrowLeft');page.wait_for_timeout(150)
|
|
d=diag();seen.append(d['engine'])
|
|
if d['engine']==13: break
|
|
knob.evaluate('(el)=>el.blur()')
|
|
assert seen[-1]==13,f'KNOB 2 on PRESETS never reached ADD (13); engines seen: {seen}'
|
|
assert len(set(seen))>1,f'KNOB 2 did not change the engine (not on PRESETS?): {seen}'
|
|
page.wait_for_function('window.__edition && __edition.additive===true && __edition.engine===13',timeout=5000)
|
|
print('engines stepped through on PRESETS:',seen,flush=True)
|
|
page.evaluate("""() => {const a=__node.context.createAnalyser();a.fftSize=512;__node.connect(a);window.__analyser=a;}""")
|
|
page.keyboard.down('b');peak=0
|
|
for _ in range(12):
|
|
page.wait_for_timeout(20)
|
|
peak=max(peak,page.evaluate("() => {const x=new Float32Array(512);__analyser.getFloatTimeDomainData(x);return Math.max(...x.map(Math.abs));}"))
|
|
page.keyboard.up('b');assert peak>0.00001,peak
|
|
assert page.evaluate("localStorage.getItem('felucca-emu-flash')")=='legacy-sample-bank-preserved'
|
|
assert not any('factory-' in x for x in requests),requests
|
|
assert not errors,errors
|
|
assert not page.evaluate('__audioErrors'),page.evaluate('__audioErrors')
|
|
print('PASS Chromium ADD15: actual ADD engine 13, physical keyboard audio peak',peak,'legacy SAMPLE storage preserved; no sample-bank requests',flush=True)
|
|
browser.close()
|
|
finally:
|
|
server.shutdown()
|