Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Cleaned the XSL style a bit.

  • Loading branch information
mkauppila committed Jun 30, 2011
1 parent 201fee3 commit ef89e24b8497190d67f33e8b6608e3bcbe09997b
Showing with 69 additions and 71 deletions.
  1. +1 −1 test/test-automation/runner.c
  2. +68 −70 test/test-automation/style.xsl
@@ -736,5 +736,5 @@ main(int argc, char *argv[])
RunEnded(totalTestPassCount + totalTestfailureCount, suiteCounter,
totalTestPassCount, totalTestfailureCount, time(0), totalRunTime);

return 0;
return (totalTestfailureCount ? 1 : 0);
}
@@ -12,104 +12,102 @@

<script type="text/javascript">

var hideTests = '[Hide tests]';
var showTests = '[Show tests]';

var hideAsserts = '[Hide Assert Summary]';
var showAsserts = '[Show Assert Summary]';

var hideAllTests = '[Hide All Tests]';
var showAllTests = '[Show All Tests]';

var hideEverything = '[Hide Everything]';
var showEverything = '[Show Everything]';

var animationSpeed = 'fast';

$(document).ready(function() {
$("span.show-tests").click(function() {
var content = $(this).html();
var id = $(this).attr('uid');

var searchString = "div.tests[uid="+id+"]";

if(content == '[Hide tests]') {
$(searchString).hide("fast");
$(this).text('[Show tests]');
if(content == hideTests) {
$(searchString).hide(animationSpeed);
$(this).text(showTests);
} else {
$(searchString).show("fast");
$(this).text('[Hide tests]');
$(searchString).show(animationSpeed);
$(this).text(hideTests);
}
});

$("span.show-asserts").click(function() {
var content = $(this).html();
var id = $(this).attr('uid');

console.log("assert uid" + id);

var searchString = "div.asserts[uid="+id+"]";

if(content == '[Hide Assert Summary]') {
console.log("hide now");

$(searchString).hide("fast");
$(this).text('[Show Assert Summary]');
if(content == hideAsserts) {
$(searchString).hide(animationSpeed);
$(this).text(showAsserts);
} else {
console.log("show now");

$(searchString).show("fast");
$(this).text('[Hide Assert Summary]');
$(searchString).show(animationSpeed);
$(this).text(hideAsserts);
}
});

$("span.show-all-tests").click(function() {
var content = $(this).html();

var searchString = "div.tests";

if(content == '[Hide All Tests]') {
console.log("hide now");

$(searchString).hide("fast");
$(this).text('[Show All Tests]');
if(content == hideAllTests) {
$(searchString).hide(animationSpeed);
$(this).text(showAllTests);

/* handle the individual '[show tests]' switcher */
$("span.show-tests[uid]").text('[Show tests]');


$("span.show-tests[uid]").text(showTests);
} else {
console.log("show now");

$(searchString).show("fast");
$(this).text('[Hide All Tests]');
$(searchString).show(animationSpeed);
$(this).text(hideAllTests);

/* handle the individual '[show tests]' switcher */
$("span.show-tests[uid]").text('[Hide tests]');
$("span.show-tests[uid]").text(hideTests);
}
});

$("span.show-everything").click(function() {
var content = $(this).html();

var searchString = "div.tests";

if(content == '[Hide Everything]') {
console.log("hide now");

$("div.tests").hide("fast");
$("div.asserts").hide("fast");
$(this).text('[Show Everything]');
if(content == hideEverything) {
$("div.tests").hide(animationSpeed);
$("div.asserts").hide(animationSpeed);
$(this).text(showEverything);

/* handle the individual switchers */
$("span.show-tests[uid]").text('[Show tests]');
$("span.show-asserts[uid]").text('[Show Assert Summary]');
$("span.show-tests[uid]").text(showTests);
$("span.show-asserts[uid]").text(showAsserts);
} else {
console.log("show now");

$("div.tests").show("fast");
$("div.asserts").show("fast");
$(this).text('[Hide Everything]');
$("div.tests").show(animationSpeed);
$("div.asserts").show(animationSpeed);
$(this).text(hideEverything);

/* handle the individual switchers */
$("span.show-tests[uid]").text('[Hide tests]');
$("span.show-asserts[uid]").text('[Hide Assert Summary]');

$("span.show-tests[uid]").text(hideTests);
$("span.show-asserts[uid]").text(hideAsserts);
}
});

/* Initially everything is hidden */
$("div.tests").hide();
$("div.asserts").hide();

$("div.test[result='passed']").addClass('passedTest');
$("div.test[result='failed']").addClass('failedTest');
/* Color the tests based on the result */
$("div.test[result='passed']").addClass('passed');
$("div.test[result='failed']").addClass('failed');

/* Color the asserts based on the result */
$("div.assert[result='pass']").addClass('passed');
$("div.assert[result='failure']").addClass('failed');
});

</script>
@@ -146,17 +144,14 @@ div, h1 {
cursor: pointer;
}

.passedTest {
.passed {
background-color: #64AA2B;
}

.failedTest {
.failed {
background-color: #FF6E40;
}

.statistics {
}


</style>

</head>
@@ -174,7 +169,7 @@ div, h1 {
<span class="title">Statistics:</span><br/>
<div class="statistics">
<span>Executed </span> <xsl:value-of select="testlog/numSuites"/> test suites. <br/>
<span>Tests in total: </span> <xsl:value-of select="testlog/numTests"/> (passed: <xsl:value-of select="testlog/numPassedTests"/> , failed: <xsl:value-of select="testlog/numFailedTests"/>)
<span>Tests in total: </span> <xsl:value-of select="testlog/numTests"/> (passed: <xsl:value-of select="testlog/numPassedTests"/>, failed: <xsl:value-of select="testlog/numFailedTests"/>)
</div>
</div>

@@ -208,19 +203,22 @@ div, h1 {

<span class="switch show-asserts" uid="{generate-id(assertSummary)}">[Show Assert Summary]</span><br/>
<div class="asserts" uid="{generate-id(assertSummary)}">
<xsl:for-each select="assert">
<div id="assert">
Assert name: <xsl:value-of select="name"/> <br/>
Result: <xsl:value-of select="result"/> <br/>
Message <xsl:value-of select="message"/> <br/>
Time <xsl:value-of select="time"/> <br/>
<xsl:for-each select="assert">
<div class="assert">
<xsl:attribute name="result">
<xsl:value-of select="result"/>
</xsl:attribute>
Assert name: <xsl:value-of select="name"/> <br/>
Result: <xsl:value-of select="result"/> <br/>
Message <xsl:value-of select="message"/> <br/>
Time <xsl:value-of select="time"/> <br/>
</div>
</xsl:for-each>
AssertSummary:
Assert count: <xsl:value-of select="assertSummary/assertCount"/> <br/>
Asserts Passed <xsl:value-of select="assertSummary/assertsPassed"/> <br/>
Asserts Failed <xsl:value-of select="assertSummary/assertsFailed"/> <br/>
</div>
</xsl:for-each>
AssertSummary:
Assert count: <xsl:value-of select="assertSummary/assertCount"/> <br/>
Asserts Passed <xsl:value-of select="assertSummary/assertsPassed"/> <br/>
Asserts Failed <xsl:value-of select="assertSummary/assertsFailed"/> <br/>
</div>
</div>
</xsl:for-each>
</div>

0 comments on commit ef89e24

Please sign in to comment.