Skip to content

Commit

Permalink
web: Add integration_tests/missing_default_fonts
Browse files Browse the repository at this point in the history
This test makes sure Ruffle does not panic when a default font is missing.
  • Loading branch information
kjarosh authored and Dinnerbone committed Dec 7, 2024
1 parent 182e0f7 commit 8e4fbd2
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 0 deletions.
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!");
}
}
}
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 not shown.
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");
});
});

0 comments on commit 8e4fbd2

Please sign in to comment.