Skip to content

Commit 842abb1

Browse files
committed
Reworked coverBar for html report
1 parent 730c0aa commit 842abb1

File tree

4 files changed

+70
-50
lines changed

4 files changed

+70
-50
lines changed

PHP/CodeCoverage/Report/HTML/Renderer/Template/directory_item.html.dist

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,23 @@
11
<tr>
22
<td class="{itemClass}">{icon}{name}</td>
3-
<td class="coverBar" align="center" width="100">
4-
<table border="0" cellspacing="0" cellpadding="1">
5-
<tr>
6-
<td class="coverBarOutline"><img src="{lines_color}.png" width="{lines_executed_width}" height="10" alt="{lines_executed_percent}"><img src="snow.png" width="{lines_not_executed_width}" height="10" alt="{lines_executed_percent}"></td>
7-
</tr>
8-
</table>
3+
<td class="coverBar">
4+
<div class="coverBarOutline" title="{lines_executed_percent}">
5+
<div class="size {lines_color}" style="width:{lines_executed_width}%" title="{lines_executed_percent}"></div>
6+
</div>
97
</td>
108
<td class="coverPer{lines_level}">{lines_executed_percent}</td>
119
<td class="coverNum{lines_level}">{num_executed_lines} / {num_executable_lines}</td>
12-
<td class="coverBar" align="center" width="100">
13-
<table border="0" cellspacing="0" cellpadding="1">
14-
<tr>
15-
<td class="coverBarOutline"><img src="{methods_color}.png" width="{methods_tested_width}" height="10" alt="{methods_tested_percent}"><img src="snow.png" width="{methods_not_tested_width}" height="10" alt="{methods_tested_percent}"></td>
16-
</tr>
17-
</table>
10+
<td class="coverBar">
11+
<div class="coverBarOutline" title="{methods_tested_percent}">
12+
<div class="size {methods_color}" style="width:{methods_tested_width}%" title="{methods_tested_percent}"></div>
13+
</div>
1814
</td>
1915
<td class="coverPer{methods_level}">{methods_tested_percent}</td>
2016
<td class="coverNum{methods_level}">{methods_number}</td>
21-
<td class="coverBar" align="center" width="100">
22-
<table border="0" cellspacing="0" cellpadding="1">
23-
<tr>
24-
<td class="coverBarOutline"><img src="{classes_color}.png" width="{classes_tested_width}" height="10" alt="{classes_tested_percent}"><img src="snow.png" width="{classes_not_tested_width}" height="10" alt="{classes_tested_percent}"></td>
25-
</tr>
26-
</table>
17+
<td class="coverBar">
18+
<div class="coverBarOutline" title="{classes_tested_percent}">
19+
<div class="size {classes_color}" style="width:{classes_tested_width}%" title="{classes_tested_percent}"></div>
20+
</div>
2721
</td>
2822
<td class="coverPer{classes_level}">{classes_tested_percent}</td>
2923
<td class="coverNum{classes_level}">{classes_number}</td>

PHP/CodeCoverage/Report/HTML/Renderer/Template/file_item.html.dist

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,24 @@
11
<tr>
22
<td class="{itemClass}">{name}</td>
3-
<td class="coverBar" align="center" width="100">
4-
<table border="0" cellspacing="0" cellpadding="1">
5-
<tr>
6-
<td class="coverBarOutline"><img src="{classes_color}.png" width="{classes_tested_width}" height="10" alt="{classes_tested_percent}"><img src="snow.png" width="{classes_not_tested_width}" height="10" alt="{classes_tested_percent}"></td>
7-
</tr>
8-
</table>
3+
<td class="coverBar">
4+
<div class="coverBarOutline" title="{classes_tested_percent}">
5+
<div class="size {classes_color}" style="width:{classes_tested_width}%" title="{classes_tested_percent}"></div>
6+
</div>
97
</td>
108
<td class="coverPer{classes_level}">{classes_tested_percent}</td>
119
<td class="coverNum{classes_level}">{classes_number}</td>
12-
<td class="coverBar" align="center" width="100">
13-
<table border="0" cellspacing="0" cellpadding="1">
14-
<tr>
15-
<td class="coverBarOutline"><img src="{methods_color}.png" width="{methods_tested_width}" height="10" alt="{methods_tested_percent}"><img src="snow.png" width="{methods_not_tested_width}" height="10" alt="{methods_tested_percent}"></td>
16-
</tr>
17-
</table>
10+
<td class="coverBar">
11+
<div class="coverBarOutline" title="{methods_tested_percent}">
12+
<div class="size {methods_color}" style="width:{methods_tested_width}%" title="{methods_tested_percent}"></div>
13+
</div>
1814
</td>
1915
<td class="coverPer{methods_level}">{methods_tested_percent}</td>
2016
<td class="coverNum{methods_level}">{methods_number}</td>
2117
<td class="crap">{crap}</td>
22-
<td class="coverBar" align="center" width="100">
23-
<table border="0" cellspacing="0" cellpadding="1">
24-
<tr>
25-
<td class="coverBarOutline"><img src="{lines_color}.png" width="{lines_executed_width}" height="10" alt="{lines_executed_percent}"><img src="snow.png" width="{lines_not_executed_width}" height="10" alt="{lines_executed_percent}"></td>
26-
</tr>
27-
</table>
18+
<td class="coverBar">
19+
<div class="coverBarOutline" title="{lines_executed_percent}">
20+
<div class="size {lines_color}" style="width:{lines_executed_width}%" title="{lines_executed_percent}"></div>
21+
</div>
2822
</td>
2923
<td class="coverPer{lines_level}">{lines_executed_percent}</td>
3024
<td class="coverNum{lines_level}">{num_executed_lines} / {num_executable_lines}</td>

PHP/CodeCoverage/Report/HTML/Renderer/Template/method_item.html.dist

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
11
<tr>
22
<td class="coverFile" colspan="4">{name}</td>
3-
<td class="coverBar" align="center" width="100">
4-
<table border="0" cellspacing="0" cellpadding="1">
5-
<tr>
6-
<td class="coverBarOutline"><img src="{methods_color}.png" width="{methods_tested_width}" height="10" alt="{methods_tested_percent}"><img src="snow.png" width="{methods_not_tested_width}" height="10" alt="{methods_tested_percent}"></td>
7-
</tr>
8-
</table>
3+
<td class="coverBar">
4+
<div class="coverBarOutline" title="{methods_tested_percent}">
5+
<div class="size {methods_color}" style="width:{methods_tested_width}%" title="{methods_tested_percent}"></div>
6+
</div>
97
</td>
108
<td class="coverPer{methods_level}">{methods_tested_percent}</td>
119
<td class="coverNum{methods_level}">{methods_number}</td>
1210
<td class="crap">{crap}</td>
13-
<td class="coverBar" align="center" width="100">
14-
<table border="0" cellspacing="0" cellpadding="1">
15-
<tr>
16-
<td class="coverBarOutline"><img src="{lines_color}.png" width="{lines_executed_width}" height="10" alt="{lines_executed_percent}"><img src="snow.png" width="{lines_not_executed_width}" height="10" alt="{lines_executed_percent}"></td>
17-
</tr>
18-
</table>
11+
<td class="coverBar">
12+
<div class="coverBarOutline" title="{lines_executed_percent}">
13+
<div class="size {lines_color}" style="width:{lines_executed_width}%" title="{lines_executed_percent}"></div>
14+
</div>
1915
</td>
2016
<td class="coverPer{lines_level}">{lines_executed_percent}</td>
2117
<td class="coverNum{lines_level}">{num_executed_lines} / {num_executable_lines}</td>

PHP/CodeCoverage/Report/HTML/Renderer/Template/style.css

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,48 @@ td.coverBar
127127
padding-left: 10px;
128128
padding-right: 10px;
129129
background-color: #d3d7cf;
130+
text-align:center;
131+
width: 100px;
130132
}
131133

132134
/* Directory view/File view (all): bar-graph outline color */
133-
td.coverBarOutline
135+
div.coverBarOutline
134136
{
135-
background-color: #2e3436;
137+
background-color: #fff;
138+
border: 1px solid #2e3436;
139+
height: 10px;
140+
overflow:hidden;
141+
width: 100px;
142+
}
143+
144+
/* Directory view/File view (all): common style for bar-graph */
145+
div.coverBarOutline div.size
146+
{
147+
height: 10px; float:left;
148+
}
149+
150+
/* Directory view/File view (all): bar-graph color no coverage rate */
151+
div.coverBarOutline div.snow
152+
{
153+
background-color:#fff;
154+
}
155+
156+
/* Directory view/File view (all): bar-graph color for low coverage rate */
157+
div.coverBarOutline div.scarlet_red
158+
{
159+
background-color:#ef2929;
160+
}
161+
162+
/* Directory view/File view (all): bar-graph color for middle coverage rate */
163+
div.coverBarOutline div.butter
164+
{
165+
background-color:#fce94f;
166+
}
167+
168+
/* Directory view/File view (all): bar-graph color for high coverage rate */
169+
div.coverBarOutline div.chameleon
170+
{
171+
background-color:#8ae234;
136172
}
137173

138174
/* Directory view/File view (all): percentage entry for files with

0 commit comments

Comments
 (0)