mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 14:32:59 -05:00
Merge pull request #1897 from kchadha/fix-cloud-var-limit
Fix cloud variable limit
This commit is contained in:
commit
94240d743e
6 changed files with 11 additions and 11 deletions
|
@ -99,7 +99,7 @@ const ArgumentTypeMap = (() => {
|
||||||
* cloud variable.
|
* cloud variable.
|
||||||
*/
|
*/
|
||||||
const cloudDataManager = () => {
|
const cloudDataManager = () => {
|
||||||
const limit = 8;
|
const limit = 10;
|
||||||
let count = 0;
|
let count = 0;
|
||||||
|
|
||||||
const canAddCloudVariable = () => count < limit;
|
const canAddCloudVariable = () => count < limit;
|
||||||
|
|
BIN
test/fixtures/cloud_variables_limit.sb2
vendored
BIN
test/fixtures/cloud_variables_limit.sb2
vendored
Binary file not shown.
BIN
test/fixtures/cloud_variables_limit.sb3
vendored
BIN
test/fixtures/cloud_variables_limit.sb3
vendored
Binary file not shown.
|
@ -56,9 +56,9 @@ test('importing an sb2 project with cloud variables at the limit for a project',
|
||||||
const stage = vm.runtime.targets[0];
|
const stage = vm.runtime.targets[0];
|
||||||
const stageVars = Object.values(stage.variables);
|
const stageVars = Object.values(stage.variables);
|
||||||
|
|
||||||
t.equal(stageVars.length, 8);
|
t.equal(stageVars.length, 10);
|
||||||
// All of the 8 stage variables should be cloud variables
|
// All of the 8 stage variables should be cloud variables
|
||||||
t.equal(stageVars.filter(v => v.isCloud).length, 8);
|
t.equal(stageVars.filter(v => v.isCloud).length, 10);
|
||||||
|
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
|
@ -83,7 +83,7 @@ test('importing an sb2 project with cloud variables exceeding the limit for a pr
|
||||||
|
|
||||||
t.equal(stageVars.length, 15);
|
t.equal(stageVars.length, 15);
|
||||||
// Only 8 of the variables should have the isCloud flag set to true
|
// Only 8 of the variables should have the isCloud flag set to true
|
||||||
t.equal(stageVars.filter(v => v.isCloud).length, 8);
|
t.equal(stageVars.filter(v => v.isCloud).length, 10);
|
||||||
|
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
|
|
|
@ -54,9 +54,9 @@ test('importing an sb3 project with cloud variables at the limit for a project',
|
||||||
const stage = vm.runtime.targets[0];
|
const stage = vm.runtime.targets[0];
|
||||||
const stageVars = Object.values(stage.variables);
|
const stageVars = Object.values(stage.variables);
|
||||||
|
|
||||||
t.equal(stageVars.length, 8);
|
t.equal(stageVars.length, 10);
|
||||||
// All of the 8 stage variables should be cloud variables
|
// All of the 10 stage variables should be cloud variables
|
||||||
t.equal(stageVars.filter(v => v.isCloud).length, 8);
|
t.equal(stageVars.filter(v => v.isCloud).length, 10);
|
||||||
|
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
|
@ -81,7 +81,7 @@ test('importing an sb3 project with cloud variables exceeding the limit for a pr
|
||||||
|
|
||||||
t.equal(stageVars.length, 15);
|
t.equal(stageVars.length, 15);
|
||||||
// Only 8 of the variables should have the isCloud flag set to true
|
// Only 8 of the variables should have the isCloud flag set to true
|
||||||
t.equal(stageVars.filter(v => v.isCloud).length, 8);
|
t.equal(stageVars.filter(v => v.isCloud).length, 10);
|
||||||
|
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
|
|
|
@ -139,7 +139,7 @@ test('Project loaded emits runtime event', t => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Cloud variable limit allows only 8 cloud variables', t => {
|
test('Cloud variable limit allows only 10 cloud variables', t => {
|
||||||
// This is a test of just the cloud variable limit mechanism
|
// This is a test of just the cloud variable limit mechanism
|
||||||
// The functions being tested below need to be used when
|
// The functions being tested below need to be used when
|
||||||
// creating and deleting cloud variables in the runtime.
|
// creating and deleting cloud variables in the runtime.
|
||||||
|
@ -148,7 +148,7 @@ test('Cloud variable limit allows only 8 cloud variables', t => {
|
||||||
|
|
||||||
t.equal(rt.hasCloudData(), false);
|
t.equal(rt.hasCloudData(), false);
|
||||||
|
|
||||||
for (let i = 0; i < 8; i++) {
|
for (let i = 0; i < 10; i++) {
|
||||||
t.equal(rt.canAddCloudVariable(), true);
|
t.equal(rt.canAddCloudVariable(), true);
|
||||||
rt.addCloudVariable();
|
rt.addCloudVariable();
|
||||||
// Adding a cloud variable should change the
|
// Adding a cloud variable should change the
|
||||||
|
@ -172,7 +172,7 @@ test('Cloud variable limit allows only 8 cloud variables', t => {
|
||||||
rt.dispose();
|
rt.dispose();
|
||||||
t.equal(rt.hasCloudData(), false);
|
t.equal(rt.hasCloudData(), false);
|
||||||
|
|
||||||
for (let i = 0; i < 8; i++) {
|
for (let i = 0; i < 10; i++) {
|
||||||
t.equal(rt.canAddCloudVariable(), true);
|
t.equal(rt.canAddCloudVariable(), true);
|
||||||
rt.addCloudVariable();
|
rt.addCloudVariable();
|
||||||
t.equal(rt.hasCloudData(), true);
|
t.equal(rt.hasCloudData(), true);
|
||||||
|
|
Loading…
Reference in a new issue