Commit Graph

520 Commits

Author SHA1 Message Date
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