diff --git a/src/playground/suite.js b/src/playground/suite.js index 63910464d..1e8dd214e 100644 --- a/src/playground/suite.js +++ b/src/playground/suite.js @@ -505,107 +505,30 @@ window.download = function (_this) { window.onload = function () { suite = new BenchSuite(); - suite.add(new BenchFixture({ - projectId: 130041250, - warmUpTime: 0, - recordingTime: 2000 - })); - - suite.add(new BenchFixture({ - projectId: 130041250, - warmUpTime: 4000, - recordingTime: 6000 - })); - - suite.add(new BenchFixture({ - projectId: 14844969, - warmUpTime: 0, - recordingTime: 2000 - })); - - suite.add(new BenchFixture({ - projectId: 14844969, - warmUpTime: 1000, - recordingTime: 6000 - })); - - suite.add(new BenchFixture({ - projectId: 173918262, - warmUpTime: 0, - recordingTime: 5000 - })); - - suite.add(new BenchFixture({ - projectId: 173918262, - warmUpTime: 5000, - recordingTime: 5000 - })); - - suite.add(new BenchFixture({ - projectId: 155128646, - warmUpTime: 0, - recordingTime: 5000 - })); - - suite.add(new BenchFixture({ - projectId: 155128646, - warmUpTime: 5000, - recordingTime: 5000 - })); - - suite.add(new BenchFixture({ - projectId: 89811578, - warmUpTime: 0, - recordingTime: 5000 - })); - - suite.add(new BenchFixture({ - projectId: 89811578, - warmUpTime: 5000, - recordingTime: 5000 - })); - - suite.add(new BenchFixture({ - projectId: 139193539, - warmUpTime: 0, - recordingTime: 5000 - })); - - suite.add(new BenchFixture({ - projectId: 139193539, - warmUpTime: 5000, - recordingTime: 5000 - })); - - // TODO: #1322 - // Error: Cannot create monitor for target that cannot be found by name - // suite.add(new BenchFixture({ - // projectId: 187694931, - // warmUpTime: 0, - // recordingTime: 5000 - // })); - // - // suite.add(new BenchFixture({ - // projectId: 187694931, - // warmUpTime: 5000, - // recordingTime: 5000 - // })); - - const standard = projectId => { + const add = (projectId, warmUp = 0, recording = 5000) => { suite.add(new BenchFixture({ projectId, - warmUpTime: 0, - recordingTime: 5000 + warmUpTime: warmUp, + recordingTime: recording })); - - suite.add(new BenchFixture({ - projectId, - warmUpTime: 5000, - recordingTime: 5000 - })); - }; + const standard = projectId => { + add(projectId, 0, 5000); + add(projectId, 5000, 5000); + }; + + add(130041250, 0, 2000); // floating blocks + add(130041250, 4000, 6000); + + add(14844969, 0, 2000); // scratch cats + add(14844969, 1000, 6000); + + standard(173918262); // bouncy heros + standard(155128646); // stacky build + standard(89811578); // solar system + standard(139193539); // pixel art maker + standard(187694931); // spiralgraph standard(219313833); // sensing_touching benchmark standard(236115215); // touching color benchmark standard(238750909); // bob ross painting (heavy pen stamp) diff --git a/src/serialization/sb2.js b/src/serialization/sb2.js index 6fd63c72c..02d09a205 100644 --- a/src/serialization/sb2.js +++ b/src/serialization/sb2.js @@ -355,7 +355,16 @@ const parseScratchObject = function (object, runtime, extensions, topLevel, zip) const sprite = new Sprite(blocks, runtime); // Sprite/stage name from JSON. if (object.hasOwnProperty('objName')) { - sprite.name = topLevel ? 'Stage' : object.objName; + if (topLevel && object.objName !== 'Stage') { + for (const child of object.children) { + if (!child.hasOwnProperty('objName') && child.target === object.objName) { + child.target = 'Stage'; + } + } + object.objName = 'Stage'; + } + + sprite.name = object.objName; } // Costumes from JSON. const costumePromises = []; diff --git a/test/fixtures/execute/monitors-stage-name.sb2 b/test/fixtures/execute/monitors-stage-name.sb2 new file mode 100644 index 000000000..6c1af6c05 Binary files /dev/null and b/test/fixtures/execute/monitors-stage-name.sb2 differ diff --git a/test/integration/execute.js b/test/integration/execute.js index dfdcb5eda..7a63e7785 100644 --- a/test/integration/execute.js +++ b/test/integration/execute.js @@ -31,7 +31,14 @@ const whenThreadsComplete = (t, vm, timeLimit = 2000) => ( // When the number of threads reaches 0 the test is expected to be complete. new Promise((resolve, reject) => { const intervalId = setInterval(() => { - if (vm.runtime.threads.length === 0) { + let active = 0; + const threads = vm.runtime.threads; + for (let i = 0; i < threads.length; i++) { + if (!threads[i].updateMonitor) { + active += 1; + } + } + if (active === 0) { resolve(); } }, 50);