[Piglit] [PATCH 1/7] html: Use CSS for indenting table rows rather than colspan.
Dylan Baker
baker.dylan.c at gmail.com
Thu Apr 25 17:02:19 PDT 2013
From: Kenneth Graunke <kenneth at whitecape.org>
Previously, we indented groups of tests by adding 10 columns
of whitespace to the table and adding colspan. This is pretty
ugly; we really should use CSS for things like this.
The new CSS-based approach should work with deeper nesting levels,
and simplifies the tables.
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Dylan Baker <baker.dylan.c at gmail.com>
---
piglit-summary-html.py | 10 ++++------
templates/index.css | 11 +++++++++++
templates/index.html | 17 +++--------------
templates/index_group.html | 3 +--
templates/index_test.html | 3 +--
5 files changed, 20 insertions(+), 24 deletions(-)
diff --git a/piglit-summary-html.py b/piglit-summary-html.py
index 5d75d5a..1f55928 100755
--- a/piglit-summary-html.py
+++ b/piglit-summary-html.py
@@ -157,7 +157,6 @@ def hrefFromParts(codename, path):
return outStr
def buildTestSummary(indent, alternate, testsummary):
- tenindent = 10 - indent
path = testsummary.path
name = testsummary.name
testruns = "".join([IndexTestTestrun % {
@@ -192,8 +191,7 @@ def buildGroupSummaryTestrun(groupresult):
def buildGroupSummary(indent, groupsummary, showcurrent):
- tenindent = 10 - indent
-
+ indent_inc = 1.75 # em
items = ''
alternate = 'a'
path = groupsummary.path
@@ -216,10 +214,10 @@ def buildGroupSummary(indent, groupsummary, showcurrent):
child = groupsummary.children[n]
if isinstance(child, framework.summary.GroupSummary):
items = items + IndexGroupGroup % {
- 'group': buildGroupSummary(indent+1, child, showcurrent)
+ 'group': buildGroupSummary(indent + indent_inc, child, showcurrent)
}
else:
- items = items + buildTestSummary(indent+1, alternate, child)
+ items = items + buildTestSummary(indent + indent_inc, alternate, child)
if alternate == 'a':
alternate = 'b'
@@ -249,7 +247,7 @@ results is an array containing the top-level results dictionarys.
else:
return IndexTestrunB % tr.__dict__
- group = buildGroupSummary(1, summary.root, showcurrent)
+ group = buildGroupSummary(0, summary.root, showcurrent)
testruns = "".join([IndexTestrun % tr.__dict__ for tr in summary.testruns])
testrunsb = "".join([testrunb(tr) for tr in summary.testruns])
diff --git a/templates/index.css b/templates/index.css
index 207465e..6d9e903 100644
--- a/templates/index.css
+++ b/templates/index.css
@@ -2,6 +2,9 @@
table {
border: 0pt;
border-collapse: collapse;
+ padding-left: 1.75em;
+ padding-right: 1.75em;
+ width: 100%;
}
tr {
@@ -12,6 +15,14 @@ td {
padding: 4pt;
}
+td:first-child {
+ padding: 0;
+}
+
+td:first-child > div {
+ padding: 4pt;
+}
+
.title {
background-color: #c8c838;
}
diff --git a/templates/index.html b/templates/index.html
index ff347df..400dde3 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -12,27 +12,16 @@
<p>
Show: %(showlinks)s
</p>
- <table width="95%%">
+ <table>
<colgroup>
- <!-- 9 columns for indent -->
- <col width="5pt" />
- <col width="20pt" />
- <col width="20pt" />
- <col width="20pt" />
- <col width="20pt" />
- <col width="20pt" />
- <col width="20pt" />
- <col width="20pt" />
- <col width="20pt" />
-
- <!-- remaining name column -->
+ <!-- name column -->
<col />
<!-- status column -->
%(testruns)s
</colgroup>
<tr>
- <td colspan="10" />
+ <td/>
%(testrunsb)s
</tr>
%(group)s
diff --git a/templates/index_group.html b/templates/index_group.html
index 9c72bcf..9f80a7c 100644
--- a/templates/index_group.html
+++ b/templates/index_group.html
@@ -1,6 +1,5 @@
<tr>
- <td colspan="%(indent)s"> </td>
- <td class="head" colspan="%(tenindent)s"><b>%(name)s</b></td>
+ <td><div style="margin-left: %(indent)sem" class="head"><b>%(name)s</b></div></td>
%(testruns)s
</tr>
%(items)s
diff --git a/templates/index_test.html b/templates/index_test.html
index 0c3bdde..4b0964e 100644
--- a/templates/index_test.html
+++ b/templates/index_test.html
@@ -1,5 +1,4 @@
<tr>
- <td colspan="%(indent)s"> </td>
- <td class="%(alternate)s" colspan="%(tenindent)s">%(name)s</td>
+ <td><div style="margin-left: %(indent)sem" class="%(alternate)s">%(name)s</div></td>
%(testruns)s
</tr>
--
1.8.1.4
More information about the Piglit
mailing list