David Wendt
826b20e8e4
tests: Don't assert execution order of frame scripts within buttons
2021-05-16 17:53:07 -07:00
David Wendt
ef4de4d0d7
core: Order of events for child `Avm2Button` states is hit-up-down-over.
...
Ok, it's not *actually* that - all our tests actually have different, conflicting information. As far as I can tell there doesn't seem to be a single set order for these; so I'm going to just pick one and then stop testing the order in which states run.
2021-05-16 17:53:07 -07:00
David Wendt
c936ccd4b4
avm2: When constructing new `SimpleButton`s, make sure the display object sees it's AVM2 side, else we replace all it's contents with AVM1 objects somehow(?!)
2021-05-16 17:53:07 -07:00
David Wendt
208c191d88
core: `Avm2Button` always runs a frame on set children, even if it's not the current state
2021-05-16 17:53:07 -07:00
David Wendt
bf1fb93b83
core: Allow linking `Avm2Button`'s object
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
44e82ea480
core: `Avm2Button` fires off events in this order when you set one of it's children:
...
1. `added`/`addedToStage` on the new state
2. `removed` (presumably) on the old state
3. `frameConstructed` on the new state
4. Any frame scripts on the new state
5. `exitFrame` on the new state
This is a rough approximation; I have several tests that fail in weird and interesting ways. Also, this only happens if you set the *active* state; presumably these events are all fired when the state changes but I can't automate tests for that yet.
2021-05-16 17:53:07 -07:00
David Wendt
434563da2f
avm2: `SimpleButton` should build a button when constructed
2021-05-16 17:53:07 -07:00
David Wendt
67c7f156ac
avm2: `instanceof` accepts `null` and `undefined`
2021-05-16 17:53:07 -07:00
David Wendt
7f294f5209
avm2: Constructor-based symbol instantiation should also post-instantiate before constructing a frame
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
07513da3ba
core: State-constructed sprites in `Avm2Button` should be post-instantiated after everything else so they get their instance numbers later
2021-05-16 17:53:07 -07:00
David Wendt
bba2ecae8e
core: `Shape` gets an instance number
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
11d7fe5107
core: Correct the order of events that are fired when an `Avm2Button` is instantiated on the timeline.
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
a013a7dfdf
core: Initial construction should also prevent normal frame execution first frame
2021-05-16 17:53:07 -07:00
David Wendt
9f5a7f5065
core: AVM2 `Button`s run their children one frame at construction time
2021-05-16 17:53:07 -07:00
David Wendt
bfef7f9969
core: `Avm2Button` should always construct a sprite for each state, even if it's not used.
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
David Wendt
821ed25374
avm2: `Avm2Button` should construct it's children
2021-05-16 17:53:07 -07:00
David Wendt
71b87f8935
avm2: Also impl `construct_frame` and `run_frame_scripts` for `Avm2Button`
2021-05-16 17:53:07 -07:00
David Wendt
4869ec650e
core: `Avm2Button` should construct a sprite whenever there's anything other than one child
2021-05-16 17:53:07 -07:00
David Wendt
c317d77916
core: `Avm2Button` shouldn't try to construct a Sprite using it's prototype
2021-05-16 17:53:07 -07:00
David Wendt
10bed4fe30
core: `set_avm2_constructor` works on constructors, not prototypes
2021-05-16 17:53:07 -07:00
David Wendt
d049ba8c0f
core: Child instantiation should print the error message it got when it fails
2021-05-16 17:53:07 -07:00
David Wendt
25473ac1dc
core: Allow AVM2 movies to define `Avm2Button` characters in their libraries
2021-05-16 17:53:07 -07:00
David Wendt
cb44554135
avm2: Add setters and getters for the four states of `SimpleButton`
2021-05-16 17:53:07 -07:00
David Wendt
494083673c
core: Add AVM2 version of Button
2021-05-16 17:53:07 -07:00
David Wendt
22eac776be
avm2: Stub `flash.display.SimpleButton`
2021-05-16 17:53:07 -07:00
David Wendt
cffa739a54
avm2: Store the sprite proto
2021-05-16 17:53:07 -07:00
David Wendt
c0296d9963
core: Rename `Button` to `Avm1Button`
2021-05-16 17:53:07 -07:00
Reiner Gerecke
efdb9c153d
core: Fix endless loop when layouting text
...
If a textfield has word wrapping enabled, is very small in size and
tries to layout a single character onto it, the layout code can run into
an endless loop where it's creating new lines and trying to fit the text
again.
If text doesn't fit at the start of a line, it won't fit on the next
either, so abort and display the whole text span on the line. Text will
be cut-off.
This can be reproduced with a AS2 file like this:
class Test {
static var app : Test;
function Test() {
_root.createTextField("tf",0,0,0,6,20);
_root.tf.text = "0";
_root.tf.wordWrap = true;
}
static function main(mc) {
app = new Test();
}
}
Build it with `mtasc -main -header 100💯 30 test.as -swf test.swf`
2021-05-15 18:56:51 -07:00
Mike Welsh
69a0700ca1
core: Remove collect::CollectWrapper
...
No longer necessary, it is possible to mark individual fields
as `#[collect(require_static)]`.
2021-05-13 23:24:10 -07:00
Ahmet Akkoç
ae038ccbb1
i18n: Update Turkish localization
2021-05-13 10:30:14 -07:00
Mike Welsh
b882284fc9
core: Use bitflags for HitTestOptions
2021-05-12 23:02:06 -07:00
Mike Welsh
d4e3bd7ef5
tests: Add tests for various funky AVM1 ops
2021-05-12 20:47:06 -07:00
relrelb
85b234003f
avm1: Handle undefined/empty method name in NewMethod
...
Seems like it behaves similarly to CallMethod with an undefined/empty
method name.
2021-05-12 20:47:06 -07:00
relrelb
2589ecdde0
avm1: Correct ImplementsOp
2021-05-12 20:47:06 -07:00
relrelb
3bf3f1015d
avm1: Return undefined on invalid count in InitArray and InitObject
...
Both InitArray and InitObject should bail-out without popping anything
off the stack when the elements/properties count is negative or greater
than or equals 2147483648.
2021-05-12 20:47:06 -07:00
relrelb
72531eddff
avm1: Cleanup CallMethod
2021-05-12 20:47:06 -07:00
relrelb
2e0bc78cd6
avm1: Fix variadic arguments
...
Previously, if the arguments count was greater than the actual
stack size, then a stack underflow occurred which resulted in a
sequence of undefined values. That didn't match Flash's behavior.
Also, this prevents potential huge allocations that hang Ruffle.
In addition, num_args seems like it should use coerce_to_u32
(wraps at 4294967297). This also means that -1 ends up acting like
u32::MAX and would pop all values off of the stack.
2021-05-12 20:47:06 -07:00
Eduardo Sánchez Muñoz
e3dc8ff28e
swf: SwfStr: reimplement `Debug` with `std::ascii::escape_default`
...
The string will now be surrounded with quotes (`"`), non-ASCII characters (UTF-8 or not) will be escaped in hexadecimal form (`\xNN`) and ASCII control characters will be escaped (`\x01`, `\n`, `\t`).
2021-05-12 10:53:26 -07:00
Mike Welsh
9538647422
tests: Fix swf::Fixed tests in --release ( fix #4313 )
...
Use `#[cfg_attr(debug_assertions, should_panic)]` to ensure that
the tests only expect to panic in debug builds.
Fixes #4313 .
2021-05-11 20:53:23 -07:00
relrelb
7acf0349c3
desktop: Refactor main.rs
2021-05-11 18:58:08 -07:00
Mike Welsh
ea4ea9922a
chore: Bump rustfft
...
Bump rustfft to 5.1.1, which fixes this issue affecting our nightly
build:
https://github.com/ejmahler/RustFFT/issues/74
2021-05-10 17:33:16 -07:00
dependabot[bot]
dd5894ebd6
chore: Bump wgpu from 0.8.0 to 0.8.1
...
Bumps [wgpu](https://github.com/gfx-rs/wgpu-rs ) from 0.8.0 to 0.8.1.
- [Release notes](https://github.com/gfx-rs/wgpu-rs/releases )
- [Changelog](https://github.com/gfx-rs/wgpu-rs/blob/master/CHANGELOG.md )
- [Commits](https://github.com/gfx-rs/wgpu-rs/commits )
Signed-off-by: dependabot[bot] <support@github.com>
2021-05-10 10:16:10 -07:00
dependabot[bot]
8e91f8dc89
chore: Bump enum-map from 1.0.0 to 1.1.0
...
Bumps [enum-map](https://gitlab.com/KonradBorowski/enum-map ) from 1.0.0 to 1.1.0.
- [Release notes](https://gitlab.com/KonradBorowski/enum-map/tags )
- [Changelog](https://gitlab.com/KonradBorowski/enum-map/blob/master/CHANGELOG.md )
- [Commits](https://gitlab.com/KonradBorowski/enum-map/commits/master )
Signed-off-by: dependabot[bot] <support@github.com>
2021-05-10 10:15:58 -07:00
dependabot[bot]
62301dea54
chore: Bump syn from 1.0.71 to 1.0.72
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.71 to 1.0.72.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.71...1.0.72 )
Signed-off-by: dependabot[bot] <support@github.com>
2021-05-10 09:40:26 -07:00
Adrian Wielgosik
c40d08e73a
web: Fix context menu checkmark in web builds
2021-05-10 00:19:29 -07:00