-
-
Notifications
You must be signed in to change notification settings - Fork 809
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Add form loader encoding tests
Several form loader encoding tests have been added. They test whether the form loader uses the correct encoding to decode text files with different SWF versions and settings.
- Loading branch information
Showing
23 changed files
with
95 additions
and
12 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
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 @@ | ||
utf8_var=UTF8: ÄÖÜ ß - 片仮名 |
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 @@ | ||
UTF8: ÄÖÜ ß - 片仮名 |
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,18 @@ | ||
// SWF Version 6 | ||
|
||
/* | ||
* This test is the first test out of a series of tests, testing the encoding the form loader uses to decode | ||
* text files. | ||
* This test tests whether a UTF-8 text file loaded in an SWF file with SWF version 6 is decoded as UTF-8. | ||
* Flash decodes invalid UTF-8 characters (such as some characters encoded in ISO Latin-1) differently, and | ||
* as of June 2024, Ruffle doesn't implement this. Therefore, this test only tests a UTF-8 file. | ||
*/ | ||
|
||
loadVariablesNum("UTF8.txt", 0); | ||
|
||
this.onEnterFrame = function() { | ||
if (this.utf8_var != undefined) { | ||
trace(this.utf8_var); | ||
this.onEnterFrame = null; | ||
} | ||
}; |
Binary file not shown.
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 @@ | ||
num_frames = 3 |
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 @@ | ||
iso_var=Iso Latin-1: ��� � |
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 @@ | ||
shift_var=Shift Jis: �Љ��� |
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 @@ | ||
utf8_var=UTF8: ÄÖÜ ß - 片仮 |
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,3 @@ | ||
UTF8: ÄÖÜ ß - 片仮 | ||
Iso Latin-1: ÄÖÜ ß | ||
Shift Jis: •Ð‰¼–¼ |
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,23 @@ | ||
// SWF Version 5 | ||
|
||
/* | ||
* This test is the second test out of a series of tests, testing the encoding the form loader uses to decode | ||
* text files. | ||
* This test tests whether text files loaded in an SWF file with SWF version 5 are decoded as Windows-1252. | ||
* Flash decodes these files as Windows-1252 on Windows. On macOS, a different custom encoding is used (with | ||
* the letters with diacritics having the same encoding as in Windows-1252). | ||
*/ | ||
|
||
// ActionScript code in Frame 1 | ||
|
||
loadVariablesNum("UTF8.txt", 0); | ||
loadVariablesNum("Iso.txt", 0); | ||
loadVariablesNum("Shift Jis.txt", 0); | ||
|
||
|
||
// ActionScript code in Frame 3 | ||
|
||
trace(this.utf8_var); | ||
trace(this.iso_var); | ||
trace(this.shift_var); | ||
stop(); |
Binary file not shown.
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 @@ | ||
num_frames = 3 |
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 @@ | ||
iso_var=Iso Latin-1: ��� � |
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 @@ | ||
shift_var=Shift Jis: �Љ��� |
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 @@ | ||
utf8_var=UTF8: ÄÖÜ ß - 片仮名 |
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,3 @@ | ||
UTF8: ÄÖÜ ß - 片仮名 | ||
Iso Latin-1: ÄÖÜ ß | ||
Shift Jis: 片仮名 |
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,25 @@ | ||
// SWF Version 6 | ||
|
||
/* | ||
* This test is the third test out of a series of tests, testing the encoding the form loader uses to decode | ||
* text files. | ||
* This test tests whether text files loaded with System#useCodepage set to true are decoded correctly. | ||
* While Flash uses the system codepage, Ruffle doesn't always have access to it, and it's not reliably the | ||
* correct encoding. Therefore, when System#useCodepage is set to true, text files in different encodings | ||
* should all be decoded correctly. | ||
*/ | ||
|
||
System.useCodepage = true; | ||
|
||
loadVariablesNum("UTF8.txt", 0); | ||
loadVariablesNum("Iso.txt", 0); | ||
loadVariablesNum("Shift Jis.txt", 0); | ||
|
||
this.onEnterFrame = function() { | ||
if (this.utf8_var != undefined && this.iso_var != undefined && this.shift_var != undefined) { | ||
trace(this.utf8_var); | ||
trace(this.iso_var); | ||
trace(this.shift_var); | ||
this.onEnterFrame = null; | ||
} | ||
}; |
Binary file not shown.
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 @@ | ||
num_frames = 3 |