Commit graph

653 commits

Author SHA1 Message Date
Christopher Willis-Ford
ea03db5fec
Merge pull request #3685 from cwillisf/fix-execute-tests
Fix "execute" integration tests
2023-03-09 15:14:30 -08:00
Andy O'Neill
2581446907 feat: ability to clear flyout blocks when language changes 2022-12-14 11:03:12 -05:00
Christopher Willis-Ford
e4f7732efb test(execute): allow *.sb and *.sb3 'execute' tests 2022-07-06 13:35:38 -07:00
Christopher Willis-Ford
281a3e256a test: fix flaky test execute/order-changes-backwards-2-broadcast-and-wait-repeat-message.sb2
Before: sprite 3 uses the `wait` block to wait for the other two sprites
to finish. After the `wait` blocks, sprite 3 sends "end" to the test. If
the sprites take too long to finish, they might not be done before the
"end" message.

After: sprite 3 sets a variable called `finished` to zero on startup,
and increments it every time it hears a new message. Each sprite sends
that new message once it's done. When sprite 3 notices that `finished >=
2`, it sends the "end" message.
2022-07-06 13:18:45 -07:00
Christopher Willis-Ford
8fbf3b465e test: temporarily skip flaky order-changes-backwards-2-broadcast-and-wait-repeat-message.sb2 2022-07-06 09:41:56 -07:00
Christopher Willis-Ford
e2f96762de test(clone-cleanup): go back to using an SB2
Part of the motivation for this test is to verify compatibility with
Scratch 2.0 / SB2 behavior, so we shouldn't change the project to an SB3
file without very good reason.
2022-06-10 10:14:17 -07:00
Christopher Willis-Ford
d8fc81a8b5 test(execute): try to make 'execute' test more reliable 2022-06-07 14:55:38 -07:00
Christopher Willis-Ford
52252bd1cb test(wait): make the wait block test reliable under CPU load
Sometimes load causes the VM to run more slowly, especially with
parallel tests. This change allows the wait block a little extra wiggle
room to account for that. Ending early is still tested with a fairly
strict threshold.
2022-06-07 11:44:06 -07:00
Christopher Willis-Ford
840ffb5df0 test: don't use process.exit to end tests
Newer versions of `tap` run more asynchronously, so sometimes using `process.nextTick(process.exit)`
to end a test would prevent the test from completing correctly. Removing all instances of
`process.nextTick(process.exit)` put tests into three categories:
* the test still worked correctly -- no fixup needed.
* the test would hang because the VM's `_steppingInterval` was keeping
  Node alive. These tests call a new `quit()` method which ends the
  stepping interval.
* the `load-extensions` test needed special attention because the "Video
  Sensing" extension starts its own loop using `setTimeout`. I added a
  `_stopLoop()` method on the extension and directly call that from the
  test. I'm not completely happy with this solution but anything more
  general would likely require a change to the extension spec, so I'm
  leaving that as a followup task.
2022-06-07 11:44:06 -07:00
Christopher Willis-Ford
605b1c2386 test(clone-cleanup): improve clone-cleanup test reliability
Previously the test relied on the project's `wait` blocks running at roughly real time. Now, the
project drives the timing using `say` blocks.
2022-06-07 11:44:06 -07:00
Christopher Willis-Ford
05f8692300 test: upgrade tap, configure coverage thresholds
As part of simplifying the CI setup I plan to not explicitly specify
`--jobs=4` to `tap` going forward. Upgrading to a newer version of `tap`
means that it will automatically parallelize jobs according to available
CPU count, which should be better anyway. Only one of our tests was
incompatible with newer versions of `tap`, so this commit includes a
compatibility fix there.

Also, by default newer versions of `tap` calculate coverage and consider
the test run to fail if below the configured thresholds. The default is
100% coverage and we're not there, so I adjusted the thresholds to match
where we're at for now. We can ratchet those up over time.
2022-06-07 11:44:06 -07: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
8cf390d2b5 Fix typo 2022-05-16 17:11:55 -04:00
Karishma Chadha
1dfaa02c97 More code cleanup from PR review 2022-05-16 16:23:41 -04:00
Karishma Chadha
fd31a777e2
Code clean up from code review
Co-authored-by: Christopher Willis-Ford <7019101+cwillisf@users.noreply.github.com>
2022-05-16 16:07:08 -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
Karishma Chadha
2d6cce5f7f
Merge pull request #2936 from adroitwhiz/remove-new-buffer
Replace `new Buffer()` with `Buffer.from()`
2021-10-27 13:59:05 -04:00
Eric Rosenbaum
7a2393bd56 test not serializing origin if it is not present 2021-05-04 20:29:31 -04:00
Eric Rosenbaum
fb09f9cbb9 test serializing origin 2021-05-04 15:36:03 -04:00
Eric Rosenbaum
8483c1a467 add test of deserializing origin 2021-05-04 15:29:36 -04: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
DD Liu
7eabcb8a29
Merge pull request #2329 from adroitwhiz/remove-updatedrawableproperties
Remove remaining updateDrawableProperties calls
2020-09-24 15:50:26 -04:00
Eric Rosenbaum
9329f93e74
Merge pull request #2557 from ericrosenbaum/broadcast-wait-var-change-fix
Prevent "broadcast and wait" being interrupted by a change to its input
2020-09-16 17:52:28 -04:00
DD Liu
7c652246df
Merge pull request #2356 from adroitwhiz/cast-to-black
Cast malformed color hex strings to RGBA 0,0,0,255 instead of null
2020-09-03 15:52:52 -04:00
Eric Rosenbaum
f103094cff update test 2020-08-12 13:21:19 -04:00
Eric Rosenbaum
04a2b50fee add test 2020-08-12 11:22:01 -04:00
apple502j
9bed114e48 Use new updateCPURenderAttributes in video sensing 2020-08-01 00:09:53 +09:00
Chris Willis-Ford
a9f473feb6
Merge pull request #2476 from cwillisf/fix-extension-url
sanitize extension ID in getExtensionIdForOpcode
2020-07-14 11:47:02 -07:00
Eric Rosenbaum
45c95f3370 Move test 2020-06-23 17:13:11 -04:00
Eric Rosenbaum
60aeebf668 Test that clock is reset on runtime dispose 2020-06-22 11:56:10 -04:00
Eric Rosenbaum
540d9c676c
Merge pull request #2341 from apple502j/patch-9
Clear some stats when disposing runtime
2020-06-22 10:25:41 -04:00
Christopher Willis-Ford
90b9da45f4 sanitize extension ID in getExtensionIdForOpcode 2020-06-15 17:59:15 -07:00
adroitwhiz
fe6b07acca Consistently format text bubbles 2020-06-09 13:28:58 -04:00
apple502j
03db30d400 Update sensing_of fields if variable gets renamed
Thanks @adroitwhiz and @fsih for some advice!
2020-05-22 19:00:43 +09:00
Chris Willis-Ford
7af161f1a2
Merge pull request #2011 from joker314/fix/random-costume
Give all backdrops a more equal chance of being randomly picked
2020-05-19 13:11:38 -07:00
adroitwhiz
05dcbc176f Remove RenderedTarget.setSay + its test 2020-05-18 01:35:32 -04:00
Joke Book
15d97ccaa7 End randIntWithout test case with t.end() 2020-05-07 16:38:45 +01:00
Joke Book
8700a70262 Fix randIntWithout test case 2020-05-07 16:37:01 +01:00
Joke Book
e5cc0e302d Use correct denominator in randIntWithout test 2020-05-07 16:28:50 +01:00
jokebookservice1
57445a4d49
Merge branch 'develop' into fix/random-costume 2020-05-07 16:11:08 +01:00
adroitwhiz
cbe912e1be Add malformed hex RGB color *list* test 2020-05-01 15:06:52 -04:00
adroitwhiz
277a355ce4 Add unit test for malformed hex color string cast 2020-05-01 14:50:39 -04:00
DD Liu
f5ce73ae51
Merge pull request #2314 from adroitwhiz/dont-update-rotation-center
Remove calls to updateDrawableSkinIdRotationCenter
2020-04-02 14:23:02 -04:00