mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-22 22:12:28 -05:00
Build out integration test SB2 files
This commit is contained in:
parent
b8af7c0723
commit
dfc6614a5b
16 changed files with 122 additions and 304 deletions
|
@ -24,6 +24,7 @@
|
||||||
"version": "./node_modules/.bin/json -f package.json -I -e \"this.repository.sha = '$(git log -n1 --pretty=format:%H)'\""
|
"version": "./node_modules/.bin/json -f package.json -I -e \"this.repository.sha = '$(git log -n1 --pretty=format:%H)'\""
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"adm-zip": "0.4.7",
|
||||||
"babel-eslint": "7.0.0",
|
"babel-eslint": "7.0.0",
|
||||||
"copy-webpack-plugin": "3.0.1",
|
"copy-webpack-plugin": "3.0.1",
|
||||||
"eslint": "3.8.1",
|
"eslint": "3.8.1",
|
||||||
|
|
BIN
test/fixtures/control.sb2
vendored
Normal file
BIN
test/fixtures/control.sb2
vendored
Normal file
Binary file not shown.
BIN
test/fixtures/data.sb2
vendored
Normal file
BIN
test/fixtures/data.sb2
vendored
Normal file
Binary file not shown.
BIN
test/fixtures/default.sb2
vendored
Normal file
BIN
test/fixtures/default.sb2
vendored
Normal file
Binary file not shown.
BIN
test/fixtures/event.sb2
vendored
Normal file
BIN
test/fixtures/event.sb2
vendored
Normal file
Binary file not shown.
6
test/fixtures/extract.js
vendored
Normal file
6
test/fixtures/extract.js
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
var AdmZip = require('adm-zip');
|
||||||
|
|
||||||
|
module.exports = function (path) {
|
||||||
|
var zip = new AdmZip(path);
|
||||||
|
return zip.readAsText('project.json', 'utf8');
|
||||||
|
};
|
BIN
test/fixtures/looks.sb2
vendored
Normal file
BIN
test/fixtures/looks.sb2
vendored
Normal file
Binary file not shown.
BIN
test/fixtures/motion.sb2
vendored
Normal file
BIN
test/fixtures/motion.sb2
vendored
Normal file
Binary file not shown.
71
test/fixtures/project_default.json
vendored
71
test/fixtures/project_default.json
vendored
|
@ -1,71 +0,0 @@
|
||||||
{
|
|
||||||
"objName": "Stage",
|
|
||||||
"sounds": [{
|
|
||||||
"soundName": "pop",
|
|
||||||
"soundID": -1,
|
|
||||||
"md5": "83a9787d4cb6f3b7632b4ddfebf74367.wav",
|
|
||||||
"sampleCount": 258,
|
|
||||||
"rate": 11025,
|
|
||||||
"format": ""
|
|
||||||
}],
|
|
||||||
"costumes": [{
|
|
||||||
"costumeName": "backdrop1",
|
|
||||||
"baseLayerID": -1,
|
|
||||||
"baseLayerMD5": "739b5e2a2435f6e1ec2993791b423146.png",
|
|
||||||
"bitmapResolution": 1,
|
|
||||||
"rotationCenterX": 240,
|
|
||||||
"rotationCenterY": 180
|
|
||||||
}],
|
|
||||||
"currentCostumeIndex": 0,
|
|
||||||
"penLayerMD5": "5c81a336fab8be57adc039a8a2b33ca9.png",
|
|
||||||
"penLayerID": -1,
|
|
||||||
"tempoBPM": 60,
|
|
||||||
"videoAlpha": 0.5,
|
|
||||||
"children": [{
|
|
||||||
"objName": "Sprite1",
|
|
||||||
"sounds": [{
|
|
||||||
"soundName": "meow",
|
|
||||||
"soundID": -1,
|
|
||||||
"md5": "83c36d806dc92327b9e7049a565c6bff.wav",
|
|
||||||
"sampleCount": 18688,
|
|
||||||
"rate": 22050,
|
|
||||||
"format": ""
|
|
||||||
}],
|
|
||||||
"costumes": [{
|
|
||||||
"costumeName": "costume1",
|
|
||||||
"baseLayerID": -1,
|
|
||||||
"baseLayerMD5": "09dc888b0b7df19f70d81588ae73420e.svg",
|
|
||||||
"bitmapResolution": 1,
|
|
||||||
"rotationCenterX": 47,
|
|
||||||
"rotationCenterY": 55
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"costumeName": "costume2",
|
|
||||||
"baseLayerID": -1,
|
|
||||||
"baseLayerMD5": "3696356a03a8d938318876a593572843.svg",
|
|
||||||
"bitmapResolution": 1,
|
|
||||||
"rotationCenterX": 47,
|
|
||||||
"rotationCenterY": 55
|
|
||||||
}],
|
|
||||||
"currentCostumeIndex": 0,
|
|
||||||
"scratchX": 0,
|
|
||||||
"scratchY": 0,
|
|
||||||
"scale": 1,
|
|
||||||
"direction": 90,
|
|
||||||
"rotationStyle": "normal",
|
|
||||||
"isDraggable": false,
|
|
||||||
"indexInLibrary": 1,
|
|
||||||
"visible": true,
|
|
||||||
"spriteInfo": {
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
"info": {
|
|
||||||
"videoOn": false,
|
|
||||||
"userAgent": "Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/50.0.2661.102 Safari\/537.36",
|
|
||||||
"swfVersion": "v446",
|
|
||||||
"scriptCount": 0,
|
|
||||||
"spriteCount": 1,
|
|
||||||
"hasCloudData": false,
|
|
||||||
"flashVersion": "MAC 21,0,0,242"
|
|
||||||
}
|
|
||||||
}
|
|
186
test/fixtures/project_demo.json
vendored
186
test/fixtures/project_demo.json
vendored
|
@ -1,186 +0,0 @@
|
||||||
{
|
|
||||||
"objName": "Stage",
|
|
||||||
"variables": [{
|
|
||||||
"name": "foo",
|
|
||||||
"value": 119,
|
|
||||||
"isPersistent": false
|
|
||||||
}],
|
|
||||||
"lists": [{
|
|
||||||
"listName": "bar",
|
|
||||||
"contents": [116, 3, 279, 245, 203, 331, 9, 36, 152, 60],
|
|
||||||
"isPersistent": false,
|
|
||||||
"x": 5,
|
|
||||||
"y": 32,
|
|
||||||
"width": 102,
|
|
||||||
"height": 202,
|
|
||||||
"visible": true
|
|
||||||
}],
|
|
||||||
"sounds": [{
|
|
||||||
"soundName": "pop",
|
|
||||||
"soundID": 1,
|
|
||||||
"md5": "83a9787d4cb6f3b7632b4ddfebf74367.wav",
|
|
||||||
"sampleCount": 258,
|
|
||||||
"rate": 11025,
|
|
||||||
"format": ""
|
|
||||||
}],
|
|
||||||
"costumes": [{
|
|
||||||
"costumeName": "backdrop1",
|
|
||||||
"baseLayerID": 5,
|
|
||||||
"baseLayerMD5": "739b5e2a2435f6e1ec2993791b423146.png",
|
|
||||||
"bitmapResolution": 1,
|
|
||||||
"rotationCenterX": 240,
|
|
||||||
"rotationCenterY": 180
|
|
||||||
}],
|
|
||||||
"currentCostumeIndex": 0,
|
|
||||||
"penLayerMD5": "5c81a336fab8be57adc039a8a2b33ca9.png",
|
|
||||||
"penLayerID": 0,
|
|
||||||
"tempoBPM": 60,
|
|
||||||
"videoAlpha": 0.5,
|
|
||||||
"children": [{
|
|
||||||
"objName": "Sprite1",
|
|
||||||
"scripts": [[30,
|
|
||||||
29,
|
|
||||||
[["whenGreenFlag"],
|
|
||||||
["doRepeat", 10, [["createCloneOf", "_myself_"]]],
|
|
||||||
["wait:elapsed:from:", 0.01],
|
|
||||||
["doWaitUntil", ["=", "1", ["randomFrom:to:", 1, 2]]],
|
|
||||||
["doForever", [["turnRight:", 15], ["changeGraphicEffect:by:", "color", 10]]]]],
|
|
||||||
[30,
|
|
||||||
275,
|
|
||||||
[["whenCloned"],
|
|
||||||
["append:toList:", ["randomFrom:to:", 0, 360], "bar"],
|
|
||||||
["heading:", ["getLine:ofList:", ["lineCountOfList:", "bar"], "bar"]],
|
|
||||||
["doForever",
|
|
||||||
[["forward:", ["readVariable", "foo"]],
|
|
||||||
["bounceOffEdge"],
|
|
||||||
["doIf", ["touching:", "_edge_"], [["changeGraphicEffect:by:", "color", 25]]]]]]],
|
|
||||||
[322,
|
|
||||||
23,
|
|
||||||
[["whenGreenFlag"], ["setVar:to:", "foo", 0], ["doForever", [["changeVar:by:", "foo", 1]]]]]],
|
|
||||||
"sounds": [{
|
|
||||||
"soundName": "meow",
|
|
||||||
"soundID": 0,
|
|
||||||
"md5": "83c36d806dc92327b9e7049a565c6bff.wav",
|
|
||||||
"sampleCount": 18688,
|
|
||||||
"rate": 22050,
|
|
||||||
"format": ""
|
|
||||||
}],
|
|
||||||
"costumes": [{
|
|
||||||
"costumeName": "costume1",
|
|
||||||
"baseLayerID": 1,
|
|
||||||
"baseLayerMD5": "f9a1c175dbe2e5dee472858dd30d16bb.svg",
|
|
||||||
"bitmapResolution": 1,
|
|
||||||
"rotationCenterX": 47,
|
|
||||||
"rotationCenterY": 55
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"costumeName": "costume2",
|
|
||||||
"baseLayerID": 2,
|
|
||||||
"baseLayerMD5": "6e8bd9ae68fdb02b7e1e3df656a75635.svg",
|
|
||||||
"bitmapResolution": 1,
|
|
||||||
"rotationCenterX": 47,
|
|
||||||
"rotationCenterY": 55
|
|
||||||
}],
|
|
||||||
"currentCostumeIndex": 0,
|
|
||||||
"scratchX": 0,
|
|
||||||
"scratchY": 0,
|
|
||||||
"scale": 1,
|
|
||||||
"direction": -30,
|
|
||||||
"rotationStyle": "normal",
|
|
||||||
"isDraggable": false,
|
|
||||||
"indexInLibrary": 1,
|
|
||||||
"visible": true,
|
|
||||||
"spriteInfo": {
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"target": "Stage",
|
|
||||||
"cmd": "getVar:",
|
|
||||||
"param": "foo",
|
|
||||||
"color": 15629590,
|
|
||||||
"label": "foo",
|
|
||||||
"mode": 1,
|
|
||||||
"sliderMin": 0,
|
|
||||||
"sliderMax": 100,
|
|
||||||
"isDiscrete": true,
|
|
||||||
"x": 5,
|
|
||||||
"y": 5,
|
|
||||||
"visible": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"objName": "Apple",
|
|
||||||
"scripts": [[52,
|
|
||||||
27,
|
|
||||||
[["whenGreenFlag"], ["doRepeat", 10, [["turnRight:", 15], ["broadcast:", "message1"]]]]]],
|
|
||||||
"sounds": [{
|
|
||||||
"soundName": "pop",
|
|
||||||
"soundID": 1,
|
|
||||||
"md5": "83a9787d4cb6f3b7632b4ddfebf74367.wav",
|
|
||||||
"sampleCount": 258,
|
|
||||||
"rate": 11025,
|
|
||||||
"format": ""
|
|
||||||
}],
|
|
||||||
"costumes": [{
|
|
||||||
"costumeName": "apple",
|
|
||||||
"baseLayerID": 3,
|
|
||||||
"baseLayerMD5": "831ccd4741a7a56d85f6698a21f4ca69.svg",
|
|
||||||
"bitmapResolution": 1,
|
|
||||||
"rotationCenterX": 31,
|
|
||||||
"rotationCenterY": 31
|
|
||||||
}],
|
|
||||||
"currentCostumeIndex": 0,
|
|
||||||
"scratchX": 135,
|
|
||||||
"scratchY": 9,
|
|
||||||
"scale": 1,
|
|
||||||
"direction": 180,
|
|
||||||
"rotationStyle": "normal",
|
|
||||||
"isDraggable": false,
|
|
||||||
"indexInLibrary": 2,
|
|
||||||
"visible": true,
|
|
||||||
"spriteInfo": {
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"objName": "Bananas",
|
|
||||||
"scripts": [[53,
|
|
||||||
33,
|
|
||||||
[["whenIReceive", "message1"], ["doForever", [["turnRight:", ["readVariable", "foo"]]]]]]],
|
|
||||||
"costumes": [{
|
|
||||||
"costumeName": "bananas",
|
|
||||||
"baseLayerID": 4,
|
|
||||||
"baseLayerMD5": "40bb8a1afe88cec78254f6fcfee98242.svg",
|
|
||||||
"bitmapResolution": 1,
|
|
||||||
"rotationCenterX": 36,
|
|
||||||
"rotationCenterY": 37
|
|
||||||
}],
|
|
||||||
"currentCostumeIndex": 0,
|
|
||||||
"scratchX": -151,
|
|
||||||
"scratchY": 13,
|
|
||||||
"scale": 1,
|
|
||||||
"direction": -59,
|
|
||||||
"rotationStyle": "normal",
|
|
||||||
"isDraggable": false,
|
|
||||||
"indexInLibrary": 3,
|
|
||||||
"visible": true,
|
|
||||||
"spriteInfo": {
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"listName": "bar",
|
|
||||||
"contents": [116, 3, 279, 245, 203, 331, 9, 36, 152, 60],
|
|
||||||
"isPersistent": false,
|
|
||||||
"x": 5,
|
|
||||||
"y": 32,
|
|
||||||
"width": 102,
|
|
||||||
"height": 202,
|
|
||||||
"visible": true
|
|
||||||
}],
|
|
||||||
"info": {
|
|
||||||
"spriteCount": 3,
|
|
||||||
"flashVersion": "MAC 21,0,0,174",
|
|
||||||
"swfVersion": "v445.1",
|
|
||||||
"videoOn": false,
|
|
||||||
"userAgent": "Scratch 2.0 Offline Editor",
|
|
||||||
"scriptCount": 5
|
|
||||||
}
|
|
||||||
}
|
|
34
test/integration/control.js
Normal file
34
test/integration/control.js
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
var test = require('tap').test;
|
||||||
|
var extract = require('../fixtures/extract');
|
||||||
|
var VirtualMachine = require('../../src/index');
|
||||||
|
|
||||||
|
var path = __dirname + '/../fixtures/control.sb2';
|
||||||
|
var project = extract(path);
|
||||||
|
|
||||||
|
test('control project', function (t) {
|
||||||
|
var vm = new VirtualMachine();
|
||||||
|
|
||||||
|
// Evaluate playground data and exit
|
||||||
|
vm.on('playgroundData', function (e) {
|
||||||
|
var threads = JSON.parse(e.threads);
|
||||||
|
t.ok(threads.length > 0);
|
||||||
|
t.end();
|
||||||
|
process.nextTick(process.exit);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Start VM, load project, and run
|
||||||
|
t.doesNotThrow(function () {
|
||||||
|
vm.start();
|
||||||
|
vm.clear();
|
||||||
|
vm.setCompatibilityMode(false);
|
||||||
|
vm.setTurboMode(false);
|
||||||
|
vm.loadProject(project);
|
||||||
|
vm.greenFlag();
|
||||||
|
});
|
||||||
|
|
||||||
|
// After two seconds, get playground data and stop
|
||||||
|
setTimeout(function () {
|
||||||
|
vm.getPlaygroundData();
|
||||||
|
vm.stopAll();
|
||||||
|
}, 2000);
|
||||||
|
});
|
33
test/integration/data.js
Normal file
33
test/integration/data.js
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
var test = require('tap').test;
|
||||||
|
var extract = require('../fixtures/extract');
|
||||||
|
var VirtualMachine = require('../../src/index');
|
||||||
|
|
||||||
|
var path = __dirname + '/../fixtures/data.sb2';
|
||||||
|
var project = extract(path);
|
||||||
|
|
||||||
|
test('data project', function (t) {
|
||||||
|
var vm = new VirtualMachine();
|
||||||
|
|
||||||
|
// Evaluate playground data and exit
|
||||||
|
vm.on('playgroundData', function () {
|
||||||
|
// @todo Additional tests
|
||||||
|
t.end();
|
||||||
|
process.nextTick(process.exit);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Start VM, load project, and run
|
||||||
|
t.doesNotThrow(function () {
|
||||||
|
vm.start();
|
||||||
|
vm.clear();
|
||||||
|
vm.setCompatibilityMode(false);
|
||||||
|
vm.setTurboMode(false);
|
||||||
|
vm.loadProject(project);
|
||||||
|
vm.greenFlag();
|
||||||
|
});
|
||||||
|
|
||||||
|
// After two seconds, get playground data and stop
|
||||||
|
setTimeout(function () {
|
||||||
|
vm.getPlaygroundData();
|
||||||
|
vm.stopAll();
|
||||||
|
}, 2000);
|
||||||
|
});
|
|
@ -1,9 +1,11 @@
|
||||||
var test = require('tap').test;
|
var test = require('tap').test;
|
||||||
|
var extract = require('../fixtures/extract');
|
||||||
var VirtualMachine = require('../../src/index');
|
var VirtualMachine = require('../../src/index');
|
||||||
|
|
||||||
var project = require('../fixtures/project_demo.json');
|
var path = __dirname + '/../fixtures/event.sb2';
|
||||||
|
var project = extract(path);
|
||||||
|
|
||||||
test('demo project', function (t) {
|
test('event project', function (t) {
|
||||||
var vm = new VirtualMachine();
|
var vm = new VirtualMachine();
|
||||||
|
|
||||||
// Evaluate playground data and exit
|
// Evaluate playground data and exit
|
||||||
|
@ -20,7 +22,7 @@ test('demo project', function (t) {
|
||||||
vm.clear();
|
vm.clear();
|
||||||
vm.setCompatibilityMode(false);
|
vm.setCompatibilityMode(false);
|
||||||
vm.setTurboMode(false);
|
vm.setTurboMode(false);
|
||||||
vm.loadProject(JSON.stringify(project));
|
vm.loadProject(project);
|
||||||
vm.greenFlag();
|
vm.greenFlag();
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
var test = require('tap').test;
|
var test = require('tap').test;
|
||||||
|
var extract = require('../fixtures/extract');
|
||||||
var VirtualMachine = require('../../src/index');
|
var VirtualMachine = require('../../src/index');
|
||||||
|
|
||||||
var project = require('../fixtures/project_default.json');
|
var path = __dirname + '/../fixtures/looks.sb2';
|
||||||
|
var project = extract(path);
|
||||||
|
|
||||||
test('default project', function (t) {
|
test('looks project', function (t) {
|
||||||
var vm = new VirtualMachine();
|
var vm = new VirtualMachine();
|
||||||
|
|
||||||
// Evaluate playground data and exit
|
// Evaluate playground data and exit
|
||||||
vm.on('playgroundData', function (e) {
|
vm.on('playgroundData', function (e) {
|
||||||
var threads = JSON.parse(e.threads);
|
var threads = JSON.parse(e.threads);
|
||||||
t.ok(threads.length == 0);
|
t.ok(threads.length === 0);
|
||||||
t.end();
|
t.end();
|
||||||
process.nextTick(process.exit);
|
process.nextTick(process.exit);
|
||||||
});
|
});
|
||||||
|
@ -20,7 +22,7 @@ test('default project', function (t) {
|
||||||
vm.clear();
|
vm.clear();
|
||||||
vm.setCompatibilityMode(false);
|
vm.setCompatibilityMode(false);
|
||||||
vm.setTurboMode(false);
|
vm.setTurboMode(false);
|
||||||
vm.loadProject(JSON.stringify(project));
|
vm.loadProject(project);
|
||||||
vm.greenFlag();
|
vm.greenFlag();
|
||||||
});
|
});
|
||||||
|
|
34
test/integration/motion.js
Normal file
34
test/integration/motion.js
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
var test = require('tap').test;
|
||||||
|
var extract = require('../fixtures/extract');
|
||||||
|
var VirtualMachine = require('../../src/index');
|
||||||
|
|
||||||
|
var path = __dirname + '/../fixtures/motion.sb2';
|
||||||
|
var project = extract(path);
|
||||||
|
|
||||||
|
test('motion project', function (t) {
|
||||||
|
var vm = new VirtualMachine();
|
||||||
|
|
||||||
|
// Evaluate playground data and exit
|
||||||
|
vm.on('playgroundData', function (e) {
|
||||||
|
var threads = JSON.parse(e.threads);
|
||||||
|
t.ok(threads.length === 0);
|
||||||
|
t.end();
|
||||||
|
process.nextTick(process.exit);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Start VM, load project, and run
|
||||||
|
t.doesNotThrow(function () {
|
||||||
|
vm.start();
|
||||||
|
vm.clear();
|
||||||
|
vm.setCompatibilityMode(false);
|
||||||
|
vm.setTurboMode(false);
|
||||||
|
vm.loadProject(project);
|
||||||
|
vm.greenFlag();
|
||||||
|
});
|
||||||
|
|
||||||
|
// After two seconds, get playground data and stop
|
||||||
|
setTimeout(function () {
|
||||||
|
vm.getPlaygroundData();
|
||||||
|
vm.stopAll();
|
||||||
|
}, 2000);
|
||||||
|
});
|
|
@ -1,6 +1,7 @@
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var test = require('tap').test;
|
var test = require('tap').test;
|
||||||
|
var extract = require('../fixtures/extract');
|
||||||
|
|
||||||
var renderedTarget = require('../../src/sprites/rendered-target');
|
var renderedTarget = require('../../src/sprites/rendered-target');
|
||||||
var runtime = require('../../src/engine/runtime');
|
var runtime = require('../../src/engine/runtime');
|
||||||
|
@ -13,46 +14,8 @@ test('spec', function (t) {
|
||||||
|
|
||||||
test('default', function (t) {
|
test('default', function (t) {
|
||||||
// Get SB2 JSON (string)
|
// Get SB2 JSON (string)
|
||||||
var uri = path.resolve(__dirname, '../fixtures/project_default.json');
|
var uri = path.resolve(__dirname, '../fixtures/default.sb2');
|
||||||
var file = fs.readFileSync(uri, 'utf8');
|
var file = extract(uri);
|
||||||
|
|
||||||
// Create runtime instance & load SB2 into it
|
|
||||||
var rt = new runtime();
|
|
||||||
sb2(file, rt);
|
|
||||||
|
|
||||||
// Test
|
|
||||||
t.type(file, 'string');
|
|
||||||
t.type(rt, 'object');
|
|
||||||
t.type(rt.targets, 'object');
|
|
||||||
|
|
||||||
t.ok(rt.targets[0] instanceof renderedTarget);
|
|
||||||
t.type(rt.targets[0].id, 'string');
|
|
||||||
t.type(rt.targets[0].blocks, 'object');
|
|
||||||
t.type(rt.targets[0].variables, 'object');
|
|
||||||
t.type(rt.targets[0].lists, 'object');
|
|
||||||
|
|
||||||
t.equal(rt.targets[0].isOriginal, true);
|
|
||||||
t.equal(rt.targets[0].currentCostume, 0);
|
|
||||||
t.equal(rt.targets[0].isOriginal, true);
|
|
||||||
t.equal(rt.targets[0].isStage, true);
|
|
||||||
|
|
||||||
t.ok(rt.targets[1] instanceof renderedTarget);
|
|
||||||
t.type(rt.targets[1].id, 'string');
|
|
||||||
t.type(rt.targets[1].blocks, 'object');
|
|
||||||
t.type(rt.targets[1].variables, 'object');
|
|
||||||
t.type(rt.targets[1].lists, 'object');
|
|
||||||
|
|
||||||
t.equal(rt.targets[1].isOriginal, true);
|
|
||||||
t.equal(rt.targets[1].currentCostume, 0);
|
|
||||||
t.equal(rt.targets[1].isOriginal, true);
|
|
||||||
t.equal(rt.targets[1].isStage, false);
|
|
||||||
t.end();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('demo', function (t) {
|
|
||||||
// Get SB2 JSON (string)
|
|
||||||
var uri = path.resolve(__dirname, '../fixtures/project_demo.json');
|
|
||||||
var file = fs.readFileSync(uri, 'utf8');
|
|
||||||
|
|
||||||
// Create runtime instance & load SB2 into it
|
// Create runtime instance & load SB2 into it
|
||||||
var rt = new runtime();
|
var rt = new runtime();
|
||||||
|
|
Loading…
Reference in a new issue