Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions scripts/build_approved_native_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
'<script defer src="assets/approved-device-view-model.js"></script>\n'
'<script defer src="assets/approved-channel-strip-view-model.js"></script>\n'
'<script defer src="assets/approved-fx-rack-view-model.js"></script>\n'
'<script defer src="assets/approved-wire-view-model.js"></script>\n'
'<script defer src="assets/approved-native-bridge.js"></script>\n'
'<script defer src="assets/approved-native-context-menu.js"></script>\n'
'<script defer src="assets/approved-native-legal.js"></script>\n')
Expand Down Expand Up @@ -368,6 +369,8 @@ def stage(out: Path) -> dict:
out / "assets" / "approved-channel-strip-view-model.js")
shutil.copy2(ROOT / "web" / "approved-fx-rack-view-model.js",
out / "assets" / "approved-fx-rack-view-model.js")
shutil.copy2(ROOT / "web" / "approved-wire-view-model.js",
out / "assets" / "approved-wire-view-model.js")
native = native_html(approved.decode("utf-8")).encode("utf-8")
(out / "index.html").write_bytes(native)
files = [out / "index.html", *sorted(p for p in (out / "assets").rglob("*") if p.is_file())]
Expand Down
3 changes: 2 additions & 1 deletion tests/approved_native_cold_start_smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@ def main():
assert page.evaluate("""()=>Boolean(
window.ArSonApprovedChannelStripViewModel &&
window.ArSonApprovedFxRackViewModel &&
window.ArSonApprovedWireViewModel &&
window.__ARMIX_NATIVE_M2__?.inputChoices &&
window.__ARMIX_NATIVE_M2__?.outputChoices)"""), (
'native assembled GUI missing GUI-1 Channel Strip ViewModel')
'native assembled GUI missing MVVM presentation modules')
io_inventory={
'types':[{'name':'Windows Audio','separate':True,
'inputs':['Studio Mic'],'outputs':['Speakers']}],
Expand Down
6 changes: 6 additions & 0 deletions tests/approved_native_gui_bundle_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,21 @@ def test_native_is_exact_assembled_public_pages_plus_nonvisual_native_seam(self)
self.assertLess(native.index('assets/approved-channel-strip-view-model.js'),
native.index('assets/approved-fx-rack-view-model.js'))
self.assertLess(native.index('assets/approved-fx-rack-view-model.js'),
native.index('assets/approved-wire-view-model.js'))
self.assertLess(native.index('assets/approved-wire-view-model.js'),
native.index('assets/approved-native-bridge.js'))
self.assertNotIn('assets/approved-channel-strip-view-model.js', approved)
self.assertNotIn('assets/approved-fx-rack-view-model.js', approved)
self.assertNotIn('assets/approved-wire-view-model.js', approved)
self.assertEqual(
(out / 'assets/approved-channel-strip-view-model.js').read_bytes(),
(ROOT / 'web/approved-channel-strip-view-model.js').read_bytes())
self.assertEqual(
(out / 'assets/approved-fx-rack-view-model.js').read_bytes(),
(ROOT / 'web/approved-fx-rack-view-model.js').read_bytes())
self.assertEqual(
(out / 'assets/approved-wire-view-model.js').read_bytes(),
(ROOT / 'web/approved-wire-view-model.js').read_bytes())
vm_source = (ROOT / "web/approved-device-view-model.js").read_bytes()
self.assertEqual((out / "assets/approved-device-view-model.js").read_bytes(),
vm_source)
Expand Down
101 changes: 93 additions & 8 deletions tests/approved_native_m2_contract.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const protocol=require("../web/approved-native-contract.js");
const deviceVM=require("../web/approved-device-view-model.js");
const stripVM=require("../web/approved-channel-strip-view-model.js");
const fxRackVM=require("../web/approved-fx-rack-view-model.js");
const wireVM=require("../web/approved-wire-view-model.js");
const read=p=>readFileSync(p,"utf8");
const fixtures=JSON.parse(read("integration/console-v6/fixtures.json"));
const clone=x=>JSON.parse(JSON.stringify(x));
Expand Down Expand Up @@ -74,6 +75,85 @@ test("GUI-2 exact mounted FX instance/power identity rejects stale, duplicate or
assert.doesNotMatch(bridge,/const effective=enabled&&globalEnabled&&!insert\.bypassed/,
"old duplicated FX bypass projection must be removed from DOM bridge");
});
test("GUI-3 WIRE selector keeps exact PRIMARY OUT vs parallel SEND identity, even to MAIN",()=>{
const source="9007199254740993",main="18446744073709551615",bus="9007199254740999";
const primary={edgeId:"9007199254741000",from:source,to:bus,enabled:true,
primaryOutput:true,gainLinear:1,tap:"POST_FADER",sendEnabled:true};
const busOut=wireVM.edgePresentation(primary,bus,main);
assert.equal(busOut.kind,"primary");assert.equal(busOut.mode,"routeOnly");
assert.equal(busOut.levelDb,0);
const mainSend={...primary,edgeId:"9007199254741001",to:main,
primaryOutput:false,gainLinear:.5,sendEnabled:false};
const independent=wireVM.edgePresentation(mainSend,main,main);
assert.equal(independent.kind,"send",
"parallel SEND to MAIN cannot be promoted by matching primaryOutId");
assert.equal(independent.mode,"send");
assert.equal(independent.levelDb,-6);
assert.equal(independent.sendEnabled,false);
assert.equal(wireVM.edgePresentation({...primary,gainLinear:.7},bus,main),null,
"primary OUT is unity; incorrect PCM readback is rejected");
assert.equal(wireVM.edgePresentation(primary,main,main),null,
"stale primary destination must not be repainted as verified");
const old={...primary};delete old.primaryOutput;
assert.equal(wireVM.edgePresentation(old,bus,main).kind,"primary",
"legacy readback without explicit primaryOutput keeps existing fallback");
const split={...mainSend,tap:"SPLIT_PRE",tapStage:"SPLIT_PRE",to:bus};
assert.equal(wireVM.edgePresentation(split,main,main).mode,"splitPre");
const updated={...split,tapStage:"PRE_FADER"};
assert.equal(wireVM.edgePresentation(updated,main,main).nativeTap,"PRE_FADER",
"actual native post-insert PRE_FADER wins over old PRE_FX tap");
assert.equal(wireVM.gainDb(0),-60);
assert.equal(wireVM.gainDb(10),6);
assert.equal(wireVM.gainDb(-1),null);
});
test("GUI-3 WIRE gain/readback and native edit eligibility are fail-closed by exact EdgeId",()=>{
const source="9007199254740993",other="9007199254740994",
edgeId="9223372036854775808",main="18446744073709551615";
const send={edgeId,from:source,to:main,enabled:true,
primaryOutput:false,gainLinear:.5,tap:"POST_FADER"};
const primary={...send,edgeId:"9223372036854775809",primaryOutput:true};
const graph={capabilities:{supportedOps:["SET_WIRE_GAIN","APPLY_WIRE_TRANSACTION",
"SET_SEND_ENABLED"]},edges:[send,primary]};
const snap={admitted:true,retained:false,graph};
const previous=JSON.stringify(snap);
assert.equal(wireVM.acceptedParallelEdge(snap,true,source,edgeId,"SET_WIRE_GAIN"),send);
assert.equal(wireVM.acceptedParallelEdge(snap,true,other,edgeId,"SET_WIRE_GAIN"),null);
assert.equal(wireVM.acceptedParallelEdge(snap,false,source,edgeId,"SET_WIRE_GAIN"),null);
assert.equal(wireVM.acceptedParallelEdge({...snap,retained:true},true,
source,edgeId,"SET_WIRE_GAIN"),null);
assert.equal(wireVM.acceptedParallelEdge({...snap,admitted:false},true,
source,edgeId,"SET_WIRE_GAIN"),null);
assert.equal(wireVM.acceptedParallelEdge(snap,true,source,edgeId,"MISSING_OP"),null);
assert.equal(wireVM.parallelEdge(graph,source,primary.edgeId),null);
assert.equal(wireVM.parallelEdge({...graph,edges:[send,send]},source,edgeId),null);
assert.equal(wireVM.parallelEdge(graph,source,edgeId,other),null);
const mapping=new Map([[edgeId,42],[primary.edgeId,41]]);
const pending=new Map([[edgeId,{requestId:"gain-1"}]]);
const rows=wireVM.gainReadback(graph.edges,mapping,pending);
assert.deepEqual(rows,[{id:42,pending:true,levelDb:-6}]);
assert.deepEqual(wireVM.gainReadback(graph.edges,new Map(),pending),[],
"unknown native EdgeId may never invent a new view-id");
assert.equal(JSON.stringify(snap),previous,"selectors never mutate native snapshot");
assert.equal(wireVM.canEditTap(send,{supported:true}),true);
assert.equal(wireVM.canEditTap(send,{supported:true,pending:true}),false);
assert.equal(wireVM.canEditTap(send,{supported:false}),false);
assert.equal(wireVM.canEditTap({...send,tap:"PRE_FX"},{supported:true}),false);
assert.equal(wireVM.gestureTap("split"),"PRE_FADER");
assert.equal(wireVM.gestureTap("send"),"POST_FADER");
assert.equal(wireVM.gestureTap("routeOnly"),null);
assert.equal(wireVM.sofAvailable(snap,true),true);
assert.equal(wireVM.sofAvailable({...snap,retained:true},true),false);
assert.equal(wireVM.sofAvailable(snap,false),false);
assert.equal(wireVM.sofAvailable({...snap,graph:{...graph,capabilities:{
supportedOps:["SET_WIRE_GAIN"]}}},true),false);
const bridge=read("web/approved-native-bridge.js");
assert.match(bridge,/wireVM\.gainReadback\(/);
assert.match(bridge,/wireVM\.parallelEdge\(/);
assert.match(bridge,/wireVM\.canEditTap\(/);
assert.match(bridge,/wireVM\.sofAvailable\(/);
assert.doesNotMatch(bridge,/const kind=isPrimary\?"primary"/,
"old WIRE presentation policy must be REMOVED, not copied");
});
function acceptedFixture(){
const s=clone(fixtures.g0);
s.device.epoch="18446744073709551610";
Expand Down Expand Up @@ -112,7 +192,8 @@ test("WIRE inspector controls PRIMARY BUS and PARALLEL MAIN by actual EdgeId, wi
const bridge=read("web/approved-native-bridge.js");
const builder=read("scripts/build_approved_native_gui.py");
assert.match(bridge,/function admittedParallelWire\(uiSourceId,uiEdgeId,operation\)/);
assert.match(bridge,/e\.edgeId===edgeId&&e\.from===source&&e\.primaryOutput===false/);
assert.match(bridge,/wireVM\.acceptedParallelEdge\(/);
assert.match(read("web/approved-wire-view-model.js"),/e\.from===sourceId&&e\.edgeId===edgeId&&e\.primaryOutput===false/);
assert.match(builder,/getElementById\('wireWsGainText'\)/);
assert.match(builder,/!row\.pending/);
const renderStart=html.indexOf("function renderWireWsInspector(){");
Expand Down Expand Up @@ -217,7 +298,9 @@ test("native PRE_FADER WIRE inspector uses one exact SET_TAP PCM intent and acce
assert.match(bridge,/function requestNativeTap\(source,edgeId,tap\)/);
assert.match(bridge,/ops\[0\]\.type==="MODE"/);
assert.match(bridge,/op:"SET_TAP",from:source,edgeId,tap/);
assert.match(bridge,/const tap=\["PRE_FADER","POST_FADER"\]\.includes\(edge\.tapStage\)/);
assert.match(bridge,/wireVM\.edgePresentation\(/);
assert.match(read("web/approved-wire-view-model.js"),
/const tap=TAPS\.has\(edge\.tapStage\)\?edge\.tapStage:edge\.tap/);
assert.match(preview,/edge\.nativeTap==='PRE_FADER'\?'PRE FADER'/);
assert.match(preview,/edge\?\.nativeTap==='PRE_FADER'\?'split'/);
assert.match(preview,/native\?'PRE FADER':'Pre FX'/);
Expand Down Expand Up @@ -870,8 +953,10 @@ test("P0 installed ChannelId WIRE capability reaches the GUI",()=>{
assert.match(native,/NATIVE_APPLY_WIRE_TRANSACTION/);
assert.match(projection,/if\(has\("NATIVE_APPLY_WIRE_TRANSACTION"\)\)/);
assert.match(projection,/available\.add\(juce::String\("APPLY_WIRE_TRANSACTION"\)\)/);
assert.match(bridge,/const kind=isPrimary\?"primary"/);
assert.match(bridge,/if \(isPrimary && edge\.gainLinear!==1\)/);
const wire=read("web/approved-wire-view-model.js");
assert.match(bridge,/wireVM\.edgePresentation\(/);
assert.match(wire,/const kind=primary\?"primary"/);
assert.match(wire,/if\(primary&&edge\.gainLinear!==1\)return null/);
assert.doesNotMatch(bridge,/if \(isMain && edge\.gainLinear!==1\)/);
});
test("P0 WIRE-to-MAIN and channel OUT use one acknowledged native transaction",()=>{
Expand Down Expand Up @@ -1314,7 +1399,7 @@ test("M3 native-only Pages scope performs real bridge projection, fader intent a
querySelector:()=>null,addEventListener(){}
};
const window={
__JUCE__:{backend:native},ArSonApprovedNativeContract:protocol,ArSonApprovedDeviceViewModel:deviceVM,ArSonApprovedChannelStripViewModel:stripVM,ArSonApprovedFxRackViewModel:fxRackVM,
__JUCE__:{backend:native},ArSonApprovedNativeContract:protocol,ArSonApprovedDeviceViewModel:deviceVM,ArSonApprovedChannelStripViewModel:stripVM,ArSonApprovedFxRackViewModel:fxRackVM,ArSonApprovedWireViewModel:wireVM,
__ARMIX_NATIVE_SCOPE__:scope,addEventListener(){},queueMicrotask(fn){microtasks.push(fn);},setTimeout(fn,ms){timers.push({fn,ms});return timers.length;}
};
vm.runInNewContext(read("web/approved-native-bridge.js"),{
Expand Down Expand Up @@ -1538,7 +1623,7 @@ test("P0 native FX rack and per-slot readback update mounted strip without repla
querySelector:selector=>selector.startsWith('.strip[data-id=')?strip:null,
addEventListener(){}
};
const win={__JUCE__:{backend:native},ArSonApprovedNativeContract:protocol,ArSonApprovedDeviceViewModel:deviceVM,ArSonApprovedChannelStripViewModel:stripVM,ArSonApprovedFxRackViewModel:fxRackVM,
const win={__JUCE__:{backend:native},ArSonApprovedNativeContract:protocol,ArSonApprovedDeviceViewModel:deviceVM,ArSonApprovedChannelStripViewModel:stripVM,ArSonApprovedFxRackViewModel:fxRackVM,ArSonApprovedWireViewModel:wireVM,
__ARMIX_NATIVE_SCOPE__:scope,addEventListener(){},
setTimeout(){return 0},clearTimeout(){},queueMicrotask(fn){fn();}};
vm.runInNewContext(read("web/approved-native-bridge.js"),
Expand Down Expand Up @@ -1716,7 +1801,7 @@ test("P0 FIRST SOUND G0 offers verified input and leaves automatic MAIN to nativ
addEventListener(){}
};
win={
__JUCE__:{backend},ArSonApprovedNativeContract:protocol,ArSonApprovedDeviceViewModel:deviceVM,ArSonApprovedChannelStripViewModel:stripVM,ArSonApprovedFxRackViewModel:fxRackVM,
__JUCE__:{backend},ArSonApprovedNativeContract:protocol,ArSonApprovedDeviceViewModel:deviceVM,ArSonApprovedChannelStripViewModel:stripVM,ArSonApprovedFxRackViewModel:fxRackVM,ArSonApprovedWireViewModel:wireVM,
__ARMIX_NATIVE_SCOPE__:scope,addEventListener(){},
setTimeout(){return 0},clearTimeout(){},queueMicrotask(fn){fn();}
};
Expand Down Expand Up @@ -1803,7 +1888,7 @@ test("P0 native hardware IN remains selectable after ChannelId ownership, failed
id==="preview"?{disabled:true}:null,
querySelector:()=>null,addEventListener(){}
};
const win={__JUCE__:{backend},ArSonApprovedNativeContract:protocol,ArSonApprovedDeviceViewModel:deviceVM,ArSonApprovedChannelStripViewModel:stripVM,ArSonApprovedFxRackViewModel:fxRackVM,
const win={__JUCE__:{backend},ArSonApprovedNativeContract:protocol,ArSonApprovedDeviceViewModel:deviceVM,ArSonApprovedChannelStripViewModel:stripVM,ArSonApprovedFxRackViewModel:fxRackVM,ArSonApprovedWireViewModel:wireVM,
__ARMIX_NATIVE_SCOPE__:scope,addEventListener(){},
setTimeout(){return 0},clearTimeout(){},
queueMicrotask(fn){microtasks.push(fn);}};
Expand Down
3 changes: 2 additions & 1 deletion tests/live_fader_held_drag.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const protocol=require("../web/approved-native-contract.js");
const deviceVM=require("../web/approved-device-view-model.js");
const stripVM=require("../web/approved-channel-strip-view-model.js");
const fxRackVM=require("../web/approved-fx-rack-view-model.js");
const wireVM=require("../web/approved-wire-view-model.js");
const read=p=>readFileSync(p,"utf8");
const clone=x=>JSON.parse(JSON.stringify(x));
const fixture=JSON.parse(read("integration/console-v6/fixtures.json")).g0;
Expand Down Expand Up @@ -79,7 +80,7 @@ function harness({m4=false}={}){
};
const window={
__JUCE__:{backend},ArSonApprovedNativeContract:protocol,ArSonApprovedDeviceViewModel:deviceVM,
ArSonApprovedChannelStripViewModel:stripVM,ArSonApprovedFxRackViewModel:fxRackVM,
ArSonApprovedChannelStripViewModel:stripVM,ArSonApprovedFxRackViewModel:fxRackVM,ArSonApprovedWireViewModel:wireVM,
__ARMIX_NATIVE_SCOPE__:scope,addEventListener(){},
setTimeout(fn,delay=0){timers.push({fn,at:now+Math.max(0,Number(delay)||0)});return timers.length;}
};
Expand Down
Loading
Loading