Adaptive Music v0.8.3 multiplayer and floating music controls
Validate and generate manual release / package (push) Waiting to run
Validate and generate manual release / package (push) Waiting to run
This commit is contained in:
1 parent
acc8cbafc6
commit
fbc265b526
33 files changed
+1673
-131
No files matched your search
@@ -41,6 +41,72 @@ test('manual MA controls wait for the scene transition and carry the current fen
|
||||
await assert.rejects(obsolete,{code:'stale'});
|
||||
assert.equal(log.length,3);
|
||||
});
|
||||
test('campaign pause holds an attached MA queue and resumes it in place', async () => {
|
||||
const {controller,provider,log}=fixture();
|
||||
controller.providers.ma=provider;
|
||||
provider.playbackStatus=async()=>({state:'playing'});
|
||||
provider.control=async(action,value,ctx)=>{ctx.check();log.push([action]);};
|
||||
await controller.pauseCampaign({attachedMA:true});
|
||||
assert.equal(controller.campaignPaused,true);
|
||||
await assert.rejects(controller.control('next'),{code:'campaign-paused'});
|
||||
await controller.resumeCampaign(()=>undefined);
|
||||
assert.equal(controller.campaignPaused,false);
|
||||
assert.deepEqual(log,[['pause'],['resume']]);
|
||||
});
|
||||
test('campaign pause covers an attached MA queue alongside an owned native fallback', async () => {
|
||||
const {controller,provider,log}=fixture();
|
||||
const state={scene:scene()};
|
||||
controller.providers.ma={
|
||||
snapshot:provider.snapshot,
|
||||
playbackStatus:async()=>({state:'playing'}),
|
||||
control:async(action,value,ctx)=>{ctx.check();log.push([action]);},
|
||||
};
|
||||
await controller.update(state);
|
||||
await controller.pauseCampaign({attachedMA:true});
|
||||
await controller.resumeCampaign(()=>state);
|
||||
assert.deepEqual(log.map(([action])=>action),['resolve','apply','stop','pause','restore','resume']);
|
||||
});
|
||||
test('campaign pause defers cue changes and keeps the pre-pause ambient position', async () => {
|
||||
const f=fixture(), c=f.controller;
|
||||
const base={scene:scene()}, combatState={...base,combats:[combat()]};
|
||||
await c.update(base);
|
||||
f.playback={...f.playback,offset:31};
|
||||
await c.pauseCampaign();
|
||||
assert.equal(c.campaignPaused,true);
|
||||
await c.update(combatState);
|
||||
assert.equal(c.current.mode,'ambient');
|
||||
assert.deepEqual(f.log,[['resolve','A'],['apply','A'],['stop']]);
|
||||
await c.resumeCampaign(()=>combatState);
|
||||
assert.equal(c.current.mode,'combat');
|
||||
assert.deepEqual(f.log.slice(3),[['resolve','combat'],['apply','combat']]);
|
||||
await c.update(base);
|
||||
assert.equal(f.playback.offset,31);
|
||||
assert.equal(f.playback.paused,false);
|
||||
});
|
||||
test('a failed next cue leaves the campaign on hold until Play is retried', async () => {
|
||||
const f=fixture(), c=f.controller;
|
||||
const current={scene:scene()}, other={scene:scene('B')};
|
||||
await c.update(current);
|
||||
await c.pauseCampaign();
|
||||
const apply=f.provider.apply;
|
||||
f.provider.apply=async()=>{throw new MusicError('unavailable');};
|
||||
await assert.rejects(c.resumeCampaign(()=>other),{code:'unavailable'});
|
||||
assert.equal(c.campaignPaused,true);
|
||||
assert.equal(c.current.mode,'ambient');
|
||||
assert.equal(f.log.some(([action])=>action==='restore'),false);
|
||||
f.provider.apply=apply;
|
||||
await c.resumeCampaign(()=>other);
|
||||
assert.equal(c.campaignPaused,false);
|
||||
assert.deepEqual(f.playback.items,['B']);
|
||||
});
|
||||
test('a campaign pause queued before runtime disposal cannot issue a write', async () => {
|
||||
const {controller,provider,log}=fixture();
|
||||
controller.providers.ma=provider;
|
||||
const pending=controller.pauseCampaign({attachedMA:true});
|
||||
controller.cancel();
|
||||
await assert.rejects(pending,{code:'stale'});
|
||||
assert.deepEqual(log,[]);
|
||||
});
|
||||
test('inactive, unstarted and other scene combats ignored; boss ties stable', () => {
|
||||
for (const change of [{active:false},{started:false},{sceneId:'B'}]) {
|
||||
assert.equal(candidates({scene:scene(),combats:[{...combat([boss()]),...change}]})[0].playlist.id,'A');
|
||||
|
||||
Reference in new issue
Block a user