[Tools 1/3] winetest: Specify multiple classes for result cells instead of having one class for every possible error / todo / skip combination.

Francois Gouget fgouget at free.fr
Mon Mar 10 08:08:43 CDT 2008


---

This series of three patches should be applied after the other '[Tools]' 
patches (though it should be mostly independent from them).

CSS lets us specify multiple classes for a given object, so lets make 
use of this rather than have a separate class for each 
fail/pass/todo/skip combination. This lets us reduce duplication and 
simplify the CSS file quite a bit.

 winetest/gather      |   30 +++++++-------
 winetest/summary.css |  102 +++++---------------------------------------------
 2 files changed, 25 insertions(+), 107 deletions(-)

diff --git a/winetest/gather b/winetest/gather
index c9e490a..ecd425c 100755
--- a/winetest/gather
+++ b/winetest/gather
@@ -244,11 +244,11 @@ print OUT <<"EOF";
   </tr>
 </table>
 <h3>Legend</h3>
-<p class="legend">All tests <span class="pass">pass</span> in all reports<br>
-   Some tests <span class="mixed">fail</span> in some reports<br>
-   Some tests <span class="fail">fail</span> in all reports<br>
-   This <span class="skip_pass">border</span> signals that some tests are skipped<br>
-   This <span class="todo_pass">border</span> signals that the implementation needs some work
+<p class="legend">All tests <span class="result pass">pass</span> in all reports<br>
+   Some tests <span class="result mixed">fail</span> in some reports<br>
+   Some tests <span class="result fail">fail</span> in all reports<br>
+   This <span class="result pass also-skip">border</span> signals that some tests are skipped<br>
+   This <span class="result pass also-todo">border</span> signals that the implementation needs some work
 </p>
 <h1>Main summary for build <a href="$url">$build</a></h1>
 <table class="report">
@@ -281,34 +281,34 @@ sub singletest($$$) {
     } elsif ($count eq "dll missing") {
         my ($dll, $subtest) = split(/:/, $testname);
         print OUT <<"EOF";
-      <td class="skip_pass"><a
+      <td class="result pass also-skip"><a
         title="No tests run as $dll.dll is not present on this system"
         >n/a</a></td>
 EOF
     } elsif ($count eq "winetest crash") {
         print OUT <<"EOF";
-      <td class="skip_fail"><a
+      <td class="result fail also-skip"><a
         title="Test did not run as winetest crashed"
         >.</a></td>
 EOF
     } elsif ($count eq "file limit") {
         print OUT <<"EOF";
-      <td class="skip_fail"><a
+      <td class="result fail also-skip"><a
         title="Test is missing because of a partial report file"
         >.</a></td>
 EOF
     } elsif ($count eq "test missing") {
         print OUT <<"EOF";
-      <td class="skip_fail"><a
+      <td class="result fail also-skip"><a
         title="Test did not run for an unknown reason"
         >.</a></td>
 EOF
     } else {
         my $class = $error?"fail":"pass";
-        my $skip = $skipped?"skip_":"";
-        my $todos = $todo?"todo_":"";
+        $class .= " also-skip" if ($skipped);
+        $class .= " also-todo" if ($todo);
         print OUT <<"EOF";
-      <td class="$todos$skip$class"><a
+      <td class="result $class"><a
         href="$file"
         title="$count tests, $todo TODO, $error errors, $skipped skipped"
         onMouseOver="refresh('$testname','$groupname $test->{tag}',$count,$todo,$error,$skipped);"
@@ -333,9 +333,9 @@ EOF
             my $href = "href=\"#$group->{name}\"";
             if (exists $group->{extrema}->{$testname}) {
                 my ($min,$max) = @{$group->{extrema}->{$testname}};
-                my $todos = (exists $group->{todo}->{$testname})?"todo_":"";
-                my $skip = (exists $group->{skipped}->{$testname})?"skip_":"";
                 my $class = $min==0?($max==0?"pass":"mixed"):"fail";
+                $class .= " also-todo" if (exists $group->{todo}->{$testname});
+                $class .= " also-skip" if (exists $group->{skipped}->{$testname});
                 my $title = "";
                 if ($min)
                 {
@@ -345,7 +345,7 @@ EOF
                 }
                 my $errors = $min==$max?$min:"$min to $max";
                 print OUT <<"EOF";
-      <td class="$todos$skip$class"><a $href$title
+      <td class="result $class"><a $href$title
         onMouseOver="refresh('$testname','$group->{name}','-','-','$errors');"
         >$max</a></td>
 EOF
diff --git a/winetest/summary.css b/winetest/summary.css
index 269f80c..2ff1fb2 100644
--- a/winetest/summary.css
+++ b/winetest/summary.css
@@ -7,113 +7,31 @@ body {
 h3, p.legend {
         text-align: center;
 }
-.pass {
-        background-color: #60ff60;
-        border-right-style: solid;
+.result {
+        border-left-width: thick;
         border-left-style: solid;
-        border-width: thick;
-        border-color: #60ff60;
-}
-.mixed {
-        background-color: #ffff40;
-        border-right-style: solid;
-        border-left-style: solid;
-        border-width: thick;
-        border-color: #ffff40;
-}
-.fail {
-        background-color: #ff5050;
-        border-right-style: solid;
-        border-left-style: solid;
-        border-width: thick;
-        border-color: #ff5050;
-}
-.vis_pass {
-        background-color: #60ff60;
-        border-right-style: solid;
-        border-left-style: solid;
-        border-width: thick;
-        border-left-color: #60ff60;
-        border-right-color: #0070ff;
-}
-.vis_fail {
-        background-color: #ff5050;
+        border-right-width: thick;
         border-right-style: solid;
-        border-left-style: solid;
-        border-width: thick;
-        border-left-color: #ff5050;
-        border-right-color: #0070ff;
 }
-.skip_pass {
+.pass {
         background-color: #60ff60;
-        border-right-style: solid;
-        border-left-style: solid;
-        border-width: thick;
         border-left-color: #60ff60;
-        border-right-color: #0070ff;
-}
-.skip_mixed {
-        background-color: #ffff40;
-        border-right-style: solid;
-        border-left-style: solid;
-        border-width: thick;
-        border-left-color: #ffff40;
-        border-right-color: #0070ff;
-}
-.skip_fail {
-        background-color: #ff5050;
-        border-right-style: solid;
-        border-left-style: solid;
-        border-width: thick;
-        border-left-color: #ff5050;
-        border-right-color: #0070ff;
-}
-.todo_pass {
-        background-color: #60ff60;
-        border-right-style: solid;
-        border-left-style: solid;
-        border-width: thick;
-        border-left-color: #ff9b49;
         border-right-color: #60ff60;
 }
-.todo_mixed {
+.mixed {
         background-color: #ffff40;
-        border-right-style: solid;
-        border-left-style: solid;
-        border-width: thick;
-        border-left-color: #ff9b49;
+        border-left-color: #ffff40;
         border-right-color: #ffff40;
 }
-.todo_fail {
+.fail {
         background-color: #ff5050;
-        border-right-style: solid;
-        border-left-style: solid;
-        border-width: thick;
-        border-left-color: #ff9b49;
+        border-left-color: #ff5050;
         border-right-color: #ff5050;
 }
-.todo_skip_pass {
-        background-color: #60ff60;
-        border-right-style: solid;
-        border-left-style: solid;
-        border-width: thick;
-        border-left-color: #ff9b49;
-        border-right-color: #0070ff;
-}
-.todo_skip_mixed {
-        background-color: #ffff40;
-        border-right-style: solid;
-        border-left-style: solid;
-        border-width: thick;
+.also-todo {
         border-left-color: #ff9b49;
-        border-right-color: #0070ff;
 }
-.todo_skip_fail {
-        background-color: #ff5050;
-        border-right-style: solid;
-        border-left-style: solid;
-        border-width: thick;
-        border-left-color: #ff9b49;
+.also-skip {
         border-right-color: #0070ff;
 }
 td {
-- 
1.5.4.1




More information about the wine-patches mailing list