mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 06:23:37 -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.
|
||||
*/
|
||||
const cloudDataManager = () => {
|
||||
const limit = 8;
|
||||
const limit = 10;
|
||||
let count = 0;
|
||||
|
||||
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 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
|
||||
t.equal(stageVars.filter(v => v.isCloud).length, 8);
|
||||
t.equal(stageVars.filter(v => v.isCloud).length, 10);
|
||||
|
||||
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);
|
||||
// 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();
|
||||
});
|
||||
|
|
|
@ -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 stageVars = Object.values(stage.variables);
|
||||
|
||||
t.equal(stageVars.length, 8);
|
||||
// All of the 8 stage variables should be cloud variables
|
||||
t.equal(stageVars.filter(v => v.isCloud).length, 8);
|
||||
t.equal(stageVars.length, 10);
|
||||
// All of the 10 stage variables should be cloud variables
|
||||
t.equal(stageVars.filter(v => v.isCloud).length, 10);
|
||||
|
||||
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);
|
||||
// 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();
|
||||
});
|
||||
|
|
|
@ -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
|
||||
// The functions being tested below need to be used when
|
||||
// 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);
|
||||
|
||||
for (let i = 0; i < 8; i++) {
|
||||
for (let i = 0; i < 10; i++) {
|
||||
t.equal(rt.canAddCloudVariable(), true);
|
||||
rt.addCloudVariable();
|
||||
// Adding a cloud variable should change the
|
||||
|
@ -172,7 +172,7 @@ test('Cloud variable limit allows only 8 cloud variables', t => {
|
|||
rt.dispose();
|
||||
t.equal(rt.hasCloudData(), false);
|
||||
|
||||
for (let i = 0; i < 8; i++) {
|
||||
for (let i = 0; i < 10; i++) {
|
||||
t.equal(rt.canAddCloudVariable(), true);
|
||||
rt.addCloudVariable();
|
||||
t.equal(rt.hasCloudData(), true);
|
||||
|
|
Loading…
Reference in a new issue