Let wait, sayforsecs, thinkforsecs - handle big numbers #1442
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves
This PR resolves #1010
Proposed Changes
For each block definition which uses
setTimeout
, ensure that the second argument passed to that function is no greater than the largest signed 32-bit integer.As a result, the
wait
block in the Control category and thethinkforsecs
andsayforsecs
blocks in the Looks category will now do their action for a very long time when passed an unreasonably large argument -- rather than instantly completing the relevant action.Reason for Changes
This maintains compatibility with the way Scratch 2.0 behaved.
@ericrosenbaum stated that:
Test Coverage
Manually tested through dragging out the aforementioned trio of blocks and verifying that they have a ring around them for more than a few seconds. Additionally, it was verified that when small numbers (like 5) were passed, the correct amount of time was taken.
On Windows 10,
npm test
was run, only warnings appeared -- and these were regarding todo comments that existed pior to this pull request's filing.npm run coverage
was terminated half-way through, it was not enjoying that the sprite library was missing. This was not identified as an issue that this pull request created.