grim/gplate

5b365cf2b4e2
Parents 7083fc1addf2
Children bd579fbbdb9a
removed check.xsl since we're not using check anymore
  • +0 -233
    tests/check.xsl
  • --- a/tests/check.xsl Sun Nov 15 00:24:01 2009 -0600
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,233 +0,0 @@
    -<?xml version="1.0" encoding="utf-8"?>
    -<!--
    - check.xsl - An XML stylesheet for transforming checks xml output
    - Copyright (C) 2007-2008 Gary Kramlich <grim@reaperworld.com>
    -
    - This program 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 of the License, or (at your option)
    - any later version.
    -
    - This program 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
    - this program; if not, write to the Free Software Foundation, Inc., 51
    - Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
    --->
    -<xsl:stylesheet version="1.1"
    - xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    - xmlns:check="http://check.sourceforge.net/ns"
    ->
    -
    - <!-- default parameters -->
    - <xsl:param name="project"/>
    - <xsl:param name="version"/>
    - <xsl:param name="arch"/>
    -
    - <!-- output options -->
    - <xsl:output method="xml"
    - version="1.0"
    - encoding="UTF-8"
    - doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
    - doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
    - />
    -
    - <!-- number of tests, number of passes, passed percentage -->
    - <xsl:variable name="tests" select="count(/check:testsuites/check:suite/check:test)"/>
    - <xsl:variable name="passes" select="count(/check:testsuites/check:suite/check:test[@result='success'])"/>
    - <xsl:variable name="percent" select="($passes div $tests)"/>
    -
    - <!-- java scriptz! -->
    - <xsl:variable name="script">
    - <xsl:comment>
    - function toggle(div) {
    - element = document.getElementById(div);
    -
    - if(element.style.display == 'block') {
    - element.style.display = 'none';
    - } else {
    - element.style.display = 'block';
    - }
    - }
    -
    - function show_all() {
    - elements = document.getElementsByTagName('div');
    -
    - for(i = 0, l = elements.length; i &lt; l; i++) {
    - if(elements[i].id) {
    - elements[i].style.display = 'block';
    - }
    - }
    - }
    -
    - function hide_all() {
    - elements = document.getElementsByTagName('div');
    -
    - for(i = 0, l = elements.length; i &lt; l; i++) {
    - if(elements[i].id) {
    - elements[i].style.display = 'none';
    - }
    - }
    - }
    - </xsl:comment>
    - </xsl:variable>
    -
    - <!-- css -->
    - <xsl:variable name="css">
    - <xsl:comment>
    - pre { margin: 0px; }
    - img { border: 0px; }
    - td { vertical-align: top; }
    - div { display: none; padding: 0px; margin: 0px; }
    - div.header { display: block; }
    - div.passed-message { margin: 2px 0px; background-color: #cfffcf; border: solid 1px #7fff7f; color: #000000; }
    - div.failed-message { margin: 2px 0px; background-color: #ffcfcf; border: solid 1px #ff7f7f; color: #000000; }
    - </xsl:comment>
    - </xsl:variable>
    -
    - <!-- title -->
    - <xsl:variable name="title">
    - <xsl:choose>
    - <xsl:when test="$project">
    - <xsl:value-of select="$project"/>
    - </xsl:when>
    - <xsl:otherwise>
    - <xsl:text>Unnamed Project</xsl:text>
    - </xsl:otherwise>
    - </xsl:choose>
    - <xsl:text> - Check Results</xsl:text>
    - </xsl:variable>
    -
    - <!-- architect -->
    - <xsl:variable name="architect">
    - <xsl:choose>
    - <xsl:when test="$arch">
    - <xsl:value-of select="$arch"/>
    - </xsl:when>
    - <xsl:otherwise>
    - <xsl:text>Unknown</xsl:text>
    - </xsl:otherwise>
    - </xsl:choose>
    - </xsl:variable>
    -
    - <!-- version -->
    - <xsl:variable name="project_version">
    - <xsl:choose>
    - <xsl:when test="$version">
    - <xsl:value-of select="$version"/>
    - </xsl:when>
    - <xsl:otherwise>
    - <xsl:text>Unknown</xsl:text>
    - </xsl:otherwise>
    - </xsl:choose>
    - </xsl:variable>
    -
    - <!-- meat and ... here, where the fuck are my potatoes!?!?! -->
    - <xsl:template match="check:testsuites">
    - <html xmlns="http://www.w3.org/1999/xhtml">
    - <head>
    - <script type="text/javascript">
    - <xsl:copy-of select="$script"/>
    - </script>
    - <style type="text/css">
    - <xsl:copy-of select="$css"/>
    - </style>
    - <title><xsl:copy-of select="$title"/></title>
    - </head>
    - <body>
    - <div class="header">
    - <h1><xsl:copy-of select="$title"/></h1>
    -
    - <table>
    - <tr>
    - <td><strong><xsl:text>Version:</xsl:text></strong></td>
    - <td><xsl:copy-of select="$project_version"/></td>
    - </tr>
    - <tr>
    - <td><strong><xsl:text>Architect:</xsl:text></strong></td>
    - <td><xsl:copy-of select="$architect"/></td>
    - </tr>
    - <tr>
    - <td><strong><xsl:text>Ran on:</xsl:text></strong></td>
    - <td><xsl:value-of select="check:datetime"/></td>
    - </tr>
    - <tr>
    - <td><strong><xsl:text>Duration:</xsl:text></strong></td>
    - <td><xsl:value-of select="format-number(check:duration, '###.##')"/><xsl:text> seconds</xsl:text></td>
    - </tr>
    - <tr>
    - <td><strong>Results:</strong></td>
    - <td>
    - <xsl:copy-of select="$passes"/>
    - <xsl:text> of </xsl:text>
    - <xsl:copy-of select="$tests"/>
    - <xsl:text> (</xsl:text>
    - <xsl:value-of select="format-number($percent, '###.##%')"/>
    - <xsl:text>) tests passed</xsl:text>
    - </td>
    - </tr>
    - </table>
    - <p>
    - <a href="javascript:show_all()">Show all messages</a>
    - <xsl:text> </xsl:text>
    - <a href="javascript:hide_all()">Hide all messages</a>
    - </p>
    - </div>
    - <table>
    - <xsl:for-each select="check:suite">
    - <xsl:if test="check:test">
    - <tr>
    - <td colspan="2"><h2><xsl:value-of select="check:title"/></h2></td>
    - </tr>
    - <xsl:for-each select="check:test">
    - <tr>
    - <td>
    - <xsl:element name="a">
    - <xsl:attribute name="href">
    - <xsl:text>javascript:toggle('</xsl:text>
    - <xsl:value-of select="check:id"/>
    - <xsl:text>')</xsl:text>
    - </xsl:attribute>
    - <xsl:value-of select="translate(check:id, '_', ' ')"/>
    - </xsl:element>
    - </td>
    - <td>
    - <xsl:choose>
    - <xsl:when test="@result='success'">
    - <img src="passed.png" alt="passed"/>
    - </xsl:when>
    - <xsl:otherwise>
    - <img src="failed.png" alt="failed"/>
    - </xsl:otherwise>
    - </xsl:choose>
    - </td>
    - <td>
    - <xsl:element name="div">
    - <xsl:attribute name="id">
    - <xsl:value-of select="check:id"/>
    - </xsl:attribute>
    - <xsl:attribute name="class">
    - <xsl:choose>
    - <xsl:when test="@result='success'">
    - <xsl:text>passed-message</xsl:text>
    - </xsl:when>
    - <xsl:otherwise>
    - <xsl:text>failed-message</xsl:text>
    - </xsl:otherwise>
    - </xsl:choose>
    - </xsl:attribute>
    - <pre><xsl:value-of select="check:message"/></pre>
    - </xsl:element>
    - </td>
    - </tr>
    - </xsl:for-each>
    - </xsl:if>
    - </xsl:for-each>
    - </table>
    - </body>
    - </html>
    - </xsl:template>
    -</xsl:stylesheet>