Commit Graph

1427 Commits

Author SHA1 Message Date
Nathan Adams 238b25daf5 tests: Add avm2/displacement_map_filter test for swf->core->avm2 and avm2->core->avm2 testing 2023-02-28 16:25:12 +01:00
Nathan Adams 30a114a441 tests: Add avm2/convolution_filter test for swf->core->avm2 and avm2->core->avm2 testing 2023-02-28 16:25:12 +01:00
Nathan Adams ec605db19c tests: Add avm2/color_matrix_filter test for swf->core->avm2 and avm2->core->avm2 testing 2023-02-28 16:25:12 +01:00
Nathan Adams aabfc6c9c0 tests: Add avm2/blur_filter test for swf->core->avm2 and avm2->core->avm2 testing 2023-02-28 16:25:12 +01:00
Nathan Adams e240bf8472 tests: Add avm2/bevel_filter test for swf->core->avm2 and avm2->core->avm2 testing 2023-02-28 16:25:12 +01:00
Aaron Hill 54eb6e33ca avm2: Ignore XML comments and processing instructions by default
This matches the default value of the settings on XML.
2023-02-27 15:53:39 -06:00
Aaron Hill 82d03b4062 avm2: Ignore XML declaration and doctype
These are completely ignored by AVM2
2023-02-27 13:41:18 -06:00
Aaron Hill c04b463f1f avm2: Implement XML.children, XMLList.children, and related methods 2023-02-27 13:25:16 -06:00
Aaron Hill 7f58b92348 avm2: Implement encodeURI and encodeURIComponent 2023-02-27 12:40:39 -06:00
Nathan Adams cfcd257932 avm2: Xml(foo) converts foo to string 2023-02-27 17:37:28 +01:00
Aaron Hill f9fc4b3179
avm2: Store interfaces from superclases/superinterfaces in ClassObject (#9728) 2023-02-25 23:57:50 +00:00
Aaron Hill c7709dffec avm2: Handle Event::CData when parsing XML 2023-02-25 17:26:31 -06:00
Adrian Wielgosik 8bdf215462 avm2: Add a test for box-then-to-bool bug 2023-02-25 23:31:17 +01:00
Aaron Hill b26f2fd6fb
avm2: Initial incomplete implementation of XML (#9647) 2023-02-25 20:06:36 +00:00
EmperorBale 216bb1bb28 tests: Add test for duplicate definitions 2023-02-24 11:55:58 -08:00
Nathan Adams edd7f80341 wgpu: Fix blown out colors when transforming them above 100% - fixes #9698 2023-02-24 19:01:41 +01:00
Aaron Hill 455124d3ba render: Fix blending onto BitmapData contents
When rendering to an offscreen texture for `Bitmapdata.draw`,
we first render to a temporary frame buffer, and then copy the contents
of the frame buffer back to the target texture. However, this results
in blend modes being incorrectly applied - for example, rendering with
BlendMode.SUBTRACT will subtract against the framebuffer (which starts
with each pixel as 0x00000000), instead of the previous BitmapData
contents.

To fix this, we now use our texture target as the frame buffer
when performing `render_offscreen`. This ensure that we blend
over existing pixels (taking into account the `blendMode` provided
in the `BitmapData.draw` call).

When multisampling is enabled, we use a copy pipeline to copy
the existing contents of our texture to a fresh multisampled frame
buffer (the non-multisampled texture target becomes our resolve buffer).
2023-02-23 09:52:56 -06:00
Nathan Adams e17b154d47 avm2: Iterate the inheritance chain for class-symbol linkage 2023-02-22 22:27:13 +01:00
Aaron Hill c258423dc3 avm2: Allow resolving interfaces before ClassObjects are available
The Adobe Animate compiler can emit a 'newclass' opcode for
a concrete class before the 'newclass' opcodes for the interfaces
it implements. As a result, we cannot rely on looking up an interface
`ClassObject` when resolving a class's interfaces.

We now store a map of exported classes in `Domain`, and use this
to lookup interfaces before their `ClassObject`s have been created.

Additionally, `link_interfaces` was failing to consider superinterfaces,
which meant that methods from superinterfaces were not being copied
into the vtable. I've fixed this along with the other changes.
2023-02-22 14:41:01 -06:00
Bale 2cfa97e84d
avm2: ByteArray.readUTF/readUTFBytes should cut off after null byte (#9673)
* avm2: Fix #9668

* tests: Extend ByteArray test
2023-02-22 18:47:59 +00:00
Nathan Adams a550c877f6 tests: Update avm2/simplebutton_constr_params test to check the button on frame 2 2023-02-22 18:49:04 +01:00
Nathan Adams aef466f8f3 avm2: Implemented BitmapData.drawWithQuality 2023-02-22 17:36:55 +01:00
Lord-McSweeney 74640ed44e
tests: Remove ^M characters from Dictionary tests (#9656)
* Remove ^M characters from Dictionary test

Using Github's automatic line ending conversion to CRLF.

* Remove ^M characters from dictionary_delete test

* Remove ^M characters from dictionary_in test
2023-02-22 09:57:50 +02:00
nosamu 1e2ab9cd0e tests: Add new clipDepth test 2023-02-21 16:39:42 +02:00
EmperorBale fa6d01c505 tests: Extend `movielcip.gotoAndPlay` test 2023-02-17 18:46:43 -08:00
EmperorBale 46bd6bbee9 tests: Add test for scopechain resolution order 2023-02-18 01:37:12 +01:00
CUB3D f7b0c021a9 avm1: The this property should be mutable 2023-02-17 14:39:10 -06:00
Aaron Hill 4149913967
core: Introduce dedicated avm2 mouse picking logic (#9565)
The mouse picking behavior in AVM2 interacts in complicated
ways with `mouseEnabled` and `mouseChildren.` It's sufficiently
different from AVM1 that I decided to split the logic into separate
`mouse_pick_avm1` and `mouse_pick_avm2` methods.

The `mouseChildren` property is now fully implemented.
Additionally, the `click_block` tests now work correctly
under Ruffle.

Combined with the orphan-movie PR, this is enough to make
SteamBirds fully playable (though performance greatly degrades
over a course of a level).
2023-02-17 19:04:52 +00:00
TÖRÖK Attila c9864bbeb4 tests: Require the "mp3" feature of core as well, just to be sure. 2023-02-16 06:23:35 +01:00
TÖRÖK Attila 0e1bddff65 tests: Fix build when running from inside the `tests` folder. 2023-02-16 06:23:35 +01:00
Aaron Hill 4e25a4fcae avm1: Add ignored test for strange rewind behavior
Ruffle doesn't correctly remove certain objects from the stage
when processing an AVM1 rewind goto.
2023-02-15 15:21:29 -06:00
EmperorBale 1e12f2d49b tests: Add test for finddef opcode 2023-02-14 14:22:02 -08:00
TÖRÖK Attila 35e21ce51d tests: Add a regression test for SoundMixer.computeSpectrum() 2023-02-14 18:47:33 +01:00
TÖRÖK Attila 4d0fee0cf8 tests: Add TestAudioBackend, used only on request 2023-02-14 18:47:33 +01:00
Adrian Wielgosik 5eb887c628 avm2: Stub describeType to have .@name work 2023-02-13 23:55:00 +01:00
Aaron Hill a52a41de97 core: Fix stageX and stageY getters for MouseEvent
These getters were previously calling `local_to_global`
with the unused localX/localY coordinate set to 0. Howver,
`local_to_global` does a matrix multiplication, which in general
will depend on both the x and y values. This was causing the getters
to return incorrect results when any of the `transform.matrix` values
included a non-diagonal matrix.

We now call `local_to_transform` with the real `localX` and `localY`
values.
2023-02-13 21:19:20 +01:00
Aaron Hill c597f9f996 core: Fix Clippy lints on nightly 2023-02-13 03:38:54 +01:00
Bale 73e9fd55fb
avm2: Make sure scripts get initialized after all scripts have been loaded when lazy init is disabled (#9478)
* avm2: Initialize scripts **after** all scripts have been loaded

* tests: Add test for eager initialization
2023-02-11 00:38:38 +00:00
Aaron Hill 4b76d1b32a
core: Support using URLVariables as a POST request body (#9489)
This is needed by the Newgrounds API. We don't have the ability
to make fake requests to HTTP urls in our test frameworks,
so I haven't added any tests for this. However, I tested locally
that this allows the Newgrounds API to work (and got a medal
in Cloud Wars).
2023-02-11 00:18:10 +00:00
nosamu a2cd3ee06e tests: Update fills_and_lines expected image 2023-02-10 23:43:01 +01:00
golfinq 37ec94f95b Avm2: Implement Stage.invalidate 2023-02-08 17:47:21 -07:00
Adrian Wielgosik 61a5161a20 avm2: Convert most errors in get/set/initproperty to AVM errors 2023-02-07 18:50:15 -06:00
Adrian Wielgosik c844d2ab6f avm2: Only store actually-passed arguments to 'arguments' 2023-02-07 18:35:30 -06:00
Nathan Adams dff558170e avm2: Implement BitmapData.getPixels() 2023-02-07 19:10:25 +01:00
Nathan Adams 43d9c3deed avm2: Make sure SoundChannel.soundTransform always returns a value 2023-02-07 18:26:27 +01:00
Nathan Adams bc7773596b avm2: addFrameScript allows null to unset the script, and only allows one script per frame 2023-02-07 18:26:27 +01:00
CUB3D 48f4df51a5 avm1: Correct depth calculation for AVM1 clips pending removal and add tests 2023-02-06 10:53:45 -07:00
CUB3D 6b6e07c7cb test: Update unload fla 2023-02-06 10:53:45 -07:00
CUB3D 2d11a250da avm1: Retrieving the child of a container should prioritise lowest depth 2023-02-06 10:53:45 -07:00
CUB3D a356be15fe avm1: Only delay removals on AVM1, check for dynamic unload handlers 2023-02-06 10:53:45 -07:00
CUB3D 755425ebfa avm1: Delay clip removals when a child has an unload listener
When removing a clip, first check if it has an unload event listener somewhere
it's hierarchy.
If it does, enqueue the removal to happen on the next frame, by moving it to a negative depth.
2023-02-06 10:53:45 -07:00
Nathan Adams a220703618 core: Made PlayerBuilder take quality instead of setting it after the Player was made 2023-02-06 16:08:04 +01:00
Nathan Adams 1cb3ea7bf9 wgpu: Store quality, not sample_count, and calculate the correct sample count per format 2023-02-06 16:08:04 +01:00
Nathan Adams 00c7e8f634 avm2: Fixed bytearray compress/decompress methods setting position of resulting bytearray 2023-02-05 19:22:01 +01:00
Nathan Adams e73389aa71 wgpu: Implement blur filter 2023-02-05 18:41:43 +01:00
Nathan Adams 284a58c817 avm2: Implement BitmapData.apply_filter for ColorMatrixFilter 2023-02-05 18:41:43 +01:00
Nathan Adams 5e2f1a66eb tests: Enable tests that no longer need to be ignored 2023-02-04 15:26:45 -06:00
Nathan Adams 06361ce01d tests: Add overlay_onto_stage test to ensure blend buffers are cleared before use 2023-01-29 20:45:01 +01:00
Moulins e36b03bce9 core::html: correctly encode text in FormatSpans::to_html
Fixes issue #9327
2023-01-29 11:19:16 -06:00
CUB3D f829157deb avm1: Defining a local that already exists on the target of a with scope, defines it on the target not the parent 2023-01-29 18:05:25 +01:00
Nathan Adams 7b1c101c81 wgpu: Fix repeat & reflect gradients 2023-01-29 17:17:44 +01:00
Nathan Adams 85dc100ee9 avm2: Implement Sprite.dropTarget - though it's wrong right now 2023-01-29 00:52:52 +01:00
Nathan Adams d918d47f66 tests: Temporarily remove EditText from text_blocks_clicks as it's broken in ruffle atm 2023-01-29 00:39:06 +01:00
Nathan Adams 8108e64bfa tests: Add avm1 text_blocks_clicks test 2023-01-29 00:39:06 +01:00
Aaron Hill 184734267d tests: Deny unknown fields when deserializing test.toml files
This will catch typos and misplaced options when modifying tests.
2023-01-28 16:27:43 -06:00
Nathan Adams b14831417a tests: Added avm2 click_test test from #9287, ignored as it fails 2023-01-28 13:13:37 -07:00
Nathan Adams 666a55e503 tests: Added avm1 click_test test from #9287, ignored as it fails 2023-01-28 13:13:37 -07:00
Aaron Hill daeb132e53 tests: Handle trailing newlines more consistently
Previously, we would strip trailing newlines from the contents
of 'output.txt' files, and skip adding a trailing newline after
the final recorded `trace` call.

To reduce the amount of processing we do of expected/ruffle output,
and to make fpcompare tests easier, I've removed the special handling
of newlines. When recording `trace` calls, we now build up a single
large `String`, with a newline after every `trace` message. When
reading in an 'output.txt' file, we do not strip any newlines.

This required adding trailings newlines to lots of 'output.txt' files,
to match the behavior of Ruffle and Flash (the last 'trace' message
ends with a newline, just like every other 'trace' message).
2023-01-28 13:59:00 -06:00
Nathan Adams 48c9cdd5ad tests: Ported visual tests from ruffle-rs/visual-tests repo 2023-01-28 12:15:59 -07:00
Nathan Adams a6c6ae13fe tests: Adjust tolerance of existing image tests 2023-01-28 12:15:59 -07:00
Nathan Adams 051927775c tests: Clippy lint 2023-01-28 12:15:59 -07:00
Nathan Adams 9c4190b20b tests: Readd suffix to actual/difference files 2023-01-28 12:15:59 -07:00
Nathan Adams 67ec70d960 tests: Set default log filter to warn for wgpu 2023-01-28 12:15:59 -07:00
Nathan Adams cdb2c5fe04 tests: Allow image tolerance & max_outliers on image comparison tests. Changed all existing image tests to use 1 sample count since this changes them all anyway 2023-01-28 12:15:59 -07:00
Nathan Adams d70d9067ec tests: Fix clippy lints 2023-01-28 12:15:59 -07:00
Nathan Adams 4ef88eaaa0 tests: Fix imgchecks feature compiling 2023-01-28 12:15:59 -07:00
Nathan Adams c73aa5b9d5 tests: Add sample_count to render options 2023-01-28 12:15:59 -07:00
Nathan Adams cbe17c4455 tests: Filter early to avoid creating test info (and thus wgpu) for tests that won't run 2023-01-28 12:15:59 -07:00
Nathan Adams 9b43836d1d tests: Allow executing of with_renderer tests always, but image comparison is still gated 2023-01-28 12:15:59 -07:00
Nathan Adams 836468b6dd tests: Add player_options.with_renderer option, automatically set when image = true 2023-01-28 12:15:59 -07:00
Nathan Adams 6acf6009ef tests: Made PlayerOptions non optional (just empty default), and it works with a PlayerBuilder instead of a Player 2023-01-28 12:15:59 -07:00
Nathan Adams e614f788af tests: Refactor code so all testing goes through Test::test(), allows for approximations with custom hooks 2023-01-28 12:15:59 -07:00
Nathan Adams 8b02045c6b tests: Readd custom assert_eq 2023-01-28 12:15:59 -07:00
Nathan Adams a340318486 tests: Refactor runner methods to take in &Test and not direct values 2023-01-28 12:15:59 -07:00
Nathan Adams 56bc2b5051 tests: Added Test::should_run() 2023-01-28 12:15:59 -07:00
Nathan Adams dda8debadc tests: Move shared object tests to their own file 2023-01-28 12:15:59 -07:00
Nathan Adams 792d68d370 tests: Move TestLogBackend to runner 2023-01-28 12:15:59 -07:00
Nathan Adams 99da686822 tests: Move external interface tests to their own file 2023-01-28 12:15:59 -07:00
Nathan Adams ccc7c0a424 tests: Move ExternalInterfaceTestProvider to its own mod 2023-01-28 12:15:59 -07:00
Nathan Adams c5ab440083 tests: Move run_test(test) to Test::run() 2023-01-28 12:15:59 -07:00
Nathan Adams 6384034e47 tests: Move test_swf_with_hooks to util/runner 2023-01-28 12:15:59 -07:00
Nathan Adams ce8cb9501b tests: Move test_swf_approx to util/runner 2023-01-28 12:15:59 -07:00
Nathan Adams 818897b74e tests: Move run_swf to util/runner 2023-01-28 12:15:59 -07:00
Nathan Adams 4418431bfe tests: Move assert_eq to utils 2023-01-28 12:15:59 -07:00
Nathan Adams a741f373b4 tests: Take in a &Path for various paths 2023-01-28 12:15:59 -07:00
Nathan Adams 83af3e6b4e tests: Extract Test struct that contains all the info for a test 2023-01-28 12:15:59 -07:00
Nathan Adams ff8506d351 tests: Extract TestOptions::read() for parsing a file 2023-01-28 12:15:59 -07:00
Nathan Adams 316df5b415 tests: Extract TestOptions into its own file 2023-01-28 12:15:59 -07:00
Nathan Adams 7d234956eb tests: Move tests away from giant macro to individual test.toml files that describe the test 2023-01-27 13:53:43 +01:00
Aaron Hill 6fe7af58d5 Move back to upstream wgpu repository
We're relying on unreleased changes, so we depend on the latest commit
from their repository.
2023-01-23 11:31:04 +01:00
EmperorBale 954a7513f8 tests: Update date tests 2023-01-16 21:48:00 +01:00
Nathan Adams 8db8e4669a wgpu: Implement Multiply blend mode as a trivial blend 2023-01-12 10:54:03 -05:00
Nathan Adams 09608c2abc wgpu: Implement Screen blend mode as a trivial blend 2023-01-12 10:54:03 -05:00
dependabot[bot] b7986406a8 build(deps): bump regex from 1.7.0 to 1.7.1
Bumps [regex](https://github.com/rust-lang/regex) from 1.7.0 to 1.7.1.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.7.0...1.7.1)

---
updated-dependencies:
- dependency-name: regex
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-12 14:27:19 +02:00
MrCheeze d1b01c9db7 tests: Update AVM2 currentLabels test for case insensitivity 2023-01-10 11:28:56 -05:00
CUB3D ea6ea8074a tests: Add tests for BitmapData.threshold, fix issues found as a result 2023-01-10 13:59:06 +01:00
MrCheeze c2ad376e2c tests: Add test for AVM2 hitTestPoint (without shapeFlag) and hitTestObject.
This is a port of a similar regression test written for AVM1.
AVM1 also has a test for hitTestPoint with shapeFlag=true, but it can't
be ported for now, because the implementation of AVM2 hit testing is not
yet accurate enough for it.
2023-01-10 12:53:20 +01:00
Nathan Adams 7a9e8b4771 core: Made NullNavigatorBackend no longer use unwraps 2023-01-10 11:10:46 +01:00
CUB3D 84d0111a14 avm1: Add test for with scope nesting 2023-01-10 10:34:10 +01:00
CUB3D ca82ff65de avm1: Defining a local in a with scope should actually define it on the parent scope 2023-01-10 10:34:10 +01:00
Aaron Hill 40d8751d67 avm2: Implement clipRect parameter for BitmapData.draw 2023-01-08 16:11:55 -05:00
Aaron Hill 1b71e288fd Remove 'gc_context lifetime
The latest `gc-arena` makes this unnecessary - we can just
use our `'a` lifetime for `MutationContext`
2023-01-06 19:20:39 -05:00
MrCheeze 41df7fdc59 avm2: For old swf versions, invalid goto labels jump to frame 1 (fix #8954)
The regression test for this was edited directly in JPEXS, so there is
no corresponding fla to compile into the swf.
2023-01-03 17:10:06 -07:00
MrCheeze 77104ca473 avm2: Improve accuracy of gotoAndPlay / gotoAndStop (partially fix #8954)
Partially based on AVM1 implementation, partially based on the new
regression tests added in this commit.
2023-01-03 17:10:06 -07:00
nosamu 664a86161a avm2: Fix `for each..in` loops over Dictionary values 2023-01-03 16:52:15 -07:00
Nathan Adams c6045a4f24 wgpu: Multiply can't be trivial blend mode because of 0 alpha 2023-01-03 03:39:13 +01:00
Nathan Adams df8ead3f96 tests: New multiply blend mode image 2023-01-03 03:39:13 +01:00
Nathan Adams 81f4741300 wgpu: Default msaa on mobiles to 2x, same as webgl backend 2023-01-03 03:39:13 +01:00
Nathan Adams 864f404f2f tests: Add blendmode visual tests 2023-01-03 03:39:13 +01:00
Nathan Adams 45339e037e tests: Added new output of bitmapdata_draw tests for github agents. Seems visually identical. 2023-01-03 03:39:13 +01:00
EmperorBale 0e2fbe4cf7 tests: Update date tests 2023-01-02 11:43:03 -08:00
EmperorBale 8b9bae8ca6 tests: Add test for LoaderContext.applicationDomain 2022-12-28 17:25:11 -05:00
dependabot[bot] 6f430bb40d build(deps): bump serde from 1.0.151 to 1.0.152
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.151 to 1.0.152.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.151...v1.0.152)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-28 10:55:35 +02:00
David Wendt 54bae0265b tests: `instantiation_on_enterframe_gotoandstop` is missing a line of output 2022-12-27 20:15:49 -07:00
David Wendt 534f1cf06c tests: Adrian's tests look like they want 2 frames of execution 2022-12-27 20:15:49 -07:00
Adrian Wielgosik 825613ec8c tests: Add tests for various PlaceObject situations we didn't catch before.
There is no source as these SWFs were handmade in JPEXS.
2022-12-27 20:15:49 -07:00
dependabot[bot] c7ba2d4e87 build(deps): bump serde_json from 1.0.89 to 1.0.91
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.89 to 1.0.91.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.89...v1.0.91)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-20 08:35:32 +02:00
dependabot[bot] 9db6ace65f build(deps): bump serde from 1.0.150 to 1.0.151
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.150 to 1.0.151.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.150...v1.0.151)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-20 00:48:45 +01:00
CUB3D acfb149316 tests: Add tests for button hittests, update hitTestPoint with onStage tests 2022-12-18 13:32:24 -07:00
Mike Welsh 696c9062d3 chore: Inherit cargo metadata from workspace
Use workspace inheritance added in Rust 1.64 to de-duplicate
various settings across all packages.
2022-12-16 15:53:59 -08:00
Adrian Wielgosik 7df920b255 avm2: Support indexing with QNames 2022-12-16 14:40:22 -08:00
Adrian Wielgosik d2dfdb9a0b avm2: Collapse PackageNamespace to Namespace 2022-12-16 12:51:01 -08:00
relrelb bd9078addf chore: Fix `clippy::uninlined_format_args` lints 2022-12-15 08:59:38 +02:00
dependabot[bot] b1c4e6f143 build(deps): bump serde from 1.0.149 to 1.0.150
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.149 to 1.0.150.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.149...v1.0.150)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-12 21:21:45 +01:00
Adrian Wielgosik 7b64fcf5fa avm2: Fix indirect event dispatching 2022-12-06 00:44:17 +01:00
dependabot[bot] 3b285f8cf2 build(deps): bump serde from 1.0.148 to 1.0.149
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.148 to 1.0.149.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.148...v1.0.149)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-05 22:35:48 +01:00
kmeisthax f79208c75f
avm2: Fix no-op gotos (#8667)
* tests: Add a test for issue #8630

* core: No-op gotos in AS3 do not actually do anything, even though they emit events

Fixes issue #8630

* tests: Add more tests for various #8630-adjacent cases

* tests: Ignore the tests with script removal as they expect MovieClip children to be nulled upon removal

* chore: Case sensitive filesystem fix

Co-authored-by: Adrian Wielgosik <adrian.wielgosik@gmail.com>
2022-12-05 18:19:29 +01:00
wsxarcher c8e39da1e0 avm2: Implement filefilter filereference 2022-12-04 15:10:48 +01:00
Adrian Wielgosik 0861153626 swf: make Clippy happy 2022-12-03 22:18:22 +01:00
Marco Bartoli f2080e6d57
avm2: implement get and set of displayobject filters (#8623) 2022-12-01 02:31:35 +01:00
dependabot[bot] 83487ae5d1 build(deps): bump serde from 1.0.147 to 1.0.148
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.147 to 1.0.148.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.147...v1.0.148)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-30 10:04:26 +01:00
Marco Grassi ad81b3bf14 upgrade lock and toml dependencies 2022-11-26 14:04:59 -05:00
Aaron Hill b8745f0ff1 avm2: Partially implement Stage3D for wgpu backend
This PR implements core 'stage3D' APIs. We are now able
to render at least two demos from the Context3D docs - a simple
triangle render, and a rotating cube.

Implemented in this PR:
* Stage3D access and Context3D creation
* IndexBuffer3D and VertexBuffer3D creation, uploading, and usage
* Program3D uploading and usage (via `naga-agal`)
* Context3D: configureBackBuffer, clear, drawTriangles, and present

Not yet implemented:
* Any 'dispose()' methods
* Depth and stencil buffers
* Context3D texture apis
* Scissor rectangle

General implementation strategy:

A new `Object` variant is added for each of the Stage3D objects
(VertexBuffer3D, Program3D, etc). This stores a handle to the
parent `Context3D`, and (depending on the object) a handle
to the underlying native resource, via `Rc<dyn
SomeRenderBackendTrait>`).

Calling methods on Context3D does not usually result in an immediate
call to a `wgpu` method. Instead, we queue up commands in our
`Context3D` instance, and execute them all on a call to `present`.
This avoids some nasty wgpu lifetime issues, and is very similar
to the approah we use for normal rendering.

The actual rendering happens on a `Texture`, with dimensions
determined by `createBackBuffer`. During 'Stage' rendering,
we render all of these Stage3D textures *behind* the normal
stage (but in front of the overall stage background color).
2022-11-25 21:43:00 -07:00
Aaron Hill 4b8cd45f4b
avm2: Partially implement StaticText (#8343)
This is linked to the legacy DisplayObject::Text, which can
only be created by Flash CS6 (but is allowed in AVM2 swfs).

The 'StaticText' class cannot be constructed from ActionScript.
To support this, I've added support for native initializers to
playerglobal. This allows us to throw an exception in the
ActionScript constructor in Test.as, and do nothing in the native
intiializer (so that we can construct it from a DisplayObject).

I've left StaticText.text unimplemented for now, since it will require
dealing with Glyphs

Co-authored-by: kmeisthax <dcrkid@yahoo.com>
2022-11-23 18:30:47 -05:00
dependabot[bot] cf8217f2ff build(deps): bump serde_json from 1.0.87 to 1.0.88
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.87 to 1.0.88.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.87...v1.0.88)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-21 16:31:02 -07:00
David Wendt 4c0099c39c tests: Reduce the epsilons on `as3_edittext_getlinemetrics` and `gettextextent` to more reasonable values 2022-11-20 17:13:48 -07:00
David Wendt 728b198c9d tests: Re-run the `gettextextent` in an environment that actually sees Noto Sans as a system font. 2022-11-20 17:13:48 -07:00
David Wendt 51d8a196a4 tests: `gettextextent` should be an approx test.
Also, yes, `TextFormat.getTextExtent` returns a bare object.
2022-11-20 17:13:48 -07:00
David Wendt 6590f58efe tests: Make `edittext_getlinemetrics` an approximate test with a tolerance of a quarter pixel. 2022-11-20 17:13:48 -07:00
David Wendt 1952870ed1 tests: Include tests for empty newlines in the `as3_edittext_getlinemetrics` test. 2022-11-20 17:13:48 -07:00
David Wendt c0b6496b96 tests: Add tests for AVM1 `gettextextent` and AVM2 `TextField.getLineMetrics`. 2022-11-20 17:13:48 -07:00
dependabot[bot] 4c34fa361d build(deps): bump image from 0.24.4 to 0.24.5
Bumps [image](https://github.com/image-rs/image) from 0.24.4 to 0.24.5.
- [Release notes](https://github.com/image-rs/image/releases)
- [Changelog](https://github.com/image-rs/image/blob/master/CHANGES.md)
- [Commits](https://github.com/image-rs/image/compare/v0.24.4...v0.24.5)

---
updated-dependencies:
- dependency-name: image
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-15 08:12:38 +02:00
dependabot[bot] 8f214ff9a3 build(deps): bump regex from 1.6.0 to 1.7.0
Bumps [regex](https://github.com/rust-lang/regex) from 1.6.0 to 1.7.0.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.6.0...1.7.0)

---
updated-dependencies:
- dependency-name: regex
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-07 23:37:56 +02:00
dependabot[bot] 52f692c0e1 build(deps): bump env_logger from 0.9.1 to 0.9.3
Bumps [env_logger](https://github.com/env-logger-rs/env_logger) from 0.9.1 to 0.9.3.
- [Release notes](https://github.com/env-logger-rs/env_logger/releases)
- [Changelog](https://github.com/env-logger-rs/env_logger/blob/main/CHANGELOG.md)
- [Commits](https://github.com/env-logger-rs/env_logger/compare/v0.9.1...v0.9.3)

---
updated-dependencies:
- dependency-name: env_logger
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-07 23:02:47 +02:00
Aaron Hill 68471723b3 core: Fix clippy format string lint 2022-10-27 08:49:39 +03:00
dependabot[bot] 01967e4865 build(deps): bump serde_json from 1.0.86 to 1.0.87
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.86 to 1.0.87.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.86...v1.0.87)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-25 10:59:40 +03:00
dependabot[bot] d589130634 build(deps): bump serde from 1.0.145 to 1.0.147
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.145 to 1.0.147.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.145...v1.0.147)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-25 09:54:26 +03:00
dependabot[bot] 3c7e9235f6 build(deps): bump futures from 0.3.24 to 0.3.25
Bumps [futures](https://github.com/rust-lang/futures-rs) from 0.3.24 to 0.3.25.
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.24...0.3.25)

---
updated-dependencies:
- dependency-name: futures
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-25 09:19:27 +03:00
Aaron Hill d0230a2bea render: Add 'naga-agal' crate to compile AGAL shaders to Naga
This is the first part of the Stage3D implementation, and can
be reviewed independently.

Stage3D shaders use the Adobe Graphics Assembly Language (AGAL),
which is a binary shader format. It supports vertex attributes,
varying registers, program constants (uniforms), and texture sampling.

This PR only implements a few parts of AGAL:
* The 'mov' and 'm44' opcodes
* Vertex attributes, varying registers, program constants, and 'output'
 registers (position or color, depending on shader type)

This is sufficient to get a non-trivial Stage3D program
running (the rotating cube demo from the Adobe docs).

The output of `naga-agal` is a `naga::Module`. This can be passed
directly to wgpu, or compiled into a shader language using
a Naga backend (glsl, wgsl, SPIR-V, etc). The test suite
output WGSL files, and uses the 'insta' crate to compare against
saved files on disk.

Currently, the only real way to write AGAL bytecode is using
the Adobe-provided 'AGALMiniAssembler' flash class.
This class assembles the textual reprentation of AGAL into
the binary format.

To make writing tests easier, I've added a 'agal_compiler' test, which
can easily be modified to add more Agal textual assembly.
2022-10-17 13:22:02 -05:00
Aaron Hill 45515be0a3 render: Improve support for BitmapData.draw
This PR fixes a numbe of interconnected bugs:
* We weren't consistently uploading a dirty BitmapData to the render
  backend before drawing to/from it.
* BitmapData.draw should *not* add a fill color - it should draw over
  the current contents of the BitmapData
* After drawing to a non-transparent BitmapData, we need to manually
  set the opacity back to 255 for each pixel (the drawing process
  takes transparency into account, but the opacity information is
  thrown away at the end).
2022-10-17 12:53:38 -05:00
David Wendt 36844e5e2f chore: Use explicit `.clamp`
Also, update the tests to confirm that this doesn't break NaN handling.
2022-10-16 14:55:07 -06:00
David Wendt 77dadd7844 tests: Test the default values for Normal antialiasing, too. 2022-10-16 14:55:07 -06:00
David Wendt ca8f9c1103 tests: Add tests for `TextField.antiAliasType` and related properties for AVM1 and AVM2. 2022-10-16 14:55:07 -06:00
relrelb 178bf4fe24 chore: Extract Cargo `edition` to `[workspace.package]`
This is possible since Rust 1.64.0: https://blog.rust-lang.org/2022/09/22/Rust-1.64.0.html#cargo-improvements-workspace-inheritance-and-multi-target-builds
2022-10-14 22:13:29 +03:00
relrelb 183b8adbf0 wgpu: Bump to `0.14.0`
Also bump `raw-window-handle` to `0.5`, as now required.
2022-10-14 21:49:40 +03:00
relrelb 4b334ce03a tests: Rewrite `Date` tests 2022-10-13 01:06:17 +03:00
relrelb a59114d569 tests: Expand `primitive_type_globals`
Cover the now-correct `NaN.toString(x)` cases.
2022-10-13 00:05:25 +03:00
dependabot[bot] 1d3412cce0 build(deps): bump serde_json from 1.0.85 to 1.0.86
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.85 to 1.0.86.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.85...v1.0.86)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-11 01:29:10 +03:00
EmperorBale bbeea8715c tests: Add test for SWZ parsing 2022-10-10 12:48:35 -07:00
relrelb bf0ace0b88 chore: Appease clippy 2022-10-09 13:46:28 +05:45
David Wendt 066ca11cff tests: Add a test for AS3 `BitmapData.clone()` 2022-10-07 01:41:48 -05:00
Tal Hayon a8b96b676a avm2: Add More BitMapData methods
This also fixes a small bug in copyChannels
2022-10-06 18:53:06 -06:00
Aaron Hill 4b2907ead5 avm2: Fix 'hasDefinition' and 'getDefinition' for ApplicationDomain
These methods were incorrectly treating the argument as a local name,
instead of a qualified name. Additionally, 'getDefinition' now throws
an AVM error.
2022-10-05 16:45:29 -05:00
Aaron Hill 9b055645d3 avm2: Support calling 'new Function()' objects
This appears to create a dummy function, which ignores all
of its arguments and always returned `undefined`
2022-10-05 08:57:12 -05:00
dependabot[bot] ac93f9d295 build(deps): bump serde from 1.0.144 to 1.0.145
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.144 to 1.0.145.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.144...v1.0.145)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-04 16:17:36 +03:00
dependabot[bot] fbba7744e7 build(deps): bump env_logger from 0.9.0 to 0.9.1
Bumps [env_logger](https://github.com/env-logger-rs/env_logger) from 0.9.0 to 0.9.1.
- [Release notes](https://github.com/env-logger-rs/env_logger/releases)
- [Changelog](https://github.com/env-logger-rs/env_logger/blob/main/CHANGELOG.md)
- [Commits](https://github.com/env-logger-rs/env_logger/compare/v0.9.0...v0.9.1)

---
updated-dependencies:
- dependency-name: env_logger
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-04 02:47:48 +03:00
dependabot[bot] 103f384a08 build(deps): bump image from 0.24.3 to 0.24.4
Bumps [image](https://github.com/image-rs/image) from 0.24.3 to 0.24.4.
- [Release notes](https://github.com/image-rs/image/releases)
- [Changelog](https://github.com/image-rs/image/blob/master/CHANGES.md)
- [Commits](https://github.com/image-rs/image/compare/v0.24.3...v0.24.4)

---
updated-dependencies:
- dependency-name: image
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-04 00:49:25 +03:00
dowgird 5ac4f4358d avm2: Added flash.net.URLVariables 2022-09-27 13:43:30 -05:00
Aaron Hill 53f42e0bec avm2: Fix getQualifiedClassName for null and undefined 2022-09-27 00:05:06 -05:00
Aaron Hill f5b59f869c avm2: Show native method names in stack trace
Previously, we would display an empty string for the method name.

We can now store a `&'static str` again in `NativeMethod`,
instead of needing a `Cow`
2022-09-26 14:13:48 -05:00
Aaron Hill dddc9e954a avm2: Add tests for looking up properties on Class objects 2022-09-25 15:37:50 -05:00
golfinq ceb877c55f avm2: Implement error types for avm2 2022-09-25 02:27:59 +03:00
dowgird e448f5e027 avm2: implemented flash.utils.unescapeMultiByte 2022-09-25 01:19:11 +03:00
Aaron Hill 66df5ea3de avm2: Implement typed 'catch' blocks
Now that we have a custom `Error` enum, this is very straightforwawrd.
I've converted `getDefinitionByName` return an AVM error, since this
is commonly used by games to test for a class.
2022-09-24 13:03:29 -05:00
Aaron Hill 7b0bc0fb74 avm2: Implement undocumented 'Function.length' property
This returns the function's parameter count, and is used by the Starling
framework to implement a custom event dispatcher.
2022-09-23 18:36:23 -05:00
David Wendt 293d52048b chore: Don't ask me how this `s` got in the output file 2022-09-23 11:45:52 -06:00
David Wendt 5a9f0ea099 tests: Add a test for `WaitForFrame`'s clamping behavior. 2022-09-23 11:45:52 -06:00
EmperorBale bfaedcf321 tests: Add test for checkfilter opcode 2022-09-22 15:18:23 -07:00
EmperorBale e40229d90b tests: Add test for ByteArray.writeObject 2022-09-21 13:39:58 -07:00
Aaron Hill 93b7de2fe6 avm2: Use custom Error instead of std::error::Error 2022-09-21 12:37:37 -05:00
Adrian Wielgosik d1ffaad927 avm2: Support enumerating null/undefined 2022-09-21 00:03:44 +02:00
EmperorBale e1eaa9770a avm2: Switch ByteArray to AS
avm2: Fix ByteArray

avm2: Implement ByteArray.defaultObjectEncoding

avm2: Rename ByteArray allocator
2022-09-17 12:31:43 -07:00
David Wendt f101160abc tests: Add a test for all `Stage.loaderInfo` properties that we weren't already testing for. 2022-09-17 12:32:15 -06:00
David Wendt eefe398f7c tests: `as3_bitmap_embedded` has a different stage size 2022-09-15 20:25:21 -06:00
David Wendt cf82a9d1c4 tests: Add a test for properties on Flex-style assets
We also re-enable the `bitmapdata_embedded` test now that we have a real renderer to work with.
2022-09-15 20:25:21 -06:00
David Wendt 2174c55d76 tests: Add a test for Flex-style image embeds. 2022-09-15 20:25:21 -06:00
David Wendt 613564baf7 tests: Adopt new expected images as the SWF stage size changed when I moved these tests to Flex/Flash Builder 2022-09-15 19:14:41 -06:00
David Wendt 0912ee4dff tests: Add an events test for `loadBytes` 2022-09-15 19:14:41 -06:00
David Wendt 0eff0bf91a core: Remove all synchronous preloading from core.
Backends that need synchronous preload behavior now explicitly ask for it as follows:

 * `tests` - repeatedly call `preload` in a loop with an exhausted execution limit to stress-test the chunked preload
 * `exporter`, `scanner` - synchronous/unlimited preload to match prior behavior

These may change in the future.
2022-09-15 19:14:41 -06:00
Aaron Hill 81a5f3f10a core: Always check mergeAlpha in BitmapData.copyPixels
Previously, we would only use mergeAlpha if alphaBitmapData
and alphaPoint. However, mergeAlpha can be used even when
those parameters are null.

Some of the AVM1 argument handling was also incorrect - I've fixed
it, and extended the existing test with the output-based test
added for AVM2.
2022-09-11 11:12:09 -05:00
Nathan Adams b2ecd39648 wgpu: Enable MSAA for offscreen textures 2022-09-11 09:07:53 +02:00
Nathan Adams c7f420dde5 wgpu: Moved WgpuRenderBackend into backend.rs 2022-09-11 09:07:53 +02:00
Aaron Hill 8370bc792d core: Use correct background alpha in BitmapData.draw
Previously, we would always use a transparent background,
even if the BitmapData is not transparent. This would normally
be corrected on the next frame when we copied the pixels to the
CPU. However, if an SWF ran `BitmapData.draw` on every frame,
this would never be corrected.
2022-09-09 19:24:21 -05:00
Aaron Hill 2f81f5814d render: Add `premultiplied_alpha` parameter for image capture
When rendering offscreen, we want the resulting image to use
premultiplied alpha, since the image will be stored in a texture.

However, when capturing an image in the exporter or test framework,
we want to use straight alpha, so that the resulting image can
be saved as a PNG.

Previously, we incorrectly used straight alpha everywhere, resulting
in incorrect output when using BitmapData.draw with transparency.
2022-09-09 15:46:48 -07:00
Aaron Hill ca030169f7 avm2: Implement BitmapData.rect and stub BitmapData.applyFilter
These are the last BitmapData methods needed for Solarmax
(the victory screen after beating the last level now renders).
2022-09-09 13:05:13 -05:00
Aaron Hill bb138d9082 avm2: Implement some of SharedObject
Our AVM2 `SharedObject` support is now *almost* equivalent
to our avm1 `SharedObject` support. We implement serialization
and deserialization for primitives, arrays, and `Object` instances
with local properties. We also implement serialization for `Date`,
but not `Xml` (since our AVM2 `Xml` class is just a stub at the moment).

This is enough to make 'This is the only level too' save level
progress to disk.

Currently, we always serialize to AMF3. When we implement
the `defaultObjectEncoding` and `objectEncoding`, we'll need
to adjust this.
2022-09-08 21:22:05 -05:00
Aaron Hill 974738fe10 tests: Add BitmapData.copyPixels image test from PR #2488 2022-09-08 19:52:48 -05:00
EmperorBale 5791423d43 tests: Enable avm_debug for regression tests 2022-09-07 13:54:33 -07:00
EmperorBale a5c3c0cab5 tests: Add test for Error.getStackTrace 2022-09-07 13:54:33 -07:00
Aaron Hill 7218146e04 avm2: Implement BitmapData.dispose
We now check if a BitmapData has been disposed by checking
for a zero width or height (which cannot happen otherwise).
As a result, we no longer need the 'disposed' field on the AVM1
BitmapData object.
2022-09-07 11:02:53 -07:00
Aaron Hill b764c4f6c1 avm2: Implement BitmapData.fillRect and BitmapData.getPixel32 2022-09-07 12:29:49 -05:00
dowgird 53ed748a54 avm2: added flash.utils.escapeMultiByte 2022-09-06 19:44:48 -07:00
Aaron Hill 93607aa86e
avm2: Implement `BitmapData.draw` for `wgpu` backend (#7254)
* avm2: Implement `BitmapData.draw` for `wgpu` backend

This method requires us to have the ability to render directly to a
texture. Fortunately, the `wgpu` backend already supports this in
the form of `TextureTarget`. However, the rendering code required
some refactoring in order to avoid creating duplicate `wgpu` resources.

The current implementation blocks on copying the pixels back
from the GPU to the CPU, so that we can immediately set them in
the Ruffle `BitmapData`. This is likely very inefficient, but will
work for a first implementation.

In the future, we could explore allowing the CPU image data and GPU
texture to be out of sync, and only synchronized when explicitly
necessary (e.g. on `getPixel` or `setPixel` calls).

* Rename `with_offscreen_backend` to `render_offscreen` and use Bitmap

* Don't panic when backend doesn't implement `render_offscreen`
2022-09-06 16:38:48 -05:00
Aaron Hill 45960de7dc avm2: Correctly implement DisplayObject.mask
The stub implementation was breaking code that relied on being
able to set a value for 'mask' and then retrieve it
(which used to work on a dynamic class like `MovieClip`).
2022-09-05 16:43:20 -07:00
dependabot[bot] 9b37c072db build(deps): bump pretty_assertions from 1.2.1 to 1.3.0
Bumps [pretty_assertions](https://github.com/rust-pretty-assertions/rust-pretty-assertions) from 1.2.1 to 1.3.0.
- [Release notes](https://github.com/rust-pretty-assertions/rust-pretty-assertions/releases)
- [Changelog](https://github.com/rust-pretty-assertions/rust-pretty-assertions/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-pretty-assertions/rust-pretty-assertions/compare/v1.2.1...v1.3.0)

---
updated-dependencies:
- dependency-name: pretty_assertions
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-05 23:30:37 +03:00
onkrot 1e0b59dbad avm2: Implement `String`.`localeCompare`, `search`, `toLocaleLowerCase`, `toLocaleUpperCase` methods. 2022-09-05 12:15:53 -07:00
Adrian Wielgosik 31780f15d8 tests: Add extra case to int_edge_cases test 2022-09-05 11:55:16 -07:00
= 91ae384682 tests: Removed software video impl for tests - it isn't used and adds a lot to compile time 2022-09-04 17:46:58 -07:00
Adrian Wielgosik 4707e4b6a8 tests: Add tests for int conversion edge cases 2022-09-04 08:57:18 +03:00
Mike Welsh c17da6e91a core: Fix some issues with `hitTest`
Fixes some issues with our winding # calculation which would cause
incorrect results for hitTest.

  * The convention for handling an intersection at endpoints was
    not the same between lines and bezier curves.
  * The bezier curve winding # function was not properly handling
    some cases where the curve was strictly y-monotonic.
  * Simplify the code a bit so that ray-curve intersections are
    returned in a consistent order based on upward/downward crossing.
2022-09-02 14:51:46 -07:00
Aaron Hill 7a7ea87679 avm2: Implement Sprite.startDrag and Sprite.stopDrag
For now, I've left 'dropTarget' unimplemented - unlike in
AVM1, the drop target can be non-interactive objects like `Shape`,
so we'll need additional refactoring to implement it.

This allows 'This is the only level too' to be playable
2022-09-02 13:03:14 -07:00
Aaron Hill 1a7c5339a7 avm2: Implement DisplayObject.localToGlobal and DisplayObject.globalToLocal
While writing tests for these methods, I discovered and fixed some
issues with how 'scrollRect' interacted with 'dobj.transform.matrix'
2022-08-29 23:12:40 -05:00
Aaron Hill e9697439de avm2: Skip over holes during array enumeration
This brings us closer to matching the Flash Player
enumeration behavior. Unfortunately, the precise enumeration
order for ScriptObject properties depends on the precise
order in the internal avmplus hashmap. This order is deterministic,
but adding/removing a property effectively randomizes it. Hopefully
there aren't any SWFS that depend on the *exact* order.
2022-08-29 15:53:44 -07:00
dependabot[bot] 802de0e7d1 build(deps): bump futures from 0.3.23 to 0.3.24
Bumps [futures](https://github.com/rust-lang/futures-rs) from 0.3.23 to 0.3.24.
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.23...0.3.24)

---
updated-dependencies:
- dependency-name: futures
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-29 23:38:43 +03:00
Toad06 c4e64c5e26 avm1: Function calls in SWF4 bump the version to 5 2022-08-29 02:17:09 -07:00
David Wendt 4de46562ca tests: Add a test for class singleton properties. 2022-08-28 17:54:22 -06:00
Aaron Hill ae8e5b2f33 avm2: Don't error when executing 'null as SomeType'
We previously used 'coerce_to_object', which produced
an error with `Value::Null`. Instead, we can just ues
`value.as_type_of`, which will correctly handle `null`
2022-08-28 16:33:15 -05:00
Aaron Hill e3e0488ed4 avm2: Delete enumerant when property is deleted 2022-08-28 12:03:19 -05:00
Aaron Hill 6a01fa93c5 avm2: Implement `String.toLowerCase` and `String.toUpperCase`
These are implemented in the same way as in AVM1. Testing
in Flash Player shows that the behavior is the same.
2022-08-28 01:32:53 -05:00
Callum Thomson 046514eeb9
avm1: Enumerate should push Undefined if the target isn't an object 2022-08-26 14:01:42 -07:00
Aaron Hill 249648674c Fix bounds computation 2022-08-26 13:04:01 -07:00
Aaron Hill 5fb95e6961 Use round-to-even for scrollRect 2022-08-26 13:04:01 -07:00
Aaron Hill fa0c843a4d avm2: Implement DisplayObject.scrollRect
This property causes a DisplayObject to be both translated
and cropped.
2022-08-26 13:04:01 -07:00
David Wendt 4510d51e18 tests: Fix regression in `as3_loaderinfo_events` caused by the frame lifecycle fixes 2022-08-25 19:24:56 -06:00
David Wendt beb0545b11 tests: Add tests for gotos interacting with frame scripts. 2022-08-25 19:24:56 -06:00
David Wendt 6569edda88 tests: Add a goto-and-stop test that inspects the children after the goto. 2022-08-25 19:24:56 -06:00
David Wendt c3add3db93 tests: Ignore the `as3_simplebutton_constr_childevents` test as it is broken by fixes I moved to another PR 2022-08-25 19:24:56 -06:00
David Wendt 38f28ce80c tests: Add a second, more thorough `clickgoto2` test 2022-08-25 19:24:56 -06:00
David Wendt f16b76866a tests: Add timeline and stage manipulation tests at user event time. 2022-08-25 19:24:56 -06:00
David Wendt 81eb5ed8ac tests: Add tests for symbol instantiation in `enterFrame`, `exitFrame`, and `frameConstructed` 2022-08-25 19:24:56 -06:00
David Wendt 27d509f169 tests: Extend the goto tests with more non-looping jumps 2022-08-25 19:24:56 -06:00
David Wendt 4d3788bfe1 tests: Add tests for AS3 gotos during `enterFrame`, `frameConstructed`, and/or `exitFrame` 2022-08-25 19:24:56 -06:00
David Wendt c10417ddb8 tests: `as3_movieclip_displayevents_timeline` should log events on the root movie clip too 2022-08-25 19:24:56 -06:00
David Wendt f1d203311f tests: `as3_movieclip_displayevents_looping` should have a `RemoveObject` in it 2022-08-25 19:24:56 -06:00
David Wendt ee1f39bba7 tests: `as3_movieclip_displayevents_xyzframeplay` tests should also list what children are on the timeline 2022-08-25 19:24:56 -06:00
David Wendt b3793f9b4c tests: Oops, forgot to recompile the exitframe play test. 2022-08-25 19:24:56 -06:00
David Wendt 10955c3a03 tests: Add tests for playing and pausing a movie clip in `enterFrame`, `frameConstructed`, and `exitFrame` 2022-08-25 19:24:56 -06:00
David Wendt 795dafa46a tests: Fix the test output for `as3_movieclip_displayevents_dblhandler`.
The test output for this test is sensitive to where we cut off each frame, because it doesn't stop all of it's handlers at the end of the test. Flash Player will just print lines forever so the end of the test is entirely arbitrary.
2022-08-25 19:24:56 -06:00
David Wendt 1a4b977325 tests: `as3_movieclip_displayevents_timeline` now explicitly winds a clip back and forth to better demonstrate a bug I ran into with frame numbering 2022-08-25 19:24:56 -06:00
David Wendt 0c18e8e99a tests: Log `this.currentFrame` on every event watcher we can. 2022-08-25 19:24:56 -06:00
David Wendt 72f878bb9d tests: Add a test for the order of events surrounding `gotoAndStop` 2022-08-25 19:24:56 -06:00
Aaron Hill 91247f5779 tests: Only require `ruffle_render_wgpu` dependency with 'imgtests'
This should speed up developer workflows when working on non-image
related changes. CI will still run all image tests.
2022-08-25 15:11:18 -07:00
Mike Welsh bea757cc92 tests: Adjust function_base_clip_removed test
Add test for #5645.
2022-08-25 00:01:02 -07:00
Aaron Hill b5391c00f6 tests: Re-add per-platform image tests
Reverts #7267

The image tests for the upcoming 'DisplayObject.stageRect' support
differ between Linux and Windows, so we need this support again.

To avoid the Linux filename churn that we previously encountered,
we now only include the platform and graphics backend in the filename
(e.g. `expected-linux-Vulkan`). This may result in some unexpected
'mismatched image' test failures if GHA updates to a version of Lavapipe
that changes rendering output, but this should be relatively easy to
notice.
2022-08-24 21:29:53 -07:00
onkrot 1a243bdd86 avm2: Implement all remaining matrix methods 2022-08-23 10:44:12 +02:00
Aaron Hill 86e6983943 avm2: Partially implement Loader.load
This PR implements the `Loader.load` method, as well as
the associated `LoaderInfo` properties and events.

We can now load in an external AVM2 SWf: it will be added
as a child of `Loader` object, and will render properly
to the screen.

Limitations:
* The only supported `URLRequest` property is `url`
* `LoaderContext` is not supported at all - we always use the default
  behavior
* Only `Loader.load` is implemented - we do not yet support unloading.
* We fire a plain 'Event' for the 'progress' event, instead of using
  the (not yet implemented) 'ProgressEvent' class

The main changes in this PR are:
* The AVM2 `Loader` class now has an associated display object,
  `LoaderDisplay`. This is basically a stub, and just renders
  its single child (if it exists).
* `LoaderStream::Stage` is renamed to `LoaderStream::NotYetLoaded`.
  This is used for both the `Stage` and an 'uninitialized'
  `Loader.contentLoaderInfo`. In both cases, certain properties throw
  errors, while others return actual values.
* The rust `Loader` manager now handles both AVM1 and AVM2 movie loads.
2022-08-22 19:36:29 -07:00
dependabot[bot] 25a77869ab build(deps): bump serde from 1.0.143 to 1.0.144
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.143 to 1.0.144.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.143...v1.0.144)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-22 16:51:56 -07:00
dependabot[bot] fa6a9641c6 build(deps): bump serde_json from 1.0.83 to 1.0.85
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.83 to 1.0.85.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.83...v1.0.85)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-22 15:06:38 -07:00
Aaron Hill 98c7f443ce core: Only store viewport dimensions in `RenderBackend`
Previously, the viewport height and width were stored in
both `Stage` and the `RenderBackend`. Any changes to the viewport
dimensions (e.g. due to window resizing) needed to be updated in both
places to keep our handling of the viewport consistent.

This PR adds a new `ViewportDimensions` type, which holds the
width, height, and scale factor. It is stored inside the
`RenderBackend` impl, and is retrieved using the newly added
method `RenderBackend.get_viewport_dimensions`. After a `Player`
has been constructed, any code that needes access to the viewport
dimensions will ultimate go through this method.

Unfortunately, `Stage` needs to use the viewport dimensions
in `build_matrices`. Therefore, any code modifying the viewport
dimensions should go through `player.set_viewport_dimensions`,
which ensures that the stage matrices are rebuilt after the render
backend is updated.
2022-08-22 13:44:30 -07:00
Mike Welsh 1ce877292e tests: Add test for _droptarget 2022-08-21 21:16:02 -07:00
David Wendt 30b1d4af2a tests: Run all tests in timeline debug mode. 2022-08-19 18:52:21 -07:00
Aaron Hill f3feaaf2be avm1: Set init object properties in reverse order
Fixes #7667

This behavior is by setter functions, and some SWFS
depend on it.
2022-08-19 11:49:40 -07:00
Aaron Hill f7205a02a9 render: Add BlendMode infrastructure and implement BlendMode.ADD
Each render backend keeps track of a stack of BlenModes,
which are pushed and popped by 'core' as we render objects
in the displaay tree. For now, I've just implemented BlendMode.ADD,
which maps directly onto blend mode supported by each backend.

All other blend modes (besides 'NORMAL') will produce a warning
when we try to render using them. This may produce a very large amount
of log output, but it's simpler than emitting each warning only once,
and will help to point developers in the right direction when they
get otherwise inexplicable rendering issues (due to a blend mode
not being implemented).

The wgpu implementation is by far the most complicated, as we need
to construct a `RenderPipeline` for each possible
`(BlendMode, MaskState)`. I haven't been able to find any documentation
about the maximum supported number of (simultaneous) WebGPU render
pipelines - if this becomes an issue, we may need to register them
on-demand when a particular blend mode is requested.
2022-08-18 16:38:17 -07:00
dowgird 038264a7a9 avm2: Implement stageFocusRect stub 2022-08-16 13:59:12 -05:00
dependabot[bot] ad2b1bbd24 build(deps): bump futures from 0.3.21 to 0.3.23
Bumps [futures](https://github.com/rust-lang/futures-rs) from 0.3.21 to 0.3.23.
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.21...0.3.23)

---
updated-dependencies:
- dependency-name: futures
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-15 23:37:47 +03:00
Aaron Hill 6f20e8882d avm2: Implement DisplayObject.transform and most of Transform
This PR implements the 'DisplayObject.transform' getters/setters,
and most of the getters/setters in the `Transform` class

From testing in FP, it appears that each call to the
'DisplayObject.transform' property produces a new
'Transform' instance, which is permanently tied to the
owner 'DisplayObject'. All of the getters/setters in
`Transform` operate directly on owner `DisplayObject`.
However, note that the `Matrix` and `ColorTransform`
valuse *produced* the getter are plain ActionScript objects,
and have no further tie to the `DisplayObject`.

Using the `DisplayObject.transform` setter results in
values being *copied* from the input `Transform` object.
The input object retains its original owner `DisplayObject`.

Not implemented:
* Transform.concatenatedColorTransform
* Transform.pixelBounds

When a DisplayObject is not a descendant of the stage,
the `concatenatedMatrix` property produces a bizarre matrix:
a scale matrix that the depends on the global state quality.
Any DisplayObject that *is* a descendant of the stage has
a `concatenatedMatrix` that does not depend on the stage quality.
I'm not sure why the behavior occurs - for now, I just manually
mimic the values prdduced by FP. However, these values may indicate
that we need to do some internal scaling based on stage quality values,
and then 'undo' this in certain circumstances when constructing
an ActionScript matrix.

Unfortunately, some of the computed 'concatenatedMatrix' values
are off by f32::EPSILON. This is likely due to us storing some
internal values in pixels rather than twips (the rounding introduced
by round-trip twips conversions could cause this slight difference0.
For now, I've opted to mark these tests as 'approximate'.

To support this, I've extended our test framework to support providing
a regex that matches floating-point values in the output. This allows
us to print out 'Matrix.toString()' and still perform approximate
comparisons between strings of the format
'(a=0, b=0, c=0, d=0, tx=0, ty=0)'
2022-08-14 19:12:25 -07:00
Nathan Adams cebe11ee38 wgpu: Avoid panics when attempting to create a texture larger than the device supports 2022-08-13 02:35:30 -07:00
Aaron Hill ef4a955e65 avm2: Always get loaderInfo from the root object 2022-08-13 02:06:38 -07:00
Aaron Hill 9d1f27484b avm2: Implement 'throw' opcode
We currently lack the ability to preserve the original
`Value<'gc>` in the error, so we're forced to stringify the error.

This means that only typeless 'catch' blocks will work properly -
however, they're the only kind of 'catch' block that we currently
implement. Implementing support for typed 'catch' blocks will naturally
allow us to preserve the original 'Value<'gc>' in the 'throw'
implementation, since we'll need to switch to a custom `Error<'gc>`
type.
2022-08-11 17:20:53 -05:00
Adrian Wielgosik 74b2dd6bb9 tests: Fix now-failing avm2 ExternalInterface test 2022-08-11 21:28:18 +02:00
Adrian Wielgosik 4a7cb51148 avm2: Make missing props on sealed classes throw properly 2022-08-11 21:28:18 +02:00
dowgird 38f50f83ef removed a now unused function, added a test 2022-08-10 01:34:08 +02:00
dowgird 31ed697acd Fixes from review 2022-08-10 01:34:08 +02:00
dowgird 26b41199fb avm2: Implemented newcatch and basic exception handling 2022-08-10 01:34:08 +02:00
Nathan Adams 3d235ac58f wgpu: Make descriptors an Arc 2022-08-09 23:19:42 +02:00
dependabot[bot] f5e3b39371 build(deps): bump serde_json from 1.0.82 to 1.0.83
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.82 to 1.0.83.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.82...v1.0.83)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-09 17:34:20 +03:00
dependabot[bot] 4603e5964e build(deps): bump serde from 1.0.141 to 1.0.143
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.141 to 1.0.143.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.141...v1.0.143)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-09 11:54:47 +03:00
TÖRÖK Attila 8306ad08e6 test: Add a test for `flash.geom.Vector3D` 2022-08-08 22:15:09 +03:00
Aaron Hill 2383e6850f avm2: Continue to process event when a handler produces an error
An exception thrown by one event handler shoud not prevent other event
handlers from running on this same event. Some SWFs like Wonderputt
depend on this behavior, as they have buggy event handlers that throw
errors.
2022-08-03 22:29:41 +03:00
Aaron Hill ad19c29c03 Remove `null` from `getChildByName` for missing child
This matches the behavior of Flash - no error is produced.
2022-08-03 21:45:59 +03:00
dependabot[bot] 3b7f6976a4 build(deps): bump serde from 1.0.140 to 1.0.141
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.140 to 1.0.141.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.140...v1.0.141)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-02 19:34:44 +03:00
relrelb e500885a37 tests: Add `biturshift`
Also add a SWF8 variant to test its special behavior.
2022-07-29 14:44:21 -07:00
Aaron Hill 0d3e046b0e
avm2: Allow classes to reference their own type from a static variable
FP allows code like
`class Foo { static var INSTANCE: Foo = new Foo(); }`

However, this breaks our current property type coercion setup -
we cannot resolve the type `Foo` when setting the property `INSTANCE`,
since `Foo` is still being constructed.

Fortunately, we can perform this 'coercion' by just checking if
the object's class name and domain match the type name and domain
of the property.
2022-07-29 13:24:37 -07:00
Aaron Hill 49d1a985ca avm2: Store `LoaderInfo` object on `MovieClip` and `Stage`
Previously, we would create a fresh `LoaderInfo` object each
time the `loaderInfo` property was accessed. However, users can
add event handlers to a `LoaderInfo`, so we need to create and
store exactly one `LoaderInfo` object per movie (and stage).

To verify that we're correctly handling the storage of `LoaderInfo`,
I've implemented firing the "init" event. This required a new
`on_frame_exit` hook, so that we can properly fire the "init"
event after the "exitFrame" for the initial frame but before
the "enterFrame" of the next frame.
2022-07-27 22:38:49 -07:00
EmperorBale 6968969381 tests: Add test for invalid UTF8 sequences 2022-07-25 10:52:56 -07:00
Aaron Hill 515c7bf518 Fix behavior when setting repeatCount, and improve tests 2022-07-24 20:43:00 -07:00
Aaron Hill b4f98190e9 avm2: Implement flash.utils.Timer and associated events
The current 'setInterval/setTimeout' implementation is
moved to 'core/src/timers.rs', and now works with both
AVM1 and AVM2 objects. The `flash.utils.Timer` class is implemented
mostly in ActionScript, with minimal modifications to the actual
Ruffle timer code.
2022-07-24 20:43:00 -07:00
Rafał Dowgird fac32b488b
avm2: implement string replace(string, function) (#7456)
* avm2: implement string replace where pattern is string and replacement is a function

* * removed unnecessary vec!

  * fixed "no newline at the end of file"
2022-07-22 17:32:02 +03:00
Rafał Dowgird 934cb05371
avm2: implement string.replace(...) with fn, for now regex only. (#7429)
* avm2: implement string.replace(...) with fn, for now regex only.

  * string - added path for replacing regex with fn (replacing string
  with fn is still unimplemented)

  * regex - factored out common replace logic for when replacement is
  a string and when it is a function

  * added tests

* Addressed review comments

* removed tinkering cruft; formatting

* addressed review comments
2022-07-19 08:47:57 +03:00
EmperorBale 41bfc028d2 tests: Add test for special unicode characters and characters that need padding 2022-07-15 15:29:55 +03:00
dowgird cfc9f51c5d avm2: implement $ patterns in regex replace 2022-07-13 15:48:25 -06:00
dependabot[bot] 90ecdfaff5 build(deps): bump serde from 1.0.138 to 1.0.139
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.138 to 1.0.139.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.138...v1.0.139)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-11 23:35:30 +03:00
Rafał Dowgird 80d1a8449a
avm2: implement string.split for regex (#7363)
* avm2: implement string.split for regex

* Compressed the testing for regexp and unwrapping thereof

* * Moved the split logic into the regex object

  * Factored out a method for utf-16 matching

  * Added tests

* formatting

* * replaced manual counting with storage.length()

* clippy cleanup

* Address review comments

  * fix import path for WString
  * remove redundant variable in return statement
  * error passing via '?' instead of unwrap()
2022-07-11 19:47:05 +03:00
dependabot[bot] 265dcd2e8d build(deps): bump serde_json from 1.0.81 to 1.0.82
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.81 to 1.0.82.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.81...v1.0.82)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-05 09:09:03 +03:00
dependabot[bot] 55e985da8c build(deps): bump serde from 1.0.137 to 1.0.138
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.137 to 1.0.138.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.137...v1.0.138)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-05 08:43:27 +03:00
Mike Welsh 49e8f4e939 tests: Add test for register preload order 2022-07-03 12:51:07 -07:00
relrelb a4fbd11cf5 tests: Expand `parse_float`
And make it non-approx, since Ruffle now traces the exact output.
2022-07-02 18:08:08 -07:00
relrelb 0148fde852 tests: Expand `as3_parse_int` and `as3_parse_float` a little 2022-07-02 17:48:19 -07:00
Mike Welsh b39d54de2c wgpu: Update exporter for wgpu 0.13 2022-07-02 16:44:37 -07:00
relrelb 65be2adc63 wgpu: Bump to `0.13.0`
Based on the work in #6717, plus additional adaptions mentioned in
https://github.com/gfx-rs/wgpu/blob/master/CHANGELOG.md#wgpu-013-2022-06-30,
and more not-mentioned but required changes.

Also bump `wasm-bindgen` to `0.2.81` (along with its helper crates), as
required by the new `wgpu` version.

Note that I don't fully understand some of the required changes, notably:
* `wgpu::PresentMode::Mailbox` no longer works on my machine (Windows 11) -
The `wgpu` documentation says that `wgpu::PresentMode::Fifo` is the
only guaranteed to be supported, so I switched over to it instead.
* `self.staging_belt.recall()` doesn't return a `Future` anymore -
I assume it became synchronous so I simply removed the `executor`
from there.
2022-07-02 16:44:37 -07:00
Aaron Hill b56eace008
avm2: Implement property type coercions
Properties can be declared with a type
(e.g. `var foo:MyClass = new MyClass();`). When
`set_property`/`init_property` is invoked for that property,
the VM will attempt to coerce the value to the provided type,
throwing an error if this fails. This can have observable behavior
consequences - if a property has type `integer`, for example, then
storing a floating point `Number` to that property will cause the
value to be coerced to an integer. Some SWFs (e.g. 'Solarmax') rely
on this behavior in order to implicitly coerce a floating point value
that's later used for array indexing.

This PR implements property type coercions in Ruffle. There are several
important considerations:

* The class lookup for property types needs to be done lazily, since
we can have a cycle between two classes (e.g. `var prop1:Class2;`
and `var prop2:Class1` in two different classes).
* The class lookup uses special rules (different from
  `resolve_definition`), and does *not* use `ScopeStack/`ScopeTree`
This means that a private class can specified as a property name -
the lookup will succeed without using a scope, even though
`flash.utils.getDefinitionByName` would fail with the same name
* The specialized 'Vector' classes (e.g "Vector$int") can be used
as property types, even though they cannot be lookup up normally.

Some Ruffle class definitions were previously using nonexistent
classes as property types (e.g. "BareObject") - these are fixed
in this PR.
2022-06-30 21:34:26 -07:00
Moulins c7bf11ece5 avm1: More accurate handling of preload/suppress flags in functions
- Handle the case where both preload aud suppress flags are
set for the same variable;
- Remove `arguments` field in `Activation`; instead use a normal
local definition;
- When `suppress_this` is set, inherit the `this` value from parent
activation. (This isn't entirely correct, as FP's `this` is mutable
and seems to be part of the scope chain, but this would require a
larger refactoring)
2022-06-29 16:02:13 -07:00
Moulins 58b4342355 avm1: add failing test for preload/suppress flags on functions 2022-06-29 16:02:13 -07:00
Aaron Hill 9f1cd4dea8 avm2: Don't try to set MovieClip child with default name
Flash Player only sets children with explicit names.
2022-06-26 19:34:21 -07:00
relrelb dd4b615e82 tests: Expand and format `as3_parse_int` 2022-06-23 01:07:15 +03:00
Callum Thomson 1310f433f2
avm2: Implement escape() toplevel (#7281)
* AVM2: Implement escape()

* chore: Fix formatting

* avm2: Escape resolves non strings to null and use push to append

* chore: Fix nits

* avm2: Escape should coerce objects, add early returns
2022-06-22 08:43:22 +03:00
relrelb a3ac9a7064 tests: Have at most one image per test
Previously image tests had an image per platform (i.e. Linux, Windows).
However, due to containing the LLVM version in their name, which
constantly updates on CI, and the fact that those images are actually
identical, unify them into a single `expected.png` image.
2022-06-21 08:03:25 +03:00
relrelb cc542e4aae tests: Add `as3_parse_float_swf10`
To cover the bug compatibility of `parseFloat`.
2022-06-21 08:02:40 +03:00
relrelb f7a0609b62 tests: Expand `as3_parse_float` 2022-06-21 08:02:40 +03:00
Aaron Hill 6d9d155b15 avm2: Use render_list instead of depth_list in most cases
The `render_list` for a container always contains all of the children
under both AVM1 and AVM2 - howver, the depth_list may not contain
some children under AVM2.

When we're not performing some AVM1-specific operation
(e.g. `getInstanceAtDepth`, or dumping out AVM1 variables),
we should be using the render list.
2022-06-11 00:59:18 +03:00
Aaron Hill 487017e7c5 avm2: Properly handle Dictionary enumerants
Previously, there was an off-by-one bug in `get_enumerant_name`,
which caused us to produce a spurious 'null' as a key.
However, the 'dictionary_foreach' test only checked that certain
keys were present, so the presence of an additional key didn't break
the test.

This commit makes Dictionary enumerants behave in the same way as
Array enumerants - all of the object-specific enumerants
(in this case, the non-primitive dicitonar keys) come first,
followed by 'base' enumerants from ScriptObject (in this case,
primtive/String keys). Additionally, `setPropertyIsEnumerable` is now
ignored for `Dictionary`, consistent with Flash's behavior.

The `dictionary_foreach` test is updated to print out all of
the keys when inspecting the dictionary. Since the enumeration
order is unstable (under both Flash and Ruffle) due to the dependency
on pointer hashing, the test sorts the keys before printing them.
This ensures that we get stable output which is consistent between
Ruffle and Flash.
2022-06-07 00:39:42 +02:00
Aaron Hill a4b3dbed79 avm2: Allow accessing `stage.loaderInfo.loaderURL`
Flash Player allows this, and returns the path to the root SWF file.
The test only checks that the returned path contains 'test.swf',
to avoid depending on a platform-specific path.
2022-06-06 22:08:54 +03:00
Aaron Hill 9e4d13f201 avm2: Make `Array.pop` actually pop from the back
The loop to search for a `non_hole` was missing
a `break;`, so it would actually find the *first*
non-hole, rather than than the last. This was not caught
by the test, since there was only one "real" element
in the array (the other one was set on 'Array.prototype')
2022-06-04 23:28:06 +03:00
Toad06 aad3ad6c08 tests: Add test for `Value::as_bool(String)` in SWFv6 2022-05-27 23:05:55 +03:00
Aaron Hill 15cb9a9ce6 Use `instance_scope` when making `super` method call
A method called with `super` is always an instance method,
so we should be using `instance_scope` for consistency with
`call_property`. This fixes a bug where a method cannot
access static class members (via `getlex`) when called bia
`super.method()`
2022-05-24 18:49:47 -06:00
relrelb a398c619a3 tests: Unignore `xml_inspect_xmldecl`
It passes now.
2022-05-20 18:46:19 -07:00
David Wendt e926af7796 core: Prevent recursive execution of frame scripts on the same movie clip.
To be clear, recursive execution of frame scripts between *different* movie clips is still allowed.
2022-05-20 18:37:42 -07:00
Aaron Hill eaeecfcfbc Adjust error message 2022-05-20 11:41:17 -07:00
Aaron Hill 8d8a7600d8 avm2: Partially implement `URLLoader` and related classes
This PR implements the `URLLoader` class, allowing AVM2 scripts
to load data from a URL. This requires several other related
classes (`URLLoaderDataFormat`, `URLRequest`, `IOError`) to be
implemented as well.

Currently implemented:
* Fetching from URLs using the 'navigator' backend
* The `text` and `binary` data formats (which store data
in a `String` or `ByteArray` respectively)
* The `open`, `complete`, and `ioError` events
* The `bytesLoaded`, `bytesTotal`, and `data` properties

Not yet implemented:
* The HTTP and security events
* All of the properties of `IOError`
* The properties on `URLRequest` (besides `url`)
* The "variables" data format

This should be enough to get some basic uses of `URLLoader` working
(e.g. simple GET requests to a particular website).

Note that in Flash's `playerglobal`, the `URLLoader` class is just
a think wrapper around the more general `URLStream`. However,
implementing `URLStream` will require changes to `Navigator``
to support notifications when data arrives in the stream. When
that happens, we should be able to re-use a large amount of the
code in this PR.
2022-05-20 11:41:17 -07:00
Toad06 7130c6c1c1 tests: Remove `Value::from_bool` 2022-05-19 20:24:53 -06:00
Toad06 78dcfe604d tests: `action_enumerate` can handle paths 2022-05-18 19:30:48 -07:00
Mike Welsh eb38b2fb00 tests: Add test for SWF5 function scope 2022-05-14 22:29:44 -07:00
Aaron Hill a453aa73af avm2: Don't consider declared return type for unchecked functions check
Testing under Flash shows that methods can be considered 'unchecked'
(allowing them to be called with more arguments than declared
parameters) even if they have a declared return type.

This is relied on by SteamBirds, which registers an event handler
which takes 0 parameters and an explicitly declared return type
2022-05-13 09:32:05 -07:00
Mike Welsh a940a0d357 tests: Add test for #768 2022-05-09 17:39:49 -07:00
dependabot[bot] 5c43dba766 build(deps): bump serde_json from 1.0.80 to 1.0.81
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.80 to 1.0.81.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.80...v1.0.81)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-09 13:42:53 -07:00
Mike Welsh cc8a88a570 tests: Add tests for ASSetPropFlags version gating 2022-05-07 10:25:10 -07:00
relrelb bcd35d6ad7 tests: Expand and cleanup `xml_namespaces`
Merge the `xml_node_namespaceuri` and `xml_node_weirdnamespace` tests
into `xml_namespaces`, cleanup, and expand it along the way.
2022-05-07 10:24:45 -07:00
relrelb bb0b56cff6 tests: Uncomment `array_sort` tests
They pass now.
2022-05-03 09:47:38 -07:00
dependabot[bot] 6375927d72 build(deps): bump serde_json from 1.0.79 to 1.0.80
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.79 to 1.0.80.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.79...v1.0.80)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-02 14:48:57 -07:00
dependabot[bot] c1bcc98668 build(deps): bump image from 0.24.1 to 0.24.2
Bumps [image](https://github.com/image-rs/image) from 0.24.1 to 0.24.2.
- [Release notes](https://github.com/image-rs/image/releases)
- [Changelog](https://github.com/image-rs/image/blob/master/CHANGES.md)
- [Commits](https://github.com/image-rs/image/commits/v0.24.2)

---
updated-dependencies:
- dependency-name: image
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-02 14:48:00 -07:00
dependabot[bot] 86e3f6c82a build(deps): bump serde from 1.0.136 to 1.0.137
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.136 to 1.0.137.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.136...v1.0.137)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-02 13:41:28 -07:00
Mike Welsh 1eb06908c8 core: Make PlayerBuilder::build infallible 2022-04-29 09:14:32 -07:00
Mike Welsh f48182ef3d core: Add various settings to PlayerBuilder 2022-04-29 09:14:32 -07:00
Mike Welsh e1e2b1008a core: Add PlayerBuilder 2022-04-29 09:14:32 -07:00
David Wendt 90da579835 tests: Tests should process events after a frame runs, otherwise we miss some at the start. 2022-04-25 16:29:07 -06:00
David Wendt d4dc440bb6 tests: Add a basic test for mouse clicks on AS2. 2022-04-25 16:29:07 -06:00
David Wendt 4c8443a464 tests: Add support for `input.json` files next to tests.
If the file is missing we treat it as if the file has no events to inject.
2022-04-25 16:29:07 -06:00
David Wendt 06410e97ba tests: Input files should be `Debug` 2022-04-25 16:29:07 -06:00
David Wendt e28ecbb647 tests: `InputInjector.next` must actually move up it's position index 2022-04-25 16:29:07 -06:00
David Wendt 952fee4ac0 tests: Add `InputInjector` type for opening and iterating an input file. 2022-04-25 16:29:07 -06:00
David Wendt ac86dee3a6 tests: Add a library defining the file format for Ruffle test input.
I intend to share this code across both Ruffle and FlashTAS (another project that allows running input tests on Flash Player), hence why it's a separate library from Ruffle's tests crate.
2022-04-25 16:29:07 -06:00
relrelb d27f1fb811 tests: Fix image tests
CI was upgraded to use LLVM 14.
Rename image tests (currently only color) to match it.
2022-04-23 00:07:56 -07:00
Mike Welsh cc9bdaaadb tests: Add test for sortOn with proto and virtual properties 2022-04-18 08:34:04 -07:00
Mike Welsh b83879c392 tests: Update reference images 2022-04-15 14:52:33 -07:00
Toad06 65d58f4733 tests: Add tests for `Add`, `Equals`, `Less` and `GetProperty` actions 2022-04-13 22:00:25 -07:00
Mike Welsh bd144194c3 tests: Add test for bool values in SWFv4 2022-04-10 20:03:39 -07:00
Mike Welsh 3d4d7a0ab5 tests: Add test for division in SWFv4 2022-04-09 23:17:39 -07:00
relrelb 7497fb7008 core: Change `Player::set_root_movie` to accept a `SwfMovie`
Move the `Arc::new` to within the function.
2022-04-08 15:16:25 -07:00
dependabot[bot] 2af8c851e2 build(deps): bump pretty_assertions from 1.2.0 to 1.2.1
Bumps [pretty_assertions](https://github.com/colin-kiegel/rust-pretty-assertions) from 1.2.0 to 1.2.1.
- [Release notes](https://github.com/colin-kiegel/rust-pretty-assertions/releases)
- [Changelog](https://github.com/colin-kiegel/rust-pretty-assertions/blob/main/CHANGELOG.md)
- [Commits](https://github.com/colin-kiegel/rust-pretty-assertions/compare/v1.2.0...v1.2.1)

---
updated-dependencies:
- dependency-name: pretty_assertions
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-04 18:43:37 -07:00
Toad06 0aff256c1a tests: `DefineLocal` also accepts dot and slash paths 2022-04-02 14:30:56 -07:00
relrelb 3a5e94dad2 tests: Expand `mcl_loadclip`
Test for invalid data loading.
2022-04-02 12:50:43 -07:00
Aaron Hill 4f23500779 avm2: Implement most of `flash.external.ExternalInterface`
This re-uses the logic we have for handling AVM1's `ExternalInterface`.
For now, serialization/deserialization of non-array objects is
left unimplemented.
2022-03-31 22:40:09 -07:00
Mike Welsh a9aaa0b0de tests: Add test for Add2 op 2022-03-31 16:57:07 -07:00
dependabot[bot] e5a3365957 build(deps): bump image from 0.23.14 to 0.24.1
Bumps [image](https://github.com/image-rs/image) from 0.23.14 to 0.24.1.
- [Release notes](https://github.com/image-rs/image/releases)
- [Changelog](https://github.com/image-rs/image/blob/master/CHANGES.md)
- [Commits](https://github.com/image-rs/image/commits)

---
updated-dependencies:
- dependency-name: image
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-30 08:55:55 +03:00
Mike Welsh 02fe467bd2 tests: Reduce epsilon for autosize tests 2022-03-29 22:22:32 -07:00
Mike Welsh f0836eb7fa tests: Add test for String(function) to string_coercion 2022-03-28 19:07:12 -07:00
Mike Welsh bda8db5a34 tests: Add Object < Object tests to lessthan2 tests 2022-03-28 19:07:12 -07:00
Mike Welsh 02a66e938c tests: Unignore avm1 string_coercion test 2022-03-28 19:07:12 -07:00
David Wendt d38e5e166b tests: Add regression tests for image loading 2022-03-27 18:55:38 -07:00
relrelb 161071e8c4 core: Re-implement `NullExecutor`
Make it a thin abstraction layer over either the `futures` or `wasm-bindgen-futures`
crates, as already done in `render/wgpu/src/uniform_buffer.rs`,
instead of a hand-made single-thread executor.

Ideally this would also be usable on desktop, but I didn't manage to
get `LocalPool` working with `winit` (it needs to post a task to the
`EventLoopProxy` as a wake procedure).
2022-03-26 10:03:42 -07:00
relrelb bee70c99de tests: Expand `xml_to_string`
Test that a set `nodeName` is included in the final string
representation.
2022-03-19 16:31:24 -07:00
relrelb bac6f50fa3 tests: Expand `xml_append_child`
Test that document roots can be appended as children.
2022-03-19 16:31:24 -07:00
relrelb 031126a1b8 core: Remove `LocaleBackend`
Previously there were 3 implementations of `LocaleBackend`:
`DesktopLocaleBackend`, `WebLocaleBackend` and `NullLocaleBackend`.

While `DesktopLocaleBackend`, `WebLocaleBackend` were identical,
`NullLocaleBackend` always returned a fixed date/time for tests
determinism.

Unify them in a single file, and use `cfg!(test)` and a new dedicated
`deterministic` feature to decide whether to mock date/time or not.
This should not cause any behavioral changes.
2022-03-16 19:57:53 +02:00
dependabot[bot] 50ab1e6130 build(deps): bump pretty_assertions from 1.1.0 to 1.2.0
Bumps [pretty_assertions](https://github.com/colin-kiegel/rust-pretty-assertions) from 1.1.0 to 1.2.0.
- [Release notes](https://github.com/colin-kiegel/rust-pretty-assertions/releases)
- [Changelog](https://github.com/colin-kiegel/rust-pretty-assertions/blob/main/CHANGELOG.md)
- [Commits](https://github.com/colin-kiegel/rust-pretty-assertions/commits)

---
updated-dependencies:
- dependency-name: pretty_assertions
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-14 22:35:54 +02:00
relrelb 95a0ef993b tests: Merge `roots_and_levels` into `stage_object_children`
And add some more cases along the way.
2022-03-12 16:48:55 +02:00
relrelb efc60094a5 tests: Expand `transform` 2022-03-12 15:59:05 +02:00
relrelb d8df22fab0 tests: Add `is_finite`
Based on `as3_is_finite`.
2022-03-06 23:15:18 +01:00
dependabot[bot] 4e2f7b02fc build(deps): bump futures from 0.3.19 to 0.3.21
Bumps [futures](https://github.com/rust-lang/futures-rs) from 0.3.19 to 0.3.21.
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.19...0.3.21)

---
updated-dependencies:
- dependency-name: futures
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-13 19:44:57 +02:00
dependabot[bot] 4a90d5f7ad build(deps): bump pretty_assertions from 1.0.0 to 1.1.0
Bumps [pretty_assertions](https://github.com/colin-kiegel/rust-pretty-assertions) from 1.0.0 to 1.1.0.
- [Release notes](https://github.com/colin-kiegel/rust-pretty-assertions/releases)
- [Changelog](https://github.com/colin-kiegel/rust-pretty-assertions/blob/main/CHANGELOG.md)
- [Commits](https://github.com/colin-kiegel/rust-pretty-assertions/compare/v1.0.0...v1.1.0)

---
updated-dependencies:
- dependency-name: pretty_assertions
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-13 17:02:18 +02:00
relrelb 26025a0446 tests: Expand `register_class` and `register_class_swf6` 2022-02-10 07:58:30 +02:00
TÖRÖK Attila 81c8f040fa tests: Adjust avm2/edittext_leading for the updated fake device font 2022-02-09 20:09:52 +01:00
Adrian Wielgosik 9059e199e2 avm2: Add tests for class calling 2022-02-07 00:49:00 +01:00
TÖRÖK Attila 43b21e5d4d chore: Bump approx to 0.5.1, remove clippy lint suppressions 2022-01-25 18:34:35 -08:00
Mike Welsh 3e9f9741ea tests: Edit funky_function_calls to test undefined this
Test `this` instead of `this == other_this` to verify when it is
indeed an unboxed undefined.
2022-01-24 02:04:57 -08:00
Mike Welsh d9bedffb9f tests: Add tests for Object-to-String coercion 2022-01-23 17:19:09 -08:00
David Wendt c42984a990 avm2: Implement `MouseEvent.toString`.
This also rearranges some things about how we construct events, because `MouseEvent` has different defaults from `Event`. When we finally support parameter metadata on methods we should remove that code.

We also remove the `value_of` code on `EventObject` as that was a mistake. Events don't do anything special in there and I misinterpreted the test results the first time around.
2022-01-22 19:58:32 -08:00
David Wendt 59d735a034 tests: Add a test for `MouseEvent.stageX`/`stageY` 2022-01-22 19:58:32 -08:00
David Wendt 69c66fe720 tests: Add a test of `MouseEvent`'s constructor 2022-01-22 19:58:32 -08:00
Mike Welsh e11e1e870f avm1: Improve Object comparisons in SWFv5
SWFv5 always calls `Object.valueOf` at least once and sometimes
twice in the Equals2 op, even when comparing two Objects.

For example, `Object(1) == Object(1)` is true in SWFv5 but false
in SWFv6.
2022-01-21 16:40:19 -08:00
Mike Welsh bf599d9107 avm1: Clean up Value::abstract_eq
Consolidate several cases and fix some issues:
 * Object-to-primitive comparison always goes through `valueOf`.
 * `Object(undefined) == undefined` is true; this will coerce
   to a bare object with no `valueOf`, resulting in
   `undefined==undefined`.
 * `{valueOf:function() { return NaN; }} == NaN` is true.
2022-01-21 16:40:19 -08:00
Mike Welsh 4d8db1e64d avm1: Fix function closures inside `with`
When creating a scope for a closure, any `with` scopes were being
filtered out, but this was incorrect; `with` scopes are still on
the scope chain when the function is called.
2022-01-19 20:29:26 -08:00
Adrian Wielgosik 5358940774 avm2: Support basic string.replace
Supports:
- string.replace(string, string)
- string.replace(regex, simple_string)

Does not support:
- string.replace(regex, string_with_replacement_codes)
- string.replace(any, function)
2022-01-17 20:10:20 -08:00
relrelb 7dad98e3a8 tests: Expand `mcl_getprogress` 2022-01-15 13:08:01 -08:00
relrelb 6ec69dcae1 tests: Expand `mcl_loadclip` 2022-01-15 13:08:01 -08:00
relrelb 6b80b296fc tests: Expand `mcl_loadclip` 2022-01-07 10:39:16 -08:00
Mike Welsh ab88f9a23e tests: Add test case for #5598 2022-01-01 22:24:08 -08:00
dependabot[bot] a99b23dcf5 build(deps): bump futures from 0.3.18 to 0.3.19
Bumps [futures](https://github.com/rust-lang/futures-rs) from 0.3.18 to 0.3.19.
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.18...0.3.19)

---
updated-dependencies:
- dependency-name: futures
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-21 08:36:06 +02:00
relrelb ccef61d076 tests: Unignore `edittext_html_roundtrip` and `as3_edittext_html_roundtrip` 2021-12-20 08:31:59 +02:00
Adrian Wielgosik 726ec47f19 avm2: Support inheritance of protected traits 2021-12-15 22:26:41 +01:00
Adrian Wielgosik 11534a4b34 avm2: Implement parseInt, parseFloat 2021-12-15 22:16:49 +01:00
EmperorBale 30f2e0f8b1
avm2: Implement JSON (#5172)
* avm2: Implement JSON.parse

* avm2: Add AvmSerializer for serializing AVM values to JSON

* avm2: Add support for replacer objects

* avm2: use *const ObjectPtr for object stack

* avm2: Add support for space parameter is JSON.stringify

* avm2: Refactor AvmSerializer design

* avm2: Restrict spaces to a maximum of 10

* avm2: Refactor map_value

* tests: Add JSON.parse test

* chore: Appease clippy

* avm2: Check if value is undefined before inserting

* tests: Add test for JSON.stringify

* tests: Improve JSON.stringify test

* chore: Replace map_or with explicit match statements

* chore: Use QName::dynamic_name

* avm2: Use Object<'gc> instead of ObjectPtr

* chore: Use explicit match in deserialize_value

* Rebase fixes

Co-authored-by: Adrian Wielgosik <adrian.wielgosik@gmail.com>
2021-12-13 18:32:04 +01:00
Adrian Wielgosik b4d444175d Update failing tests, drag one always-failing case to separate test 2021-12-11 20:48:09 +01:00
relrelb e801ab234e tests: Expand `as3_trace` 2021-12-10 19:54:35 +02:00
relrelb 6e70379054 tests: Add `trace` 2021-12-10 19:54:35 +02:00
relrelb 7966d850dd core: Normalize `\r` to `\n` in `avm_trace`
Fixes #3120.
2021-12-10 19:54:35 +02:00
Daniel Jacobs ed7a13ab05 Chore: Alphabetize regression tests 2021-12-04 13:45:22 +02:00
dependabot[bot] ea254b53b7 build(deps): bump futures from 0.3.17 to 0.3.18
Bumps [futures](https://github.com/rust-lang/futures-rs) from 0.3.17 to 0.3.18.
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.17...0.3.18)

---
updated-dependencies:
- dependency-name: futures
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-29 22:35:40 +02:00
David Wendt 7569994f1f avm2: Impl `Boolean.toString` and `Boolean.valueOf`. 2021-11-28 18:40:21 -07:00
David Wendt aa01a682e1 avm2: Implement `uint`'s various formatting methods, too. 2021-11-28 18:40:21 -07:00
David Wendt e43d18f7b0 avm2: Impl `int` versions of `toFixed`, `toString`, `toExponential`, and `toPrecision` 2021-11-28 18:40:21 -07:00
David Wendt 9e62b05157 avm2: Implement `Number.AS3::toString` and `Number.AS3::valueOf`.
This method has an odd flaw that we don't emulate yet. Actually, two:

1. Precision limits that are specific to the chosen radix
2. Occasional and intermittent corruption in the resulting 0 padding; usually manifesting as `x`, `W`, or `°` characters

The first could be emulated, but I've chosen not to... because the second thing listed not only isn't really possible to emulate, but actively prohibits approx-testing the results. So I'm marking the test as ignored and hoping no movies actually rely on the precision limits in `toString`.
2021-11-28 18:40:21 -07:00
David Wendt 4a09dfa3d0 avm2: Implement `Number.toFixed` and `Number.toPrecision` 2021-11-28 18:40:21 -07:00
David Wendt 55a7a1882d avm2: Implement `Number.toExponential` 2021-11-28 18:40:21 -07:00
relrelb 8fb77b34d6 tests: Add `bitmap_data_compare` 2021-11-20 14:11:14 +02:00
relrelb 7c6d006862 avm2: Correct `TextFormat` properties coercion 2021-11-20 13:36:06 +02:00
relrelb 10b7c69719 avm1: Correct `TextFormat` properties coercion 2021-11-20 13:36:06 +02:00
relrelb ae189c5a0d tests: Fix image tests
Seems like CI was upgraded to use LLVM 13.
Rename image tests (currently only color) to match it.
2021-11-19 21:40:30 +02:00
relrelb 2083d77100 tests: Expand `sound`
Add cases of `Sound.setVolume()` and `Sound.setPan()` with no arguments.
Also correct `Sound` to `sound` in traces.
2021-11-14 20:25:45 +02:00
relrelb 2e5a8922ae tests: Uncomment `Sound.getDuration` tests
`NullAudioBackend` returns real durations by now.
2021-11-14 20:25:45 +02:00
David Wendt 19f9c11854 tests: Add test for `Function`'s type. 2021-11-11 17:12:49 -07:00
David Wendt e89d85c3f6 tests: Add tests for the four remaining primitive constructors 2021-11-11 16:34:11 -07:00
Tal Hayon 7ed38850fd core: implement displayState for Stage in avm1/2 2021-11-11 16:20:05 -07:00
David Wendt c4b680fef9 tests: Add test for `EventDispatcher.toString` 2021-11-10 18:16:26 -07:00
David Wendt 360ae1f044 avm2: Private classes in different scripts are allowed to share the same name without conflicting. 2021-11-10 17:43:02 -07:00
David Wendt 5b58301795 tests: Fix all remaining test bugs caused by discrepancies between how Ruffle and Flash Player handle dynamic `Namespace`s.
For some reason, in Flash Player, `RTQName`s that use a dynamic namespace do *not* pick the same namespace that you would ordinarily get if declaring or referencing that namespace statically. My suspicion is that this has something to do with E4X namespaces, which are flagged as a separate space from ES4 namespaces.
2021-11-09 17:28:33 -07:00
David Wendt 427b2bf17a avm2: Implement `Proxy.deleteproperty` 2021-11-09 17:28:33 -07:00
David Wendt 452a87da84 tests: In the `getproperty` test, test each multiname type directly to rule out any funny business.
For some reason, Flash Player treats `getlex`ing `flash.utils.flash_proxy` as a separate namespace from `pushnamespace`ing it. Don't ask why.
2021-11-09 17:28:33 -07:00
David Wendt 685d386389 tests: Add a test for every part of `Proxy` that does not involve E4X. 2021-11-09 17:28:33 -07:00
David Wendt 95f105aadd core: `Stage`, `EditText`, and `Avm2Button` should also be interactive objects. 2021-11-09 16:48:29 -07:00
David Wendt e71c749db5 avm2: Implement accessors for new `InteractiveObject` flags. 2021-11-09 16:48:29 -07:00
David Wendt 9d3e249cf9 tests: Add test for interface namespaces (accessed via coercion semantic sugar) 2021-11-02 16:54:38 -06:00
Mike Welsh 92977e0430 tests: Add hitTest test for unclosed drawing path 2021-10-31 19:01:55 -07:00
Mike Welsh 64cc6fc80f tests: Add test for duplicateMovieClip w/ drawing API 2021-10-31 19:01:55 -07:00
David Wendt 039777c41e avm2: `Object.hasOwnProperty`, `propertyIsEnumerable`, and `setPropertyIsEnumerable` only work with public-NS properties. 2021-10-30 11:44:29 -06:00
Mike Welsh a1130b973f tests: Add test for GotoFrame2 after bogus tellTarget 2021-10-28 10:18:18 -07:00
Mike Welsh 6ac49b3d0d tests: Add test for tellTarget with removed base clip 2021-10-28 10:18:18 -07:00
EmperorBale 1e9189dffc tests: Improve AMF3 test 2021-10-25 16:32:55 -07:00
EmperorBale 84a7b3d148 tests: Add test for reading AMF0 objects 2021-10-25 16:32:55 -07:00
EmperorBale e7a723f250 tests: Add test for reading AMF3 objects 2021-10-25 16:32:55 -07:00
EmperorBale f6c5e2e0dc avm2: Add test for array enumeration on elements 2021-10-25 13:45:29 -07:00
Mike Welsh df270c55af wgpu: Make WgpuRenderBackend::build_descriptors async
This will be necessary for using wgpu on web, where the whole
renderer creation will need to be async.
2021-10-24 17:20:19 -07:00
Mike Welsh 0cbdad1ff2 wgpu: Bump to wgpu 0.11 2021-10-24 17:20:19 -07:00
David Wendt 5abb11482e avm2: Make builtin class prototypes also instances of `Object`, with the sole exception of `Function`, whose prototype is an instance of it's class. 2021-10-22 20:12:48 -07:00
David Wendt 469f8cb9db avm2: All prototypes are instances of `Object`, not their own class. 2021-10-22 20:12:48 -07:00
Adrian Wielgosik bc82a4f705 build: Bump Rust edition to 2021 2021-10-21 10:24:05 -07:00
EmperorBale 2793c3b556 tests: Add test for getouterscope 2021-10-19 18:39:41 -06:00
EmperorBale a9f5823074 tests: Add test for with 2021-10-19 18:39:41 -06:00
EmperorBale edee0a713c tests: Add test for #5292 2021-10-19 18:39:41 -06:00
relrelb 7816938e9b tests: Expand avm1 `SuperObject` tests 2021-10-16 11:14:38 -07:00
Mike Welsh af244c1c66 tests: Add test for function w/ removed base clip 2021-10-12 17:23:01 -07:00
Mike Welsh f008fc4474 tests: Add test for avm2 self-goto execution order 2021-10-10 18:27:30 -07:00
Mike Welsh 279834a499 tests: Add test for default null-ish slot values 2021-10-10 14:01:36 -07:00
EmperorBale 2b77fff8f7 tests: Add test for vector enumeration 2021-10-10 11:02:42 -07:00
EmperorBale 9bca63375f tests: Add test for array enumeration 2021-10-10 11:02:42 -07:00
dependabot[bot] cd9206f08d build(deps): bump pretty_assertions from 0.7.2 to 1.0.0
Bumps [pretty_assertions](https://github.com/colin-kiegel/rust-pretty-assertions) from 0.7.2 to 1.0.0.
- [Release notes](https://github.com/colin-kiegel/rust-pretty-assertions/releases)
- [Changelog](https://github.com/colin-kiegel/rust-pretty-assertions/blob/main/CHANGELOG.md)
- [Commits](https://github.com/colin-kiegel/rust-pretty-assertions/compare/v0.7.2...v1.0.0)

---
updated-dependencies:
- dependency-name: pretty_assertions
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-04 15:02:30 -07:00
TÖRÖK Attila 8cf39f3001 Allow the if_then_panic clippy lint in one more place 2021-10-03 15:50:54 -07:00
David Wendt aaca3460d4 avm2: `QName` overrides `toString` and `valueOf` in both namespaces 2021-10-01 16:30:58 -06:00
David Wendt 44b5536fb6 tests: Add tests for `QName`. 2021-10-01 16:30:58 -06:00
David Wendt 2007b0e5c3 tests: Remove superfluous `^M` characters from ActionScript source 2021-09-25 16:54:36 -06:00
David Wendt c299f63784 avm2: Implement object space enumeration.
This required making enumerants into `Value`s, rather than `QName`s.
2021-09-25 16:54:36 -06:00
David Wendt 66ac5d0693 tests: Add tests for various operations on `Dictionary`. 2021-09-25 16:54:36 -06:00
EmperorBale b4fe77394d tests: Write tests 2021-09-23 00:01:50 +02:00
kmeisthax 42275f43f3 avm2: Properly make all classes an instance of `Class`. (#57)
* avm2: Properly make all classes an instance of `Class`.

Also, does this technically mean that `Class` is a metaclass?

* avm2: Remove `Function::from_method_and_proto` as it will no longer be needed

* avm2: Ensure builtin classes are also instances of `Class`.

This requires tying a veritable gordian knot of classes; everything needs to be allocated up-front, linked together, and then properly initialized later on. This necessitated splitting the whole class construction process up into three steps:

1. Allocation via `from_class_partial`, which does everything that can be done without any other classes
2. Weaving via `link_prototype` and `link_type`, which links all of the allocated parts together correctly. This also includes initializing `SystemClasses` and `SystemPrototypes`.
3. Initialization via `into_finished_class`, which must be done *after* the weave has finished.

Once complete you have core classes that are all instances of `Class`, along with prototypes that have their usual legacy quirks.

Note that this does *not* make prototypes instances of their class. We do need to do that, but doing so breaks ES3 legacy support. This is because we currently only work with bound methods, but need to be able to call unbound methods in `callproperty`.

* tests: Add a test for all core classes' instance-of relationships
2021-09-22 00:29:37 +02:00
dependabot[bot] f1656f4f9c build(deps): bump pretty_assertions from 0.6.1 to 0.7.2
Bumps [pretty_assertions](https://github.com/colin-kiegel/rust-pretty-assertions) from 0.6.1 to 0.7.2.
- [Release notes](https://github.com/colin-kiegel/rust-pretty-assertions/releases)
- [Changelog](https://github.com/colin-kiegel/rust-pretty-assertions/blob/main/CHANGELOG.md)
- [Commits](https://github.com/colin-kiegel/rust-pretty-assertions/compare/v0.6.1...v0.7.2)

---
updated-dependencies:
- dependency-name: pretty_assertions
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-21 00:07:31 +03:00
Chris Midgley bcf1899291 dev: use rabcdasm to produce asasm / abc output, note how 2021-09-18 18:42:36 +02:00
Chris Midgley 7bab1de1e7 avm2: implement coerce_x opcodes 2021-09-18 18:42:36 +02:00
lukaszN 42300d4a1e avm2: String tests 2021-09-18 18:37:46 +02:00
relrelb 818bf0809d tests: Add math_min_max 2021-09-16 02:38:34 -07:00
David Wendt 1e0d259075 avm2: Allow nulling `Bitmap.bitmapData`.
One of the two tests in this PR relies upon the backend storing bitmap data, but the test rendering backend does not yet do this.
2021-09-11 12:11:35 -07:00
David Wendt 7c5dc568f1 avm2: Impl `BitmapData.getPixel`.
This also changes the `bitmapdata_constr` test slightly to use a different starting value. Our premultiplied alpha calculations generate slightly different values from Flash Player which trips the test.
2021-09-11 12:11:35 -07:00
David Wendt 723b8b6756 tests: Add tests for `BitmapData`'s constructor, in both fresh and embedded bitmap contexts. 2021-09-11 12:11:35 -07:00
David Wendt fbccd75e23 tests: Add bitmap timeline test 2021-09-11 12:11:35 -07:00
Chris Midgley bd26790f5b
avm1: Fix `this` inside watchers (#5276)
* fix: fix 'this' inside watchers

* tests: test value of 'this' in watcher

* lint: cargo fmt
2021-09-11 15:15:16 +03:00
Tal Hayon 7d6eaf127d core: Fix EditText width and height scaling (close #3001) 2021-09-08 02:39:01 -07:00
Chris Midgley 868706d775
avm1: call watcher, if defined, from virtual properties on prototype (#4827)
* avm1: extract get_watcher

* tests: add tests for TextField text watch

* avm1: call the watcher, if defined, from call_setter

* dev: shadow variable to avoid unused mut warning

* dev: remove value mutability

* chore: cargo fmt

* dev: unify virtual and stored property watcher cases

* tests: add test for watching prototyped property

* feat: when getting old values, ascend the proto chain ignoring virtual properties

* chore: lint

* dev: share complicated code

* chore: Small cleanups

Co-authored-by: relrelb <relrelbachar@gmail.com>
2021-09-08 03:41:18 +03:00
David Wendt 34fe35a998 avm2: Impl `SoundMixer.bufferTime` 2021-09-03 16:47:02 -06:00
David Wendt 364ee62c92 avm2: Impl `SoundChannel`'s `soundComplete` event.
This includes a test that is currently ignored because `NullAudioBackend` can't fire complete events.
2021-09-03 16:47:02 -06:00
David Wendt efcab92d97 avm2: Impl `SoundMixer.stopAll` 2021-09-03 16:47:02 -06:00
David Wendt d73ba586d0 avm2: Impl `SoundChannel.stop()` 2021-09-03 16:47:02 -06:00
David Wendt 39305f6a38 avm2: Implement `SoundChannel.soundTransform` 2021-09-03 16:47:02 -06:00
David Wendt 6b7609ff4e avm2: Stub `SoundChannel.position`.
This also comes with an ignored test for `position`, because I originally believed this to be implementable.
2021-09-03 16:47:02 -06:00
David Wendt 116fb1f323 avm2: Impl `Sound.play`
This does not (yet) implement the third `SoundTransform` parameter on `play`.
2021-09-03 16:47:02 -06:00
David Wendt 3c3228f3c9 tests: Add tests for `SimpleButton.soundTransform` and `SoundMixer.soundTransform` 2021-09-03 16:47:02 -06:00
David Wendt 2f6e695483 avm2: Impl `Sprite.soundTransform` 2021-09-03 16:47:02 -06:00
David Wendt 66117450f5 tests: Add more coverage of `rightToLeft` as it disables `pan` 2021-09-03 16:47:02 -06:00
David Wendt 9926237074 tests: Add a test for AS3 `SoundTransform` properties 2021-09-03 16:47:02 -06:00
David Wendt b184273352 tests: Add some basic tests for the `Sound` class 2021-09-03 16:47:02 -06:00
David Wendt bf4492c454 avm2: Add the legacy Vector types that old movies can use.
This one was rather tough to test, as I actually can't generate ABCs in Animate CC that reference these classes. I instead had to modify a compiled SWF to open the package-internal namespace that these pre-specialized classes exist in.
2021-09-02 17:57:58 -06:00
David Wendt b452b653bf tests: Add a test for `Vector`'s instance initializer. 2021-09-02 17:57:58 -06:00
David Wendt aaddcc598f avm2: Impl `Vector.toLocaleString` and test `toString` 2021-09-02 17:57:58 -06:00
David Wendt dbc6f38c34 avm2: Impl `Vector.splice` 2021-09-02 17:57:58 -06:00
David Wendt 81d0775776 avm2: Impl `Vector.sort` 2021-09-02 17:57:58 -06:00
David Wendt 44a9f13047 avm2: Impl `Vector.slice` 2021-09-02 17:57:58 -06:00
David Wendt 077fd87842 avm2: Impl `Vector.reverse` 2021-09-02 17:57:58 -06:00
David Wendt aa2d729a44 avm2: Impl `Vector.removeAt` 2021-09-02 17:57:58 -06:00
David Wendt cea580e7c0 tests: Ensure we're testing push/shift/etc with empty vectors 2021-09-02 17:57:58 -06:00
David Wendt a053015558 avm2: Impl `Vector.insertAt` 2021-09-02 17:57:58 -06:00
David Wendt e3ad30a0f7 tests: Consolidate all of the type variants of each test into one test per function. 2021-09-02 17:57:58 -06:00
David Wendt 1cfa9e0b28 avm2: Impl `Vector.push` and `.pop` 2021-09-02 17:57:58 -06:00
David Wendt 6350ce2dde avm2: Impl `Vector.map` 2021-09-02 17:57:58 -06:00
David Wendt 7628b2b49a avm2: Impl `Vector.lastIndexOf` (and the weird backward-index behavior of `indexOf`) 2021-09-02 17:57:58 -06:00
David Wendt 4624157ae0 avm2: Impl `Vector.indexOf` 2021-09-02 17:57:58 -06:00
David Wendt c06a3c10d8 avm2: Impl `Vector.filter` 2021-09-02 17:57:58 -06:00
David Wendt 97e6f55110 avm2: Impl `Vector.every` 2021-09-02 17:57:58 -06:00
David Wendt 01904acad3 tests: Add `Vector.<T>.join` tests 2021-09-02 17:57:58 -06:00
David Wendt f255c7d577 tests: Add tests for multi-dimensional vector coercion typechecks & concatenation 2021-09-02 17:57:58 -06:00
David Wendt ecf514969b tests: Add a test for concatenating to lists of ES4 interfaces. 2021-09-02 17:57:58 -06:00
David Wendt 8740098e5d tests: Recompile the `vector_es4class_concat` test 2021-09-02 17:57:58 -06:00
David Wendt 70b60d6bb4 tests: Recompile the concat test 2021-09-02 17:57:58 -06:00
David Wendt 9a1b864988 tests: Add tests for `Vector.concat` 2021-09-02 17:57:58 -06:00
David Wendt 176f05a16b tests: Recompile a handful of miscompiled tests 2021-09-02 17:57:58 -06:00
David Wendt 1711400f07 tests: Actually enable all the vector tests I've been running 2021-09-02 17:57:58 -06:00
David Wendt f6ea1b2bff tests: Add a test for the `delete` operator 2021-09-02 17:57:58 -06:00
David Wendt f3cf82ad5a tests: Add test for sticking ES3 classes in a `Vector.<Object>` 2021-09-02 17:57:58 -06:00
David Wendt e65958cc22 tests: Add another test for subclass and superclass storage 2021-09-02 17:57:58 -06:00
David Wendt 2af5192893 tests: Add tests for vector holes and set coercion 2021-09-02 17:57:58 -06:00
David Wendt 9a3c4e6adb tests: Here's a very basic test for int access 2021-09-02 17:57:58 -06:00
David Wendt 4cf407da7e tests: Add a test for symbol class association on buttons, both for timeline-constructed and AVM-constructed buttons. 2021-08-31 21:21:54 -06:00
David Wendt 587c423027 tests: Remove garbage in `font_embedded` test, too 2021-08-30 17:53:39 -06:00
David Wendt 6c3c930954 tests: Remove garbage character in `font_hasglyphs` test 2021-08-30 17:53:39 -06:00
David Wendt 2d57bed82e avm2: Impl `Font.hasGlyphs` 2021-08-30 17:53:39 -06:00
David Wendt 37af9be533 avm2: Implement `Font` for embedded fonts. 2021-08-30 17:53:39 -06:00
Adrian Wielgosik 945bce4a85 xml: Use forked quick-xml to support loose entity parsing 2021-08-30 19:08:22 +02:00
EmperorBale 830c2b541f tests: Add test for getQualifiedSuperclassName 2021-08-29 20:41:20 -06:00
EmperorBale a2a73c0278 tests: Improve getDefinitionByName test 2021-08-29 20:41:20 -06:00
EmperorBale 34e9443a3b tests: Add test for getQualifiedClassName 2021-08-29 20:41:20 -06:00
EmperorBale 70ffc8c224 tests: Add test for getDefinitionByName 2021-08-29 20:41:20 -06:00
David Wendt 24086af276 tests: Restore the "original" source code of the AVM1 rectangle test and reapply all modifications made to it to produce the AVM2 test 2021-08-23 16:40:32 -06:00
lukaszN cf3f02a9ce avm2: add tests for Rectangle 2021-08-23 15:44:14 -06:00
lukaszN 65eb6f3dfd avm2: Add flash.geom.Rectangle tests 2021-08-23 15:44:14 -06:00
Tal Hayon 7b9049cedf core: Add DefineBinaryData and SymbolClass connection (Part of #1368) 2021-08-21 12:24:46 -06:00
relrelb 9d174825c9 tests: Expand add_property 2021-08-21 17:23:15 +03:00
Chris Midgley 58c907e985
avm2: implement string.split for undefined (#5064)
* avm2: implement string.split for undefined

* chore: cargo fmt

* dev: avoid explicit ArrayStorage
2021-08-18 18:02:41 +02:00
Adrian Wielgosik 5dee7f163c Add new tests for avm2 string.split() 2021-08-14 00:52:38 +02:00
relrelb 3641822f7d tests: Expand object_prototypes 2021-07-30 17:42:42 -07:00
Mike Welsh 8a2298bd8f chore: Bump mesa-vulkan-drivers version 2021-07-22 00:30:18 -07:00
Aaron Hill 068e06e40f Add support for image comparison tests 2021-07-21 21:48:24 -07:00
EmperorBale 38ae630aac tests: Add test for generateRandomBytes 2021-07-21 18:09:21 +02:00
David Wendt ddd73b3cd6 avm2: Supercalls should fall back to normal receiver access if there is no matching supertrait to use. 2021-07-20 22:12:31 -04:00
David Wendt b2c1299f79 tests: Add a test for bare calls on the ES4 class object 2021-07-20 22:12:28 -04:00
David Wendt 21a994ee8a tests: Actually run the `istypelate_coerce` test 2021-07-20 22:05:37 -04:00
David Wendt e38b1bc281 avm2: Make numbers appear to be of any numeric type that can represent them.
This also prevents an exception from being fired when testing `undefined` or `null`, which are valid inputs to `istype`.
2021-07-20 22:05:35 -04:00
David Wendt 974fe152ff avm2: Include the parameter coercions into `op_coerce` 2021-07-20 22:05:34 -04:00
David Wendt 2d3ef5493b tests: Add tests for default parameters, type checks, and implicit typecheck coercions 2021-07-20 22:05:33 -04:00
dependabot[bot] ca2d17ade6 chore: Bump env_logger from 0.8.4 to 0.9.0
Bumps [env_logger](https://github.com/env-logger-rs/env_logger) from 0.8.4 to 0.9.0.
- [Release notes](https://github.com/env-logger-rs/env_logger/releases)
- [Changelog](https://github.com/env-logger-rs/env_logger/blob/main/CHANGELOG.md)
- [Commits](https://github.com/env-logger-rs/env_logger/compare/v0.8.4...v0.9.0)

---
updated-dependencies:
- dependency-name: env_logger
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-19 23:49:40 +03:00
relrelb 3ddd8ff31c tests: Add as_set_prop_flags 2021-07-18 20:03:52 +03:00
Callum Thomson 939d467897
avm1: Correct ToInteger
* Coerce objects as well.
* Wrap numbers around i32.
2021-07-09 03:39:07 +03:00
Chris Midgley ac0fc40345
avm1: implement scroll, maxscroll and bottomScroll for TextField (#4698)
* tests: add tests for scroll

* avm1: implement scroll, maxscroll, bottomScroll

* chore: fmt

* docs: note that scroll is 1-based

* fix: non-word wrapped text with manual breaks is scrollable

* chore: move magic number to const

* chore: avoid mut with extra if

* chore: moving clamping behaviour into core

* refactor: eagerly compute line data

* fix: make scroll work when text is aligned right

* chore: clippy

* docs: add more information about line_data

* tests: add more test cases for scroll
2021-07-08 19:23:30 +02:00
EmperorBale d334e30259
avm1: Fix apply_to_display_object (#4377) (#4743)
* avm1: Fix apply_to_display_object
2021-07-06 17:32:14 +02:00
relrelb b44f3f2c15 tests: Turn array_vs_object_length into array_length 2021-06-22 10:43:10 -07:00
relrelb 814ce4c265 tests: Merge array_apply into array_constructor 2021-06-22 10:43:10 -07:00
relrelb ff7ccfa43e tests: Enable negative array length in array_constructor 2021-06-22 10:43:10 -07:00
relrelb c383b70336 avm1: Merge array_function with constructor 2021-06-22 10:43:10 -07:00
Chris Midgley b7de03b5c8
avm1: implement hscroll and maxhscroll for TextField 2021-06-22 01:43:02 -07:00
EmperorBale 1ee61cca57
avm2: ByteArray updates 2021-06-22 01:26:27 -07:00
Mike Welsh e0a478163b tests: Add test for PlaceObjectAction::Replace during goto 2021-06-16 20:57:43 -07:00
Mike Welsh 6146502b1a tests: Add test for SetTarget on a removed clip 2021-06-14 14:04:28 -07:00
Mike Welsh 76603d5554 tests: Add test for execution order 2021-06-14 14:04:28 -07:00
Mike Welsh cb136e56bb tests: Change button_order test to 2 frames
In Flash, the trace actually occurs on the 2nd frame. Frame 1 is
when the clips are actually loaded. Previously this inaccurately
happened on frame 1 in Ruffle, but now happens correctly on frame
2.
2021-06-14 14:04:28 -07:00
Mike Welsh 1f96af6b64 core: Add Avm1::exec_list to manage global list of display objects 2021-06-14 14:04:28 -07:00
dependabot[bot] cf4a1136c5 chore: Bump env_logger from 0.8.3 to 0.8.4
Bumps [env_logger](https://github.com/env-logger-rs/env_logger) from 0.8.3 to 0.8.4.
- [Release notes](https://github.com/env-logger-rs/env_logger/releases)
- [Changelog](https://github.com/env-logger-rs/env_logger/blob/main/CHANGELOG.md)
- [Commits](https://github.com/env-logger-rs/env_logger/compare/v0.8.3...v0.8.4)

---
updated-dependencies:
- dependency-name: env_logger
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-14 00:47:57 -07:00
Mike Welsh 5135b14023 tests: Add test for PlaceObject replace 2021-06-08 19:47:16 -07:00
Mike Welsh 5acc476789 tests: Add test for DefineFunction case sensitivity 2021-06-08 16:51:59 -07:00
dependabot[bot] 2f1dc0cbb1 chore: Bump approx from 0.4.0 to 0.5.0
Bumps [approx](https://github.com/brendanzab/approx) from 0.4.0 to 0.5.0.
- [Release notes](https://github.com/brendanzab/approx/releases)
- [Commits](https://github.com/brendanzab/approx/compare/v0.4.0...v0.5.0)

---
updated-dependencies:
- dependency-name: approx
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-07 11:30:59 -07:00
Adam Gashlin 79aabb3aa7 tests: Test attachMovie scaling 2021-06-02 23:28:24 -07:00
Mike Welsh 2b98c878f0 swf: Use Fixed in more places 2021-05-30 21:24:03 -07:00
Adrian Wielgosik 34d54dbc05
avm1: Fix string methods handling of negative args (fix #4437)
* Improve string.substr handling of negative args
* Add tests for more substr() combinations
2021-05-30 12:04:17 -07:00
Mike Welsh b4dd64a568 tests: Add test for overriding Object.prototype.toString 2021-05-24 17:52:15 -07:00
Mike Welsh 3ddb97d2f6 core: Add SwfMovie::frame_rate and num_frames 2021-05-23 23:02:38 -07:00
Mike Welsh e1439f4105 swf: Add HeaderExt struct providing additional info
When reading an SWF, search for FileAttributes and
SetBackgroundColor and return this along with the header data
because it's useful (in particular, the AS3 flag).
2021-05-23 23:02:38 -07:00
David Wendt b383aec78d tests: Move the button tests into the new test directory. 2021-05-16 17:53:07 -07:00
David Wendt 71bb0c901a avm2: Impl the constructor parameters for `SimpleButton` 2021-05-16 17:53:07 -07:00
David Wendt e4a6a10038 tests: Add tests for what children see as their parent when constructed or shuffled between movie clips and buttons 2021-05-16 17:53:07 -07:00
David Wendt d7deaf5e00 tests: Add currently-failing tests for the `SimpleButton` constructor and order-of-events. 2021-05-16 17:53:07 -07:00
David Wendt ea80d999da tests: Add an almost-passing test for buttons with multiple levels of children 2021-05-16 17:53:07 -07:00
David Wendt 3707ef7fec tests: Add a test for child events using the same timeline structure as the structure test. 2021-05-16 17:53:07 -07:00
David Wendt 6a70c1b3e0 tests: Extend the simplebutton structure test to include frame 2 2021-05-16 17:53:07 -07:00
David Wendt afefdb892f tests: Add a test for timeline-constructed AS3 `SimpleButton` contents 2021-05-16 17:53:07 -07:00
Mike Welsh d4e3bd7ef5 tests: Add tests for various funky AVM1 ops 2021-05-12 20:47:06 -07:00
CUB3D f4a9446829 avm1: Fix tests for SharedObject 2021-05-09 23:20:32 -07:00
CUB3D 07336c306a avm1: Add test for generated file 2021-05-09 23:20:32 -07:00
CUB3D cd1cde1708 avm1: Implement de/serialization of shared objects into Flash Player Lso format 2021-05-09 23:20:32 -07:00
Mike Welsh ef617eebad avm1: Use `set_html_text` when initializing textfield from a variable binding
If a textfield was created with a variable binding, and the variable
already existed, the initial text of the textfield is set to the
variable value. However, this was not obeying the HTML setting of
the text field, so HTML tags were mistakenly shown in some content.

Fixes #3522.
2021-05-06 16:58:33 -07:00
Mike Welsh b82391726f avm1: MovieClip.getBytesLoaded/Total should return the clip's length
MovieClip.getBytesLoaded and getBytesTotal return the size of that
specific clip, even if it's not a loaded SWF.  The previous logic
only returned the size of the parent SWF.

If the clip is an SWF, the uncompressed size of the SWF is returned.
Otherwise, the length of the tag list inside the clip's DefineSprite
tag is returned.
2021-05-04 16:36:56 -07:00
Aaron Hill 08d0829177 Move all SWF tests out of `core` to new `tests` package
This allows `regressions_tests.rs` to depend on other crates in the
workspace, such as `render`, without introducing a cyclic dependency.

Split out from #4054
2021-05-04 11:47:59 -07:00
Mike Welsh b7ac6dc2ce Refactor 2019-04-27 18:15:43 -07:00
Mike Welsh 8d4ce5af8a Initial commit 2019-04-25 10:52:22 -07:00