Commit Graph

1234 Commits

Author SHA1 Message Date
sleepycatcoding cd9ed1a1da tests: remove unneeded loops 2023-07-31 22:32:03 +02:00
sleepycatcoding 1b765e2a45 tests: Use new socket API 2023-07-31 22:32:03 +02:00
sleepycatcoding 749ba80c8a tests: Lower socket test task timeout to 1 microsecond
This was hiding the fact that the test technically did not run and failed, as it only happened very rarely in some scenarios.
2023-07-31 22:32:03 +02:00
Nathan Adams 91bfbe6ab1 tests: Port avmplus as3 MethodClosures test 2023-07-31 19:52:12 +02:00
Nathan Adams 4de8301f75 tests: Port avmplus as3 RuntimeErrors test 2023-07-31 19:52:12 +02:00
Nathan Adams 27fc81f0f3 tests: Port avmplus as3 Dictionary test 2023-07-31 19:52:12 +02:00
Nathan Adams 9ba9ec17a7 tests: Port avmplus as3 e12_6_3_12 Statement test 2023-07-31 19:52:12 +02:00
Nathan Adams cc302a56de tests: Port avmplus as3 for-each-in tests 2023-07-31 19:52:12 +02:00
Nathan Adams d6f83ce9c3 tests: Port avmplus es3 switch tests 2023-07-31 19:52:12 +02:00
Nathan Adams 98f9316fa7 tests: Port avmplus es3 Int tests 2023-07-31 19:52:12 +02:00
Nathan Adams b42ae15759 tests: Port avmplus es3 Number tests 2023-07-31 19:52:12 +02:00
Nathan Adams dab0779493 tests: Port avmplus es3 uint tests 2023-07-31 19:52:12 +02:00
Nathan Adams 01bacb51ba tests: Port avmplus es3 Type Conversions tests 2023-07-31 19:52:12 +02:00
Nathan Adams cdc8e65f0c tests: Port avmplus es3 const tests 2023-07-31 19:52:12 +02:00
Nathan Adams c903c0081c tests: Port avmplus es3 ClassDef tests 2023-07-31 19:52:12 +02:00
Abiel Deneke 6552b4e132 avm2: Implement `Matrix3D.prependScale` 2023-07-31 17:00:44 +02:00
TÖRÖK Attila 288ed7e341 tests: Add an avm1 visual test for BitmapData::perlinNoise() 2023-07-31 16:41:01 +02:00
Adrian Wielgosik 399ac2490c avm2: Remove accidentally duplicated tests 2023-07-30 18:05:24 +02:00
Nathan Adams 647b49ad52 tests: Move from_avmplus up one level 2023-07-30 13:59:33 +02:00
Nathan Adams c8a86966b0 tests: Port avmplus e4x XMLList tests 2023-07-30 13:59:33 +02:00
Nathan Adams 2e1f848144 tests: Port avmplus e4x XML tests 2023-07-30 13:59:33 +02:00
Nathan Adams 0ac0ea21c5 tests: Port avmplus e4x Types tests 2023-07-30 13:59:33 +02:00
Nathan Adams f97559066b tests: Port avmplus e4x TypeConversion tests 2023-07-30 13:59:33 +02:00
Nathan Adams 068a4b38ac tests: Port avmplus e4x Regress tests 2023-07-30 13:59:33 +02:00
Nathan Adams 8a0e57ca95 tests: Port avmplus e4x Namespace tests 2023-07-30 13:59:33 +02:00
Nathan Adams 6030ed563b tests: Port avmplus ecma3 Number tests 2023-07-30 13:59:33 +02:00
Nathan Adams 495f19f10d tests: Port avmplus ecma3 ObjectObjects tests 2023-07-30 13:59:33 +02:00
Nathan Adams e25c18beed tests: Port avmplus ecma3 Statements tests 2023-07-30 13:59:33 +02:00
Nathan Adams 04dbff285a tests: Port avmplus ecma3 String tests 2023-07-30 13:59:33 +02:00
Nathan Adams b7f6373af3 tests: Port avmplus ecma3 TypeConversion tests 2023-07-30 13:59:33 +02:00
Nathan Adams e08e9cc14b tests: Port avmplus ecma3 instanceof tests 2023-07-30 13:59:33 +02:00
Nathan Adams 9c12d3134a tests: Port avmplus ecma3 ErrorObject tests 2023-07-30 13:59:33 +02:00
Nathan Adams e707e98487 tests: Port avmplus ecma3 Boolean tests 2023-07-30 13:59:33 +02:00
Tom Schuster f237aa1da2 avm2: Implement XMLNode.nodeValue 2023-07-30 11:14:00 +02:00
TÖRÖK Attila acddd6c26d tests: Add glow_pass_scaling visual test 2023-07-29 22:23:49 +02:00
TÖRÖK Attila 24afc21f87 tests: Remove redundant "test" suffix from the name of blur_pass_scaling_test 2023-07-29 22:23:49 +02:00
Aaron Hill 4406a70fc9 avm2: Enable Vector.<ObjectSubclass> serialization tests
This also fixes a minor bug (we should always deserialize
to a `Vector.<Object>`, not a `Vector.<*>`)
2023-07-29 15:30:24 -04:00
Nathan Adams f9be8be99e avm2: Make 'new Math()' and 'Math(value)' throw errors 2023-07-29 15:24:30 +02:00
Adrian Wielgosik 456e9d2c05 avm2: Extend vector_concat test 2023-07-28 23:42:04 +02:00
Adrian Wielgosik 22d7ffdefc avm2: fix Vector null display 2023-07-28 23:42:04 +02:00
Adrian Wielgosik e1d73f031a avm2: Activate the Vector/specialized_at_runtime test 2023-07-28 23:42:04 +02:00
Nathan Adams 8be0a36b1a tests: Port avmplus ecma3 Array tests 2023-07-28 22:22:47 +02:00
Nathan Adams 90b4653eaf tests: Port avmplus ecma3 Exception tests 2023-07-28 22:22:47 +02:00
Nathan Adams a52bed18bd tests: Port avmplus ecma3 FunctionObjects tests 2023-07-28 22:22:47 +02:00
Nathan Adams 684c0ea5e6 tests: Port avmplus ecma3 GlobalObject tests 2023-07-28 22:22:47 +02:00
Nathan Adams d3606e3c9d tests: Port avmplus ecma3 Types tests 2023-07-28 22:22:47 +02:00
Nathan Adams a8410aa34e tests: Port avmplus ecma3 ExecutionContexts tests 2023-07-28 22:22:47 +02:00
Nathan Adams 1a354d5809 tests: Port avmplus ecma3 Expression tests 2023-07-28 22:22:47 +02:00
Nathan Adams 8ff5ff8176 tests: Port avmplus ecma3 Function tests 2023-07-28 22:22:47 +02:00
Nathan Adams e1749cd0ad tests: Port avmplus ecma3 Unicode tests 2023-07-28 22:22:47 +02:00
Lord-McSweeney cf5c02ca1b avm2+tests: Fully implement XML.appendChild, add a test 2023-07-28 15:21:38 +02:00
Lord-McSweeney cf8dde966f tests: Allow avmplus e4x/Global/e13_1_2_1 to run, since it no longer loops indefinitely 2023-07-28 13:11:15 +02:00
sleepycatcoding 46d6d6724d tests: Allow some avmplus tests as they now succeed 2023-07-27 23:39:06 +02:00
sleepycatcoding 04aa060c61 tests: Check XML/XMLList.parent() in xml_list_concat 2023-07-27 23:39:06 +02:00
sleepycatcoding 02d815e86b avm2: Implement XML addition operations 2023-07-27 23:39:06 +02:00
Nathan Adams 70fb674d8b avm2: Implement correct errors for write_bytes with offset+length > u32::MAX 2023-07-27 19:47:16 +02:00
Nathan Adams 1bbefbe472 avm2: Throw correct error when writing a too-large string to ByteArray 2023-07-27 19:47:16 +02:00
Nathan Adams 0d1d110660 tests: Port avmplus ByteArray tests 2023-07-27 19:47:16 +02:00
Nathan Adams 7dc0224451 tests: Add lzma feature and add a required_features.lzma flag 2023-07-27 19:47:16 +02:00
Nathan Adams 08b7a8c498 tests: Port avmplus e4x QName tests 2023-07-27 19:30:41 +02:00
Nathan Adams e88a03c2d5 tests: Port avmplus e4x Statements tests 2023-07-27 19:30:41 +02:00
Nathan Adams cbf029c019 tests: Port avmplus e4x Global tests 2023-07-27 19:30:41 +02:00
Nathan Adams 28dfcab8ff tests: Port avmplus e4x Expression tests 2023-07-27 19:30:41 +02:00
Nathan Adams 4f315ef6a9 tests: Include PrettyString workaround again 2023-07-27 19:30:41 +02:00
Nathan Adams cb23067382 avm2: Implement UninitializedError 2023-07-27 09:49:47 +02:00
Nathan Adams 5fc37c7e13 avm2: Implement call handler for Error 2023-07-27 09:49:47 +02:00
Nathan Adams 55d77970e0 tests: Port avmplus Exception tests over 2023-07-27 09:49:47 +02:00
Aaron Hill 583caa3389
avm2: Implement DisplayObject.blendShader (#12238) 2023-07-26 23:25:26 +00:00
Nathan Adams 6a7063a83b tests: Mark vectorIndexRangeExceptions as ignore again, and explain why 2023-07-27 00:52:40 +02:00
Nathan Adams 1ffb87c227 tests: If an image test isn't being checked and we expect it to fail, make it fail 2023-07-27 00:52:40 +02:00
Nathan Adams 049cb0e84d tests: Increase tolerance of bitmapdata_applyfilter_blur to make it pass on my machine 2023-07-27 00:52:40 +02:00
Nathan Adams bdf960f972 tests: Unflagged previously ignored tests that now pass successfully 2023-07-27 00:52:40 +02:00
Nathan Adams a10dfca653 tests: Change a lot of tests from ignore to known_failure 2023-07-27 00:52:40 +02:00
Nathan Adams 6063579fbd tests: Add known_failure to test.toml 2023-07-27 00:52:40 +02:00
Aaron Hill 99ed2c6d4a
avm2: Fix handling of default domain memory (#12308) 2023-07-26 18:26:26 +00:00
Nathan Adams 0a21a6015c tests: Document fscommand('quit') 2023-07-26 17:00:15 +02:00
Nathan Adams 6b788faa9d tests: Implement fscommand('quit') on test runner 2023-07-26 17:00:15 +02:00
Nathan Adams 1a0a82d898 core: Move fscommand execution outside of ExternalInterfaceProvider, so it can be implemented without causing ExternalInterface.available to become true 2023-07-26 17:00:15 +02:00
Nathan Adams 4252d035af tests: Add issue to avm_plus ignored tests 2023-07-26 16:12:57 +02:00
Nathan Adams 3e7a7854ae tests: Ignore failing avmplus tests 2023-07-26 16:12:57 +02:00
Nathan Adams 6b2813c022 tests: Port some avmplus tests over 2023-07-26 16:12:57 +02:00
sleepycatcoding dc5cf083d2 tests: Add test for close event 2023-07-26 14:01:03 +02:00
sleepycatcoding 28f8937124 tests: Add read socket test (Little Endian) 2023-07-26 14:01:03 +02:00
sleepycatcoding c3582464be tests: Add socket read test (Big Endian) 2023-07-26 14:01:03 +02:00
sleepycatcoding 525c708fe8 tests: Fix some number ranges
Also reduce float precision.
2023-07-26 14:01:03 +02:00
sleepycatcoding f23fe16557 tests: Write a signed short too 2023-07-26 14:01:03 +02:00
sleepycatcoding b169671238 tests: Add test for socket write (Little Endian) 2023-07-26 14:01:03 +02:00
sleepycatcoding 4927d0c6b9 tests: Add test for socket write (Big Endian) 2023-07-26 14:01:03 +02:00
sleepycatcoding d52f2a4409 tests: Add socket_connect test 2023-07-26 14:01:03 +02:00
sleepycatcoding 809e511656 chore: Remove accidental doc change
For some reason my IDE keeps adding random stuff :(
2023-07-26 14:01:03 +02:00
sleepycatcoding 9604b07518 tests: Allow passing path to mocket utility
Also use anyhow to remove some unwraps.
2023-07-26 14:01:03 +02:00
sleepycatcoding a0e40287c9 tests: Rename socket-mock utility to mocket 2023-07-26 14:01:03 +02:00
sleepycatcoding 87ab1a22e9 chore: Fix clippy warning 2023-07-26 14:01:03 +02:00
sleepycatcoding 06e9656841 chore: fmt 2023-07-26 14:01:03 +02:00
sleepycatcoding d5da477df8 tests: Improve socket testing backend 2023-07-26 14:01:03 +02:00
sleepycatcoding 5d29c909c6 tests: Use socket.json when running tests 2023-07-26 14:01:03 +02:00
sleepycatcoding 3e8ee00a67 tests: Move SocketEvent into ruffle_socket_format crate 2023-07-26 14:01:03 +02:00
sleepycatcoding 88626b7212 tests: Add experimental socket_mock tool
This is used to help to create/test socket.json files against real Flash Player to verify behavior.
2023-07-26 14:01:03 +02:00
TÖRÖK Attila d1a94c5d24 tests: Don't exclude WARP from visual tests of blur 2023-07-26 13:03:11 +02:00
TÖRÖK Attila 2e721fdcbe tests: Update the expected output of some visual blur tests 2023-07-26 13:03:11 +02:00
TÖRÖK Attila 9fa3a11b22 tests: Add a visual test for equivalence of blur quality/repetition and filters/applyFilter 2023-07-26 13:03:11 +02:00
TÖRÖK Attila 5f840bf103 tests: Add a visual test for blur filter quality 2023-07-26 13:03:11 +02:00
Aaron Hill a91b0cf5cb avm2: Don't error in DisplayObject.removeChildren when `to` is max
Our previous special-case wasn't broad enough
2023-07-25 21:44:23 -04:00
Aaron Hill 3c64e8e249 avm2: Implement AMF Vector serialization/deserialization
Some of the tests are currently disabled because (separate from this PR)
we can't actually run `toString()` on a Vector.<Object>, due to our
broken vector handling.
2023-07-25 09:35:50 -04:00
CUB3D 7346f9f6cb avm1: Differentiate between clips with no name set and empty string names 2023-07-25 08:25:37 +02:00
TÖRÖK Attila 1c0fff9e12 tests: Update the expected output of the avm2/bitmapdata_sync visual test 2023-07-25 00:38:08 -04:00
sleepycatcoding f2c9237ea1
avm2: Allow setting prototype to undefined (#12282)
* avm2+tests: Allow setting prototype to undefined

This is used internally by Adobe Flex in many places. Also add test.

* avm2: Set prototype when constructing a Function with null prototype

* tests: Expand prototype_set_null test

* chore: fmt
2023-07-24 20:41:38 +00:00
Nathan Adams 92e3e44453 avm1: Reverse iteration when applying filters - fixes #12272 2023-07-24 13:44:02 +02:00
TÖRÖK Attila 0d1f7f8dcc tests: Increase the tolerance of visual tests for the bevel filter slightly
To accomodate platform differences.
2023-07-24 04:44:22 +02:00
TÖRÖK Attila e14b92ae3b tests: Update visual test images due to slightly different blur algorithm 2023-07-24 04:44:22 +02:00
TÖRÖK Attila 7fe1c71257 tests: Add a visual test for fractional blur strength 2023-07-24 04:44:22 +02:00
Nathan Adams 9c661a14c3 tests: Port Shumway's avm1 tests over 2023-07-24 04:26:14 +02:00
Aaron Hill cd9efb2dfa wgpu: Ignore zero width/height Stage3D scissor rect
This matches Flash's behavior, and prevents wgpu from panicking.
2023-07-23 17:05:27 -04:00
Aaron Hill 8941a0bb79 avm2: Clamp ByteArray.position when ByteArray.length is set
Note that ByteArray.position can manually be set out-of-range
afterwards.
2023-07-23 14:51:30 -04:00
Aaron Hill 005fdffd05 avm2: Correctly set fields on ShaderInput and ShaderParameter
The special meta key `defaultValue` should be used to set
the default `value` field. Also, `index` is the position
within *just* the image or texture params, not within
all of the params.
2023-07-23 13:52:26 -04:00
sleepycatcoding f47ed92108 tests: Add test for socket errors 2023-07-23 09:13:01 +02:00
sleepycatcoding 75672ae998 web, tests: Update connect_socket stubs 2023-07-23 09:13:01 +02:00
sleepycatcoding ed22a7a23b web, tests: remove Option for connection timeout 2023-07-23 09:13:01 +02:00
sleepycatcoding 486c0ca149 web, tests: Ignore timeout parameter 2023-07-23 09:13:01 +02:00
sleepycatcoding 437187a7bd tests: Log socket connections on test backend 2023-07-23 09:13:01 +02:00
sleepycatcoding 0699c34881 chore: Fmt 2023-07-23 09:13:01 +02:00
sleepycatcoding e59dd9a8ef web, tests: fix connect_socket stubs 2023-07-23 09:13:01 +02:00
sleepycatcoding 67aa0fcbd4 tests: Stub connect_socket() 2023-07-23 09:13:01 +02:00
Nathan Adams 4219f39668 avm2: Throw proper error when setting name of timeline objects 2023-07-23 01:18:53 +02:00
Aaron Hill 5ee6218ab4 avm2: Fix `super_vtable` in `describeType`
This more closely matches what avmplus does.
2023-07-22 17:50:10 -04:00
Abiel Deneke 8f6e9d8f63 avm2: Don't change the length of a fixed output Vector 2023-07-22 16:11:08 -04:00
Nathan Adams 4accc2ca86 tests: Add 'delete list.@*' to the xmllist delete test 2023-07-22 18:24:08 +02:00
Nathan Adams d1cfb1b8d1 avm2: Implement delete_property_local for XMLList 2023-07-22 18:24:08 +02:00
Nathan Adams 4410d666ed avm2: Implement Bitmap.pixelSnapping 2023-07-22 00:34:17 +02:00
Nathan Adams 289f73c85f core: Add pixel snapping (default auto) to Bitmaps, and force it for cacheAsBitmap 2023-07-22 00:34:17 +02:00
Lord-McSweeney 68c5024f21 tests: Add test for LocalConnection.send 2023-07-22 00:00:24 +02:00
Nathan Adams 98ce792a5b avm1: Implement BitmapData.applyFilter() 2023-07-21 21:43:54 +02:00
Aaron Hill f328797d04 avm2: Fix bugs with describeType interfaces and methods
Interfaces should only be listed when calling describeType
with a class instance (not with a `Class` object).

Additionally, AS3 methods can actually be displayed under
some circumstances. This is due to weird legacy behavior
that avmplus implements. A full fix requirs us to implement
namespace versioning, but we can get closer by special-casing
playerglobals (which is special-cased by namespace versioning
anyway).
2023-07-21 15:23:56 -04:00
Nathan Adams f1e96bb1f1 tests: Reduce size of blur_scales_with_screen test 2023-07-20 23:19:20 +02:00
Nathan Adams 67c33ef9c3 core: Disable cacheAsBitmap for swfs that are too large (depending on swf version) 2023-07-20 23:19:20 +02:00
Nathan Adams a85aa41e6a tests: Add displacement filter scaling test 2023-07-20 12:41:30 +02:00
TÖRÖK Attila ad591224f9 tests: Another test with .filters instead of applyFilter 2023-07-20 12:41:30 +02:00
TÖRÖK Attila 4e7baf647e tests: Add another displacement map test 2023-07-20 12:41:30 +02:00
Nathan Adams 400ff32723 wgpu: Implement a naive DisplacementMap filter 2023-07-20 12:41:30 +02:00
Lord-McSweeney dd0d4f7eea avm2: Add test for NetStream.client 2023-07-19 17:26:24 -06:00
Lord-McSweeney 42c1facf55 avm1+tests: Implement onMetaData event for AVM1, fix netStatus test for AVM2 2023-07-19 17:26:24 -06:00
Aaron Hill 715abd8985 avm2: Use invisible mask descendants for mouse picking and rendering
The 'DisplayObject.visible' flag seems to be ignored for mask objects
(and their descendants) - mouse picking still takes them into account,
and they get rendered as part of the mask.

This commit changes display object rendering and AVM2 mouse picking
to ignore DisplayObject.visibility when dealing with mask objects/
descendants.
2023-07-19 23:18:28 +02:00
Nathan Adams b1ba144166 wgpu: Implement Bevel filter 2023-07-19 22:59:33 +02:00
CUB3D 771f568509 core: Trying to access a named shape should resolve to the parent as they have no object representation 2023-07-19 22:32:42 +02:00
sleepycatcoding 4c1c3cc105 avm2+tests: Allow concating XMLLists; add test 2023-07-19 16:03:10 -04:00
Nathan Adams 5597535471 wgpu: Store wgpu::Instance in Descriptors 2023-07-19 21:36:30 +02:00
Nathan Adams 030c3c50e8 wgpu: Make `request_adapter_and_device` take in wgpu::Instance by ref 2023-07-19 21:36:30 +02:00
Nathan Adams 5304009892 tests: Port Shumway's timeline tests over 2023-07-19 17:04:38 +02:00
Lord-McSweeney 5975714f75 avm2+swf+tests: Store metadata on Traits and VTable, report metadata in describeType; parse ABC metadata key-value pairs correctly; add test 2023-07-19 16:24:23 +02:00
Nathan Adams b8081ac609 core: Use actual bounding box of curves instead of an approximation 2023-07-19 02:09:12 +02:00
Nathan Adams aa243dbe4c tests: Port Shumway's acid tests over 2023-07-18 23:48:21 +02:00
Nathan Adams 0076d65865 wgpu: Speed up blur filter by about 50% 2023-07-17 23:33:30 +02:00
nosamu de9ea9571b avm2: Implement SharedObject.size 2023-07-17 00:53:52 +02:00
nosamu fea0df192f avm1: Implement SharedObject.getSize() 2023-07-17 00:53:52 +02:00
MrCheeze e1819f7c00 tests: Add visual test for colored underlines.
Note that the underline's vertical position is wrong, meaning that the
expected.png will have to be updated whenever this is fixed.
2023-07-17 00:32:46 +02:00
Kornelius Rohrschneider a0493c770e core: Implement suggested changes to PR
The suggested changes in the feedback to the pull request have been
implemented.
Therefore, this commit consists of multiple smaller changes:

- The unload_movie method has been renamed to avm1_unload_movie.
- The movieclip_default_state test now doesn't test
  getTextSnapshot().getCount() because the underlying methods haven't
  been implemented in AVM1 yet.
  This should be reverted when they have been implemented or stubbed in
  AVM1.
2023-07-17 00:08:02 +02:00
Kornelius Rohrschneider bd67ce8661 tests: Add MovieClip state tests
Two tests testing the different states of a MovieClip have been added.

A MovieClip can be in different specific states (namely: default state,
initial loading state, error state, image state, success state and
unloaded state). A state of a MovieClip consists of the values of all
properties and the results of some getter functions of the MovieClip.
To make sure that all of these states are implemented correctly and will
continue to be so in the future, two MovieClip state tests have been
added.

The movieclip_default_state test tests the default state of a MovieClip
after it has been created with createEmptyMovieClip.

The movieclip_state_values test has MovieClips going through all other
states and tests if the values are correct in each.

These tests currently only test the MovieClip states when trying to load
a local file since Ruffle tests currently don’t support tests using
remote URLs. Test cases for remote URLs are still included and can be
used if Ruffle starts supporting remote URLs at some point.

A HelperTest, which can be used to find out about how the state of a
MovieClip changes when trying to load and unload it, has been included
as well.
2023-07-17 00:08:02 +02:00
Kornelius Rohrschneider 8888aae60b tests: Add MovieClip invalid getBounds tests
The behaviour of when the results of getBounds / getRect calls on
MovieClips with invalid bounds are 6710886.35 and when they are
6710886.4 for each corner of the rectangle is rather complex.
To make sure it works correctly in every case and will continue to do so
in the future, eight tests testing the results of getBounds calls under
these circumstances have been added.

This needs to be tested in several tests because an internal state
determining the results can change irreversibly. Making sure that it
changes correctly on different occasions takes several tests.
2023-07-17 00:08:02 +02:00
Kornelius Rohrschneider a0d0b8e638 core: Refactor & improve NavigatorBackend implementations
All NavigatorBackend implementations have been refactored, resulting in
improved code quality, less duplicated code, more consistent and easier
to understand procedures, additional error handling and better error
messages.

A resolve_url method has been added to the NavigatorBackend trait. It
takes a URL and and resolves it to the actual URL from which a file can
be fetched (including handling of relative links and pre-processing). It
has been implemented in each NavigatorBackend implementation.

Duplicated code has been put into new public functions in
core/src/backend/navigator.rs which are called by all NavigatorBackend
implementations.

ExternalNavigatorBackend:
- The navigate_to_url and fetch methods have been adapted to use
  resolve_url, removing redundant code.
- Error handling has been added in case that the URL can't be converted
  to a PathBuf.
- A TODO about differences between the flash player fetch and the
  Ruffle fetch implementation has been added.

WebNavigatorBackend:
- The previous resolve_url method exclusively to the WebNavigatorBackend
  has been replaced by the new resolve_url method. It is used by
  navigate_to_url and fetch.
- resolve_url now always pre-processes the URL if it's valid (even if no
  base_url exists) and explicitly returns whether the URL can be parsed.
- navigate_to_url now traces an explanatory error each if the URL can't
  be parsed or is local.
- fetch now returns an explanatory error each if the URL can't be parsed
  or is local (previously, a vague "Got JS error" has been returned).

TestNavigatorBackend & NullNavigatorBackend:
- fetch pre-processes the URL now (using the resolve_url implementation).
- If the URL isn't local, an explanatory error is returned (previously,
  it was just an "Invalid URL" error).
- If the URL can't be parsed, an explanatory error with the reason is
  returned (previously, it was just an "Invalid URL" error).

Additionally, error messages in all NavigatorBackend implementations
have been improved and made more consistent, e.g. if a local file can't
be read.
2023-07-17 00:08:02 +02:00
Kornelius Rohrschneider 893052c2a6 core: Add MovieClip error state
A load_error_swf function has been added to the Loader. It makes the
MovieClip enter the error state in which some attributes have certain
error values to signal that no valid file could be loaded. This happens
if no file could be loaded or if the loaded content is no valid
supported content.
The function creates an error state movie stub using the new
SwfMovie::error_movie function (which uses a new default_error_header
function) and configures remaining variables with the
movie_not_available method.
One TODO in order for the error state to be completely implemented has
been added.

Since the error state of the MovieClip includes the final URL of the SWF
file obtained after any redirects, the load_error_swf and
movie_loader_error functions (now) take an swf_url attribute.
To get this URL in case no file could be loaded, the
NavigatorBackend::fetch method has been changed to return an
ErrorResponse struct (including the url and the actual error) in the
error case. The Response struct returned in the success case has been
renamed to SuccessResponse.
All fetch implementations have been adapted accordingly. Code has been
adjusted to return the actual error where that's needed.

Documentation has been added and improved.
2023-07-17 00:08:02 +02:00
MrCheeze 901594b99f
avm2: Do not remove an EditText's selection on unfocus (fix #9006) + implement selectionBegin/selectionEnd/caretIndex (#9067)
* avm2: Do not remove an EditText's selection on unfocus (fix #9006)

There are significant differences between how selection and caret info
work between AVM1 and AVM2.

In AVM1, there is only a single, global selection, which applies to
whichever element is currently focused. Therefore changing the focus
necessarily erases any information of what was selected before. There
can also be no active selection at all.

In AVM2, every text field has its own independent selection info. It is
NOT optional, the default selection is just a caret at position 0. If a
field loses focus, the selection is not rendered, but it is still
present. Movies such as #9006 rely on the same selection still being
there once you give back focus to the field.

Ruffle's model of selections (an Option per text field) is different
from both the AVM1 model (an optional singleton) and the AVM2 model
(mandatory per text field). This fix does not change that, it is only a
narrow fix targeted at 9006.

* avm2: implement selectionBegin/selectionEnd/caretIndex and add a test.

The selection test validates a few situations, including the behaviour
when unfocusing that was fixed in the previous commit.

The test does not validate how the selection changes after replacing
text, as there are still some inaccuracies there.

* avm2: Additional selection fixes needed after merging with master.

1. The default caret for an AVM2 textbox is at the end of the textbox,
   not the beginning.
2. Selection should not be changed when focusing on a textbox in AVM2.
3. Fixed a test whose output.txt didn't actually match the flash player
   output.

* avm2: Make the selection AVM checks compatible with mixed AVM, and revert the on_focus_changed parameters

---------

Co-authored-by: Nathan Adams <dinnerbone@dinnerbone.com>
2023-07-15 16:17:45 +00:00
Nathan Adams 26cf380aa4 avm2: Fix Array.sort(function) 2023-07-15 17:53:05 +02:00
CUB3D e4bd1908bd chore: Fmt 2023-07-15 11:45:02 +02:00
CUB3D 14712b46c6 chore: Fix clippy lint 2023-07-15 11:45:02 +02:00
CUB3D d7a780f5ea core: Fix caching order, add test 2023-07-15 11:45:02 +02:00
Abiel Deneke ae1853f639 tests: Add test for `Matrix3D.transformVectors` 2023-07-14 23:39:39 -04:00
michiel2005 8141e7b54c avm1: fix buttons that were not clickable after a goto 2023-07-14 16:51:07 -06:00
TÖRÖK Attila 49e9376e12 tests/visual: Update avm1/avm2 netstream_play_flv expected images
These changed imperceptibly due to deblocking.
2023-07-14 14:44:23 +02:00
TÖRÖK Attila 39c493ebd5 tests/visual: Disable deblocking for the h263 colorconversion test
Since this functionality was not enabled before, the reference image is
not deblocked. This commit disables deblocking for the test to match the
reference image, and eliminate deblocking as a source of differences.
2023-07-14 14:44:23 +02:00
TÖRÖK Attila f55cbf0a92 tests/visual: Add a basic test for h263 video deblocking 2023-07-14 14:44:23 +02:00
Nathan Adams e0886707c5 tests: Exclude WARP for blur_scales_with_screen 2023-07-12 18:51:11 +02:00
Nathan Adams c3fdfc17dd swf: Scale filter distances where appropriate 2023-07-12 18:51:11 +02:00
Nathan Adams 5c13d323b3 wgpu: Implement the undocumented ability to disable compositeSource for glow/shadow 2023-07-12 18:51:11 +02:00
Nathan Adams 6f98b3d596 wgpu: Saturate alpha in glow shader 2023-07-12 18:51:11 +02:00
Nathan Adams 8cb6e5bdf0 wgpu: Implement drop shadow filter 2023-07-12 18:51:11 +02:00
Nathan Adams aba2394732 wgpu: Respect alpha for glows 2023-07-12 18:51:11 +02:00
Nathan Adams f150a32d86 core: Only scale filters with stage view matrix 2023-07-12 18:51:11 +02:00
Nathan Adams 1aa2ac28c2 wgpu: Slight opimitsation to blur filter by not needing to calculate full_width per fragment 2023-07-12 18:51:11 +02:00
Nathan Adams 30e7a1eac6 core: Account for filter size changes when drawing cacheAsBitmaps 2023-07-12 18:51:11 +02:00
Nathan Adams b30c522f9c wgpu: Implement glow filter 2023-07-12 18:51:11 +02:00
Nathan Adams d4b81cae5c avm1: Migrate XMLNode to NativeObject 2023-07-12 18:33:58 +02:00
Aaron Hill 9d3e96e3a4
render: Implement more Pixelbender opcodes, and fix matrices (#11896) 2023-07-09 16:54:26 +00:00
Adrian Wielgosik b38bd604db avm2: Fix Multiname-with-params formatting 2023-07-08 01:55:44 +02:00
Aaron Hill 61c50e636a
avm2: Convert `has_class_in_chain` to use a `GcCell<Class>` (#11494) 2023-07-07 16:22:38 -04:00
Aaron Hill 4cf0735692 avm2: Implement Utils3D.projectVector and Utils3D.projectVectors 2023-07-06 11:34:40 -04:00
Aaron Hill fb9dbd21b0 tests: Fix stage3d_blend test formatting 2023-07-06 11:18:39 -04:00
Aaron Hill 90dbcfca5d render: Fix writing to varying register in vertex shader 2023-07-06 11:18:39 -04:00
Aaron Hill c295e3e481 avm2: Implement NetConnection.connect with a null `command` 2023-07-06 01:20:34 -04:00
Aaron Hill 009fab1889 core: Expose `LoaderInfo.parameters` and fix other properties
When using a 'Loader', properties on the 'contentLoaderInfo' become
set during specific events in the load sequence. In particular,
'LoaderInfo.bytesTotal' becomes available during the first 'progress'
event.

Also, 'LoaderInfo.parameters' is now properly set from the URL query
parameters. In Flash player, this work even with filesystem urls
(e.g. 'file:///some/path/to/file.txt?paramOne=valOne' will load
a file named 'file.txt', setting and expose the parameter 'paramOne'
with value 'valOne' in `LoaderInfo.parameters`). This required some
cleanup to the desktop and test NavigatorBackend impls to strip
out query parameters when loading a parameter from disk.

Previously, we would set `SwfMovie.parameters` manually from the url.
Now, the various `SwfMovie` constructors automatically extract
query parameters from the provided url. Outside of `SwfMovie`,
we only append *extra* parameters (e.g. those set from `flashvars`).

This makes CPMStar ads work, since the loaded SWF needs to access
`LoaderInfo.parameters`
2023-07-05 19:47:16 -04:00
Aaron Hill 8ac8be7213 avm2: Implement Graphics.drawPath
The 'winding' argument and filling behavior described in the docs
are not yet implemented. However, this implementation is good enough
for Scratch to render its default cat image.
2023-07-05 19:21:50 -04:00
Aaron Hill bbb5619bc9 tests: Add TextField Event.CHANGE test and update test input format 2023-07-05 18:00:59 -04:00
Adrian Wielgosik 87ede6a052 avm2: Set correct `this` values in function calls 2023-07-05 22:36:20 +02:00
Aaron Hill 2d1da4d18e avm2: Throw TypeError when trying to parse malformed XML
Scratch detects if a string is valid XML by trying to construct
an XML object, and catching the thrown error.
2023-07-05 19:41:23 +02:00
Nathan Adams 4fc170e5bd avm1: Implement gradient filters conversions 2023-07-05 19:18:00 +02:00
Nathan Adams bfedfbaa98 avm1: Implement displacement map filter conversions 2023-07-05 19:18:00 +02:00
Nathan Adams 8a767492e6 avm1: Implement drop shadow filter conversions 2023-07-05 19:18:00 +02:00
Nathan Adams 40b4f9bafa avm1: Implement glow filter conversions 2023-07-05 19:18:00 +02:00
Nathan Adams 30027bc03e avm1: Implement convolution filter conversions 2023-07-05 19:18:00 +02:00
Nathan Adams df6064b2e9 avm1: Implement color matrix filter conversions 2023-07-05 19:18:00 +02:00
Nathan Adams b3629669bd avm1: Implement blur filter conversions 2023-07-05 19:18:00 +02:00