Skip to content

Commit 06565d5

Browse files
committed
2 parents 8b431a9 + c182d09 commit 06565d5

File tree

585 files changed

+17351
-5239
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

585 files changed

+17351
-5239
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
Select text in the video above. This test requires WebKitTestRunner.
3+
4+
Verifies that the highlight and handles show up in the correct place when selecting Live Text inside a video
5+
6+
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
7+
8+
PASS viewBeforeSelecting is not viewAfterSelecting
9+
PASS viewAfterSelecting is not viewAfterClearingSelection
10+
PASS successfullyParsed is true
11+
12+
TEST COMPLETE
13+
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true AsyncOverflowScrollingEnabled=true SelectionHonorsOverflowScrolling=true ] -->
2+
<html>
3+
<head>
4+
<meta name="viewport" content="width=device-width, initial-scale=1">
5+
<meta charset="utf-8">
6+
<script src="../../../resources/ui-helper.js"></script>
7+
<script src="../../../resources/js-test.js"></script>
8+
<style>
9+
body, html {
10+
font-family: system-ui;
11+
font-size: 16px;
12+
line-height: 1.5;
13+
}
14+
15+
video {
16+
width: 100%;
17+
}
18+
</style>
19+
</head>
20+
<body>
21+
<video></video>
22+
<p>Select text in the video above. This test requires WebKitTestRunner.</p>
23+
<div id="description"></div>
24+
<div id="console"></div>
25+
<script>
26+
jsTestIsAsync = true;
27+
28+
addEventListener("load", async () => {
29+
description("Verifies that the highlight and handles show up in the correct place when selecting Live Text inside a video");
30+
31+
const video = document.querySelector("video");
32+
video.controls = false;
33+
video.addEventListener("canplaythrough", completeTest);
34+
video.src = "../../../media/content/audio-describes-video.mp4";
35+
36+
async function completeTest() {
37+
// Rect centered in the video, rotated by 5 degrees clockwise.
38+
const liveTextQuad = {
39+
topLeft : new DOMPointReadOnly(0.1837, 0.3269),
40+
topRight : new DOMPointReadOnly(0.7814, 0.2746),
41+
bottomRight : new DOMPointReadOnly(0.8163, 0.6731),
42+
bottomLeft : new DOMPointReadOnly(0.2186, 0.7254),
43+
};
44+
45+
window.internals?.installImageOverlay(video, [
46+
{
47+
topLeft : liveTextQuad.topLeft,
48+
topRight : liveTextQuad.topRight,
49+
bottomRight : liveTextQuad.bottomRight,
50+
bottomLeft : liveTextQuad.bottomLeft,
51+
children: [
52+
{
53+
text : "Bip",
54+
topLeft : liveTextQuad.topLeft,
55+
topRight : liveTextQuad.topRight,
56+
bottomRight : liveTextQuad.bottomRight,
57+
bottomLeft : liveTextQuad.bottomLeft
58+
}
59+
]
60+
}
61+
]);
62+
63+
const {x, y} = UIHelper.midPointOfRect(video.getBoundingClientRect());
64+
viewBeforeSelecting = await UIHelper.frontmostViewAtPoint(x, y);
65+
66+
await UIHelper.longPressElement(video);
67+
await UIHelper.waitForSelectionToAppear();
68+
69+
viewAfterSelecting = await UIHelper.frontmostViewAtPoint(x, y);
70+
71+
getSelection().removeAllRanges();
72+
await UIHelper.waitForSelectionToDisappear();
73+
74+
viewAfterClearingSelection = await UIHelper.frontmostViewAtPoint(x, y);
75+
76+
shouldNotBe("viewBeforeSelecting", "viewAfterSelecting");
77+
shouldNotBe("viewAfterSelecting", "viewAfterClearingSelection");
78+
79+
finishJSTest();
80+
};
81+
});
82+
</script>
83+
</body>
84+
</html>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta name="viewport" content="width=device-width, initial-scale=1" />
5+
<style>
6+
body {
7+
margin: 0;
8+
padding: 0;
9+
padding-top: 5px;
10+
}
11+
#d1, #d2 {
12+
top: 0;
13+
left: 0;
14+
width: 20px;
15+
height: 30px;
16+
background-color: black;
17+
position: absolute;
18+
}
19+
</style>
20+
</head>
21+
<body>
22+
<select id="select"><option>Option</option></select>
23+
<div id="d1"></div>
24+
<div id="d2"></div>
25+
</body>
26+
<script defer>
27+
var selectRect = select.getBoundingClientRect();
28+
d2.style.left = selectRect.x + selectRect.width - 10 + "px";
29+
</script>
30+
</html>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta name="viewport" content="width=device-width, initial-scale=1" />
5+
</head>
6+
<style>
7+
body {
8+
margin: 0;
9+
padding: 0;
10+
padding-top: 5px;
11+
}
12+
#d1, #d2 {
13+
top: 0;
14+
left: 0;
15+
width: 20px;
16+
height: 30px;
17+
background-color: black;
18+
position: absolute;
19+
}
20+
</style>
21+
<body onload="runTest()">
22+
<select id="select"><option>Option</option></select>
23+
<div id="d1"></div>
24+
<div id="d2"></div>
25+
</body>
26+
<script>
27+
select.focus();
28+
</script>
29+
</html>

LayoutTests/fast/snapshot/transformed-expected.html

Lines changed: 0 additions & 18 deletions
This file was deleted.

LayoutTests/fast/snapshot/transformed.html

Lines changed: 0 additions & 55 deletions
This file was deleted.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CONSOLE MESSAGE: promises created
2+
CONSOLE MESSAGE: Pass
3+

0 commit comments

Comments
 (0)