Bug 1493387 [wpt PR 13159] - Fix the path of mplus-1p-regular.woff in all tests,...
[gecko.git] / testing / web-platform / tests / css / css-text / i18n / ja / css-text-line-break-ja-hyphens-normal.html
blob5e22458f9351669b38d90632f475ca25682db2bb
1 <!DOCTYPE html>
2 <html lang="en" >
3 <head>
4 <meta charset="utf-8"/>
5 <title>CSS3 Text, linebreaks: hyphens (normal,ja)</title>
6 <link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org">
7 <link rel="help" href="https://drafts.csswg.org/css-text-3/#line-break-property">
8 <script src="/resources/testharness.js"></script>
9 <script src="/resources/testharnessreport.js"></script>
10 <meta name="assert" content="When the language is Japanese, and line-break:normal, a browser allows a break before a hyphen.">
11 <style type="text/css">
12 @font-face {
13 font-family: 'mplus-1p-regular';
14 src: url('/fonts/mplus-1p-regular.woff') format('woff');
16 #wrapper { position: relative; }
17 .test { color: red; }
18 .test, .ref { font-size: 30px; font-family: mplus-1p-regular, sans-serif; width: 185px; padding: 0; border: 1px solid orange; line-height: 1em; }
19 </style>
20 <style>
21 .test { line-break: normal; }
22 </style>
23 <script>
24 var charlist = `2010 HYPHEN
25 2013 EN DASH
26 301C WAVE DASH
27 30A0 KATAKANA-HIRAGANA DOUBLE HYPHEN`
28 </script>
29 </head>
30 <body>
31 <script>
32 var lines = charlist.split('\n')
33 var out = '<div id="log"></div>\n'
34 for (var i=0;i<lines.length;i++) {
35 // get the data
36 var firstSpace = lines[i].indexOf(' ')
37 var hex = lines[i].substr(0,firstSpace)
38 var name = lines[i].substr(firstSpace)
39 // make a test
40 out += '<div class="wrapper"><div>'+hex+'</div>' +
41 '<div class="test" id="test'+i+'" lang="ja">文文文文文文&#x'+hex+';字<span id="testSpan'+i+'">字</span></div>' +
42 '<div class="ref" id="ref'+i+'" lang="ja">文文文文文文<br/>&#x'+hex+';字<span id="refSpan'+i+'">字</span></div>' +
43 '</div>'
45 document.querySelector('body').innerHTML = out
46 // hide successful tests
47 for (i=0;i<lines.length;i++) {
48 if (document.getElementById('testSpan'+i).offsetLeft === document.getElementById('refSpan'+i).offsetLeft) document.getElementById('test'+i).parentNode.style.display = 'none'
50 // run the test framework
51 for (i=0;i<lines.length;i++) {
52 test(function() {
53 assert_true(document.getElementById('testSpan'+i).offsetLeft === document.getElementById('refSpan'+i).offsetLeft);
54 }, lines[i]+' may appear at line start if ja and normal');
56 </script>
57 <!--Notes:
58 The test creates a box with room for 6 characters, causing wrapping to occur either between the 6th and the 7th character, or before the 6th if the breaks after the 6th or before the 7th are prohibited.
60 It also creates the expected behaviour with a ref instance, using <br/>. Each line ends with a span. The test then checks whether the left edge of the span is in the same place in test and ref instance.
61 -->
62 </body>
63 </html>