mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-06-02 08:33:56 -04:00
Create a new addTarget
function on the runtime which populates the targets list as well as the executable targets list.
This commit is contained in:
parent
fbee37e915
commit
59a865ef47
7 changed files with 21 additions and 24 deletions
test
|
@ -193,8 +193,7 @@ test('edge activated hat should trigger for both sprites when sprite is cloned',
|
|||
t.equal(numTargetEdgeHats, 1);
|
||||
|
||||
const cloneTarget = vm.runtime.targets[1].makeClone();
|
||||
vm.runtime.targets.push(cloneTarget);
|
||||
vm.runtime.addExecutable(cloneTarget);
|
||||
vm.runtime.addTarget(cloneTarget);
|
||||
|
||||
vm.runtime._step();
|
||||
// Check that the runtime's _edgeActivatedHatValues object has two separate keys
|
||||
|
|
|
@ -54,9 +54,8 @@ test('#760 - broadcastAndWait', t => {
|
|||
const tgt = new Target(rt, b);
|
||||
tgt.isStage = true;
|
||||
tgt.createVariable('testBroadcastID', 'message', Variable.BROADCAST_MESSAGE_TYPE);
|
||||
// Need to add to both runtime.targets as well as runtime.executableTargets here
|
||||
rt.targets.push(tgt);
|
||||
rt.executableTargets.push(tgt);
|
||||
|
||||
rt.addTarget(tgt);
|
||||
|
||||
let th = rt._pushThread('broadcastAndWaitBlock', t);
|
||||
const util = new BlockUtility();
|
||||
|
|
|
@ -48,7 +48,7 @@ const testCostume = (costumes, arg, currentCostume = 1, isStage = false) => {
|
|||
|
||||
if (isStage) {
|
||||
target.isStage = true;
|
||||
rt.targets.push(target);
|
||||
rt.addTarget(target);
|
||||
looks.switchBackdrop({BACKDROP: arg}, {target});
|
||||
} else {
|
||||
looks.switchCostume({COSTUME: arg}, {target});
|
||||
|
|
|
@ -188,7 +188,7 @@ test('renameVariable calls cloud io device\'s requestRenameVariable function', t
|
|||
target.isStage = true;
|
||||
const mockCloudVar = new Variable('foo', 'bar', Variable.SCALAR_TYPE, true);
|
||||
target.variables[mockCloudVar.id] = mockCloudVar;
|
||||
runtime.targets.push(target);
|
||||
runtime.addTarget(target);
|
||||
|
||||
target.renameVariable('foo', 'bar2');
|
||||
|
||||
|
@ -215,7 +215,7 @@ test('renameVariable does not call cloud io device\'s requestRenameVariable func
|
|||
const target = new Target(runtime);
|
||||
const mockCloudVar = new Variable('foo', 'bar', Variable.SCALAR_TYPE, true);
|
||||
target.variables[mockCloudVar.id] = mockCloudVar;
|
||||
runtime.targets.push(target);
|
||||
runtime.addTarget(target);
|
||||
|
||||
target.renameVariable('foo', 'bar2');
|
||||
|
||||
|
@ -266,7 +266,7 @@ test('deleteVariable calls cloud io device\'s requestRenameVariable function', t
|
|||
target.isStage = true;
|
||||
const mockCloudVar = new Variable('foo', 'bar', Variable.SCALAR_TYPE, true);
|
||||
target.variables[mockCloudVar.id] = mockCloudVar;
|
||||
runtime.targets.push(target);
|
||||
runtime.addTarget(target);
|
||||
|
||||
target.deleteVariable('foo');
|
||||
|
||||
|
@ -288,7 +288,7 @@ test('deleteVariable calls cloud io device\'s requestRenameVariable function', t
|
|||
const target = new Target(runtime);
|
||||
const mockCloudVar = new Variable('foo', 'bar', Variable.SCALAR_TYPE, true);
|
||||
target.variables[mockCloudVar.id] = mockCloudVar;
|
||||
runtime.targets.push(target);
|
||||
runtime.addTarget(target);
|
||||
|
||||
target.deleteVariable('foo');
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue