Added gst-plugins-base-subtitles0.10-0.10.34 for Meego Harmattan 1.2
[mafwsubrenderer] / gst-plugins-base-subtitles0.10 / common / coverage / coverage-report.xsl
1 <?xml version="1.0" encoding="utf-8"?>\r
2 <!--\r
3 #\r
4 # Copyright (C) 2006 Daniel Berrange\r
5 #\r
6 # This program is free software; you can redistribute it and/or modify\r
7 # it under the terms of the GNU General Public License as published by\r
8 # the Free Software Foundation; either version 2 of the License, or\r
9 # (at your option) any later version.\r
10 #\r
11 # This program is distributed in the hope that it will be useful,\r
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14 # GNU General Public License for more details.\r
15 #\r
16 # You should have received a copy of the GNU General Public License\r
17 # along with this program; if not, write to the Free Software\r
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
19 -->\r
20 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\r
21                 version="1.0">\r
22 \r
23   <xsl:output method="html"/>\r
24 \r
25   <xsl:template match="coverage">\r
26     <html>\r
27       <head>\r
28         <title>Coverage report</title>\r
29         <style type="text/css">\r
30           tbody tr.odd td.label {\r
31             border-top: 1px solid rgb(128,128,128);\r
32             border-bottom: 1px solid rgb(128,128,128);\r
33           }\r
34           tbody tr.odd td.label {\r
35             background: rgb(200,200,200);\r
36           }\r
37           \r
38           thead, tfoot {\r
39             background: rgb(60,60,60);\r
40             color: white;\r
41             font-weight: bold;\r
42           }\r
43 \r
44           tr td.perfect {\r
45             background: rgb(0,255,0);\r
46             color: black;\r
47           }\r
48           tr td.excellant {\r
49             background: rgb(140,255,140);\r
50             color: black;\r
51           }\r
52           tr td.good {\r
53             background: rgb(160,255,0);\r
54             color: black;\r
55           }\r
56           tr td.poor {\r
57             background: rgb(255,160,0);\r
58             color: black;\r
59           }\r
60           tr td.bad {\r
61             background: rgb(255,140,140);\r
62             color: black;\r
63           }\r
64           tr td.terrible {\r
65             background: rgb(255,0,0);\r
66             color: black;\r
67           }\r
68         </style>\r
69       </head>\r
70       <body>\r
71         <h1>Coverage report</h1>\r
72         <xsl:apply-templates/>\r
73       </body>\r
74     </html>\r
75   </xsl:template>\r
76 \r
77   <xsl:template match="functions">\r
78     <h2>Function coverage</h2>\r
79     <xsl:call-template name="content">\r
80       <xsl:with-param name="type" select="'function'"/>\r
81     </xsl:call-template>\r
82   </xsl:template>\r
83   \r
84 \r
85   <xsl:template match="files">\r
86     <h2>File coverage</h2>\r
87     <xsl:call-template name="content">\r
88       <xsl:with-param name="type" select="'file'"/>\r
89     </xsl:call-template>\r
90   </xsl:template>\r
91 \r
92   <xsl:template name="content">\r
93     <xsl:param name="type"/>\r
94     <table>\r
95       <thead>\r
96         <tr>\r
97           <th>Name</th>\r
98           <th>Lines</th>\r
99           <th>Branches</th>\r
100           <th>Conditions</th>\r
101           <th>Calls</th>\r
102         </tr>\r
103       </thead>\r
104       <tbody>\r
105         <xsl:for-each select="entry">\r
106           <xsl:call-template name="entry">\r
107             <xsl:with-param name="type" select="$type"/>\r
108             <xsl:with-param name="class">\r
109               <xsl:choose>\r
110                 <xsl:when test="position() mod 2">\r
111                   <xsl:text>odd</xsl:text>\r
112                 </xsl:when>\r
113                 <xsl:otherwise>\r
114                   <xsl:text>even</xsl:text>\r
115                 </xsl:otherwise>\r
116               </xsl:choose>\r
117             </xsl:with-param>\r
118           </xsl:call-template>\r
119         </xsl:for-each>\r
120       </tbody>\r
121       <tfoot>\r
122         <xsl:for-each select="summary">\r
123           <xsl:call-template name="entry">\r
124             <xsl:with-param name="type" select="'summary'"/>\r
125             <xsl:with-param name="class">\r
126               <xsl:choose>\r
127                 <xsl:when test="position() mod 2">\r
128                   <xsl:text>odd</xsl:text>\r
129                 </xsl:when>\r
130                 <xsl:otherwise>\r
131                   <xsl:text>even</xsl:text>\r
132                 </xsl:otherwise>\r
133               </xsl:choose>\r
134             </xsl:with-param>\r
135           </xsl:call-template>\r
136         </xsl:for-each>\r
137       </tfoot>\r
138     </table>\r
139   </xsl:template>\r
140   \r
141   <xsl:template name="entry">\r
142     <xsl:param name="type"/>\r
143     <xsl:param name="class"/>\r
144     <tr class="{$class}">\r
145       <xsl:choose>\r
146         <xsl:when test="$type = 'function'">\r
147           <td class="label"><a href="{@details}.html#{@name}"><xsl:value-of select="@name"/></a></td>\r
148         </xsl:when>\r
149         <xsl:when test="$type = 'file'">\r
150           <td class="label"><a href="{@details}.html"><xsl:value-of select="@name"/></a></td>\r
151         </xsl:when>\r
152         <xsl:otherwise>\r
153           <td class="label">Summary</td>\r
154         </xsl:otherwise>\r
155       </xsl:choose>\r
156 \r
157       <xsl:if test="count(lines)">\r
158         <xsl:apply-templates select="lines"/>\r
159       </xsl:if>\r
160       <xsl:if test="not(count(lines))">\r
161         <xsl:call-template name="missing"/>\r
162       </xsl:if>\r
163 \r
164       <xsl:if test="count(branches)">\r
165         <xsl:apply-templates select="branches"/>\r
166       </xsl:if>\r
167       <xsl:if test="not(count(branches))">\r
168         <xsl:call-template name="missing"/>\r
169       </xsl:if>\r
170 \r
171       <xsl:if test="count(conditions)">\r
172         <xsl:apply-templates select="conditions"/>\r
173       </xsl:if>\r
174       <xsl:if test="not(count(conditions))">\r
175         <xsl:call-template name="missing"/>\r
176       </xsl:if>\r
177 \r
178       <xsl:if test="count(calls)">\r
179         <xsl:apply-templates select="calls"/>\r
180       </xsl:if>\r
181       <xsl:if test="not(count(calls))">\r
182         <xsl:call-template name="missing"/>\r
183       </xsl:if>\r
184 \r
185     </tr>\r
186   </xsl:template>\r
187   \r
188   <xsl:template match="lines">\r
189     <xsl:call-template name="row"/>\r
190   </xsl:template>\r
191 \r
192   <xsl:template match="branches">\r
193     <xsl:call-template name="row"/>\r
194   </xsl:template>\r
195 \r
196   <xsl:template match="conditions">\r
197     <xsl:call-template name="row"/>\r
198   </xsl:template>\r
199 \r
200   <xsl:template match="calls">\r
201     <xsl:call-template name="row"/>\r
202   </xsl:template>\r
203 \r
204   <xsl:template name="missing">\r
205     <td></td>\r
206   </xsl:template>\r
207 \r
208   <xsl:template name="row">\r
209     <xsl:variable name="quality">\r
210       <xsl:choose>\r
211         <xsl:when test="@coverage = 100">\r
212           <xsl:text>perfect</xsl:text>\r
213         </xsl:when>\r
214         <xsl:when test="@coverage >= 80.0">\r
215           <xsl:text>excellant</xsl:text>\r
216         </xsl:when>\r
217         <xsl:when test="@coverage >= 60.0">\r
218           <xsl:text>good</xsl:text>\r
219         </xsl:when>\r
220         <xsl:when test="@coverage >= 40.0">\r
221           <xsl:text>poor</xsl:text>\r
222         </xsl:when>\r
223         <xsl:when test="@coverage >= 20.0">\r
224           <xsl:text>bad</xsl:text>\r
225         </xsl:when>\r
226         <xsl:otherwise>\r
227           <xsl:text>terrible</xsl:text>\r
228         </xsl:otherwise>\r
229       </xsl:choose>\r
230     </xsl:variable>\r
231     \r
232     <td class="{$quality}"><xsl:value-of select="@coverage"/>% of <xsl:value-of select="@count"/></td>\r
233   </xsl:template>\r
234 \r
235 </xsl:stylesheet>\r