[fpc-devel] [patch] - fpcUnit XSLT
Kris Leech
krisleech at interkonect.com
Mon Nov 20 21:22:43 CET 2006
Graeme Geldenhuys wrote:
> Hi,
>
> Attached is a patch for the fpcUnit's example XSLT files.
>
> Changes:
> * Grouping by Test Suites is now supported in the generated HTML
> * Cleaned up the fpcunit.css file
> * Added a navi.js file, which is the JavaScript required for the
> grouping. (Depending on others, this could be moved into the
> fpcunit.xsl file if preferred).
Is this a class for actually doing XSLT transforms on XML?
If so what unit / documenation can I find this in?
>
>
>------------------------------------------------------------------------
>
>Index: fcl/fpcunit/example_xsl/fpcunit.css
>===================================================================
>--- fcl/fpcunit/example_xsl/fpcunit.css (revision 5431)
>+++ fcl/fpcunit/example_xsl/fpcunit.css (working copy)
>@@ -4,19 +4,23 @@
> font-size: x-small;
> background: #FFFFFF;
> }
>+
> a
> {
> text-decoration: none;
> background-color: Transparent
> }
>+
> a:link
> {
> color: #0033ff;
> }
>+
> a:visited
> {
> color: #003399;
> }
>+
> a:active, a:hover
> {
> color:#69c;
>@@ -26,21 +30,22 @@
> {
> padding: 4px 4px 4px 6px;
> font-size: large;
>- border: 1px solid black;
>- font-weight: bold;
>- color: white;
>- background-color: #006699;
>+ border: 1px solid black;
>+ font-weight: bold;
>+ color: white;
>+ background-color: #006699;
> }
>+
> h3
> {
> padding: 4px 4px 4px 6px;
> border: 1px solid #003399;
> color: #FFFFFF;
>-/* #003399; */
> background-color: #0099CC;
> font-weight: normal;
> font-size: medium;
> }
>+
> table
> {
> padding:0px;
>@@ -48,59 +53,90 @@
> margin-left: -2px;
> margin-right: -2px;
> }
>+
> th, td
> {
> padding: 2px 4px 2px 4px;
> vertical-align: top;
> font-size: x-small;
> }
>+
> address
> {
> font-family: verdana, arial, helvetica, Sans-Serif;
> font-size: 8pt;
>- font-style: normal;
>- text-align: right;
>+ font-style: normal;
>+ text-align: right;
> }
>
> .title
> {
> background-color: #bbb;
>-/* #bbb; #D8D8D8 #D3E4FF */
> color: white;
> }
>+
> .resultmessage
> {
> background-color: #D3E4FF;
> }
>+
> .success
> {
> background-color: lightgreen;
> color: black;
> }
>+
> .failure
> {
> background-color: #FF00FF;
> color: black;
> }
>+
> .notrun
> {
> background-color: yellow;
> color: black;
> }
>+
> .error
> {
> background-color: red;
> color: black;
> font-size: 9pt;
> }
>+
> .right
> {
> font-size: 8pt;
> text-align: right;
> }
>+
> .backToTop
> {
> text-align: right;
> }
>
>+.testsuitelabel
>+{
>+ background-color: cadetblue;
>+ color: black;
>+ cursor:pointer; cursor:hand; /* cross browser hack */
>+ padding-top: 3px;
>+ border: 1px solid #F5F5F5;
>+}
>
>+.testsuiteshowall
>+{
>+ display:inline;
>+ cursor:pointer; cursor:hand; /* cross browser hack */
>+}
>+
>+.testsuitehideall
>+{
>+ display:inline;
>+ cursor:pointer; cursor:hand; /* cross browser hack */
>+}
>+
>+div.testcontent {
>+ margin-left: 8px;
>+}
>Index: fcl/fpcunit/example_xsl/navi.js
>===================================================================
>--- fcl/fpcunit/example_xsl/navi.js (revision 0)
>+++ fcl/fpcunit/example_xsl/navi.js (revision 0)
>@@ -0,0 +1,50 @@
>+
>+window.onload = function () {
>+ var x = document.getElementsByTagName('div');
>+ for (var i=0;i<x.length;i++)
>+ {
>+ if (x[i].className == 'testsuitelabel')
>+ x[i].onclick = clickSuite;
>+ if (x[i].className == 'testsuiteshowall')
>+ x[i].onclick = openSuites;
>+ if (x[i].className == 'testsuitehideall')
>+ x[i].onclick = closeSuites;
>+ }
>+
>+ closeSuites();
>+}
>+
>+function closeSuites()
>+{
>+ var x = document.getElementsByTagName('div');
>+ for (var i=0;i<x.length;i++)
>+ {
>+ if (x[i].className == 'testcontent')
>+ x[i].style.display = 'none';
>+ }
>+}
>+
>+function openSuites()
>+{
>+ var x = document.getElementsByTagName('div');
>+ for (var i=0;i<x.length;i++)
>+ {
>+ if (x[i].className == 'testcontent')
>+ x[i].style.display = 'block';
>+ }
>+}
>+
>+function clickSuite(e)
>+{
>+ if (!e) var e = window.event;
>+ if (e.target) var tg = e.target;
>+ else if (e.srcElement) var tg = e.srcElement;
>+ while (tg.nodeName != 'DIV') // Safari GRRRRRRRRRR
>+ tg = tg.parentNode;
>+ var nextSib = tg.nextSibling;
>+ while (nextSib.nodeType != 1)
>+ nextSib = nextSib.nextSibling;
>+ var nextSibStatus = (nextSib.style.display == 'none') ? 'block' : 'none';
>+ nextSib.style.display = nextSibStatus;
>+}
>+
>
>Property changes on: fcl/fpcunit/example_xsl/navi.js
>___________________________________________________________________
>Name: svn:mime-type
> + text/plain
>Name: svn:eol-style
> + native
>
>Index: fcl/fpcunit/example_xsl/fpcunit.xsl
>===================================================================
>--- fcl/fpcunit/example_xsl/fpcunit.xsl (revision 5431)
>+++ fcl/fpcunit/example_xsl/fpcunit.xsl (working copy)
>@@ -9,6 +9,7 @@
> <style type="text/css" title="fpcUnit" media="screen">
> @import "fpcunit.css";
> </style>
>+ <script src="navi.js"></script>
> </head>
> <body>
>
>@@ -101,18 +102,24 @@
> <!-- Test Listing Table -->
> <table border="0" rules="none" width="100%">
> <tr align="left" class="title">
>- <th width="89%" align="left">Name</th>
>- <th width="11%" align="left">Elapsed Time<br/>(hh:mm:ss.zzz)</th>
>+ <td align="left">Name<br/><div class="testsuiteshowall">[show all]</div><div class="testsuitehideall">[hide all]</div></td>
>+ <td width="150" align="right">Elapsed Time<br/>(hh:mm:ss.zzz)</td>
> </tr>
>- <xsl:for-each select="TestListing/TestSuite/Test">
>- <xsl:variable name="testName" select="@Name"/>
>- <xsl:variable name="elapsedTime" select="ElapsedTime"/>
>- <tr class="success">
>- <td><xsl:value-of select="$testName"/></td>
>- <td><xsl:value-of select="ElapsedTime"/></td>
>- </tr>
>- </xsl:for-each>
> </table>
>+ <xsl:for-each select="TestListing/TestSuite">
>+ <div class="testsuitelabel"><xsl:value-of select="@Name"/></div>
>+ <div class="testcontent">
>+ <table border="0" cellspacing="1" width="100%">
>+ <xsl:for-each select="./Test">
>+ <tr class="success">
>+ <td><xsl:value-of select="@Name"/></td>
>+ <td width="150" align="right"><xsl:value-of select="ElapsedTime"/></td>
>+ </tr>
>+ </xsl:for-each> <!-- Test -->
>+ </table>
>+ </div>
>+ </xsl:for-each> <!-- TestSuite -->
>+
> </div> <!-- testlisting -->
> </xsl:template>
>
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>fpc-devel maillist - fpc-devel at lists.freepascal.org
>http://lists.freepascal.org/mailman/listinfo/fpc-devel
>
>
More information about the fpc-devel
mailing list