Commit Graph
185 Commits
Author SHA1 Message Date
GarboMuffin cb2eba9eb3 Document and test that saveProjectSb3DontZip does not copy asset buffers 2023-01-12 03:56:06 -06:00
GarboMuffin b020a60739 Add saveProjectSb3Stream 2023-01-05 16:34:45 -06:00
GarboMuffin 451d9c1d0c Add tests for saveProjectSb3DontZip 2023-01-05 16:33:19 -06:00
GarboMuffin b1313e1ce2 Add type option to saveProjectSb3 2023-01-05 16:33:03 -06:00
GarboMuffin e8fc44e92a Add snapshot tests with warp timer enabled 2022-12-07 10:26:20 -06:00
GarboMuffin 971219fd0c Differentiate modified input and unexpected output errors in snapshot tests 2022-12-06 20:46:28 -06:00
GarboMuffin 1ca4ce5cc8 Move snapshot tests to test/snapshot 2022-12-06 20:24:01 -06:00
GarboMuffin 2e4e67b1f0 Implement primitive compiler output snapshot testing
If the compiler's type analysis becomes smarter, being able to show that
its output matches what is expected will become more important. Snapshot
testing is how we will solve that.
2022-12-03 02:16:36 -06:00
GarboMuffin bc24d05d0b Parse saved extension in ScratchX (.sbx) projects
They are treated the same as the list we store in .sb3 projects
2022-11-21 22:54:13 -06:00
GarboMuffin 2b265e55a0 Disable private skin access when cloud variables or custom extensions are used
This is a breaking change.
Replaces logic that was previously in our scratch-gui fork.
Upstream does the opposite; they disable cloud variables when video
sensing is used. We can't do the same because of custom extensions.
Disabling all custom extensions when video sensing is used would be too
limiting. The concern with custom extensions is not that they will steal
private skins, but that a project could use their blocks to fetch()
color information to a remote server similar to cloud variables.
The end result is not dissimilar: Cloud variables and video sensing
shouldn't be used together.
2022-11-16 20:52:31 -06:00
GarboMuffin 83d72053a7 Fix repeated util.yield() in interpreted addon blocks 2022-11-12 11:33:44 -06:00
GarboMuffin 30a47a2b39 Allow addon blocks to be hidden 2022-11-12 01:09:25 -06:00
GarboMuffin c7309b96ab Remove addon block color parameters
The parameters didn't work in the way that you would expect. Only the
values provided in the first call to addAddonBlock would do anything,
and this gives a false impression that this will color the blocks in the
editor. Color options may be re-added in the future as part of a more
significant API update.
2022-11-12 01:08:09 -06:00
GarboMuffin 0fd98a6ac5 Allow addon block callback to return a Promise 2022-11-12 01:08:09 -06:00
GarboMuffin 4eafaf573b Reimplement addon blocks with the compatibility layer
callAddonBlock is removed. executeInCompatibilityLayer is used instead.
Notably this makes all the block utility control flow work in the compiler.
2022-11-12 01:08:09 -06:00
GarboMuffin a1904b022b Replace addAddonBlock callback 2nd argument with BlockUtility
Documentation says it should be BlockUtility but in reality it was
something that mimicked a Thread.
This is a breaking change.
2022-11-12 00:07:17 -06:00
GarboMuffin 688b257f7c Add tests for addAddonBlock 2022-11-11 23:33:43 -06:00
GarboMuffin ae7526f156 Merge branch 'extensions-update' into develop
This adds a new mode of custom extension that runs outside of any
sandbox -- they're just <script> tags. This is disabled by default and
needs explicit opt-in. Documentation will be written later.

This also will save the URLs of the loaded custom extensions to
project.json when serializing a project. When deserializing a project,
this list can be read to automatically load the extensions. This, again,
is disabled by default and requires explicit opt-in.

A new mechanism called the SecurityManager was added to the extension
manager to facilitate these new features. This replaces workerMode and
is a breaking change.

Various other custom extension related changes were also added:
 - Reject invalid URLs in loadExtensionURL
 - Various cleanup and refactoring
2022-10-29 22:55:08 -05:00
GarboMuffin dcc0d961d7 Automatically load custom extensions saved in project
Requires disabled-by-default security manager configuration
2022-10-22 22:02:30 -05:00
GarboMuffin 1e35432db0 Update format for saving custom extensions
Use a dictionary instead. Lets the VM that loads it possibly do some clever things.
Also added a test case.
2022-10-22 21:38:06 -05:00
GarboMuffin b31ca10082 Don't serialize hidden monitors from extensions
Replace our specific tw_getLastKeyPressed hack with a general solution
https://github.com/LLK/scratch-vm/issues/2331
2022-10-22 18:51:16 -05:00
GarboMuffin 6db9599f2e Do not use md5 to generate asset IDs in packaged runtime mode
md5 unnecessary in this mode and slows project load by ~10%.
2022-08-05 00:18:09 -05:00
GarboMuffin 1bfc83e666 Use storage.createAsset instead of new storage.Asset in tests 2022-08-05 00:17:53 -05:00
GarboMuffin 9815a27470 Remove references to original asset in packaged runtime mode 2022-08-05 00:17:53 -05:00
GarboMuffin 73c0261480 Test that the center given to the renderer is what's stored in the SVG 2022-08-02 00:06:43 -05:00
GarboMuffin 458b9b7aad Allow rotation center preservation in exported SVGs
Requires additional changes in scratch-gui
2022-08-01 23:50:50 -05:00
Thomas Weber 09df19b60b Add test for edge activated hat returning promise
Adds test for bug fixed in
3062334108
2022-07-09 16:32:28 -05:00
Thomas Weber 25e81a4f67 Allow importing simple ScratchX (.sbx) project files
Extends .sb2 importer to convert extension blocks from ScratchX project files
(.sbx) to the format we require.
This doesn't automatically load extensions; they still must be loaded manually.
2022-07-08 22:24:33 -05:00
Thomas Weber 7a4fb5db1d Update some TW: comments in some tests 2022-05-28 18:51:29 -05:00
Thomas Weber 895321d2f3 Increase test timeout for some tests 2022-05-26 15:48:43 -05:00
Thomas Weber 5f30a80a8c Fix more test timeout errors 2022-05-26 15:34:43 -05:00
Thomas Weber 16b146ec08 Fix broken tests due to timeouts 2022-05-26 15:21:41 -05:00
Thomas Weber 20de0556d2 Merge branch 'develop' of https://github.com/llk/scratch-vm into develop 2022-05-26 14:53:37 -05:00
Thomas Weber fe6bea498d Merge branch 'develop' of https://github.com/llk/scratch-vm into develop 2022-05-23 19:01:17 -05:00
Karishma Chadha 2ff83ce667 Add tests for missing and corrupt pngs in sb3 and sprite3 files 2022-05-23 19:54:45 -04:00
Karishma Chadha 3e193565ee Hook up error handling to bitmap loading flow and add tests for loading missing and corrupt bitmpas from sb2 and sprite2 files 2022-05-23 19:54:45 -04:00
Karishma Chadha 59f3c8afe9 Add sb2 and sprite2 tests for a corrupted vector costume 2022-05-21 19:51:29 -04:00
Karishma Chadha 28c6daaaf7 Mock bitmap loading and add sb2 and sprite2 tests for a missing svg costume 2022-05-21 19:51:29 -04:00
Karishma Chadha 8ab21dd701 Handle error from sound failing to load (e.g. corrupted sound) 2022-05-19 17:45:27 -04:00
Karishma Chadha 4679d06ac0 Update storage and update 'loadSound' to handle null asset from storage. Track additional metadata for broken costumes: 'bitmapResolution' and 'dataFormat'. 2022-05-18 21:26:36 -04:00
Karishma Chadha 11f938f8a9 Update to latest version of storage which fixes issue where an HTML 404 page was being returned for missing asset data. Update VM to handle null assets properly. 2022-05-18 16:55:46 -04:00
Karishma Chadha 8b9ce99762 Add tests that serializing a costume does not save any data for assets that were missing when the project was first loaded 2022-05-16 17:33:21 -04:00
Karishma Chadha 70a78cf7db Add tests for load costume error handling. Fix issue where asset data was not getting saved out properly. 2022-05-13 19:07:34 -04:00
Thomas Weber 238de64bd8 Re-enable cloud_variables_sb2.js tests
These were supposed to have been re-enabeld a while ago
2022-05-13 17:06:49 -05:00
Thomas Weber 5907ab0103 Reset cloud variable limit to 10 for compatibility reasons
We don't want people to make a project in TW with 20 cloud variables and then have issues importing it to Scratch.
The packager, which has no limit, will convert any variable that starts with ☁ to a cloud variable, so this can be worked around.
2021-12-30 16:26:16 -06:00
Thomas Weber d28fb098d4 Fix tests 2021-12-13 17:01:27 -06:00
Thomas Weber e969ae55c5 Merge branch 'develop' of github.com:LLK/scratch-vm into develop 2021-10-30 15:43:29 -05:00
Thomas Weber 75a23e54c8 Disable intentionally broken tests 2021-08-03 16:26:22 -05:00
adroitwhiz 3c9f7557f5 Replace new Buffer() with Buffer.from()
This removes the deprecation warnings logged when tests are run.
2021-03-07 16:21:06 -05:00
Thomas Weber 66f8fc19a3 Remove tw from CORE_EXTENSIONS, let GUI load it 2021-01-29 18:03:54 -06:00