-
-
Notifications
You must be signed in to change notification settings - Fork 832
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Add avm2/filereference_save_and_load test
This test ensures that the error 2037 is thrown when load is called after save. It's currently a known failure as Ruffle is not as strict as FP regarding throwing the error 2037.
- Loading branch information
1 parent
6ea64c9
commit d852c74
Showing
4 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package { | ||
import flash.display.Sprite; | ||
public class Test extends Sprite { } | ||
} | ||
|
||
import flash.net.FileReference; | ||
import flash.net.FileFilter; | ||
import flash.events.Event; | ||
import flash.events.ProgressEvent; | ||
import flash.utils.setTimeout; | ||
|
||
var file = new FileReference(); | ||
|
||
function dump(file) { | ||
try { | ||
trace("file.name: " + file.name); | ||
} catch (e) { | ||
trace("file.name threw: " + e); | ||
} | ||
|
||
try { | ||
trace("file.size: " + file.size); | ||
} catch (e) { | ||
trace("file.size threw: " + e); | ||
} | ||
|
||
trace("file.data: " + file.data); | ||
trace(""); | ||
} | ||
|
||
function onopen(e) { | ||
trace("open event"); | ||
dump(e.target); | ||
} | ||
|
||
function onprogress(e) { | ||
trace("progress event"); | ||
trace(e.bytesLoaded + " / " + e.bytesTotal); | ||
dump(e.target); | ||
} | ||
|
||
function oncomplete(e) { | ||
trace("complete event"); | ||
dump(e.target); | ||
|
||
try { | ||
file.load(); | ||
} catch(e) { | ||
trace("Error: " + e); | ||
} | ||
} | ||
|
||
function onselect(e) { | ||
trace("select event"); | ||
dump(e.target); | ||
} | ||
|
||
function oncancel(e) { | ||
trace("cancel event"); | ||
dump(e.target); | ||
} | ||
|
||
file.addEventListener(Event.OPEN, onopen); | ||
file.addEventListener(ProgressEvent.PROGRESS, onprogress); | ||
file.addEventListener(Event.COMPLETE, oncomplete); | ||
file.addEventListener(Event.SELECT, onselect); | ||
file.addEventListener(Event.CANCEL, oncancel); | ||
|
||
file.save("Hello, World!", "debug-success.txt"); |
22 changes: 22 additions & 0 deletions
22
tests/tests/swfs/avm2/filereference_save_and_load/output.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
select event | ||
file.name: debug-success.txt | ||
file.size: 0 | ||
file.data: null | ||
|
||
open event | ||
file.name: debug-success.txt | ||
file.size: 0 | ||
file.data: null | ||
|
||
progress event | ||
13 / 13 | ||
file.name: debug-success.txt | ||
file.size: 0 | ||
file.data: null | ||
|
||
complete event | ||
file.name: debug-success.txt | ||
file.size: 13 | ||
file.data: null | ||
|
||
Error: Error: Error #2037: Functions called in incorrect sequence, or earlier call was unsuccessful. |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
num_ticks = 1 | ||
|
||
# FIXME FP is more strict regarding the error 2037 | ||
known_failure = true | ||
|
||
# this test currently overflows the stack | ||
ignore = true |