3 <title>getSubStringLength() with Arabic script
</title>
4 <script src=
"../../resources/testharness.js"></script>
5 <script src=
"../../resources/testharnessreport.js"></script>
6 <svg width=
"50px" height=
"120px" font-family=
"Arial" font-size=
"30px">
7 <text id=
"ltrtext" y=
"30">إعلانات
</text>
8 <text id=
"rtltext" y=
"60" x=
"75" direction=
"rtl">إعلانات
</text>
9 <text id=
"ltrmixed" y=
"90">Fooإعلانات
</text>
10 <text id=
"rtlmixed" y=
"120" x=
"75" direction=
"rtl">Fooإعلانات
</text>
14 var textElms
= document
.getElementsByTagName('text');
15 var ltr
= textElms
[0];
16 var rtl
= textElms
[1];
17 var subExtentsLtr
= [];
18 var subExtentsRtl
= [];
19 for (var i
= 1; i
< 7; ++i
) {
20 subExtentsLtr
.push(ltr
.getSubStringLength(1, i
));
21 subExtentsRtl
.push(rtl
.getSubStringLength(1, i
));
24 assert_array_equals(subExtentsLtr
, subExtentsRtl
);
25 }, '"direction" does not affect sub string lengths.');
28 var textElms
= document
.getElementsByTagName('text');
29 var extentsLtr
= textElms
[2].getSubStringLength(2, 7);
30 var extentsRtl
= textElms
[3].getSubStringLength(2, 7);
32 assert_equals(extentsLtr
, extentsRtl
);
33 }, '"direction" does not affect sub string lengths across BiDi runs w/ different levels.');