text-dom-04-f-isvalid.html (6123B)
1 <!DOCTYPE html> 2 <html lang='en'> 3 <head> 4 <title>text-dom-04-f-manual.svg</title> 5 <meta charset='utf-8'> 6 </head> 7 <body> 8 <h1>Source SVG: text-dom-04-f-manual.svg</h1> 9 <svg id="svg-root" width="100%" height="100%" onload="test()" xmlns="http://www.w3.org/2000/svg" 10 viewBox="0 0 480 360" xmlns:xlink="http://www.w3.org/1999/xlink"> 11 <!--======================================================================--> 12 <!--= Copyright 2008 World Wide Web Consortium, (Massachusetts =--> 13 <!--= Institute of Technology, European Research Consortium for =--> 14 <!--= Informatics and Mathematics (ERCIM), Keio University). =--> 15 <!--= All Rights Reserved. =--> 16 <!--= See http://www.w3.org/Consortium/Legal/. =--> 17 <!--======================================================================--> 18 19 <title id="test-title">$RCSfile: text-dom-04-f.svg,v $</title> 20 <defs> 21 <font-face 22 font-family="SVGFreeSansASCII" 23 unicode-range="U+0-7F"> 24 <font-face-src> 25 <font-face-uri xlink:href="../resources/SVGFreeSans.svg#ascii"/> 26 </font-face-src> 27 </font-face> 28 </defs> 29 <g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18"> 30 <defs> 31 <font horiz-adv-x="4000" id="mini"> 32 <font-face font-family="simplesvgfont" units-per-em="4000" ascent="800" descent="-200" alphabetic="0"/> 33 <missing-glyph horiz-adv-x="10000" d="M0 0 4000 0"/> 34 <glyph unicode="a" glyph-name="a" horiz-adv-x="4100" d="M0 4000l2000 -4000l2000 4000Z"/> 35 <glyph unicode="b" glyph-name="b" horiz-adv-x="2000" d="M0 0l2000 0000l0 2000l-2000 0Z"/> 36 <glyph unicode="cb" d="M0 0l2000 2000l-2000 2000Z" horiz-adv-x="800"/> 37 <glyph unicode="c" glyph-name="c" horiz-adv-x="1900" d="M0 0L2000 2000l-2000 0L2000 0Z"/> 38 <glyph unicode="𝍒" glyph-name="compliance" d="M1000,0 h1000 v-1000 h-1000 z" horiz-adv-x="2100"/> 39 <hkern u1="c" u2="a" k="500"/> 40 </font> 41 </defs> 42 43 <script type="text/ecmascript"><![CDATA[ 44 function test() 45 { 46 var t = document.getElementById("t"); 47 var r = document.getElementById("r"); 48 var res = document.getElementById("res"); 49 var isPassed = true; 50 51 // string: abca𝍒cb 52 // indices: 0123 4 5 67 53 54 var tests = new Array("getSubStringLength(0,1)", "4100", // 'a' 55 "getSubStringLength(0,2)", "6100", // 'ab' 56 "getSubStringLength(0,3)", "7500", // 'abc' 57 "getSubStringLength(0,4)", "11600", // 'abca' 58 "getSubStringLength(0,5)", "13700", // 'abca' and high surrogate of 1D352 59 "getSubStringLength(0,6)", "13700", // 'abca𝍒' 60 "getSubStringLength(0,7)", "14500", // 'abca𝍒' and half of ligature 'cb' 61 "getSubStringLength(0,8)", "14500", // 'abca�' 62 "getSubStringLength(0,9)", "14500", // 'abca�' 63 "getSubStringLength(3,1)", "4100", // 'a' 64 "getSubStringLength(1,1)", "2000", // 'b' 65 "getSubStringLength(4,1)", "2100", // high surrogate of 1D352 66 "getSubStringLength(4,2)", "2100", // '𝍒' 67 "getSubStringLength(5,1)", "2100", // low surrogate of 1D352 68 "getSubStringLength(6,1)", "800", // first half of ligature 'cb' 69 "getSubStringLength(6,2)", "800", // ligature 'cb' 70 "getSubStringLength(7,1)", "800", // second half of ligature 'cb' 71 "getSubStringLength(8,1)", "INDEX_SIZE_ERR", 72 "getSubStringLength(9,0)", "INDEX_SIZE_ERR", 73 "getSubStringLength(-1,1)", "INDEX_SIZE_ERR", 74 "getSubStringLength(-57,0)", "INDEX_SIZE_ERR", 75 "getSubStringLength(0,-52)", "INDEX_SIZE_ERR", 76 "getSubStringLength(-1,-5)", "INDEX_SIZE_ERR", 77 "getSubStringLength(7,0)", "0", // second half of ligature 'cb' 78 "getSubStringLength(5,0)", "0", // high surrogate of 1D352 79 "getSubStringLength(4,0)", "0" // low surrogate of 1D352 80 ); 81 82 try 83 { 84 for(var i = 0; i < tests.length; i=i+2) 85 { 86 try 87 { 88 val = eval("t."+tests[i]); 89 } 90 catch(e) 91 { 92 if(e.code == DOMException.INDEX_SIZE_ERR) 93 { 94 val = "INDEX_SIZE_ERR" 95 } 96 else 97 { 98 val = e; 99 } 100 } 101 102 if(val != tests[i+1]) 103 { 104 throw "Failed " + tests[i] + " got " + val + " but expected " + tests[i+1]; 105 } 106 } 107 } 108 catch(f) 109 { 110 isPassed = false; 111 res.textContent = f; 112 } 113 114 if(isPassed) 115 { 116 r.setAttribute("fill", "none"); 117 } 118 } 119 ]]></script> 120 121 <g transform="scale(0.02 0.02) translate(4000 2000)"> 122 <g id="reference" fill="red"> 123 <path d="M0 4000l2000 -4000l2000 4000Z" transform="scale(1 -1) translate(0 -8000)"/> 124 <path d="M0 0l2000 0000l0 2000l-2000 0Z" transform="translate(4100 6000)"/> 125 <path d="M0 0L2000 2000l-2000 0L2000 0Z" transform="translate(6100 6000)"/> 126 <path d="M0 4000l2000 -4000l2000 4000Z" transform="scale(1 -1) translate(7500 -8000)"/> 127 <path d="M1000,0 h1000 v-1000 h-1000 z" transform="scale(1 -1) translate(11600 -8000)"/> 128 <path d="M0 0l2000 2000l-2000 2000Z" transform="scale(1 -1) translate(13700 -8000)"/> 129 </g> 130 131 <text id="t" font-family="simplesvgfont" font-size="4000" y="2em" fill="lime">abca𝍒cb</text> 132 <rect id="r" x="5000" y="10%" width="2000" height="2000" fill="red"/> 133 <text id="res" x="50%" text-anchor="middle" font-family="sans-serif" font-size="200" y="80%"></text> 134 </g> 135 </g> 136 <g font-family="SVGFreeSansASCII,sans-serif" font-size="32"> 137 <text id="revision" x="10" y="340" stroke="none" 138 fill="black">$Revision: 1.4 $</text> 139 </g> 140 <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000"/> 141 <!-- comment out this watermark once the test is approved --> 142 <g id="draft-watermark"> 143 <rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/> 144 <text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240" 145 text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text> 146 </g> 147 </svg> 148 </body> 149 </html>