Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Cleaned the XSL style a bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkauppila committed Jun 30, 2011
1 parent 201fee3 commit ef89e24
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 71 deletions.
2 changes: 1 addition & 1 deletion test/test-automation/runner.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -736,5 +736,5 @@ main(int argc, char *argv[])
RunEnded(totalTestPassCount + totalTestfailureCount, suiteCounter, RunEnded(totalTestPassCount + totalTestfailureCount, suiteCounter,
totalTestPassCount, totalTestfailureCount, time(0), totalRunTime); totalTestPassCount, totalTestfailureCount, time(0), totalRunTime);


return 0; return (totalTestfailureCount ? 1 : 0);
} }
138 changes: 68 additions & 70 deletions test/test-automation/style.xsl
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -12,104 +12,102 @@


<script type="text/javascript"> <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() { $(document).ready(function() {
$("span.show-tests").click(function() { $("span.show-tests").click(function() {
var content = $(this).html(); var content = $(this).html();
var id = $(this).attr('uid'); var id = $(this).attr('uid');

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


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


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

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

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


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

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

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


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

var searchString = "div.tests"; var searchString = "div.tests";


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

$(this).text(showAllTests);
$(searchString).hide("fast");
$(this).text('[Show All Tests]');


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


} else { } else {
console.log("show now"); $(searchString).show(animationSpeed);

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


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


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

var searchString = "div.tests"; var searchString = "div.tests";


if(content == '[Hide Everything]') { if(content == hideEverything) {
console.log("hide now"); $("div.tests").hide(animationSpeed);

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


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

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


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

} }
}); });


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


$("div.test[result='passed']").addClass('passedTest'); /* Color the tests based on the result */
$("div.test[result='failed']").addClass('failedTest'); $("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> </script>
Expand Down Expand Up @@ -146,17 +144,14 @@ div, h1 {
cursor: pointer; cursor: pointer;
} }


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


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


.statistics {
}

</style> </style>


</head> </head>
Expand All @@ -174,7 +169,7 @@ div, h1 {
<span class="title">Statistics:</span><br/> <span class="title">Statistics:</span><br/>
<div class="statistics"> <div class="statistics">
<span>Executed </span> <xsl:value-of select="testlog/numSuites"/> test suites. <br/> <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>
</div> </div>


Expand Down Expand Up @@ -208,19 +203,22 @@ div, h1 {


<span class="switch show-asserts" uid="{generate-id(assertSummary)}">[Show Assert Summary]</span><br/> <span class="switch show-asserts" uid="{generate-id(assertSummary)}">[Show Assert Summary]</span><br/>
<div class="asserts" uid="{generate-id(assertSummary)}"> <div class="asserts" uid="{generate-id(assertSummary)}">
<xsl:for-each select="assert"> <xsl:for-each select="assert">
<div id="assert"> <div class="assert">
Assert name: <xsl:value-of select="name"/> <br/> <xsl:attribute name="result">
Result: <xsl:value-of select="result"/> <br/> <xsl:value-of select="result"/>
Message <xsl:value-of select="message"/> <br/> </xsl:attribute>
Time <xsl:value-of select="time"/> <br/> 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> </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> </div>
</xsl:for-each> </xsl:for-each>
</div> </div>
Expand Down

0 comments on commit ef89e24

Please sign in to comment.