Commit graph

140 commits

Author SHA1 Message Date
Scimonster
7afb17df7f Correctly deserialize HTML entities in block DOM
E.g. in variable names
2017-10-09 01:19:55 +03:00
Chris Willis-Ford
2665ef2b2b Merge pull request #640 from cwillisf/feature/message-dispatch
Implement message dispatch system
2017-08-17 10:57:23 -07:00
Christopher Willis-Ford
b4c0cfe940 Refactor common code in {central,worker}-dispatch
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.
2017-08-09 17:30:00 -04:00
DD Liu
fed449876f just hat changes 2017-08-03 16:01:53 -04:00
Christopher Willis-Ford
84ac66d6e5 Fix exception message 2017-07-21 13:23:52 -07:00
Christopher Willis-Ford
0fcc248ac1 Add tests for message dispatch system; fix bugs
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.
2017-07-21 13:23:52 -07:00
Paul Kaplan
bd3a29650b Fix variable import scoping 2017-07-17 12:28:44 -04:00
Christopher Willis-Ford
6275710e47 Add test case for pen state cloning 2017-06-16 16:29:12 -07:00
Christopher Willis-Ford
cd1c72c7cc Convert attachTestStorage to makeTestStorage
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`.
2017-06-12 12:34:20 -07:00
Christopher Willis-Ford
6320fd72c3 Add test for clone cleanup
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.
2017-06-08 11:16:29 -07:00
Christopher Willis-Ford
eb931fd99b Specify dataFormat when loading asset for import
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.
2017-05-24 15:35:10 -07:00
Ray Schamp
baee9a2793 Don't clean costume and sound lists
They are already clean, since we don't store the data on them any more.
2017-05-04 13:03:42 -04:00
Ray Schamp
f785117e1d Lint and fix failing tests 2017-04-27 17:49:57 -04:00
Ray Schamp
bafdf8d9f2 Use ES6 linting rules in the project root
Update all tests for `no-var` and `prefer-arrow-callback` (using `--fix`)
2017-04-24 15:37:58 -04:00
Andrew Sliwinski
8dc94391b0 Merge pull request #527 from CSnap/add_testing
Added testing to rendered-target
2017-04-24 10:15:55 -04:00
SillyInventor
a158db8aff Implemented Proposed Fixes
Moved 'fake renderer' to fixtures
Fixed spacing after ()
Removed extra line break
2017-04-24 10:04:06 -04:00
Christopher Willis-Ford
c750f53c81 Get Asset and AssetType from storage instance 2017-04-20 16:12:17 -07:00
Chris Willis-Ford
3d7f1187e5 Merge branch 'develop' into use-scratch-storage 2017-03-13 15:48:21 -07:00
Christopher Willis-Ford
e4fd9d57a2 Fix tests involving scratch-storage
- 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.
2017-03-09 15:50:43 -08:00
Ray Schamp
b03768cad6 Remove filter toolbox utility (#496)
* 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.
2017-03-09 16:41:06 -05:00
Ray Schamp
0b2d053177 Update tests to account for custom categories 2017-03-01 12:57:46 -05:00
Ray Schamp
6ea9b54539 Add filterToolbox unit tests 2017-02-27 12:58:18 -05:00
Christopher Willis-Ford
3b3daf8aca Add hat execution order test 2017-02-14 16:33:42 -08:00
Andrew Sliwinski
92ff57de7d Add basic test coverage for the sound blocks 2017-02-03 17:39:36 -05:00
Christopher Willis-Ford
88cc50aa18 Code review: more docs, move constants, clone util
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.
2017-01-20 11:26:18 -08:00
Christopher Willis-Ford
72f17d6dc4 Add pen integration test
See `pen.sb2` for details
2017-01-19 15:58:00 -08:00
Andrew Sliwinski
6ee8959100 Improve integration test coverage 2017-01-05 16:58:31 -05:00
Andrew Sliwinski
dfc6614a5b Build out integration test SB2 files 2016-12-23 21:08:13 -05:00
Andrew Sliwinski
b8af7c0723 Add minimal integration tests 2016-12-23 14:09:35 -05:00
Andrew Sliwinski
4709cae4b7 Basic integration (end-to-end) testing for default project 2016-12-23 10:39:19 -05:00
Andrew Sliwinski
9cd4d96101 Add test coverage for SB2 importer (#278) 2016-10-17 11:55:21 -04:00
Tim Mickel
9a8b68643a Shadow improvements (#135)
* 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
2016-09-06 10:55:52 -04:00
Tim Mickel
7780b25c46 Project wide rename substack -> branch 2016-08-10 11:43:49 -04:00
Tim Mickel
9f89caa0e6 Add regression test for adapter's empty field handling 2016-06-14 18:14:15 -04:00
Tim Mickel
2339c5e710 Additional tests for invalid adapter inputs 2016-06-07 12:01:47 -04:00
Tim Mickel
06eaee9108 Additional adapter tests for new cases 2016-06-07 11:04:44 -04:00
Tim Mickel
4eb63cf33e Test for CREATE event with substack 2016-06-07 10:49:12 -04:00
Tim Mickel
feea7a0566 Update CREATE event fixture to have outerHTML 2016-06-06 15:59:07 -04:00
Andrew Sliwinski
981b85e78f AST create / change / move / delete from blockly 2016-04-26 09:49:52 -04:00
Andrew Sliwinski
f9f47ed103 WIP 2016-04-18 17:20:30 -04:00