mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 06:23:37 -05:00
Merge pull request #1564 from mzgoddard/monitor-rename
Rename Stage object and Stage monitors together
This commit is contained in:
commit
91d2663c35
4 changed files with 37 additions and 98 deletions
|
@ -505,107 +505,30 @@ window.download = function (_this) {
|
||||||
window.onload = function () {
|
window.onload = function () {
|
||||||
suite = new BenchSuite();
|
suite = new BenchSuite();
|
||||||
|
|
||||||
suite.add(new BenchFixture({
|
const add = (projectId, warmUp = 0, recording = 5000) => {
|
||||||
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 => {
|
|
||||||
suite.add(new BenchFixture({
|
suite.add(new BenchFixture({
|
||||||
projectId,
|
projectId,
|
||||||
warmUpTime: 0,
|
warmUpTime: warmUp,
|
||||||
recordingTime: 5000
|
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(219313833); // sensing_touching benchmark
|
||||||
standard(236115215); // touching color benchmark
|
standard(236115215); // touching color benchmark
|
||||||
standard(238750909); // bob ross painting (heavy pen stamp)
|
standard(238750909); // bob ross painting (heavy pen stamp)
|
||||||
|
|
|
@ -355,7 +355,16 @@ const parseScratchObject = function (object, runtime, extensions, topLevel, zip)
|
||||||
const sprite = new Sprite(blocks, runtime);
|
const sprite = new Sprite(blocks, runtime);
|
||||||
// Sprite/stage name from JSON.
|
// Sprite/stage name from JSON.
|
||||||
if (object.hasOwnProperty('objName')) {
|
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.
|
// Costumes from JSON.
|
||||||
const costumePromises = [];
|
const costumePromises = [];
|
||||||
|
|
BIN
test/fixtures/execute/monitors-stage-name.sb2
vendored
Normal file
BIN
test/fixtures/execute/monitors-stage-name.sb2
vendored
Normal file
Binary file not shown.
|
@ -31,7 +31,14 @@ const whenThreadsComplete = (t, vm, timeLimit = 2000) => (
|
||||||
// When the number of threads reaches 0 the test is expected to be complete.
|
// When the number of threads reaches 0 the test is expected to be complete.
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
const intervalId = setInterval(() => {
|
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();
|
resolve();
|
||||||
}
|
}
|
||||||
}, 50);
|
}, 50);
|
||||||
|
|
Loading…
Reference in a new issue