OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <meta charset="UTF-8"> | 2 <meta charset="UTF-8"> |
3 <title>getSubStringLength() with Arabic script</title> | 3 <title>getSubStringLength() with Arabic script</title> |
4 <script src="../../resources/testharness.js"></script> | 4 <script src="../../resources/testharness.js"></script> |
5 <script src="../../resources/testharnessreport.js"></script> | 5 <script src="../../resources/testharnessreport.js"></script> |
6 <svg width="50px" height="120px" font-family="Arial" font-size="30px"> | 6 <svg width="50px" height="120px" font-family="Arial" font-size="30px"> |
7 <text id="ltrtext" y="30">إعلانات</text> | 7 <text id="ltrtext" y="30">إعلانات</text> |
8 <text id="rtltext" y="90" x="75" direction="rtl">إعلانات</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> |
9 </svg> | 11 </svg> |
10 <script> | 12 <script> |
11 test(function() { | 13 test(function() { |
12 var textElms = document.querySelectorAll('text'); | 14 var textElms = document.getElementsByTagName('text'); |
13 var ltr = textElms[0]; | 15 var ltr = textElms[0]; |
14 var rtl = textElms[1]; | 16 var rtl = textElms[1]; |
15 var subExtentsLtr = []; | 17 var subExtentsLtr = []; |
16 var subExtentsRtl = []; | 18 var subExtentsRtl = []; |
17 for (var i = 1; i < 7; ++i) { | 19 for (var i = 1; i < 7; ++i) { |
18 subExtentsLtr.push(ltr.getSubStringLength(1, i)); | 20 subExtentsLtr.push(ltr.getSubStringLength(1, i)); |
19 subExtentsRtl.push(rtl.getSubStringLength(1, i)); | 21 subExtentsRtl.push(rtl.getSubStringLength(1, i)); |
20 } | 22 } |
21 | 23 |
22 assert_array_equals(subExtentsLtr, subExtentsRtl); | 24 assert_array_equals(subExtentsLtr, subExtentsRtl); |
23 }, '"direction" does not affect sub string lengths.'); | 25 }, '"direction" does not affect sub string lengths.'); |
| 26 |
| 27 test(function() { |
| 28 var textElms = document.getElementsByTagName('text'); |
| 29 var extentsLtr = textElms[2].getSubStringLength(2, 7); |
| 30 var extentsRtl = textElms[3].getSubStringLength(2, 7); |
| 31 |
| 32 assert_equals(extentsLtr, extentsRtl); |
| 33 }, '"direction" does not affect sub string lengths across BiDi runs w/ different
levels.'); |
24 </script> | 34 </script> |
OLD | NEW |