-
-
Notifications
You must be signed in to change notification settings - Fork 838
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
web: Add integration_tests/missing_default_fonts
This test makes sure Ruffle does not panic when a default font is missing.
- Loading branch information
1 parent
182e0f7
commit 8e4fbd2
Showing
4 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
web/packages/selfhosted/test/integration_tests/missing_default_fonts/Test.as
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,21 @@ | ||
package { | ||
import flash.display.MovieClip; | ||
import flash.text.TextField; | ||
import flash.text.TextFormat; | ||
import flash.utils.setTimeout; | ||
|
||
[SWF(width="400", height="400")] | ||
public class Test extends MovieClip { | ||
public function Test() { | ||
var tf = new TextFormat(); | ||
tf.font = "Some Unknown Font 3"; | ||
tf.size = 10; | ||
|
||
var f = new TextField(); | ||
f.defaultTextFormat = tf; | ||
f.text = "test"; | ||
addChild(f); | ||
trace("Loaded!"); | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
web/packages/selfhosted/test/integration_tests/missing_default_fonts/index.html
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 @@ | ||
<!doctype html> | ||
<html> | ||
|
||
<head> | ||
<title>missing_default_fonts</title> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
|
||
<script> | ||
window.RufflePlayer = window.RufflePlayer || {}; | ||
window.RufflePlayer.config = { | ||
"defaultFonts": { sans: ["Some Unknown Font", "Some Other Unknown Font"] } | ||
}; | ||
</script> | ||
</head> | ||
|
||
<body> | ||
<div id="flashContent"> | ||
<object type="application/x-shockwave-flash" data="test.swf" width="400" height="400" id="objectElement"> | ||
</object> | ||
</div> | ||
</body> | ||
|
||
</html> |
Binary file added
BIN
+993 Bytes
web/packages/selfhosted/test/integration_tests/missing_default_fonts/test.swf
Binary file not shown.
14 changes: 14 additions & 0 deletions
14
web/packages/selfhosted/test/integration_tests/missing_default_fonts/test.ts
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,14 @@ | ||
import { injectRuffleAndWait, openTest, playAndMonitor } from "../../utils.js"; | ||
import { use } from "chai"; | ||
import chaiHtml from "chai-html"; | ||
|
||
use(chaiHtml); | ||
|
||
describe("Missing Default Fonts", () => { | ||
it("load the test", async () => { | ||
await openTest(browser, "integration_tests/missing_default_fonts"); | ||
await injectRuffleAndWait(browser); | ||
const player = await browser.$("<ruffle-object>"); | ||
await playAndMonitor(browser, player, "Loaded!\n"); | ||
}); | ||
}); |