mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-06-03 17:14:27 -04:00
add test of deserializing origin
This commit is contained in:
parent
679efb28fd
commit
8483c1a467
3 changed files with 17 additions and 0 deletions
test
BIN
test/fixtures/origin-absent.sb3
vendored
Normal file
BIN
test/fixtures/origin-absent.sb3
vendored
Normal file
Binary file not shown.
BIN
test/fixtures/origin.sb3
vendored
Normal file
BIN
test/fixtures/origin.sb3
vendored
Normal file
Binary file not shown.
|
@ -11,6 +11,8 @@ const commentsSB3NoDupeIds = path.resolve(__dirname, '../fixtures/comments_no_du
|
||||||
const variableReporterSB2ProjectPath = path.resolve(__dirname, '../fixtures/top-level-variable-reporter.sb2');
|
const variableReporterSB2ProjectPath = path.resolve(__dirname, '../fixtures/top-level-variable-reporter.sb2');
|
||||||
const topLevelReportersProjectPath = path.resolve(__dirname, '../fixtures/top-level-reporters.sb3');
|
const topLevelReportersProjectPath = path.resolve(__dirname, '../fixtures/top-level-reporters.sb3');
|
||||||
const draggableSB3ProjectPath = path.resolve(__dirname, '../fixtures/draggable.sb3');
|
const draggableSB3ProjectPath = path.resolve(__dirname, '../fixtures/draggable.sb3');
|
||||||
|
const originSB3ProjectPath = path.resolve(__dirname, '../fixtures/origin.sb3');
|
||||||
|
const originAbsentSB3ProjectPath = path.resolve(__dirname, '../fixtures/origin-absent.sb3');
|
||||||
const FakeRenderer = require('../fixtures/fake-renderer');
|
const FakeRenderer = require('../fixtures/fake-renderer');
|
||||||
|
|
||||||
test('serialize', t => {
|
test('serialize', t => {
|
||||||
|
@ -324,3 +326,18 @@ test('(#1850) sprite draggability state read when loading SB3 file', t => {
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('load origin value from SB3 file json metadata', t => {
|
||||||
|
const vm = new VirtualMachine();
|
||||||
|
vm.loadProject(readFileToBuffer(originSB3ProjectPath))
|
||||||
|
.then(() => {
|
||||||
|
t.type(vm.runtime.origin, 'string');
|
||||||
|
})
|
||||||
|
.then(() => vm.loadProject(readFileToBuffer(originAbsentSB3ProjectPath)))
|
||||||
|
.then(() => {
|
||||||
|
// After loading a project with an origin, then loading one without an origin,
|
||||||
|
// origin value should no longer be set.
|
||||||
|
t.equal(vm.runtime.origin, null);
|
||||||
|
t.end();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue