Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / text / zero-width-characters-complex-script.html
blobabefec95cedf675e10bd6c7fb4c684d073d06edc
1 <head>
2 <script>
4 function testChar(a, b, ch)
6 // Strings a and b selected here do not have any 'interaction' between them.
7 var span = document.getElementById("characters");
8 span.firstChild.data = a + b;
9 var abWidth = span.offsetWidth;
10 span.firstChild.data = a;
11 var aWidth = span.offsetWidth;
12 span.firstChild.data = a + String.fromCharCode(ch) + b;
13 var abWithChWidth = span.offsetWidth;
15 if (abWithChWidth > abWidth)
16 return 1;
17 if (abWidth > aWidth)
18 return 0;
19 return 1;
22 function testWithZeroWidthSpace(a, b) {
23 var failedCount = 0;
25 for (var i = 1; i < 32; ++i)
26 if (i != 9 && i != 10 && i != 13)
27 failedCount += testChar(a, b, i);
29 for (var i = 0x7F; i < 0xA0; ++i)
30 failedCount += testChar(a, b, i);
31 failedCount += testChar(a, b, 0xAD);
33 // ZWJ (U+200C) and ZWNJ (U+200D) are excluded because they
34 // can affect the rendering in complex script text.
35 failedCount += testChar(a, b, 0x200B);
36 failedCount += testChar(a, b, 0x200E);
37 failedCount += testChar(a, b, 0x200F);
38 failedCount += testChar(a, b, 0x202A);
39 failedCount += testChar(a, b, 0x202B);
40 failedCount += testChar(a, b, 0x202C);
41 failedCount += testChar(a, b, 0x202D);
42 failedCount += testChar(a, b, 0x202E);
43 failedCount += testChar(a, b, 0xFEFF);
44 failedCount += testChar(a, b, 0xFFFC);
46 return failedCount;
49 function test()
51 if (window.testRunner)
52 testRunner.dumpAsText();
54 var failedDevanagariCount = testWithZeroWidthSpace("\u0915\u093E", "\u0916");
56 var failedArabicCount = testWithZeroWidthSpace("\u0627\u0644\u0645\u062A\u0648\u0633\u0637\u0020\u200B\u200B\u0647\u0648\u0020\u0020", "\u0647\u0648\u0020");
58 var testArea = document.getElementById("testArea");
59 testArea.parentNode.removeChild(testArea);
61 var result = "";
62 if (failedDevanagariCount == 0 && failedArabicCount == 0)
63 result = "PASS: All characters had zero-width.";
64 else {
65 if (failedDevanagariCount > 0)
66 result = "FAIL: " + failedDevanagariCount + " characters had non-zero width" +
67 " or failed to get measured when test with Devanagari";
68 if (failedArabicCount > 0)
69 result += "\nFAIL: " + failedArabicCount + " characters had non-zero width" +
70 " or failed to get measured when test with Arabic";
72 document.getElementById("result").firstChild.data = result;
74 </script>
75 </head>
76 <body onload="test()">
77 <p>This test checks various characters that should always be zero width to ensure that they are when enclosed by complex script characters.
78 The WebKit text system ensures this in a way that's independent of the fonts installed on the system.</p>
79 <p id="result">FAIL: Script did not run to completion.</p>
80 <p id="testArea"><span id="characters">&#x0915;&#x093E;&#x0916;</span></p>
81 </body>