summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/conformance-checkers/html-svg/styling-pres-02-f-novalid.html
blob: 35fa750d41403879030f6c8358f28d8369af5949 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<!DOCTYPE html>
<html lang='en'>
<head>
 <title>styling-pres-02-f-manual.svg</title>
 <meta charset='utf-8'>
</head>
<body>
 <h1>Source SVG: styling-pres-02-f-manual.svg</h1>
<svg id="svg-root" width="100%" height="100%"
  viewBox="0 0 480 360" xmlns="http://www.w3.org/2000/svg"
  xmlns:xlink="http://www.w3.org/1999/xlink">
  <!--======================================================================-->
  <!--=  Copyright 2008 World Wide Web Consortium, (Massachusetts          =-->
  <!--=  Institute of Technology, European Research Consortium for         =-->
  <!--=  Informatics and Mathematics (ERCIM), Keio University).            =-->
  <!--=  All Rights Reserved.                                              =-->
  <!--=  See http://www.w3.org/Consortium/Legal/.                          =-->
  <!--======================================================================-->
  
  <title id="test-title">$RCSfile: styling-pres-02-f.svg,v $</title>
  <defs>
    <font-face
      font-family="SVGFreeSansASCII"
      unicode-range="U+0-7F">
      <font-face-src>
        <font-face-uri xlink:href="../resources/SVGFreeSans.svg#ascii"/>
      </font-face-src>
    </font-face>
  </defs>
  <g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18">
    <text x='10' y='20'>Testing inapplicable presentation attributes</text>

    <g visibility='hidden'>
    	<path id="path" d="M0,0"/>
      <image id='image' xlink:href='../images/20x20.png' width='10' height='10' fill='rgb(0, 0, 255)'/>
      <rect id='rect' width='10' height='10' font-size='123px'/>
      <circle id='circle' r='10' font-style='italic'/>
      <ellipse id='ellipse' rx='10' ry='5' font-variant='small-caps'/>
      <polyline id='polyline' points='0,0 10,10' letter-spacing='20px'/>
      <text id='text' stop-color='rgb(0, 255, 0)'>a<tspan id='tspan' stop-opacity='0.5'>b</tspan><tref id='tref' xlink:href='#tspan' flood-color='rgb(255, 0, 0)'/><textPath id='textPath' xlink:href='#path' flood-opacity='0.25'/><altGlyph id='altGlyph' glyphRef='blah' color-interpolation-filters='auto'>c</altGlyph></text>
      <linearGradient id='linearGradient' display='block'><stop id='stop' offset='0' fill-rule='evenodd'/></linearGradient>
      <radialGradient id='radialGradient' visibility='hidden'><stop offset='0'/></radialGradient>
      <clipPath id='clipPath' lighting-color='rgb(255, 255, 255)'/>
    </g>

    <g font-size='14'>
      <rect id='r1' x='10' y='25' width='20' height='20'/>
      <text x='40' y='40'>fill on image</text>

      <rect id='r2' x='10' y='55' width='20' height='20'/>
      <text x='40' y='70'>stop-opacity on tspan</text>

      <rect id='r3' x='10' y='85' width='20' height='20'/>
      <text x='40' y='100'>font-size on rect</text>

      <rect id='r4' x='10' y='115' width='20' height='20'/>
      <text x='40' y='130'>font-style on circle</text>

      <rect id='r5' x='10' y='145' width='20' height='20'/>
      <text x='40' y='160'>stop-color on text</text>

      <rect id='r6' x='10' y='175' width='20' height='20'/>
      <text x='40' y='190'>font-variant on ellipse</text>

      <rect id='r7' x='10' y='205' width='20' height='20'/>
      <text x='40' y='220'>letter-spacing on polyline</text>

      <rect id='r11' x='250' y='25' width='20' height='20'/>
      <text x='280' y='40'>flood-color on tref</text>

      <rect id='r12' x='250' y='55' width='20' height='20'/>
      <text x='280' y='70'>flood-opacity on textPath</text>

      <rect id='r13' x='250' y='85' width='20' height='20'/>
      <text x='280' y='100'>clr-intp-filters on altGlyph</text>

      <rect id='r14' x='250' y='115' width='20' height='20'/>
      <text x='280' y='130'>display on linearGradient</text>

      <rect id='r15' x='250' y='145' width='20' height='20'/>
      <text x='280' y='160'>fill-rule on stop</text>

      <rect id='r16' x='250' y='175' width='20' height='20'/>
      <text x='280' y='190'>visibility on radialGradient</text>

      <rect id='r17' x='250' y='205' width='20' height='20'/>
      <text x='280' y='220'>lighting-color on clipPath</text>
    </g>

    <script><![CDATA[
      function $(x) { return document.getElementById(x) }
      function decimalToHex(d) {
        var hex = Number(d).toString(16);
        while (hex.length < 2) {
            hex = "0" + hex;
        }
        return hex;
      }
  
      function checkSVGColor(e, p, r, g, b) {
        var v;
        try {
          var cssstyledecl = document.defaultView.getComputedStyle(e,null);
          var v = cssstyledecl.getPropertyValue(p);
          var longhex = "#" + decimalToHex(r) + decimalToHex(g) + decimalToHex(b);
          return v == "rgb(" + r + ", " + g + ", " + b + ")" ||
                 v == "rgba(" + r + ", " + g + ", " + b + ", 1)" ||
                 v == longhex ||
                 v == longhex.toUpperCase();
        } catch (ex) {
        }
        return false;
      }

      function checkFloat(e, p, f) {
        var v;
        try {
          var cssstyledecl = document.defaultView.getComputedStyle(e,null);
          v = cssstyledecl.getPropertyValue(p);
          return parseFloat(v) == f;
        } catch (ex) {
        }
        return false;
      }

      function checkPx(e, p, f) {
        var v;
        try {
          var cssstyledecl = document.defaultView.getComputedStyle(e,null);
          v = cssstyledecl.getPropertyValue(p);
          return v == f;
        } catch (ex) {
        }
        return false;
      }

      function checkIdent(e, p, i) {
        var v;
        i = i.toLowerCase();
        try {
          var cssstyledecl = document.defaultView.getComputedStyle(e,null);
          v = cssstyledecl.getPropertyValue(p);
          return v.toLowerCase() == i;
        } catch (ex) {
        }
        return false;
      }

      function report(n, b) {
        $('r' + n).setAttribute('fill', b ? 'green' : 'red');
      }

      report(1, checkSVGColor($('image'), 'fill', 0, 0, 255));
      report(2, checkFloat($('tspan'), 'stop-opacity', 0.5));
      report(3, checkPx($('rect'), 'font-size', '123px'));
      report(4, checkIdent($('circle'), 'font-style', 'italic'));
      report(5, checkSVGColor($('text'), 'stop-color', 0, 255, 0));
      report(6, checkIdent($('ellipse'), 'font-variant', 'small-caps'));
      report(7, checkPx($('polyline'), 'letter-spacing', '20px'));
      
      report(11, checkSVGColor($('tref'), 'flood-color', 255, 0, 0));
      report(12, checkFloat($('textPath'), 'flood-opacity', 0.25));
      report(13, checkIdent($('altGlyph'), 'color-interpolation-filters', 'auto'));
      report(14, checkIdent($('linearGradient'), 'display', 'block'));
      report(15, checkIdent($('stop'), 'fill-rule', 'evenodd'));
      report(16, checkIdent($('radialGradient'), 'visibility', 'hidden'));
      report(17, checkSVGColor($('clipPath'), 'lighting-color', 255, 255, 255));
    ]]></script>
  </g>
  <g font-family="SVGFreeSansASCII,sans-serif" font-size="32">
    <text id="revision" x="10" y="340" stroke="none"
      fill="black">$Revision: 1.9 $</text>
  </g>
  <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000"/>
  <!-- comment out this watermark once the test is approved -->
  <!--
  <g id="draft-watermark">
    <rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/>
    <text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240"
      text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text>
  </g>
  -->
</svg>
</body>
</html>