4 <title>Test for per-character selection with SVG font
</title>
8 font-family: 'ABCFont';
9 src: local('☺'), url('../custom/resources/ABCFont.svg#ABCFont') format('svg');
15 font-family: 'ABCFont';
29 This test checks that individual characters can be selected correctly when using an SVG font.
31 <span id=
"text" class=
"svgfont">aaaaaaaaaa
</span>
35 <script type=
"text/javascript">
37 var text
= document
.getElementById('text');
39 if (!window
.testRunner
)
42 var textWidth
= text
.offsetWidth
;
43 var estCharWidth
= textWidth
/ 10;
44 eventSender
.mouseMoveTo(text
.offsetLeft
+ (estCharWidth
* 3) + 2, text
.offsetTop
+ text
.offsetHeight
/ 2);
45 eventSender
.leapForward(200);
46 eventSender
.mouseDown();
47 eventSender
.mouseMoveTo(text
.offsetLeft
+ (estCharWidth
* 3) + 2, text
.offsetTop
+ text
.offsetHeight
/ 2);
48 eventSender
.leapForward(200);
49 eventSender
.mouseMoveTo(text
.offsetLeft
+ (estCharWidth
* 6) + 2, text
.offsetTop
+ text
.offsetHeight
/ 2);
50 eventSender
.leapForward(200);
51 eventSender
.mouseUp();
56 var text
= document
.getElementById('text');
58 if (!window
.testRunner
)
61 var range
= window
.getSelection().getRangeAt(0);
62 if (range
.startOffset
=== 3 && range
.endOffset
=== 6)
65 return fail("FAIL: range was [" + range
.startOffset
+ ", " + range
.endOffset
+ "]; expected [3, 6]");
68 function pass(message
) {
72 function fail(message
) {
76 function log(passed
, message
) {
77 var passfail
= document
.getElementById('passfail');
78 passfail
.innerHTML
= message
;
79 passfail
.className
= (passed
? "pass" : "fail");
80 testRunner
.dumpAsText();