forked from scratchfoundation/scratch-vm
-
-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove note/drum concurrency limit when misc limits are removed
- Loading branch information
1 parent
c857903
commit 9511cc4
Showing
2 changed files
with
36 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const test = require('tap').test; | ||
const Music = require('../../src/extensions/scratch3_music/index.js'); | ||
const Runtime = require('../../src/engine/runtime.js'); | ||
|
||
test('_isConcurrencyLimited', t => { | ||
const rt = new Runtime(); | ||
|
||
// sanity check so that the setRuntimeOptions() call below actually does something | ||
t.equal(rt.runtimeOptions.miscLimits, true, 'misc limits enabled by default'); | ||
|
||
const blocks = new Music(rt); | ||
t.equal(blocks._isConcurrencyLimited(), false, 'not limited initially'); | ||
|
||
// logic here is slightly weird but this matches Scratch | ||
blocks._concurrencyCounter = Music.CONCURRENCY_LIMIT; | ||
t.equal(blocks._isConcurrencyLimited(), false, 'not limited at limit'); | ||
|
||
blocks._concurrencyCounter = Music.CONCURRENCY_LIMIT + 1; | ||
t.equal(blocks._isConcurrencyLimited(), true, 'limited above limit'); | ||
|
||
rt.setRuntimeOptions({ | ||
miscLimits: false | ||
}); | ||
t.equal(blocks._isConcurrencyLimited(), false, 'not limited when miscLimits: false'); | ||
|
||
t.end(); | ||
}); |