aboutsummaryrefslogtreecommitdiffstats
path: root/tests/report-styles
diff options
context:
space:
mode:
authorJiri Vanek <[email protected]>2012-06-11 20:53:23 +0200
committerJiri Vanek <[email protected]>2012-06-11 20:53:23 +0200
commit7ab4e85d1b8e1eadebca99320c605dee7ecd09d5 (patch)
treef1ba6e290a5d4c976f1393d99b0b74c5600abaf3 /tests/report-styles
parentc90a15733bd947699610d0dbf59e8c88fe139a1d (diff)
Implemented xml logging backend
Diffstat (limited to 'tests/report-styles')
-rw-r--r--tests/report-styles/index.js82
-rw-r--r--tests/report-styles/jreport.xsl24
-rw-r--r--tests/report-styles/logs.xsl153
-rw-r--r--tests/report-styles/output.css7
-rw-r--r--tests/report-styles/report.css5
5 files changed, 269 insertions, 2 deletions
diff --git a/tests/report-styles/index.js b/tests/report-styles/index.js
index 27b6ed5..75158c2 100644
--- a/tests/report-styles/index.js
+++ b/tests/report-styles/index.js
@@ -1,3 +1,20 @@
+function showhideMethods(inElement,toValue) {
+ var e = document.getElementById(inElement);
+ methods=e.getElementsByClassName("method");
+ for ( var i = 0; i < methods.length; i++ ) {
+ methods[i].style.display=toValue
+ }
+}
+function openAnchor() {
+ anchor=self.document.location.hash;
+ if (anchor==null || anchor=="") return;
+ stub=anchor.substring(1);
+ var logs=getLogsArray(stub);
+ logs[0].style.display="inline";
+ logs[1].style.display="inline";
+ recalcArraysWidth(logs);
+ window.location.hash=stub;
+}
function negateIdDisplay(which) {
var e = document.getElementById(which);
@@ -8,6 +25,14 @@ function negateIdDisplay(which) {
}
}
+function negateIdDisplayInline(which) {
+ var e = document.getElementById(which);
+ if (e.style.display=="inline") {
+ e.style.display="none"
+ } else {
+ e.style.display="inline"
+ }
+}
function setClassDisplay(which,what) {
var e = document.getElementsByClassName(which);
@@ -16,5 +41,62 @@ function setClassDisplay(which,what) {
}
}
+function negateClassBlocDisplay(which) {
+ var e = document.getElementsByClassName(which);
+ for ( var i = 0; i < e.length; i++ ) {
+ if (e[i].style.display=="block") {
+ e[i].style.display="none"
+ } else {
+ e[i].style.display="block"
+ }
+ }
+}
+function negateClassBlocDisplayIn(where,which) {
+ var parent = document.getElementById(where);
+ var e = parent.getElementsByClassName(which);
+ for ( var i = 0; i < e.length; i++ ) {
+ if (e[i].style.display=="block") {
+ e[i].style.display="none"
+ } else {
+ e[i].style.display="block"
+ }
+ }
+}
+
+function getLogsArray(stub) {
+ return new Array(document.getElementById(stub+".out"),document.getElementById(stub+".err"),document.getElementById(stub+".all"));
+}
+
+function recalcLogsWidth(stub) {
+ var logs=getLogsArray(stub)
+ recalcArraysWidth(logs);
+}
+function showAllLogs() {
+ var e = document.getElementsByClassName("method");
+ for ( var i = 0; i < e.length; i++ ) {
+ stub=e[i].id;
+ var logs=getLogsArray(stub)
+ logs[0].style.display="none";
+ logs[1].style.display="none"
+ logs[2].style.display="inline"
+ recalcArraysWidth(logs);
+
+ }
+}
+function recalcArraysWidth(logs) {
+ visible=0;
+ for ( var i = 0; i < logs.length; i++ ) {
+ if (logs[i].style.display!="none"){
+ visible++;
+ }
+ }
+ if (visible==0) return;
+ nwWidth=90/visible;
+ for ( var i = 0; i < logs.length; i++ ) {
+ if (logs[i].style.display!="none"){
+ logs[i].style.width=nwWidth+"%";
+ }
+ }
+}
diff --git a/tests/report-styles/jreport.xsl b/tests/report-styles/jreport.xsl
index c83972c..a54d0f9 100644
--- a/tests/report-styles/jreport.xsl
+++ b/tests/report-styles/jreport.xsl
@@ -38,6 +38,14 @@ exception statement from your version.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
+<!--
+when parameter is mentioned (no matter of value) eg:
+<xsl:param name="logs">none</xsl:param>
+then xsltproc is not able to change its value since 2008
+This parameter is providing relative path to file with logs which is then linked from this index
+Bad luck that xsltproc is not able to use default values.
+If there is no need for linking, please use value "none" for this variable
+-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
@@ -208,8 +216,20 @@ exception statement from your version.
</a>
<div class="lineHeader">
<div class="clazz">
- <xsl:value-of select="@classname"/>
- </div>
+ <xsl:choose>
+ <xsl:when test="$logs!='none'">
+ <a class="logLink" target="new">
+ <xsl:attribute name="href">
+ <xsl:value-of select="$logs"/>#<xsl:value-of select="@classname"/>.<xsl:value-of select="@name"/>
+ </xsl:attribute>
+ <xsl:value-of select="@classname"/>
+ </a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@classname"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </div>
<xsl:text disable-output-escaping="no"> - </xsl:text>
<div class="method">
<xsl:value-of select="@name"/>
diff --git a/tests/report-styles/logs.xsl b/tests/report-styles/logs.xsl
new file mode 100644
index 0000000..e139614
--- /dev/null
+++ b/tests/report-styles/logs.xsl
@@ -0,0 +1,153 @@
+<?xml version="1.0"?>
+<!--
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+IcedTea is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version.
+
+ -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+ <xsl:template match="/">
+ <html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <script src="report-styles/index.js"/>
+ <link href="report-styles/output.css" rel="stylesheet" type="text/css"/>
+ </head>
+ <body onload="setClassDisplay(&quot;fulltrace&quot;,&quot;none&quot;);setClassDisplay(&quot;stamp&quot;,&quot;none&quot;);setClassDisplay(&quot;output&quot;,&quot;none&quot;);openAnchor();">
+ <div id="wholePage">
+ <button onclick="showAllLogs()">show all</button>
+ <button onclick="setClassDisplay('output','none')">hide all</button>
+ <button onclick="showAllLogs()">show all logs</button>
+ <button onclick="setClassDisplay('output','none')">hide all logs</button>
+ <button onclick="setClassDisplay('method','block')">show all methods</button>
+ <button onclick="setClassDisplay('method','none')">hide all methods</button>
+ <xsl:for-each select="/logs/classlog">
+ <div class="classa">
+ <xsl:attribute name="id">
+ <xsl:value-of select="@className"/>
+ </xsl:attribute>
+ <h1>
+ <a>
+ <xsl:attribute name="name">
+ <xsl:value-of select="@className"/>
+ </xsl:attribute>
+ </a>
+ <xsl:value-of select="@className"/>
+ </h1>
+ <button><xsl:attribute name="onclick">
+ showhideMethods('<xsl:value-of select="@className"/>','none')
+ </xsl:attribute>
+hide methods</button>
+ <button><xsl:attribute name="onclick">
+ showhideMethods('<xsl:value-of select="@className"/>','block')
+ </xsl:attribute>
+show methods</button>
+ <xsl:for-each select="testLog">
+ <div class="method">
+ <xsl:attribute name="id">
+ <xsl:value-of select="@fullId"/>
+ </xsl:attribute>
+ <h2>
+ <a>
+ <xsl:attribute name="name">
+ <xsl:value-of select="@fullId"/>
+ </xsl:attribute>
+ <xsl:value-of select="@testMethod"/>
+ </a>
+ </h2>
+ <button><xsl:attribute name="onclick">
+ negateIdDisplayInline('<xsl:value-of select="@fullId"/>.out');
+ recalcLogsWidth('<xsl:value-of select="@fullId"/>');
+ </xsl:attribute>
+show/hide stdout</button>
+ <button><xsl:attribute name="onclick">
+ negateIdDisplayInline('<xsl:value-of select="@fullId"/>.err');
+ recalcLogsWidth('<xsl:value-of select="@fullId"/>');
+ </xsl:attribute>
+show/hide stderr</button>
+ <button><xsl:attribute name="onclick">
+ negateIdDisplayInline('<xsl:value-of select="@fullId"/>.all');
+ recalcLogsWidth('<xsl:value-of select="@fullId"/>');
+ </xsl:attribute>
+show/hide alllog</button>
+ <button><xsl:attribute name="onclick">
+ negateClassBlocDisplayIn('<xsl:value-of select="@fullId"/>','fulltrace');
+ </xsl:attribute>
+show/hide fulltraces</button>
+ <button><xsl:attribute name="onclick">
+ negateClassBlocDisplayIn('<xsl:value-of select="@fullId"/>','stamp');
+ </xsl:attribute>
+show/hide stamps</button>
+ <div class="space-line">
+ <!-- -->
+ </div>
+ <xsl:for-each select="log">
+ <div class="output">
+ <xsl:attribute name="id"><xsl:value-of select="../@fullId"/>.<xsl:value-of select="@id"/></xsl:attribute>
+ <h3>
+ <xsl:value-of select="@id"/>
+ </h3>
+ <xsl:for-each select="item">
+ <div class="item">
+ <xsl:attribute name="id"><xsl:value-of select="../../@fullId"/>.<xsl:value-of select="../@id"/>.<xsl:value-of select="@id"/></xsl:attribute>
+ <div class="stamp"><xsl:value-of select="stamp"/></div>
+ <div class="fulltrace">
+ <pre>
+ <xsl:value-of select="fulltrace"/>
+ </pre>
+ </div>
+ <pre>
+ <xsl:value-of select="text"/>
+ </pre>
+ <!--item-->
+ </div>
+ </xsl:for-each>
+ <!--output-->
+ </div>
+ </xsl:for-each>
+ <div class="space-line">
+ <!-- -->
+ </div>
+ <!--method-->
+ </div>
+ </xsl:for-each>
+ <!--classa-->
+ </div>
+ </xsl:for-each>
+ <!--wholePage-->
+ </div>
+ </body>
+ </html>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/tests/report-styles/output.css b/tests/report-styles/output.css
new file mode 100644
index 0000000..3da997c
--- /dev/null
+++ b/tests/report-styles/output.css
@@ -0,0 +1,7 @@
+div.space-line { clear: both; margin: 0; padding: 0; width: auto;}
+div.classa { border: thin solid black; padding: 5px; margin: 5px;}
+div.method {border: thin solid black; padding: 5px; margin: 5px;}
+div.output { border: thin solid black; padding: 5px; margin: 5px; float: left; display: inline; width:30%; overflow-x: scroll}
+div.item {border-bottom: thin solid black; border-top: thin solid black; border-left: thin solid black; padding: 5px; margin: 5px;}
+div.stamp { border: thin solid black; padding: 5px; margin: 5px;}
+div.fulltrace {border-bottom: thin solid black; border-top: thin solid black; border-left: thin solid black; padding: 5px; margin: 5px;}
diff --git a/tests/report-styles/report.css b/tests/report-styles/report.css
index e0a59c3..0afbf56 100644
--- a/tests/report-styles/report.css
+++ b/tests/report-styles/report.css
@@ -19,3 +19,8 @@ div.cell1 {display:inline; float: left;height:auto}
div.cell2 {display:inline; float: right;height:auto}
a.classSumaryName{font-weight:bold}
+
+a.logLink:link {color: black}
+a.logLink:active {color: black; }
+a.logLink:visited {color: black;}
+a.logLink:hover {color: black;font-weight: bolder;}