text-dom-03-f-novalid.html (4273B)
1 <!DOCTYPE html> 2 <html lang='en'> 3 <head> 4 <title>text-dom-03-f-manual.svg</title> 5 <meta charset='utf-8'> 6 </head> 7 <body> 8 <h1>Source SVG: text-dom-03-f-manual.svg</h1> 9 <svg version="1.1" baseProfile="full" id="svg-root" 10 width="100%" height="100%" viewBox="0 0 480 360" 11 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> 12 <!--======================================================================--> 13 <!--= SVG 1.1 2nd Edition Test Case =--> 14 <!--======================================================================--> 15 <!--= Copyright 2009 World Wide Web Consortium, (Massachusetts =--> 16 <!--= Institute of Technology, European Research Consortium for =--> 17 <!--= Informatics and Mathematics (ERCIM), Keio University). =--> 18 <!--= All Rights Reserved. =--> 19 <!--= See http://www.w3.org/Consortium/Legal/. =--> 20 <!--======================================================================--> 21 22 <title id="test-title">$RCSfile: text-dom-03-f.svg,v $</title> 23 <defs> 24 <font-face font-family="SVGFreeSansASCII" unicode-range="U+0-7F"> 25 <font-face-src> 26 <font-face-uri xlink:href="../resources/SVGFreeSans.svg#ascii"/> 27 </font-face-src> 28 </font-face> 29 </defs> 30 <g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18"> 31 <text x='10' y='30' font-size='13'>Test that getSubStringLength() handles out-of-range arguments</text> 32 33 <font horiz-adv-x='1000'> 34 <font-face font-family='TestFont'/> 35 <glyph unicode='a' horiz-adv-x='100' d='M0,0 h80 v1000 h-80 z'/> 36 <glyph unicode='𐀀' horiz-adv-x='200' d='M0,0 h180 v1000 h-180 z'/> 37 <glyph unicode='b' horiz-adv-x='400' d='M0,0 h380 v1000 h-380 z'/> 38 </font> 39 40 <text id='t' x='50' y='50' visibility='hidden' font-family='TestFont' font-size='10'>ababa</text> 41 42 <rect id='r1' x='10' y='40' width='30' height='30'/> 43 <text x='50' y='60'>charnum < 0</text> 44 45 <rect id='r2' x='10' y='80' width='30' height='30'/> 46 <text x='50' y='100'>nchars < 0</text> 47 48 <rect id='r3' x='10' y='120' width='30' height='30'/> 49 <text x='50' y='140'>charnum = 0, nchars = length</text> 50 51 <rect id='r4' x='10' y='160' width='30' height='30'/> 52 <text x='50' y='180'>charnum = 0, nchars = length + 10</text> 53 54 <rect id='r5' x='10' y='200' width='30' height='30'/> 55 <text x='50' y='220'>charnum = 1, nchars = -1</text> 56 57 <script><![CDATA[ 58 function $(x) { return document.getElementById(x) } 59 60 var b, t = $('t'); 61 62 b = false; 63 try { 64 t.getSubStringLength(-1, 1); 65 } catch (e) { 66 b = e.code == 1; // DOMException.INDEX_SIZE_ERR 67 } 68 $('r1').setAttribute('fill', b ? 'green' : 'red'); 69 70 b = false; 71 try { 72 t.getSubStringLength(1, -1); 73 } catch (e) { 74 b = e.code == 1; // DOMException.INDEX_SIZE_ERR 75 } 76 $('r2').setAttribute('fill', b ? 'green' : 'red'); 77 78 b = false; 79 try { 80 b = t.getSubStringLength(0, 5) == 11; 81 } catch (e) { 82 } 83 $('r3').setAttribute('fill', b ? 'green' : 'red'); 84 85 b = false; 86 try { 87 b = t.getSubStringLength(0, 15) == 11; 88 } catch (e) { 89 } 90 $('r4').setAttribute('fill', b ? 'green' : 'red'); 91 92 b = false; 93 try { 94 t.getSubStringLength(1, -1); 95 } catch (e) { 96 b = e.code == 1; // DOMException.INDEX_SIZE_ERR 97 } 98 $('r5').setAttribute('fill', b ? 'green' : 'red'); 99 ]]></script> 100 </g> 101 <g font-family="SVGFreeSansASCII,sans-serif" font-size="32"> 102 <text id="revision" x="10" y="340" stroke="none" fill="black">$Revision: 1.9 $</text> 103 </g> 104 <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000"/> 105 <!-- comment out this watermark once the test is approved --><!-- 106 <g id="draft-watermark"> 107 <rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/> 108 <text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240" 109 text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text> 110 </g>--> 111 </svg> 112 </body> 113 </html>