Commit graph

488 commits

Author SHA1 Message Date
Paul Kaplan
4378603d36 Prevent the runtime from spawning new stepping intervals 2018-11-28 08:34:22 -05:00
Valerie R Young
70f00e30c4 Revert changes to toNumber, fix comparison of infinity in cast.compare 2018-11-27 17:53:20 -05:00
Paul Kaplan
ffb02c607d
Merge pull request #1783 from paulkaplan/emit-start-event
Emit a RUNTIME_STARTED event to track if the vm has been started
2018-11-27 16:38:27 -05:00
Paul Kaplan
0c38c3cffe Force exiting after tests finish 2018-11-27 16:06:56 -05:00
Paul Kaplan
cc4751228e Emit a RUNTIME_STARTED event to track if the vm has been started 2018-11-27 11:37:01 -05:00
Karishma Chadha
abbce00203 Add unit tests for new rename and delete cloud var functionality. 2018-11-20 19:56:45 -05:00
Karishma Chadha
25ce08131a Add rename and delete functionality for cloud variables. Refactor function name for cloud variable creation API. 2018-11-20 15:11:12 -05:00
Christopher Willis-Ford
3649c15f2a Fix monitor tests to count only monitor threads
The monitor tests no longer fail if the last step happens to have run a
non-monitor thread in addition to the monitor threads.
2018-11-19 16:34:33 -08:00
Chris Willis-Ford
e071cf3c0c
Merge pull request #1768 from cwillisf/node11-fix-unit-tests
Fix unit tests on Travis CI
2018-11-19 14:06:10 -08:00
Christopher Willis-Ford
30a1ba52e3 Use absolute path for worker shim in dispatch test
Node 11 causes TinyWorker to resolve its start script path differently,
compared to Node 8. Using an absolute path works for both.
2018-11-19 11:57:43 -08:00
Valerie R Young
d8078c018d Implement feedback, broadcast order 2018-11-16 17:24:28 -05:00
Katie Broida
bb82c46f8a
Handle coordinate precision the same as Scratch 2 (#1722) 2018-11-15 15:50:56 -05:00
Valerie Young
2ca735eab4
Merge pull request #1716 from bocoup/unknown-block-input-fix
Handle unknown opcode in input
2018-11-15 10:09:46 -05:00
Ray Schamp
f2550d582c
Merge pull request #1750 from rschamp/feature/sb3-json-assets
Add method for collecting all targets' assets
2018-11-15 10:31:58 +00:00
Ray Schamp
bcd1c5b13a Consolidate collectAssets into getter 2018-11-15 10:26:05 +00:00
Karishma Chadha
0c9da5d963
Merge pull request #1755 from kchadha/cloud-var-create
Create cloud variables
2018-11-14 21:39:29 -05:00
Karishma Chadha
e2e6509a4a Fix lint error 2018-11-14 19:22:41 -05:00
Karishma Chadha
fad4d381bb Add and update unit tests for new create cloud variable functionality. 2018-11-14 15:46:51 -05:00
Karishma Chadha
3dd0d0a657
Merge pull request #1686 from kchadha/monitor-save-load
Monitor save & load
2018-11-14 13:23:10 -05:00
Karishma Chadha
dccb41e3c4 Comment and test cleanup. 2018-11-14 10:42:52 -05:00
Valerie R Young
b4e5655b18 Satisfy linter 2018-11-13 13:59:22 -05:00
Valerie R Young
1b44841034 Add unit tests for treatment of infinity primatives 2018-11-13 13:51:12 -05:00
Ray Schamp
df56e615ec Add method for collecting all targets' assets
Resolves #1601. Does not include the project JSON since that would require knowledge of a project ID, which the VM has not been responsible for so far.

For now, it is the responsibility of the consumer to determine if these assets should be saved or not. Otherwise the VM would need to be responsible for saving, which has been out of its scope.
2018-11-12 15:13:02 +00:00
Karishma Chadha
6dfc0b678e Add integration test for monitor save/load. 2018-11-09 23:45:49 -05:00
Karishma Chadha
cfa71723eb Ignore video sensing monitor and import music tempo monitor unless it is hidden. Load extensions for visible monitors. Add tests for new functionality. 2018-11-09 00:09:54 -05:00
Karishma Chadha
fe186913ac
Merge pull request #1742 from kchadha/multi-monitors
Multi monitors
2018-11-08 14:44:22 -05:00
Karishma Chadha
87244b4110 Normalize capitalization of sensing_current block fields during sb2 import and during monitor id generation. Update monitors integration test to include sensing_current block monitors. 2018-11-08 14:11:30 -05:00
Ray Schamp
4f5aba4fe6
Merge pull request #1727 from paulkaplan/add-ext-on-share
Add unloaded extensions on block sharing
2018-11-08 10:15:58 +00:00
Karishma Chadha
5db3db3a92 monitor id getter should use block fields instead of a list of strings 2018-11-08 01:33:26 -05:00
Karishma Chadha
8aa0fa11aa
Merge pull request #1649 from mzgoddard/get-attribute-stage-alt-name
Get attribute stage alt name
2018-11-07 17:47:44 -05:00
Karishma Chadha
4bb2d19584
Merge pull request #1683 from mzgoddard/sequencer-thread-cleanup
Sequencer thread cleanup
2018-11-07 17:15:11 -05:00
Paul Kaplan
ce94144051 Fixup from comments 2018-11-07 10:11:16 -05:00
Valerie R Young
05a28e553e Say 'end' only after 4th increment 2018-11-06 13:26:25 -05:00
Valerie R Young
b64d18b627 Satisfy linter 2018-11-05 15:16:57 -05:00
Valerie R Young
2c76d3bf71 Add unit test for unknown opcode inputs 2018-11-05 13:23:31 -05:00
Paul Kaplan
979ed66594 Add a unit test to ensure extensions are loaded on shareBlocksToTarget 2018-11-05 13:01:00 -05:00
Paul Kaplan
c8ad1955d4 Load extensions before sharing blocks.
This commit fixes the unit tests so the assertions are made after the promise resolves
2018-11-05 13:00:35 -05:00
Paul Kaplan
bc1da9fa44 Move extension ID parsing into a helper and add test 2018-11-05 12:57:09 -05:00
Karishma Chadha
5593c9ab3e
Merge pull request #1711 from kchadha/import-cloud-var-info
Import cloud var info and enforce cloud var limit
2018-11-01 09:46:37 -04:00
Karishma Chadha
ffef2e92fc Fix up docs and incorrect initialization of cloud data manager functions. Add 'spec' unit tests that the cloud data manager functions are actually functions. 2018-10-31 19:20:13 -04:00
Michael "Z" Goddard
2ffa8eb333
update runtime thread tests
Threads are now removed after every "inner" step. Any thread that
reaches its DONE conditions is immediately removed instead of requiring
an extra step to remove it. As such tests that check the number of
threads have been updated to consider this.
2018-10-31 17:56:12 -04:00
Katie Broida
5cf10b1af1
Tests to check whether extensions load (#1700) 2018-10-31 17:22:21 -04:00
Karishma Chadha
1df6743a5f Refactor cloud data manager to break out cloud data limit check vs. limit update. 2018-10-31 13:40:05 -04:00
Karishma Chadha
d041259473 Fix documentation for local cloud var test 2018-10-30 19:01:16 -04:00
Karishma Chadha
a6de046dda Add unit and integration tests for the new functionality. 2018-10-30 18:54:25 -04:00
Katie Broida
6ef600dc2c
Add runtime event for when the project is loaded (#1669) 2018-10-30 15:26:22 -04:00
Karishma Chadha
fd5e178d3b
Merge pull request #1703 from kchadha/cloud-io
Cloud IO
2018-10-30 11:57:20 -04:00
Paul Kaplan
b245b3868f
Merge pull request #1416 from paulkaplan/fix-mouse-down
Make click hats trigger on mouse down instead of up
2018-10-29 15:05:18 -04:00
Karishma Chadha
be238d35d2
Merge pull request #1517 from joker314/costume-compatibility
Make "switch costume" and "switch backdrop" blocks compatible with 2.0
2018-10-29 11:39:41 -04:00
Karishma Chadha
19b6c35cab Add unit tests for cloud io device 2018-10-29 00:59:24 -04:00
Paul Kaplan
e002db48f2 Add logic to trigger click hats on mouse up on a draggable target
As long as the event was not a drag
2018-10-25 15:08:37 -04:00
Paul Kaplan
9bf7ef8573 Add unit tests for activating click hats 2018-10-25 14:06:36 -04:00
Ray Schamp
de86eb3f19
Merge pull request #1691 from rschamp/storage-no-cache
Store asset objects on costumes and sounds
2018-10-25 10:15:47 +01:00
Karishma Chadha
d3e38c1ae9
Merge pull request #1640 from mzgoddard/set-procedure-param-missing
Set procedure param missing
2018-10-25 00:13:51 -04:00
Katie Broida
18c83dcc67
Prevent non-core extensions from adding monitors (#1688) 2018-10-24 16:43:01 -04:00
Ray Schamp
902aee48ee Merge branch 'develop' of https://github.com/LLK/scratch-vm into storage-no-cache
# Conflicts:
#	package-lock.json
2018-10-24 12:09:06 +01:00
Michael "Z" Goddard
afd2ed72c8
add procedure parameter used outside of proc integrations 2018-10-23 15:14:31 -04:00
Michael "Z" Goddard
58a7a6bb04
add get param blocks in wrong procedure integrations 2018-10-23 15:14:30 -04:00
Michael "Z" Goddard
ef4045aaf1
Merge pull request #1642 from mzgoddard/set-procedure-param-defaults
Set procedure param defaults
2018-10-23 15:13:16 -04:00
Michael "Z" Goddard
5e5655c916
Merge pull request #1632 from mzgoddard/stop-other-sounds
Stop other sounds
2018-10-23 15:11:08 -04:00
Ray Schamp
b47912dce4 Store asset objects on costumes and sounds
Stop using storage for in-memory storage, and keep these on the vm objects. Towards https://github.com/LLK/scratch-vm/issues/1577
2018-10-23 11:10:50 +01:00
Michael "Z" Goddard
c986d0cf23
test that broadcast_and_wait can yield and continue in the same tick 2018-10-19 16:37:33 -04:00
DD
91e2f3a935 Revert 1643 Confirm extension in use in sb2 serialization 2018-10-18 11:06:13 -04:00
Katie Broida
899ce56214
Confirm extension in use in sb2 serialization (#1643)
Add a check when serializing sb2 projects to see whether an extension is actually in use in a block or a visible monitor.
2018-10-17 10:49:08 -04:00
Michael "Z" Goddard
2b257dde57
add getProcedureParamNamesIdsAndDefaults
Use getProcedureParamNamesIdsAndDefaults to get the defaults along with
names and ids so defaults may be set for a procedure call if the
parameter is not provided.
2018-10-16 16:31:45 -04:00
Michael "Z" Goddard
ca38fb2cc3
add recursive procedure default parameter execute integrations 2018-10-16 16:31:45 -04:00
Andrew Sliwinski
23f6346045
Merge pull request #1631 from mzgoddard/stop-other-asks
Stop other asks
2018-10-15 13:16:49 -04:00
jokebookservice1
341bd8f3d3
feat: Allow switching to specially named backdrops
The `switch costume` block accepts special values like "next costume" and
"previous costume". If you create a costume with these names, these take
priority over the special values. However, the `switch backdrop` block
keeps these special values for values like "next backdrop", "previous
backdrop", "random backdrop". It is impossible to navigate to such a
backdrop by name via block. This commit also modifies tests to allow for
this.

BREAKING CHANGE: specially-named backdrops can now be navigated
2018-10-10 20:06:54 +01:00
jokebookservice1
1a7ce093c3
style(blocks_looks.js): add semicolon/space 2018-10-10 19:39:57 +01:00
jokebookservice1
f2a46098ab
refactor: move helper functions for tests
Move the helper functions `testCostume` and `testBackdrop` outside of
their test definitions. In addition, define the latter in terms of the
former.
2018-10-10 19:20:03 +01:00
jokebookservice1
c90e033148
test: add more comments, add additional test 2018-10-10 18:16:58 +01:00
Michael "Z" Goddard
42570293d6
add sensing getAttributeOf with Stage alternate name integration 2018-10-09 11:29:20 -04:00
Michael "Z" Goddard
4d56dd3872
ask and wait units should define target.sprite 2018-10-05 16:42:46 -04:00
Michael "Z" Goddard
ecf9a359e2
fix inaccuracy in 760 unit regression test 2018-10-05 16:34:01 -04:00
Michael "Z" Goddard
533109541b
add broadcast and wait integration that ensures it yields a tick 2018-10-05 16:33:56 -04:00
Michael "Z" Goddard
f1af5b5e99
add order changing broadcast and wait with same message integration 2018-10-05 14:54:02 -04:00
Michael "Z" Goddard
afc546077e
add execution order execute integration tests
- rename order-clones-2 -> order-clones-static-2
2018-10-05 13:26:05 -04:00
Michael "Z" Goddard
a22b74e6cb
Merge pull request #1617 from mzgoddard/execution-order
Sprite clone and initial draw order execution order
2018-10-05 13:25:22 -04:00
Andrew Sliwinski
853de9fa7d
Merge pull request #1593 from joker314/fix/compare-strings
Fix locale-dependant string comparison operators to match 2.0
2018-10-04 14:38:40 -04:00
Andrew Sliwinski
e024b7d369
Add case from GH-1526 to unit test suite 2018-10-04 14:36:44 -04:00
Michael "Z" Goddard
574749bbba
add STOP_FOR_TARGET runtime event and respond for ask blocks
Remove questions for targets that are individually stopping and
progress the asked question if it is from a stopping target.
2018-10-03 10:38:14 -04:00
Michael "Z" Goddard
dec0cd10df
add execution order execute integration tests 2018-10-03 10:35:24 -04:00
Andrew Sliwinski
7a28d5e41d
Merge pull request #1586 from mzgoddard/variable-id-type
conflict workaround for variables and lists of the same name
2018-10-01 18:27:59 -04:00
Michael "Z" Goddard
8c98000caf
add execute integration masked variable and list test 2018-09-27 11:57:24 -04:00
Chris Willis-Ford
c541e87da5
Merge pull request #1587 from cwillisf/util_token-bucket
Add a rate-limited task queue utility
2018-09-19 10:48:04 -07:00
Ray Schamp
416377ad2d
Merge pull request #1594 from rschamp/renderer-getter
Add API for the attached renderer
2018-09-18 16:11:53 -04:00
Ray Schamp
6c94c85c9a Add API for the attached renderer
Resolves #1281
2018-09-18 15:47:47 -04:00
Karishma Chadha
0ad59d3859
Merge pull request #1563 from mzgoddard/get-param-condition-input
Get param condition input
2018-09-18 15:29:43 -04:00
jokebookservice1
bbefc18158
test: correct typo for function name 2018-09-17 23:25:40 +01:00
jokebookservice1
460b1745be
test: Ensure less-than compares well 2018-09-17 23:12:30 +01:00
Christopher Willis-Ford
69ba2045fe Rename TokenBucket to TaskQueue 2018-09-14 22:34:34 -04:00
Christopher Willis-Ford
70c6ad4ef1 Add cancelAll method to clear the task queue 2018-09-14 22:10:17 -04:00
Christopher Willis-Ford
33e0197ad5 Add tests for TokenBucket 2018-09-13 17:05:00 -04:00
Chris Willis-Ford
8977ce1e93
Merge pull request #1565 from cwillisf/extension-monitors
Extension monitors
2018-09-12 18:10:12 -04:00
Christopher Willis-Ford
2a13697621 Add tests for getLabelForOpcode 2018-09-12 17:23:01 -04:00
Karishma Chadha
91d2663c35
Merge pull request #1564 from mzgoddard/monitor-rename
Rename Stage object and Stage monitors together
2018-09-12 12:11:45 -04:00
Michael "Z" Goddard
cbb79c40ad
add monitors-stage-name test
Test that an sb2 with a stage name other than Stage and a monitor on
one of its variables is able to load.
2018-09-11 15:10:14 -04:00
Michael "Z" Goddard
18c565794e
support execute integration tests with monitor threads
Do not count monitor threads towards the "active" number of threads.
The test is complete when there are no non-monitor threads running.
2018-09-11 15:10:14 -04:00
Michael "Z" Goddard
d8309e9d24
add execute integration procedures-boolean-reporter-bug test 2018-09-07 19:06:18 -04:00
Evelyn Eastmond
ec432e3b2f Refactor for hardware extensions (#1555)
* Beginning refactor: renaming 'device' to 'peripheral', shortening function names, reordering functions, etc.

* Continuing refactoring: renaming some functions to be more verbose in the runtime, adding JSDocs, etc.

* Changing 'device' to 'peripheral', etc.

* Changing 'session' to 'socket'.

* Fixing EV3 menus and menu arg validation, reordering functions, etc.

* Add _send, add some references to documentation, etc.

* Factored out _outputCommand and _inputCommand, renamed some enums, etc.

* Fixed _outputCommand, some other minor cleanup.

* Make _outputCommand and _inputCommand public.

* Added TODO.

* Renamed BLE UUID enums to be clearer.

* Change WeDo2 in comments to WeDo 2.0, etc.

* Changed some WeDo2Motor command names, cleaned up some JSDocs.

* Beginning a major EV3 refactor.

* WeDo2 formatting and comment changes.

* Motor refactoring in EV3: motorTurnClockwise and motorTurnCounterClockwise initial working state.

* Add reminders to possibly cast motor menu args in WeDo2.

* Continue to move motor commands in EV3 to EV3Motor class, don't create new EV3Motor on every poll cycle, etc.

* Factoring EV3 polling value commands, etc.

* Fixing EV3 motor power, position and button pressed, and some commenting, etc.

* Move EV3 motor position parsing to EV3Motor class, move directCommand and directCompoundCommand functions, some commenting, etc.

* Changed WeDo2 motor label enum name.

* Removed some EV3 motor functions that aren't needed, changed menu label enum names, moved some opcodes up to enums.

* Fixing comments and documentation.

* Some commenting.

* Adding further documentation and references to PDFs, changed reply check to be safer, etc.

* Some comment changes.

* Moving some functions around in EV3 and WeDo2 to match.

* Commenting, etc.

* Some renaming of session, etc.

* Fix stopAllMotors in EV3.

* Fixing clearing of motors in EV3.

* Some comment changes.

* Change runtime .extensions/registerExtension to .peripheralExtensions/registerPeripheralExtension.

* Renaming outputCommand/inputCommand to generateOutputCommand/generateInputCommand, etc.

* Moved motorCommandIDs to EV3Motor class, renamed directCommand to generateCommand, etc.

* Adding a reminder to rename something.

* JSDoc fix in EV3Motor class.

* Fixing microbit function name.

* Adding a todo item.

* Changing Ev3 menu formats to be backwards compatible, moving a BLE function up.

* Fixing EV3 ports again, and button pressed returning a boolean.

* Fixing menu value to be a string in EV3.
2018-09-07 17:01:23 -04:00