Central dispatch and worker dispatch share most of their code now by
inheriting from a new shared dispatch class.
Also, the format of passed messages has been altered to make it easier
to understand in a debugger.
The tests run using TinyWorker, which emulates web workers on Node.
There are quite a few quirks in that situation due to the differences
between Node and Webpack as well as the differences between TinyWorker
and real Web Workers.
The tests also exposed a few bugs in the dispatch system, which have now
been fixed. Most notably, if a method called through the dispatch system
throws an exception that exception will now be passed back to the
caller. Previously the exception would escape the dispatch system and
the caller would never hear any response at all.
Rather than assuming that the storage instance will be attached to a VM,
just return it. Callers may attach it to a `VM` or (in the case of
`import_sb2.js`) to a `Runtime`.
This new test verifies that clones and their associated threads are
cleaned up properly by the `delete this clone` block. The clones run two
stacks each: one which waits and then deletes the clone, and another
which includes a `forever` loop: this is to verify that the thread
running the `forever` loop is ended when the clone itself is deleted.
The project does this with two batches of clones to ensure there are no
problems with reusing array indices previously occupied by now-removed
threads or clones.
When importing a project we know the file extension for each asset to be
loaded. This change provides that information to the storage system so
that we can load assets which don't use the default. For example, this
allows loading JPG-format backdrops.
In support of this change, there's a new function on `StringUtil` called
`splitFirst`, which splits a string on the first instance of a separator
character. This change includes unit tests for this new function.
- Attach the storage module to the VM for tests which load projects or
other assets.
- Move `import_sb2.js` from `test/unit/ into `test/integration` since it
now depends heavily on `scratch-storage`.
- Skip loading costumes when there is no renderer.
* Revert "Merge pull request #486 from rschamp/fix-filter-tests"
This reverts commit ba00db897f, reversing
changes made to 739c5deb63.
* Revert "Show Categories that use custom code to load (variables, procedures) (#483)"
This reverts commit 739c5deb63.
* Revert "Merge pull request #461 from rschamp/filter-toolbox"
This reverts commit 343b5bfe8e, reversing
changes made to 370f2c6a47.
Changes include:
- Added missing JSDoc for items in `scratch3_pen.js` and `target.js`.
- Moved constants used by `Scratch3PenBlocks` into the class.
- Created a constant for minimum and maximum pen size.
- Added `util/clone.js` to host cloning functionality.
- Pen blocks now check for the renderer before trying to use it.
- The pen integration test covers all blocks, though `clear`, `stamp`,
and `pen down` will skip some of their functionality when there is no
renderer.
* Always add `next` to block representation
* Add `shadow` property to inputs, to maintain obscured shadows
* Create obscured shadows in SB2 import
* Add XML import of obscured shadows
* Alias SB2 shadow inputs to block inputs
* Add shadow to inputs on "delete inputs" test
* Add a small test to ensure obscured shadows are preserved
* Add more obscured shadow tests