blob: 95994e2b5029a9f650bda23b10b7e56f37c878bd [file] [log] [blame]
Brian Muramatsu2f8eead2010-09-24 14:56:43 -07001<?xml version="1.0" encoding="utf-8"?>
2<!--
3 * Copyright (C) 2010 The Android Open Source Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 -->
17
18<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#160;"> ]>
19<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
20 <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes" />
21 <xsl:template match="/">
22 <html>
23 <head>
24 <script type="text/javascript">
25 function toggleVisibility(id) {
26 element = document.getElementById(id);
27 if (element.style.display == "none") {
28 element.style.display = "";
29 } else {
30 element.style.display = "none";
31 }
32 }
33 </script>
34 <style type="text/css">
Brian Muramatsu16fdad82010-12-02 17:13:44 -080035 body {
36 background-color: #CCCCCC;
37 font-family: sans-serif;
38 margin: 10px;
39 }
40
41 .info {
42 margin-bottom: 10px;
43 }
44
45 .apks, .package, .class {
46 cursor: pointer;
47 text-decoration: underline;
48 }
49
50 .packageDetails {
51 padding-left: 20px;
52 }
53
54 .classDetails {
55 padding-left: 40px;
56 }
57
58 .method {
59 font-family: courier;
60 white-space: nowrap;
61 }
62
63 .red {
Brian Muramatsu37e73412012-01-03 15:12:19 -080064 background-color: #FF6666;
Brian Muramatsu16fdad82010-12-02 17:13:44 -080065 }
66
67 .yellow {
Brian Muramatsu37e73412012-01-03 15:12:19 -080068 background-color: #FFFF66;
Brian Muramatsu16fdad82010-12-02 17:13:44 -080069 }
70
71 .green {
Brian Muramatsu37e73412012-01-03 15:12:19 -080072 background-color: #66FF66;
Brian Muramatsu16fdad82010-12-02 17:13:44 -080073 }
Brian Muramatsud9423e02012-01-05 16:00:46 -080074
75 .deprecated {
76 text-decoration: line-through;
77 }
Brian Muramatsu2f8eead2010-09-24 14:56:43 -070078 </style>
79 </head>
80 <body>
81 <h1>CTS API Coverage</h1>
82 <div class="info">
83 Generated: <xsl:value-of select="api-coverage/@generatedTime" />
84 </div>
85 <div class="apks" onclick="toggleVisibility('sourceApks')">
86 Source APKs (<xsl:value-of select="count(api-coverage/debug/sources/apk)" />)
87 </div>
88 <div id="sourceApks" style="display: none">
89 <ul>
90 <xsl:for-each select="api-coverage/debug/sources/apk">
91 <li><xsl:value-of select="@path" /></li>
92 </xsl:for-each>
93 </ul>
94 </div>
95 <ul>
96 <xsl:for-each select="api-coverage/api/package">
97 <xsl:call-template name="packageOrClassListItem">
98 <xsl:with-param name="bulletClass" select="'package'" />
99 </xsl:call-template>
100 <div class="packageDetails" id="{@name}" style="display: none">
101 <ul>
102 <xsl:for-each select="class">
103 <xsl:call-template name="packageOrClassListItem">
104 <xsl:with-param name="bulletClass" select="'class'" />
105 </xsl:call-template>
106 <div class="classDetails" id="{@name}" style="display: none">
107 <xsl:for-each select="constructor">
108 <xsl:call-template name="methodListItem" />
109 </xsl:for-each>
110 <xsl:for-each select="method">
111 <xsl:call-template name="methodListItem" />
112 </xsl:for-each>
113 </div>
114 </xsl:for-each>
115 </ul>
116 </div>
117 </xsl:for-each>
118 </ul>
119 </body>
120 </html>
121 </xsl:template>
122
123 <xsl:template name="packageOrClassListItem">
124 <xsl:param name="bulletClass" />
Brian Muramatsud9423e02012-01-05 16:00:46 -0800125
Brian Muramatsu2f8eead2010-09-24 14:56:43 -0700126 <xsl:variable name="colorClass">
127 <xsl:choose>
128 <xsl:when test="@coveragePercentage &lt;= 50">red</xsl:when>
129 <xsl:when test="@coveragePercentage &lt;= 80">yellow</xsl:when>
130 <xsl:otherwise>green</xsl:otherwise>
131 </xsl:choose>
132 </xsl:variable>
133
Brian Muramatsud9423e02012-01-05 16:00:46 -0800134 <xsl:variable name="deprecatedClass">
135 <xsl:choose>
136 <xsl:when test="@deprecated = 'true'">deprecated</xsl:when>
137 <xsl:otherwise></xsl:otherwise>
138 </xsl:choose>
139 </xsl:variable>
140
Brian Muramatsu2f8eead2010-09-24 14:56:43 -0700141 <li class="{$bulletClass}" onclick="toggleVisibility('{@name}')">
Brian Muramatsud9423e02012-01-05 16:00:46 -0800142 <span class="{$colorClass} {$deprecatedClass}">
Brian Muramatsu2f8eead2010-09-24 14:56:43 -0700143 <b><xsl:value-of select="@name" /></b>
144 &nbsp;<xsl:value-of select="@coveragePercentage" />%
145 &nbsp;(<xsl:value-of select="@numCovered" />/<xsl:value-of select="@numTotal" />)
146 </span>
147 </li>
148 </xsl:template>
149
150 <xsl:template name="methodListItem">
Brian Muramatsud9423e02012-01-05 16:00:46 -0800151
152 <xsl:variable name="deprecatedClass">
153 <xsl:choose>
154 <xsl:when test="@deprecated = 'true'">deprecated</xsl:when>
155 <xsl:otherwise></xsl:otherwise>
156 </xsl:choose>
157 </xsl:variable>
158
159 <span class="method {$deprecatedClass}">
Brian Muramatsu2f8eead2010-09-24 14:56:43 -0700160 <xsl:choose>
161 <xsl:when test="@covered = 'true'">[X]</xsl:when>
162 <xsl:otherwise>[ ]</xsl:otherwise>
163 </xsl:choose>
164 <xsl:if test="@returnType != ''">&nbsp;<xsl:value-of select="@returnType" /></xsl:if>
165 <b>&nbsp;<xsl:value-of select="@name" /></b><xsl:call-template name="formatParameters" />
166 </span>
167 <br />
168 </xsl:template>
Brian Muramatsud9423e02012-01-05 16:00:46 -0800169
Brian Muramatsu2f8eead2010-09-24 14:56:43 -0700170 <xsl:template name="formatParameters">(<xsl:for-each select="parameter">
171 <xsl:value-of select="@type" />
172 <xsl:if test="not(position() = last())">,&nbsp;</xsl:if>
173 </xsl:for-each>)
174 </xsl:template>
175
176</xsl:stylesheet>
177