Skip to content

Commit e3fdfe1

Browse files
committed
web: Add context_menu_escaping_body integration test
This test verifies how the context menu is displayed when it escapes the document body in quirks and no quirks modes.
1 parent 7995a16 commit e3fdfe1

File tree

5 files changed

+117
-0
lines changed

5 files changed

+117
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package {
2+
import flash.display.*;
3+
4+
[SWF(width="400", height="400")]
5+
public class Test extends MovieClip {
6+
public function Test() {
7+
var rect = new Sprite();
8+
rect.graphics.lineStyle(2, 0xFF0000);
9+
rect.graphics.drawRect(0, 0, 400, 400);
10+
rect.graphics.drawRect(199, 199, 2, 2);
11+
addChild(rect);
12+
trace("Loaded!");
13+
}
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!doctype html>
2+
<html>
3+
4+
<head>
5+
<title>context_menu_escaping_body</title>
6+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7+
</head>
8+
9+
<body>
10+
<div style="position:absolute;top:0;left:0;height:100%;width:100%;">
11+
<div id="flashContent">
12+
<object type="application/x-shockwave-flash" data="test.swf" width="400" height="400" id="objectElement">
13+
</object>
14+
</div>
15+
</div>
16+
</body>
17+
18+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<html>
2+
3+
<head>
4+
<title>context_menu_escaping_body</title>
5+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6+
</head>
7+
8+
<body>
9+
<div style="position:absolute;top:0;left:0;height:100%;width:100%;">
10+
<div id="flashContent">
11+
<object type="application/x-shockwave-flash" data="test.swf" width="400" height="400" id="objectElement">
12+
</object>
13+
</div>
14+
</div>
15+
</body>
16+
17+
</html>
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import { injectRuffleAndWait, openTest, playAndMonitor } from "../../utils.js";
2+
import { expect, use } from "chai";
3+
import chaiHtml from "chai-html";
4+
5+
use(chaiHtml);
6+
7+
describe("Context Menu", () => {
8+
it("(quirks mode) load the test", async () => {
9+
await browser.setWindowSize(1000, 1000);
10+
11+
await openTest(
12+
browser,
13+
"integration_tests/context_menu_escaping_body",
14+
"index_quirks.html",
15+
);
16+
await injectRuffleAndWait(browser);
17+
const player = await browser.$("<ruffle-object>");
18+
await playAndMonitor(browser, player, "Loaded!\n");
19+
20+
// Dismiss hardware acceleration modal in Chrome
21+
await player.click();
22+
await player.click();
23+
});
24+
25+
it("(quirks mode) open context menu", async () => {
26+
const player = await browser.$("#objectElement");
27+
28+
await player.click({ x: -150, y: -150, button: "right" });
29+
30+
const menu = await player.$("#context-menu");
31+
const menuLocation = await menu.getLocation();
32+
expect(menuLocation.x).to.equal(50);
33+
expect(menuLocation.y).to.equal(50);
34+
35+
// Dismiss the menu
36+
await player.click({ x: -151, y: -151 });
37+
});
38+
39+
it("(no quirks mode) load the test", async () => {
40+
await openTest(
41+
browser,
42+
"integration_tests/context_menu_escaping_body",
43+
"index_no_quirks.html",
44+
);
45+
await injectRuffleAndWait(browser);
46+
const player = await browser.$("<ruffle-object>");
47+
await playAndMonitor(browser, player, "Loaded!\n");
48+
49+
// Dismiss hardware acceleration modal in Chrome
50+
await player.click();
51+
await player.click();
52+
});
53+
54+
it("(no quirks mode) open context menu", async () => {
55+
const player = await browser.$("#objectElement");
56+
57+
await player.click({ x: -150, y: -150, button: "right" });
58+
59+
const menu = await player.$("#context-menu");
60+
const menuLocation = await menu.getLocation();
61+
expect(menuLocation.x).to.equal(50);
62+
expect(menuLocation.y).to.equal(50);
63+
64+
// Dismiss the menu
65+
await player.click({ x: -151, y: -151 });
66+
});
67+
});

0 commit comments

Comments
 (0)