Commit Graph

362 Commits

Author SHA1 Message Date
David Wendt 34ba1643dd tests: Add test for reading properties of an array 2020-09-15 02:20:11 -07:00
David Wendt 1d3f5d80be tests: Add test for `new Array`'s arguments. 2020-09-15 02:20:11 -07:00
Nathan Adams 319efabb47 tests: Make tests capture trace output through new backend 2020-09-13 13:51:39 -07:00
Nathan Adams e25e03a841 core: Log to new avm_trace method where we want things to show up 2020-09-13 13:51:39 -07:00
Nathan Adams de009c7673 core: Add Log backend, for capturing trace output specific to a movie 2020-09-13 13:51:39 -07:00
CUB3D efa7e862fd core: Propagate this through scope and get_variable 2020-09-07 13:14:48 -07:00
CUB3D 91d5e0f74b core: Update tests 2020-09-07 13:14:48 -07:00
CUB3D 136a5664b0 core: Pass the correct this for CallFunction when in a with scope
fixes #805, #945, #1018
2020-09-07 13:14:48 -07:00
David Wendt 3b5411547a avm2: Implement `in` 2020-09-07 11:07:07 -07:00
Mike Welsh 64679e8796 avm1: typeof button/text should be object (fix #1110) 2020-09-04 11:33:40 -07:00
Nathan Adams b2dc564628 avm1: Fix String.lastIndexOf(undefined) 2020-09-04 11:32:16 -07:00
Nathan Adams ea7a9758c4 avm1: Fix String.indexOf(undefined) 2020-09-04 11:32:16 -07:00
Mike Welsh 3a813f1f15 tests: Test for #1104 2020-09-03 19:09:48 -07:00
Nathan Adams b5531a48d0 web: Allow reentrant ExternalInterface callbacks 2020-09-03 18:17:44 -07:00
Nathan Adams a49e8d8587 web: Implement two-way communication with ExternalInterface 2020-09-03 18:17:44 -07:00
Nathan Adams 687c912067 core: Allow for reentry from ExternalInterface methods 2020-09-03 18:17:44 -07:00
Nathan Adams 32de953822 core: Allow passing arguments and returning values to/from ExternalInterface 2020-09-03 18:17:44 -07:00
Nathan Adams e1b3ac79d6 core: Add ability to call out to ExternalInterfaceProviders 2020-09-03 18:17:44 -07:00
Nathan Adams 502ea98ed4 core: Add ability to call in to ExternalInterface callbacks from outside of the player (+ test) 2020-09-03 18:17:44 -07:00
Nathan Adams 169c61bf96 tests: Added ability for tests to have a before_start and before_end, and added basic ExternalInterface test that uses it 2020-09-03 18:17:44 -07:00
Nathan Adams c5ac707fb5 avm1: Iterating xmlnode attributes should list every attribute 2020-09-03 17:03:43 -07:00
Nathan Adams 40cdb84656 tests: Add test for avm1 Function(foo) 2020-09-03 17:01:20 -07:00
Mike Welsh d7a186b2cd avm1: Implement shape hit testing 2020-09-02 17:51:55 -07:00
Mike Welsh 2da3c0d319 tests: Add hitTest shapeflag test 2020-09-02 17:51:55 -07:00
Nathan Adams 9dfc20e1ba avm1: Implement Date.UTC 2020-09-02 17:12:31 -07:00
Nathan Adams 86eb6f2e50 avm1: Implement Date - #249 2020-09-02 17:12:31 -07:00
Nathan Adams 3d30ec67e2 test: Add more cases to registerClass tests 2020-09-02 15:18:59 -07:00
Mike Welsh 537cca7c38 tests: Add test for #1086 2020-09-02 13:25:53 -07:00
CUB3D 143ba03754 core: Fix clippy lints and format 2020-09-02 10:59:00 -07:00
CUB3D a2c151677b core: Add blurFilter and test 2020-09-02 10:59:00 -07:00
CUB3D d1ad095bad core: Add tests for bitmap_filter 2020-09-02 10:59:00 -07:00
kmeisthax 559bc05b6a
avm2: Implement avm2 math opcodes (merge #1037)
* Implement `add`, with tests.

* Implement `add_i`.

There's no test, because for whatever reason, I can't figure out how to emit this from Animate CC 2020.

* avm2: Implement `bitand` with tests.

* Implement `bitnot` with tests.

* Implement `bitor` with tests.

* avm2: Implement `bitxor`

* avm2: Implement `declocal`, `declocal_i`, `decrement`, and `decrement_i`.

* tests: `swf_approx` tests should be allowed to print NaNs.

* avm2: Implement `divide`.

* avm2: Implement `inclocal`, `inclocal_i`, `increment`, and `increment_i`.

* avm2: Implement `lshift`.

* Implement `modulo`.

* avm2: Implement `multiply` and `multiply_i` (no tests for the latter)

* avm2: Implement `negate` and `negate_i` (no tests for the latter)

* avm2: Implement `rshift`

* avm2: Implement `subtract` and `subtract_i` (the latter without tests)

* avm2: Implement `urshift`.
2020-08-23 13:38:38 -07:00
Mike Welsh 06b6d14367 avm1: Fix removeMovieClip depth range
removeMovieClip should only function on objects within a certain
depth range, usually to prevent removing timeline clips. However,
this wasn't working properly in some cases because the depth was
being biased incorrectly (removeMovieClip never takes a depth
parameter, so we should not bias the depth).
2020-08-21 00:55:35 -07:00
Mike Welsh 528b52ac7c tests: Activate unused remove_movie_clip test 2020-08-21 00:55:35 -07:00
Mike Welsh bbc5e01009 tests: Add test for targetPath action 2020-08-20 18:14:01 -07:00
Mike Welsh e9f9cda34d tests: Rename target_path test to string_path 2020-08-20 18:14:01 -07:00
Mike Welsh b8f5a405b9 tests: Add test for flash.geom.Transform 2020-08-20 17:29:04 -07:00
Mike Welsh 544c1becc2 tests: Add test for button children 2020-08-18 01:18:15 -07:00
Mike Welsh b5c7e1dab0 tests: Add test for conflicting instance names 2020-08-18 01:18:15 -07:00
Floens 95acc14190 avm1: fix array unshift
update array_trivial test for it
2020-08-16 04:27:09 -07:00
Albert Safin e03373bceb avm1: parseInt 2020-08-13 00:40:20 -07:00
David Wendt 354b194b69 avm1: Add test for nested text fields in buttons. 2020-08-12 11:08:27 -07:00
David Wendt 6ec1d453b8 Add tests for `greaterequals`, `greaterthan`, `lessequals`, and `lessthan`. 2020-08-10 16:38:04 -07:00
David Wendt f88f2e225a Add tests for `>`, `<`, `<=`, and `>=`.
Note that this does NOT completely test the full range of if instructions for abstract relational comparison. Notably, the Adobe Animate CC compiler compiles each operator into it's negated equivalent, e.g. `<` becomes `ifnlt`.

I do not know how to get it to emit `ifge` or the like, which differ only by how they handle `NaN`s.
2020-08-10 16:38:04 -07:00
David Wendt 76ab8570e4 Implement and test `equals`.
The test is also far more in-depth than the `if_eq`/`if_ne` tests, which use the same set of vectors as the strict-equality tests from a while ago. Interestingly, this test passed on first run
2020-08-10 16:38:04 -07:00
David Wendt 5da4e2f118 Test for `iseq` and `isne` 2020-08-10 16:38:04 -07:00
David Wendt 86965eb674 Test for `coerce_s`.
I cannot yet figure out how to generate tests that use `convert_s`, so it's not covered.
2020-08-10 16:38:04 -07:00
David Wendt 35f939cb15 Add and test for `convert_u` using `ToUint32` from ECMA-262 2020-08-10 16:38:04 -07:00
David Wendt 6eb41035cf Add & test ECMA-262 ToInt32 and `convert_i` opcode.
The ECMA-262 documentation is awfully overwrought for something that boils down to "chop off the non-whole part, wrap to 32 bits, then reinterpret as signed". Bitwise operations are *hell* to describe mathematically, and such descriptions are even harder to understand.
2020-08-10 16:38:04 -07:00
David Wendt 351fe026e9 Add a test for all the above numerical coercions. 2020-08-10 16:38:04 -07:00
David Wendt 60f9613365 Implement and test for `convert_b`. 2020-08-10 16:38:04 -07:00
David Wendt 6cf48eb543 Implement and test `not`. 2020-08-10 16:38:04 -07:00
David Wendt b972c24f7e Oh look, I figured out how to emit `istrue`, so that's tested, too. 2020-08-10 16:38:04 -07:00
David Wendt 850ebc88a2 Add test for truthiness.
As compiled by Adobe Animate CC 2020, this test appears to only use `iffalse`. However, both `op_is_false` and `op_is_true` coerce in the same manner, so I'm not entirely sure this is a problem for now.
2020-08-10 16:38:04 -07:00
unknown 47a8eb6f3e avm1: Copy broadcast functions for MovieClipLoader 2020-08-04 07:02:14 -07:00
Nathan Adams 88a31cc5a9 avm1: Ensure we call movie constructors through Function::construct, not manually, to set __constructor__ 2020-08-01 02:33:14 -07:00
unknown a14f19e9e5 avm1: Call the respective listeners 2020-07-29 15:24:23 -07:00
unknown 795cd72dce avm1: Broadcasting functions are now copied from AsBroadcaster 2020-07-29 15:24:23 -07:00
unknown b72dbcae96 chore: Assert his inside of listeners 2020-07-29 15:24:23 -07:00
unknown df50cbb27f avm1: Fix the behavior of addListener and removeListener 2020-07-29 15:24:23 -07:00
unknown 20989ef03d avm1: Initialize now copies the functions from AsBroadcaster 2020-07-29 15:24:23 -07:00
unknown 890dc0ea13 avm1: Implement AsBroadcaster 2020-07-29 15:24:23 -07:00
Nathan Adams 32be19da6d avm1: Allow gotoAndStop/gotoAndPlay with frame numbers in paths - #915 2020-07-29 13:53:57 -07:00
Mike Welsh 5d08956152 tests: Add typeof and labels for Object() test 2020-07-29 13:52:51 -07:00
CUB3D 0fe3a23fd6 core: Correct handling of Object function without args 2020-07-29 13:52:51 -07:00
CUB3D 49bee3fe5c core: Implement Object() function 2020-07-29 13:52:51 -07:00
CUB3D c1771d7d4e core: Split function and constructor, tests, fix bug with constructor 2020-07-27 12:50:31 -07:00
CUB3D afb1d6b42f core: Add global Array() function 2020-07-27 12:50:31 -07:00
CUB3D 22db5ab76a core: Populate function when creating a constructor 2020-07-27 10:38:50 -07:00
Nathan Adams cf61f8a4d3 avm1: Add failing test for registerClass in a loaded movie 2020-07-27 01:40:28 -07:00
David Wendt f56d16a68d Separate player creation from root movie setup, and allow users of Ruffle to load in movies synchronously or asynchronously.
During the small period of time when a player is created but has no root movie, a temporary empty movie is installed with an assumed stage size and framerate of 550x400@12fps. This is Flash default for new projects, so it seemed appropriate. User ActionScript cannot see these values, and I'm not even sure JavaScript can, either.
2020-07-23 23:02:51 -04:00
Mike Welsh efa059ff8d tests: Add test for LoadVars 2020-07-23 03:00:19 -07:00
Mike Welsh 74cb8609c1 avm1: Support loading into _level in GetURL2
Calling loadMovieNum with a variable parameter compiles into a
GetURL2 call with a `_level` window target parameter. Previously
this triggered Ruffle to try to navigate to the SWF. Now it
properly loads the SWF inside the current movie.
2020-07-23 02:08:48 -07:00
Nathan Adams f0980301da avm1: Implement arguments.callee 2020-07-22 15:57:45 -07:00
Nathan Adams d5deeee1b7 avm1: Properly implement the arguments object, it's an array 2020-07-21 07:49:00 -07:00
Mike Welsh 1a5d7fe452
avm2: Initial AVM2 interpreter (merge #404)
Initial work on the AVM2 interpreter.
2020-07-19 19:59:05 -07:00
Mike Welsh 8c1ec01d75 tests: Test clip events copying in duplicateMovieClip
duplicateMovieClip should also copy any clip events on the source
clip to the newly created movie clip.
2020-07-17 20:49:05 -07:00
Mike Welsh f9b1c586d1 tests: Add test for paths in ActionCall 2020-07-14 23:34:21 -07:00
David Wendt 64e5b46259 Add tests for `instanceof` and `is` operators. 2020-07-13 17:45:10 -04:00
David Wendt 563a515189 Add a test for loading interfaces into the AVM2.
This test will fail if the AVM2 implementation does not support bodyless methods or bare classes properly.
2020-07-13 17:45:07 -04:00
David Wendt 6117288fe2 Add tests for `ifstricteq`, `ifstrictne`, and `strictequals`. 2020-07-13 17:44:59 -04:00
David Wendt 03a240ebcd Add tests for `valueOf`. 2020-07-13 17:44:58 -04:00
David Wendt 3b52dfe2ba Since we have an `es3_inheritance` test now, rename the existing inheritance test to `es4_inheritance`. 2020-07-13 17:44:57 -04:00
David Wendt cf6714d33c Implement and test `toLocaleString`.
This function has vague documentation about enabling locale-specific formatting in subclasses. As far as I can tell, none of the objects I implemented so far do anything different than `toString`, so I just have it use the same `TObject` property I set up for `toString`.
2020-07-13 17:44:57 -04:00
David Wendt 3558c3afa0 Add test of `Function.prototype.call` 2020-07-13 17:44:56 -04:00
David Wendt 16774aa055 Add a test for legacy / ES3 inheritance.
This was originally something *way* more evil: mixed inheritance between ES3 and ES4 classes. It didn't pan out due to fundamental limitations of the two object models. How the hell did Brendan Eich/Adobe/TC-39 expect ES4 classes to be adopted in already-existing codebases?!
2020-07-13 17:44:56 -04:00
David Wendt 37cdcb3bce Add tests for `toString` on objects, functions, and classes. 2020-07-13 17:44:54 -04:00
David Wendt ba2c1f5750 Add test for `setPropertyIsEnumerable` 2020-07-13 17:44:39 -04:00
David Wendt dc0cb00a03 Add a test for `propertyIsEnumerable`. 2020-07-13 17:44:37 -04:00
David Wendt 42cb8f57c8 Add a test for `has_own_property` in various class instance scenarios. 2020-07-13 17:44:35 -04:00
David Wendt 8677804ea0 Actually enable the `isPrototypeOf` test. 2020-07-13 17:44:34 -04:00
David Wendt 0e89cb2175 Impl `Object.isPrototypeOf` w/ test 2020-07-13 17:44:33 -04:00
David Wendt d29f3dc1d0 Add `as3_object_enumeration` and `as3_class_enumeration` tests.
The former tests iterating normal objects and the latter tests iterating objects with prototypes.
2020-07-13 17:44:33 -04:00
David Wendt 7253c091a2 Add tests for control flow instructions that use booleans or strict equality.
Other comparisons will have to wait until we have ECMA-compliant abstract comparison and coercion.
2020-07-13 17:44:30 -04:00
David Wendt ddc9aa4cca Add a test for ES4 method binding of `this`. 2020-07-13 17:44:29 -04:00
David Wendt f042e453a3 Add a test for interactions between prototype and class-trait properties.
This is the test that broke the old object model's back, please see parent commit's description for more details.
2020-07-13 17:44:27 -04:00
David Wendt 6cc3f7ecc3 Add a test for stored properties as well.
This test passed with no errors.
2020-07-13 17:44:24 -04:00
David Wendt 5abc78d3bd Add test of AVM2 virtual properties.
This tests:

 * Getter invocation
 * Setter invocation
 * Properties with one or the other, but not both
 * Inheritance
 * Superproperty getters and setters
 * Getters with inherited setter
 * Setters with inherited getter
2020-07-13 17:44:24 -04:00
David Wendt 785832b7f3 Add `as3_inheritance` test, which is primarily designed to test method calls, constructor execution, and usage of `super`. 2020-07-13 17:44:22 -04:00
David Wendt ab5a95c05b Add a test for various types of class methods. 2020-07-13 17:44:19 -04:00