Index: tools/code_coverage/croc_html.py |
=================================================================== |
--- tools/code_coverage/croc_html.py (revision 144176) |
+++ tools/code_coverage/croc_html.py (working copy) |
@@ -193,19 +193,20 @@ |
is_file: Are items in this section files? |
""" |
+ caption = None |
John Grabowski
2012/06/26 21:45:29
This is odd. caption is a param, which you force
pshenoy
2012/06/29 18:23:07
Sorry. I did this for testing purpose and forgot t
|
if caption is not None: |
- table.E('tr').E('td', e_class='secdesc', colspan=8).Text(caption) |
+ table.E('tr').E('th', e_class='secdesc', colspan=8).Text(caption) |
sec_hdr = table.E('tr') |
if itemtype is not None: |
- sec_hdr.E('td', e_class='section').Text(itemtype) |
+ sec_hdr.E('th', e_class='section').Text(itemtype) |
- sec_hdr.E('td', e_class='section').Text('Coverage') |
- sec_hdr.E('td', e_class='section', colspan=3).Text( |
+ sec_hdr.E('th', e_class='section').Text('Coverage') |
+ sec_hdr.E('th', e_class='section', colspan=3).Text( |
'Lines executed / instrumented / missing') |
- graph = sec_hdr.E('td', e_class='section') |
+ graph = sec_hdr.E('th', e_class='section') |
graph.E('span', style='color:#00FF00').Text('exe') |
graph.Text(' / ') |
graph.E('span', style='color:#FFFF00').Text('inst') |
@@ -213,10 +214,10 @@ |
graph.E('span', style='color:#FF0000').Text('miss') |
if is_file: |
- sec_hdr.E('td', e_class='section').Text('Language') |
- sec_hdr.E('td', e_class='section').Text('Group') |
+ sec_hdr.E('th', e_class='section').Text('Language') |
+ sec_hdr.E('th', e_class='section').Text('Group') |
else: |
- sec_hdr.E('td', e_class='section', colspan=2) |
+ sec_hdr.E('th', e_class='section', colspan=2) |
def AddItem(self, table, itemname, stats, attrs, link=None): |
"""Adds a bar graph to the element. This is a series of <td> elements. |
@@ -358,20 +359,28 @@ |
body = f.body |
+ dirs = [''] + cov_dir.dirpath.split('/') |
+ num_dirs = len(dirs) |
+ sort_jsfile = '../' * (num_dirs - 1) + 'sorttable.js' |
+ script = body.E('script', src=sort_jsfile) |
+ body.E('/script') |
+ |
# Write header section |
if cov_dir.dirpath: |
self.AddCaptionForSubdir(body, cov_dir.dirpath) |
else: |
body.E('h2').Text(title) |
- table = body.E('table') |
- |
+ table = body.E('table', e_class='sortable') |
+ table.E('h3').Text('Coverage by Group') |
# Coverage by group |
self.AddSectionHeader(table, 'Coverage by Group', 'Group') |
for group in sorted(cov_dir.stats_by_group): |
self.AddItem(table, group, cov_dir.stats_by_group[group], None) |
+ table = body.E('table', e_class='sortable') |
+ table.E('h3').Text('Subdirectories') |
# List subdirs |
if cov_dir.subdirs: |
self.AddSectionHeader(table, 'Subdirectories', 'Subdirectory') |
@@ -380,6 +389,8 @@ |
self.AddItem(table, d + '/', cov_dir.subdirs[d].stats_by_group['all'], |
None, link=d + '/index.html') |
+ table = body.E('table', e_class='sortable') |
+ table.E('h3').Text('Files in This Directory') |
# List files |
if cov_dir.files: |
self.AddSectionHeader(table, 'Files in This Directory', 'Filename', |
@@ -401,6 +412,7 @@ |
# Files to copy into output root |
copy_files = [ |
'croc.css', |
+ 'sorttable.js', |
] |
# Copy files from our directory into the output directory |