Commit graph

399 commits

Author SHA1 Message Date
Paul Kaplan
ec1d8c657e Add failing test for callNoReturn on undefined proc 2017-10-25 10:29:07 -04:00
Chris Willis-Ford
7051ccfd69 Merge pull request #687 from cwillisf/builtin-extensions
Builtin extensions
2017-10-13 09:48:56 -07:00
Paul Kaplan
8d722b9073 Fix opcode, which isn't actually used in the code... 2017-10-10 15:10:03 -04:00
Paul Kaplan
e8c5bbbf80 Fix tests and make chain more resilient 2017-10-10 12:19:27 -04:00
Scimonster
7afb17df7f Correctly deserialize HTML entities in block DOM
E.g. in variable names
2017-10-09 01:19:55 +03:00
Christopher Willis-Ford
b6727a766f Fix pen tests 2017-10-04 16:07:50 -07:00
Christopher Willis-Ford
772da24d9e Add integration test for a non-worker extension 2017-10-02 12:02:44 -07:00
Paul Kaplan
0f04c99e67 Merge pull request #676 from paulkaplan/duplicate
Add sprite duplication method
2017-09-13 11:57:13 -04:00
Paul Kaplan
81370f7625 Refactor method exports to fix linting and CWF comment 2017-09-11 10:11:48 -04:00
Ray Schamp
32bc087bba Fix remaining lint issues 2017-08-26 13:24:10 -04:00
Ray Schamp
5113876588 Pass with --fix 2017-08-26 13:24:10 -04: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
Ken
963078210a Add test coverage 2017-08-11 01:37:10 +12: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
8906aada5f words better 2017-08-03 17:32:50 -04:00
DD Liu
ffbbbc71cc remove debugger 2017-07-31 18:09:20 -04:00
DD Liu
a48efe681e tests 2017-07-31 17:57:51 -04:00
Paul Kaplan
f2bd32a81a Merge pull request #653 from paulkaplan/sound-ids
Use sound ID instead of md5 for playing sounds
2017-07-26 09:00:00 -04:00
Paul Kaplan
44298fd71b Use soundId instead of md5 for playing sounds 2017-07-25 12:20:32 -04:00
Paul Kaplan
0cf05647d2 Merge branch 'develop' into fix-asset-naming 2017-07-25 10:48:25 -04:00
Paul Kaplan
f96a92b4d1 Move renaming and adding into rendered-target with tests 2017-07-25 10:32:25 -04:00
Paul Kaplan
ef16a7d574 Use name instead of costumeName when using vm#addCostume 2017-07-25 10:31:15 -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
Paul Kaplan
0e33d061fe Merge pull request #633 from paulkaplan/fix-sound-indexing
Fix sound indexing and add tests
2017-07-13 15:08:05 -04:00
Paul Kaplan
a83c0808a0 Add public API for costume and sound renaming with tests 2017-07-07 08:19:32 -04:00
Paul Kaplan
7ec45d9519 Satisfy linter 2017-07-06 17:23:25 -04:00
Paul Kaplan
2ddb6215fd Add tests and fixes for set instrument and play drum 2017-07-06 14:56:46 -04:00
Paul Kaplan
1b6baf8114 Make playSound use one indexing 2017-07-06 14:28:11 -04:00
Chris Willis-Ford
47fc38fd9a Merge pull request #619 from cwillisf/clone-custom-state
Clone custom state
2017-06-27 22:37:30 -07:00
Paul Kaplan
b0fb4f0b55 Merge pull request #614 from marisaleung/develop_cherry-picks
Updated variables and var_fire event listener.
2017-06-23 13:05:03 -04:00
marisaleung
875ccf5b88 Updated variables and var_fire event listener. 2017-06-23 09:57:01 -07:00
Christopher Willis-Ford
6275710e47 Add test case for pen state cloning 2017-06-16 16:29:12 -07:00
Christopher Willis-Ford
1bf1808826 Clarify "flattening" step in SB3 roundtrip test 2017-06-13 13:58:34 -07:00
Christopher Willis-Ford
4b1aad5099 Add test for SB3 serialization round trip 2017-06-12 12:34:51 -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
Ray Schamp
ecf535f4c3 Merge pull request #579 from cwillisf/load-jpeg-backdrops
Specify dataFormat when loading asset for import
2017-06-02 09:06:37 -04:00
DD Liu
875eba568b fix file name in test 2017-05-30 10:24:09 -04:00
DD Liu
809760b954 Merge branch 'develop' into immutableState 2017-05-26 13:50:50 -04: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
Chris Willis-Ford
3970883e45 Merge pull request #549 from cwillisf/device-manager-client
Device manager client
2017-05-24 14:43:28 -07:00
DD Liu
5df3d4ab68 Merge branch 'develop' into immutableState 2017-05-24 15:42:54 -04:00
DD Liu
1902848ea4 Switch to ordered maps of monitor records for monitor state 2017-05-24 15:42:29 -04:00
Paul Kaplan
423da12c3c Handle more cases of deleting costumes 2017-05-22 08:17:28 -04:00
Paul Kaplan
30a0c0d251 Allow deleting the last sound 2017-05-22 08:17:28 -04:00
Paul Kaplan
a608ca4fed Make rendered targets in charge of deleting their own sounds and costumes 2017-05-22 08:17:28 -04:00
Paul Kaplan
71081502fe Add to the vm spec 2017-05-22 08:17:28 -04:00
DD Liu
48c51ab2ec switch to nested immutables state 2017-05-19 17:28:00 -04:00
DD Liu
9645a513b1 Only send monitor update on change 2017-05-19 12:28:05 -04:00
Paul Kaplan
beaef901a7 Add failing test for gui issues 370
Fix rename increment when renamed to itself
2017-05-18 09:13:31 -04: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
Christopher Willis-Ford
96c74867b5 Remove test for canceling a search
When no Device Manager instance is present this test takes a long time
and can cause timeouts. We'll need to fake the HTTP requests if we want
to do this sort of test reliably.
2017-04-28 15:06:42 -07:00
Christopher Willis-Ford
9a9c509e76 Implement a few tests for io/deviceManager 2017-04-28 14:50:57 -07:00
Ray Schamp
f785117e1d Lint and fix failing tests 2017-04-27 17:49:57 -04:00
Ray Schamp
2a4af8a9ca Fix up most linting/merge errors 2017-04-26 16:50:53 -04:00
Ray Schamp
a4cdb027ab Merge branch 'develop' of github.com:morantsur/scratch-vm into feature/serialization
# Conflicts:
#	src/playground/index.html
#	src/serialization/sb2.js
#	src/sprites/rendered-target.js
#	src/virtual-machine.js
#	test/unit/serialization_sb2.js
2017-04-26 11:44:53 -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
Paul Kaplan
8a4c3af18a Merge pull request #535 from paulkaplan/isolate-import
Separate downloading from installation of sprite info
2017-04-19 11:40:30 -04:00
Paul Kaplan
f161640876 Update tests 2017-04-18 11:55:38 -04:00
SillyInventor
da6ce9182d Added testing to rendered-target
Added a fake renderer with known predictable output
Added testing for most if not all functions
2017-04-07 14:50:13 -04:00
Paul Kaplan
80e8003fb2 Add tests for rendered target 2017-04-06 09:46:40 -04:00
Paul Kaplan
771f18e23b Merge pull request #516 from paulkaplan/add-sound-public-api
Expose VM#addSound publicly
2017-04-04 09:05:45 -04:00
Ray Schamp
57e73a68a6 Add costume dataURI to costumes from storage (#517)
* Add costume dataURI to costumes from storage

Towards #515, LLK/scratch-gui#279

* Fix tests

* Load costumes incrementally

Some of our tests assume that at least some of our costume data is available before the costume data is loaded. So, provide as much costume data as is available.

* Remove unnecessary filter for null costumes

Resolved when we updated to load costumes incrementally.

/ht @cwillisf
2017-04-03 15:58:13 -04:00
Chris Willis-Ford
a4aa3810ae Merge pull request #462 from griffpatch/optimise/reduceGetBlockCalls
Optimise reducegetblockcalls
2017-04-03 13:00:05 -04:00
Paul Kaplan
251244ce9c Expose VM#addSound publicly 2017-04-03 09:33:23 -04:00
Chris Willis-Ford
c8b4871b19 Merge pull request #498 from cwillisf/use-scratch-storage
Load projects & costumes through scratch-storage
2017-03-23 22:10:25 -07:00
griffpatch
220d854f28 Merge remote-tracking branch 'refs/remotes/LLK/develop' into optimise/reduceGetBlockCalls
# Conflicts:
#	src/engine/execute.js
2017-03-22 08:58:01 +00:00
griffpatch
25429b1192 Tidy up commit and revert direct member access 2017-03-22 08:48:30 +00:00
Paul Kaplan
8bbb395b35 Add sprite name incrementing and reserved naming 2017-03-20 12:52:57 -04:00
Paul Kaplan
052ecef91c Add string utils with tests 2017-03-20 12:12:38 -04:00
Paul Kaplan
5d2352e471 Add test for skipping rename on blank input 2017-03-20 11:14:25 -04:00
Paul Kaplan
627fc1d9c3 Add tests for existing vm.renameSprite functionality 2017-03-20 11:13:24 -04:00
Chris Willis-Ford
3d7f1187e5 Merge branch 'develop' into use-scratch-storage 2017-03-13 15:48:21 -07:00
Moran
94d2a39cc1 Merge branch 'develop' of https://github.com/LLK/scratch-vm into develop 2017-03-13 18:07:17 -04: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
Paul Kaplan
fe3799bb48 Add test for gfx reset on stop 2017-03-06 16:15:04 -05:00
Moran
d8e1d42bf2 Merge branch 'develop' of https://github.com/LLK/scratch-vm into develop 2017-03-03 15:23:43 -05:00
Ray Schamp
8dadc42857 Add draggable property to sprites
This property should be managed by the VM so that it can be displayed in the sprite info panel in the GUI.
2017-03-01 18:49:17 -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
Andrew Sliwinski
401fd78fd0 Merge pull request #463 from CSnap/sequencerTesting
Adding Sequencer Unit Tests
2017-02-18 10:24:52 -05:00
SillyInventor
2fc2ee2c4b Adding sequencer unit tests for each function 2017-02-16 14:30:00 -05:00
Christopher Willis-Ford
3b3daf8aca Add hat execution order test 2017-02-14 16:33:42 -08:00
SillyInventor
e8949dcdf5 Added remaining tests 2017-02-10 13:06:39 -05:00
SillyInventor
3324f51193 Added some unit tests for some thread functions 2017-02-09 18:18:53 -05:00
griffpatch
9cb595312e Implement "Stop this script" function
Existing implementation incorrectly terminates the entire thread.
See: http://llk.github.io/scratch-vm/#144142535
2017-02-08 09:44:10 +00:00
morant
e16f2924a3 Merge branch 'develop' of https://github.com/LLK/scratch-vm into develop 2017-02-07 09:53:17 -05:00
Andrew Sliwinski
92ff57de7d Add basic test coverage for the sound blocks 2017-02-03 17:39:36 -05:00
SillyInventor
1ac89f5aa4 Added new util function that sends tan function infinities correctly
Changed mathop to call new math util
Changed sin & cos to round correctly (to get 0)
Added testing for the new math util function
Added testing for the new mathop functions
2017-01-31 19:05:54 -05:00
morant
c6c1a63ff0 Merge branch 'feature/194' of https://github.com/morantsur/scratch-vm into develop
+ Solve code conflicts, and handle deserialization of 3.0 projects.

# Conflicts:
#	src/index.js
#	test/unit/serialization_sb2.js
2017-01-27 20:05:54 -05:00
griffpatch
0dcaa46107 Fix lint issues
Had to update the test scripts to handle the alpha channel, also I note
that all the hex tests are using CSS notation, not scratch notation
(which is 0x not #)
2017-01-27 17:05:17 +00:00
Christopher Willis-Ford
f8088be127 Undo accidental harmless but unnecessary change 2017-01-20 11:37:54 -08: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
Christopher Willis-Ford
d0845728ee Add unit tests for new color-related functionality
Also, fix a math error in `Color.rgbToHsv`.

Newly covered functions:
- `toRbgColorObject` from `util/cast.js`
- `hsvToRgb` from `util/colors.js`
- `rgbToHsv` from `util/colors.js`
- `mixRgb` from `util/colors.js`
2017-01-19 15:24:45 -08:00
Andrew Sliwinski
6ee8959100 Improve integration test coverage 2017-01-05 16:58:31 -05:00
Andrew Sliwinski
6d83931341 WIP clean-up 2016-12-30 10:19:58 -05:00
Andrew Sliwinski
7d5820585b Resolve lint issues 2016-12-23 21:31:00 -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
Tim Mickel
2f0ce7137c Rename Clone -> RenderedTarget (#317) 2016-10-26 11:19:43 -04:00
Andrew Sliwinski
1b4a1ca1bc Resolve merge conflicts 2016-10-24 15:53:42 -04:00
Andrew Sliwinski
153df22918 Address feedback from PR review 2016-10-24 15:16:06 -04:00
Andrew Sliwinski
5b73ffa66c Add minimal test coverage for control blocks 2016-10-24 14:38:24 -04:00
Andrew Sliwinski
8b87b36ed3 Resolve race condition with the clock tests 2016-10-24 12:03:43 -04:00
Andrew Sliwinski
336bc65e2d Add minimal test coverage and docs for mouse module 2016-10-24 11:56:52 -04:00
Ray Schamp
7712b2902f Fix quote-props 2016-10-24 11:02:19 -04:00
Ray Schamp
0e909cb9a5 Fix comma-spacing 2016-10-24 10:57:52 -04:00
Ray Schamp
f6c0064235 All linting other than console statements 2016-10-23 22:20:29 -04:00
Ray Schamp
68ed110b49 Pass with eslint --fix
Resolved whitespace issues, e.g., space-before-function-paren and key-spacing
2016-10-23 12:41:45 -04:00
Andrew Sliwinski
faf8a898a0 Add minimal test coverage and docs for keyboard module. 2016-10-21 18:31:07 -04:00
Andrew Sliwinski
7e9745ce3f Add basic test coverage for clock module. 2016-10-21 12:42:32 -04:00
Andrew Sliwinski
1615c47d80 Merge pull request #279 from thisandagain/bugfix/229
Fix `degToRad` function definition
2016-10-17 11:56:48 -04:00
Andrew Sliwinski
9cd4d96101 Add test coverage for SB2 importer (#278) 2016-10-17 11:55:21 -04:00
Andrew Sliwinski
ace9a96fc2 Fix degToRad function definition. Resolves GH-229 2016-10-17 11:52:02 -04:00
Andrew Sliwinski
157b6152f5 Address feedback from PR review. GH-103 2016-10-04 14:37:39 -04:00
Andrew Sliwinski
953c892aab Add unit test coverage for operator blocks. Resolves GH-103 2016-10-03 21:43:31 -04:00
Andrew Sliwinski
4205d05cdb Address feedback from PR review. GH-103 2016-10-03 18:23:43 -04:00
Andrew Sliwinski
8ca6944292 Add unit tests for all utility modules. Re GH-103 2016-10-03 16:34:57 -04:00
Tim Mickel
5728d648b1 Ensure clone.effects is defined on each instance (#225)
* Ensure clone.effects is defined on each instance

* Add regression test for GH-224
2016-10-03 10:16:43 -04:00
Tim Mickel
14feb64005 Create a new input if one doesn't exist (#148)
* Create a new input if one doesn't exist

* Add regression tests for move-into-empty and obscuring shadows via move
2016-09-08 09:40:01 -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
020250e258 Test: take out old blockListener check 2016-08-31 13:57:54 -04:00
Tim Mickel
4faaf1b685 Rename stacks to scripts
Further pushing toward removing ambiguity of what "stack" means in the codebase.
2016-08-11 11:11:27 -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
e9accca107 Add test for blocks.js changeBlock 2016-06-07 11:40:47 -04:00
Tim Mickel
6e087475f6 Tests for blocks.js getters 2016-06-07 11:34:01 -04:00
Tim Mickel
8421308782 Add delete test for blocks with inputs/statements 2016-06-07 11:18:41 -04:00
Tim Mickel
855caab8d2 Add blocks delete chain test 2016-06-07 11:11:20 -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
53372c5704 Fixing case problem with blocks.js tests 2016-06-06 16:17:12 -04:00
Tim Mickel
7732409102 Update unit tests for new adapter, blocks module 2016-06-06 15:59:21 -04:00
Tim Mickel
feea7a0566 Update CREATE event fixture to have outerHTML 2016-06-06 15:59:07 -04:00
Tim Mickel
1bda89ffbb Updating timer test for timeElapsed
This is a better name for it and now the value isn't negative...
2016-04-26 17:03:22 -04:00
Andrew Sliwinski
f1375ef44f Delete unused primitives stub 2016-04-26 12:05:38 -04:00
Andrew Sliwinski
389d112729 All tests passing 2016-04-26 09:54:14 -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
Andrew Sliwinski
655556273a Initial commit 2016-04-08 13:10:37 -04:00