r21514 - in /branches/upstream/libtest-tap-htmlmatrix-perl: ./ current/ current/lib/ current/lib/Test/ current/lib/Test/TAP/ current/lib/Test/TAP/HTMLMatrix/ current/lib/Test/TAP/Model/ current/lib/Test/TAP/Model/File/ current/lib/Test/TAP/Model/Subtest/ current/t/
gregoa at users.alioth.debian.org
gregoa at users.alioth.debian.org
Sun Jun 15 15:38:48 UTC 2008
Author: gregoa
Date: Sun Jun 15 15:38:48 2008
New Revision: 21514
URL: http://svn.debian.org/wsvn/?sc=1&rev=21514
Log:
[svn-inject] Installing original source of libtest-tap-htmlmatrix-perl
Added:
branches/upstream/libtest-tap-htmlmatrix-perl/
branches/upstream/libtest-tap-htmlmatrix-perl/current/
branches/upstream/libtest-tap-htmlmatrix-perl/current/Build.PL
branches/upstream/libtest-tap-htmlmatrix-perl/current/MANIFEST
branches/upstream/libtest-tap-htmlmatrix-perl/current/META.yml
branches/upstream/libtest-tap-htmlmatrix-perl/current/Makefile.PL
branches/upstream/libtest-tap-htmlmatrix-perl/current/SIGNATURE
branches/upstream/libtest-tap-htmlmatrix-perl/current/example.pl
branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/
branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/
branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/
branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/HTMLMatrix/
branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/HTMLMatrix.pm
branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/HTMLMatrix/htmlmatrix.css
branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/HTMLMatrix/template.html
branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/Model/
branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/Model/Colorful.pm
branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/Model/File/
branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/Model/File/Visual.pm
branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/Model/Subtest/
branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/Model/Subtest/Visual.pm
branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/Model/Visual.pm
branches/upstream/libtest-tap-htmlmatrix-perl/current/t/
branches/upstream/libtest-tap-htmlmatrix-perl/current/t/00_dist.t
branches/upstream/libtest-tap-htmlmatrix-perl/current/t/basic.t
branches/upstream/libtest-tap-htmlmatrix-perl/current/t/colorful.t
branches/upstream/libtest-tap-htmlmatrix-perl/current/t/file_visual.t
branches/upstream/libtest-tap-htmlmatrix-perl/current/t/model_visual.t
branches/upstream/libtest-tap-htmlmatrix-perl/current/t/paths.t
branches/upstream/libtest-tap-htmlmatrix-perl/current/t/subtest_visual.t
branches/upstream/libtest-tap-htmlmatrix-perl/current/t/templ_output.t
branches/upstream/libtest-tap-htmlmatrix-perl/current/t/uri.t
Added: branches/upstream/libtest-tap-htmlmatrix-perl/current/Build.PL
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-tap-htmlmatrix-perl/current/Build.PL?rev=21514&op=file
==============================================================================
--- branches/upstream/libtest-tap-htmlmatrix-perl/current/Build.PL (added)
+++ branches/upstream/libtest-tap-htmlmatrix-perl/current/Build.PL Sun Jun 15 15:38:48 2008
@@ -1,0 +1,27 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+use Module::Build;
+
+my $b = Module::Build->new(
+ module_name => 'Test::TAP::HTMLMatrix',
+ license => 'perl',
+ requires => {
+ 'perl' => '>= 5.008',
+ 'Test::TAP::Model' => '>= 0.03',
+ 'Petal' => 0,
+ 'URI::file' => 0,
+ },
+ build_requires => {
+ 'Test::More' => 0,
+ },
+ create_makefile_pl => 'traditional',
+ sign => 1,
+);
+
+$b->add_build_element("html");
+$b->add_build_element("css");
+
+$b->create_build_script;
+
Added: branches/upstream/libtest-tap-htmlmatrix-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-tap-htmlmatrix-perl/current/MANIFEST?rev=21514&op=file
==============================================================================
--- branches/upstream/libtest-tap-htmlmatrix-perl/current/MANIFEST (added)
+++ branches/upstream/libtest-tap-htmlmatrix-perl/current/MANIFEST Sun Jun 15 15:38:48 2008
@@ -1,0 +1,22 @@
+Build.PL
+example.pl
+lib/Test/TAP/HTMLMatrix.pm
+lib/Test/TAP/HTMLMatrix/htmlmatrix.css
+lib/Test/TAP/HTMLMatrix/template.html
+lib/Test/TAP/Model/Colorful.pm
+lib/Test/TAP/Model/File/Visual.pm
+lib/Test/TAP/Model/Subtest/Visual.pm
+lib/Test/TAP/Model/Visual.pm
+MANIFEST This list of files
+t/00_dist.t
+t/basic.t
+t/colorful.t
+t/file_visual.t
+t/model_visual.t
+t/paths.t
+t/subtest_visual.t
+t/templ_output.t
+t/uri.t
+META.yml
+Makefile.PL
+SIGNATURE Added here by Module::Build
Added: branches/upstream/libtest-tap-htmlmatrix-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-tap-htmlmatrix-perl/current/META.yml?rev=21514&op=file
==============================================================================
--- branches/upstream/libtest-tap-htmlmatrix-perl/current/META.yml (added)
+++ branches/upstream/libtest-tap-htmlmatrix-perl/current/META.yml Sun Jun 15 15:38:48 2008
@@ -1,0 +1,28 @@
+---
+name: Test-TAP-HTMLMatrix
+version: 0.04
+author: ~
+abstract: |-
+ Creates colorful matrix of L<Test::Harness>
+ friendly test run results using L<Test::TAP::Model>.
+license: perl
+requires:
+ Petal: 0
+ Test::TAP::Model: >= 0.03
+ URI::file: 0
+ perl: >= 5.008
+build_requires:
+ Test::More: 0
+provides:
+ Test::TAP::HTMLMatrix:
+ file: lib/Test/TAP/HTMLMatrix.pm
+ version: 0.04
+ Test::TAP::Model::Colorful:
+ file: lib/Test/TAP/Model/Colorful.pm
+ Test::TAP::Model::File::Visual:
+ file: lib/Test/TAP/Model/File/Visual.pm
+ Test::TAP::Model::Subtest::Visual:
+ file: lib/Test/TAP/Model/Subtest/Visual.pm
+ Test::TAP::Model::Visual:
+ file: lib/Test/TAP/Model/Visual.pm
+generated_by: Module::Build version 0.2609
Added: branches/upstream/libtest-tap-htmlmatrix-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-tap-htmlmatrix-perl/current/Makefile.PL?rev=21514&op=file
==============================================================================
--- branches/upstream/libtest-tap-htmlmatrix-perl/current/Makefile.PL (added)
+++ branches/upstream/libtest-tap-htmlmatrix-perl/current/Makefile.PL Sun Jun 15 15:38:48 2008
@@ -1,0 +1,16 @@
+# Note: this file was auto-generated by Module::Build::Compat version 0.03
+use ExtUtils::MakeMaker;
+WriteMakefile
+(
+ 'NAME' => 'Test::TAP::HTMLMatrix',
+ 'VERSION_FROM' => 'lib/Test/TAP/HTMLMatrix.pm',
+ 'PREREQ_PM' => {
+ 'Petal' => '0',
+ 'Test::More' => '0',
+ 'Test::TAP::Model' => '>= 0.03',
+ 'URI::file' => '0'
+ },
+ 'INSTALLDIRS' => 'site',
+ 'PL_FILES' => {}
+ )
+;
Added: branches/upstream/libtest-tap-htmlmatrix-perl/current/SIGNATURE
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-tap-htmlmatrix-perl/current/SIGNATURE?rev=21514&op=file
==============================================================================
--- branches/upstream/libtest-tap-htmlmatrix-perl/current/SIGNATURE (added)
+++ branches/upstream/libtest-tap-htmlmatrix-perl/current/SIGNATURE Sun Jun 15 15:38:48 2008
@@ -1,0 +1,44 @@
+This file contains message digests of all files listed in MANIFEST,
+signed via the Module::Signature module, version 0.44.
+
+To verify the content in this distribution, first make sure you have
+Module::Signature installed, then type:
+
+ % cpansign -v
+
+It will check each file's integrity, as well as the signature's
+validity. If "==> Signature verified OK! <==" is not displayed,
+the distribution may already have been compromised, and you should
+not run its Makefile.PL or Build.PL.
+
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+SHA1 45ed83ec587623ffbf5bb49bfe61dcdfca1d6560 Build.PL
+SHA1 8a25c8abc96233eec411fa7181e2a454a9f5ba6c MANIFEST
+SHA1 3233b937cab25707d217f709711d65915ef99de5 META.yml
+SHA1 e55e6b102c03dbd68720e54bdddafc8c3b3a51de Makefile.PL
+SHA1 a0cff662974051fa5446f2c84cc76f5932c8a7d0 example.pl
+SHA1 bd1a5757be36a71dbd571fbb740417e6464858d9 lib/Test/TAP/HTMLMatrix.pm
+SHA1 20cb4d9e38408f820e44c12f27f96cd93505c6a0 lib/Test/TAP/HTMLMatrix/htmlmatrix.css
+SHA1 fa24d30f89aadeba3ddd6228b6939c8059b6432f lib/Test/TAP/HTMLMatrix/template.html
+SHA1 54f31f1c8bf59c64274332746955140183dabda4 lib/Test/TAP/Model/Colorful.pm
+SHA1 a0f8ed66cd9d320f9d95ec10fd8aad08d89b9423 lib/Test/TAP/Model/File/Visual.pm
+SHA1 67a61c1821b2ca2503bc6da617858b6558fd8253 lib/Test/TAP/Model/Subtest/Visual.pm
+SHA1 1dd343853743a971c8e570d20a6ef564357d8443 lib/Test/TAP/Model/Visual.pm
+SHA1 c04440d94389ed001b94cdec72080305ed7d9648 t/00_dist.t
+SHA1 5eabda254775b9d03db77da35152b77bd115e09a t/basic.t
+SHA1 499d6f857af998a28b3e897bf66c53f938e6d963 t/colorful.t
+SHA1 88e5139c087524f4b115b883bec7b9019653a774 t/file_visual.t
+SHA1 3a4af8f5ae0af33c18f70a3ed82887c647546a21 t/model_visual.t
+SHA1 45133f5530bdd571ccabaf058651640b5518b0b5 t/paths.t
+SHA1 59e8590283cf880f5308beef75523a2c06a7e736 t/subtest_visual.t
+SHA1 0c7891c49328312c71413496afc5ff85a92efeba t/templ_output.t
+SHA1 5d94ea8dd444a3bb1cb824e484325f5df36e4232 t/uri.t
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.0 (GNU/Linux)
+
+iD8DBQFCdQp9N2uCuGP2mw4RAuN2AJ9hs6Qtvi/39F7FayB4qAghlE4pWQCghrl4
+Ot7C1o3mrVJLn1+faL0qWhA=
+=s1DE
+-----END PGP SIGNATURE-----
Added: branches/upstream/libtest-tap-htmlmatrix-perl/current/example.pl
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-tap-htmlmatrix-perl/current/example.pl?rev=21514&op=file
==============================================================================
--- branches/upstream/libtest-tap-htmlmatrix-perl/current/example.pl (added)
+++ branches/upstream/libtest-tap-htmlmatrix-perl/current/example.pl Sun Jun 15 15:38:48 2008
@@ -1,0 +1,17 @@
+#!/usr/bin/perl
+
+use Test::TAP::HTMLMatrix;
+use Test::TAP::Model::Visual;
+
+my $model = Test::TAP::Model::Visual->new_with_tests(glob("t/*.t"));
+
+open STDOUT, ">", "example.html"; #"|xmllint --noblanks -> example.html" or die "couldn't pipe to xmllint";
+
+my $v = Test::TAP::HTMLMatrix->new($model);
+
+$v->has_inline_css(1);
+
+print "$v";
+
+print STDERR "open example.html\n";
+
Added: branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/HTMLMatrix.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/HTMLMatrix.pm?rev=21514&op=file
==============================================================================
--- branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/HTMLMatrix.pm (added)
+++ branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/HTMLMatrix.pm Sun Jun 15 15:38:48 2008
@@ -1,0 +1,263 @@
+#!/usr/bin/perl
+
+package Test::TAP::HTMLMatrix;
+use fields qw/model extra petal has_inline_css/;
+
+use strict;
+use warnings;
+
+use Test::TAP::Model::Visual;
+use Petal;
+use Carp qw/croak/;
+use File::Spec;
+use URI::file;
+
+use overload '""' => "html";
+
+our $VERSION = "0.04";
+
+sub new {
+ my $pkg = shift;
+
+ my $model = shift || croak "must supply a model to graph";
+
+ my __PACKAGE__ $self = $pkg->fields::new;
+
+ my $ext = shift;
+ my $petal = shift || Petal->new(
+ file => File::Spec->abs2rel($self->template_file), # damn petal requires rel path
+ input => "XHTML",
+ output => "XHTML",
+
+ encode_charset => "utf8",
+ decode_charset => "utf8",
+ );
+
+ $self->model($model);
+ $self->extra($ext);
+ $self->petal($petal);
+
+ $self;
+}
+
+sub title { "TAP Matrix - " . gmtime() . " GMT" }
+
+sub tests {
+ my $self = shift;
+ [ sort { $a->name cmp $b->name } $self->model->test_files ];
+}
+
+sub model {
+ my __PACKAGE__ $self = shift;
+ $self->{model} = shift if @_;
+ $self->{model};
+}
+
+sub extra {
+ my __PACKAGE__ $self = shift;
+ $self->{extra} = shift if @_;
+ $self->{extra};
+}
+
+sub petal {
+ my __PACKAGE__ $self = shift;
+ $self->{petal} = shift if @_;
+ $self->{petal};
+}
+
+sub html {
+ my __PACKAGE__ $self = shift;
+ $self->{petal}->process(page => $self);
+}
+
+sub _find_in_INC {
+ my $self = shift;
+ my $file = shift;
+
+ foreach my $str (grep { not ref } @INC){
+ my $target = File::Spec->catfile($str, $file);
+ return $target if -e $target;
+ }
+
+ die "couldn't find $file in \@INC";
+}
+
+sub _find_in_my_INC {
+ my $self = shift;
+ $self->_find_in_INC(File::Spec->catfile(split("::", __PACKAGE__), shift));
+}
+
+sub template_file {
+ my $self = shift;
+ $self->_find_in_my_INC("template.html");
+}
+
+sub css_file {
+ my $self = shift;
+ $self->_find_in_my_INC("htmlmatrix.css");
+}
+
+sub css_uri {
+ my $self = shift;
+ URI::file->new($self->css_file);
+}
+
+sub has_inline_css {
+ my $self = shift;
+ $self->{has_inline_css} = shift if @_;
+ $self->{has_inline_css};
+}
+
+sub _slurp_css {
+ my $self = shift;
+ local $/;
+ open my $fh, $self->css_file or die "open: " . $self->css_file. ": $!";
+ <$fh>;
+}
+
+sub inline_css {
+ my $self = shift;
+ "\n<!--\n" . $self->_slurp_css . "-->/\n";
+}
+
+__PACKAGE__
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Test::TAP::HTMLMatrix - Creates colorful matrix of L<Test::Harness>
+friendly test run results using L<Test::TAP::Model>.
+
+=head1 SYNOPSIS
+
+ use Test::TAP::HTMLMatrix;
+ use Test::TAP::Model::Visual;
+
+ my $model = Test::TAP::Model::Visual->new(...);
+
+ my $v = Test::TAP::HTMLMatrix->new($model);
+
+ print $v->html;
+
+=head1 DESCRIPTION
+
+This module is a wrapper for a template and some visualization classes, that
+knows to take a L<Test::TAP::Model> object, which encapsulates test results,
+and produce a pretty html file.
+
+=head1 METHODS
+
+=over 4
+
+=item new ($model, $?extra, $?petal)
+
+$model is the L<Test::TAP::Model> object to extract results from, and the
+optional $?extra is a string to put in <pre></pre> at the top.
+
+$petal is an optional templater object. If you are not happy with the default
+template, you can use this. Read the source to see how it's processed.
+
+=item html
+
+Returns an HTML string.
+
+This is also the method implementing stringification.
+
+=item model
+
+=item extra
+
+=item petal
+
+Just settergetters. You can override these for added fun.
+
+=item title
+
+A reasonable title for the page:
+
+ "TAP Matrix - <gmtime>"
+
+=item tests
+
+A sorted array ref, resulting from $self->model->test_files;
+
+=item template_file
+
+=item css_file
+
+These return the full path to the L<Petal> template and the CSS stylesheet it
+uses.
+
+Note that these are taken from @INC. If you put F<template.html> under
+C< catfile(qw/Test TAP HTMLMatrix/) > somewhere in your @INC, it should find it
+like you'd expect.
+
+=item css_uri
+
+This is a L<URI::file> object based on C<css_file>. Nothing fancy.
+
+You probably want to override this to something more specific to your env.
+
+=item has_inline_css ?$new_value
+
+This accessor controls whether inline CSS will be generated instead of C<<
+<link> >> style stylesheet refs.
+
+=item inline_css
+
+Returns the contents of C<css_file> fudged slightly to work inside C<< <style>
+>> tags.
+
+=back
+
+=head1 AUTHORS
+
+This list was generated from svn log testgraph.pl and testgraph.css in the pugs
+repo, sorted by last name.
+
+=over 4
+
+=item *
+
+Michal Jurosz
+
+=item *
+
+Yuval Kogman <nothingmuch at woobling.org> NUFFIN
+
+=item *
+
+Max Maischein <corion at cpan.org> CORION
+
+=item *
+
+James Mastros <james at mastros.biz> JMASTROS
+
+=item *
+
+Scott McWhirter <scott-cpan at NOSPAMkungfuftr.com> KUNGFUFTR
+
+=item *
+
+putter (svn handle)
+
+=item *
+
+Autrijs Tang <autrijus at autrjius.org> AUTRIJUS
+
+=item *
+
+Gaal Yahas <gaal at forum2.org> GAAL
+
+=back
+
+=head1 COPYRIGHT & LICNESE
+
+ Copyright (c) 2005 the aforementioned authors. All rights
+ reserved. This program is free software; you can redistribute
+ it and/or modify it under the same terms as Perl itself.
+
+=cut
Added: branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/HTMLMatrix/htmlmatrix.css
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/HTMLMatrix/htmlmatrix.css?rev=21514&op=file
==============================================================================
--- branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/HTMLMatrix/htmlmatrix.css (added)
+++ branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/HTMLMatrix/htmlmatrix.css Sun Jun 15 15:38:48 2008
@@ -1,0 +1,66 @@
+body {
+ font-family: Verdana, Arial, Helvetica, Tahoma;
+ font-size: small;
+ background-color: #EFEFEF;
+}
+
+a { color: #000066; text-decoration: none; font-style: italic; }
+
+/* has to do with div style tooltips: div { display: none; } */
+
+/* FIXME - make the spacing of the little cells prettier. This is a start:
+table.m td { padding: 0; margin: 2px; }
+table.m { margin: 0; margin-bottom: 2px; border-spacing: 2px 0; empty-cells: hide }
+*/
+
+#matrix {
+ border-collapse: collapse;
+ border: 1px solid #444444;
+ background-color: #dddddd;
+}
+
+th, tfoot td {
+ border: 1px solid #444444;
+ font-weight: bold;
+ font-size: 1em;
+ color: black
+ text-align: center;
+ vertical-algin: middle;
+ background-color: #efefef;
+}
+
+.td {
+ padding: 0.2em;
+}
+
+.x {
+ display: table-cell;
+ /* width: 4000em; */
+ white-space: nowrap;
+ overflow: hidden;
+ border: 1px solid #444444;
+}
+.x a { display: block; text-decoration: none;}
+/* again, div style tooltips: .x a div { display: none; font-weight: bold; color: #336699; font-style: none;}
+.x a:visited div { display: none }
+.x a:hover div { display: block; position: absolute; background-color: #BBBBBB; border: 1px solid #444444; left: 2em; padding: 5px; } */
+
+.r, .x { color: black; border: 1px solid #505050; }
+.sum { width: 1em; text-align: right; }
+.sum, .r {
+ border: 1px solid #505050;
+ padding: 0px;
+}
+.sum, .r, .ok {
+ text-align: center;
+ font-weight: bold;
+ font-size: 0.85em;
+ padding: 0.1em;
+}
+
+.f { background-color: #ff3020; }
+.p { background-color: #00ff00; }
+.sk { background-color: #ddffdd; }
+.u { background-color: #ffdd20; color: white; }
+.t { background-color: #007f00; color: white; }
+.nottest { background-color: #7f7f7f; color: white ; }
Added: branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/HTMLMatrix/template.html
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/HTMLMatrix/template.html?rev=21514&op=file
==============================================================================
--- branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/HTMLMatrix/template.html (added)
+++ branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/HTMLMatrix/template.html Sun Jun 15 15:38:48 2008
@@ -1,0 +1,52 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xml:lang="en" lang = "en" xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title petal:content="page/title">TAP Matrix</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <link petal:omit-tag="page/has_inline_css" rel="stylesheet" petal:attr="href page/css_uri" type="text/css" />
+ <style petal:cond="page/has_inline_css" petal:content="structure page/inline_css" type="text/css" />
+ </head>
+ <body>
+
+ <pre petal:condition="page/extra" petal:content="page/extra" />
+
+ <table id="matrix" petal:attr="summary page/model/summary">
+ <colgroup span="2" />
+ <colgroup span="1" />
+ <colgroup span="1" />
+ <thead>
+ <tr>
+ <th class="r" colspan="2">Test file</th>
+ <th class="r">Test cases</th>
+ <th class="r">%</th>
+ </tr>
+ </thead>
+ <tfoot>
+ <tr>
+ <td class="r">TOTAL</td>
+ <td class="r">
+ <span petal:replace="page/model/test_files">f</span> files
+ </td>
+ <td class="r" petal:contents="page/model/summary" />
+ <td class="x sum" petal:attr="style page/model/color_css" petal:content="page/model/total_percentage">100%</td>
+ </tr>
+ </tfoot>
+ <tr petal:repeat="test page/tests">
+ <td><a petal:attr="href test/link" petal:content="test/name">foo</a></td>
+ <td class="ok" petal:content="test/str_status">OK</td>
+ <td>
+ <table petal:repeat="case_row test/case_rows" width="100%" summary="individual subtests">
+ <tr>
+ <td petal:repeat="case case_row/cases" petal:attr="class case/css_class">
+ <a petal:attr="href case/link; title case/popup" petal:content="structure string:&#160\;" />
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td class="x sum" petal:attr="style test/color_css" petal:content="test/percentage">100%</td>
+ </tr>
+ </table>
+
+ </body>
+</html>
Added: branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/Model/Colorful.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/Model/Colorful.pm?rev=21514&op=file
==============================================================================
--- branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/Model/Colorful.pm (added)
+++ branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/Model/Colorful.pm Sun Jun 15 15:38:48 2008
@@ -1,0 +1,60 @@
+#!/usr/bin/perl
+
+package Test::TAP::Model::Colorful;
+
+use strict;
+use warnings;
+
+sub color {
+ my $self = shift;
+
+ my $ratio = $self->ratio;
+
+ my $l= 100;
+ if ($ratio == 1){
+ return "#00ff00";
+ } else {
+ return sprintf("#ff%02x%02x", $l + ((255 - $l) * $ratio), $l-20);
+ }
+}
+
+sub color_css {
+ my $self = shift;
+ return "background-color: " . $self->color;
+}
+
+__PACKAGE__
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Test::TAP::Model::Colorful - Creates color from something that
+knows it's success ratio.
+
+=head1 SYNOPSIS
+
+ See template
+
+=head1 DESCRIPTION
+
+Provides methods that are used to color the test matrix.
+
+=head1 METHODS
+
+=over 4
+
+=item color
+
+A string in hex format (C<#xxxxxx>) corresponding to an RGB color representing
+the ratio or success.
+
+=item color_css
+
+Wraps the color in a C<background-color: %s>.
+
+=back
+
+=cut
Added: branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/Model/File/Visual.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/Model/File/Visual.pm?rev=21514&op=file
==============================================================================
--- branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/Model/File/Visual.pm (added)
+++ branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/Model/File/Visual.pm Sun Jun 15 15:38:48 2008
@@ -1,0 +1,93 @@
+#!/usr/bin/perl
+
+package Test::TAP::Model::File::Visual;
+use base qw/Test::TAP::Model::File Test::TAP::Model::Colorful/;
+
+use strict;
+use warnings;
+
+use Test::TAP::Model::Subtest::Visual;
+use URI::file;
+
+sub subtest_class { "Test::TAP::Model::Subtest::Visual" }
+
+sub str_status {
+ my $self = shift;
+ return "SKIPPED" if $self->skipped;
+ return "BAILED OUT" if $self->bailed_out;
+
+ return "OK"
+ if $self->ok
+ and $self->actual_cases == $self->planned
+ and $self->actual_cases > 0;
+
+ return "FAILED";
+}
+
+sub link { URI::file->new($_[0]->name) }
+
+sub case_rows {
+ my $self = shift;
+ my @cases = $self->cases;
+ my @ret;
+
+ my $rows = int(.9 + @cases / 50) || 1;
+ my $per_row = int(.9 + @cases / $rows);
+
+ push @ret, { cases => [ splice(@cases, 0, $per_row) ] } while @cases;
+
+ \@ret;
+}
+
+__PACKAGE__
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Test::TAP::Model::File::Visual - A test file with additional display oriented
+methods.
+
+=head1 SYNOPSIS
+
+ See the template.
+
+=head1 DESCRIPTION
+
+This module is a subclass of L<Test::TAP::Model::File> that provides some
+methods that ease display.
+
+It also inherits from L<Test::TAP::Model::Colorful>, which
+provides additional methods.
+
+=head1 METHODS
+
+=over 4
+
+=item str_status
+
+A string, "OK" or "FAILED"
+
+=item link
+
+Just the name of the test. Should be overridden to contain a proper path.
+
+=item case_rows
+
+The test's test cases, split into rows close to 50 elements in size.
+
+The structure returned is:
+
+
+ [ { cases => [ case, case, ... ] }, { cases => [ ... ] }, ... ];
+
+=item subtest_class
+
+This method overrides L<Test::TAP::Model::File/subtest_class> to return
+L<Test::TAP::Model::Subtest::Visual>.
+
+=back
+
+=cut
Added: branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/Model/Subtest/Visual.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/Model/Subtest/Visual.pm?rev=21514&op=file
==============================================================================
--- branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/Model/Subtest/Visual.pm (added)
+++ branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/Model/Subtest/Visual.pm Sun Jun 15 15:38:48 2008
@@ -1,0 +1,84 @@
+#!/usr/bin/perl
+
+package Test::TAP::Model::Subtest::Visual;
+use base qw/Test::TAP::Model::Subtest/;
+
+use strict;
+use warnings;
+
+use URI;
+use URI::file;
+
+sub css_class {
+ my $self = shift;
+ return "x sk" if $self->skipped;
+
+ my $todo = $self->todo;
+
+ "x " .
+ ($self->actual_ok
+ ? ( $todo ? "u" : "p" )
+ : ( $todo ? "t" : "f" ))
+}
+
+sub popup {
+ my $self = shift;
+ my $text = join("\n", $self->line, $self->diag);
+
+ { chomp $text and redo };
+
+ $text;
+}
+
+sub link {
+ my $self = shift;
+ my $file = $self->test_file;
+ return URI->new("#") unless $file;
+
+ my $uri = URI::file->new($file);
+ $_ and $uri->fragment("line_$_") for $self->test_line;
+
+ return $uri;
+}
+
+__PACKAGE__
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Test::TAP::Model::Subtest::Visual - A subtest with additional display oriented
+methods.
+
+=head1 SYNOPSIS
+
+ See template
+
+=head1 DESCRIPTION
+
+This object knows is used by the template to display per case cells, with a
+class, and a link, and a tooltip.
+
+=head1 METHODS
+
+=over 4
+
+=item css_class
+
+The correct css class for a case as defined in F<testgraph.css>.
+
+=item popup
+
+A concatenation of the test line and it's diagnosis, used for tooltips.
+
+=item link
+
+Extracted from the pos:
+
+ $file#line_$line
+
+=back
+
+=cut
Added: branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/Model/Visual.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/Model/Visual.pm?rev=21514&op=file
==============================================================================
--- branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/Model/Visual.pm (added)
+++ branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/Model/Visual.pm Sun Jun 15 15:38:48 2008
@@ -1,0 +1,57 @@
+#!/usr/bin/perl
+
+package Test::TAP::Model::Visual;
+use base qw/Test::TAP::Model Test::TAP::Model::Colorful/;
+
+use strict;
+use warnings;
+
+use Test::TAP::Model::File::Visual;
+
+sub file_class { "Test::TAP::Model::File::Visual" }
+
+sub summary {
+ my $self = shift;
+ $self->{_summar} ||=
+ sprintf "%d test cases: %d ok, %d failed, %d todo, "
+ ."%d skipped and %d unexpectedly succeeded",
+ map { my $m = "total_$_"; $self->$m }
+ qw/seen passed failed todo skipped unexpectedly_succeeded/;
+}
+
+__PACKAGE__
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Test::TAP::Model::Visual - A result set that will create ::Visual children, and
+knows it's color.
+
+=head1 SYNOPSIS
+
+ See template
+
+=head1 DESCRIPTION
+
+It inherits from L<Test::TAP::Model::Colorful>. That's about it.
+
+=head1 METHODS
+
+=over 4
+
+=item file_class
+
+This is actually the only functionality. This method is overridden to return
+L<Test::TAP::Model::File::Visual>. See L<Test::TAP::Model/file_class> for
+details.
+
+=item summary
+
+A nice little textual summary about the result of the entire test run.
+
+=back
+
+=cut
Added: branches/upstream/libtest-tap-htmlmatrix-perl/current/t/00_dist.t
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-tap-htmlmatrix-perl/current/t/00_dist.t?rev=21514&op=file
==============================================================================
--- branches/upstream/libtest-tap-htmlmatrix-perl/current/t/00_dist.t (added)
+++ branches/upstream/libtest-tap-htmlmatrix-perl/current/t/00_dist.t Sun Jun 15 15:38:48 2008
@@ -1,0 +1,12 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More;
+
+BEGIN {
+ eval "use Test::Distribution not => 'description'";
+ plan skip_all => "Test::Distribution must be installed" if $@;
+}
+
Added: branches/upstream/libtest-tap-htmlmatrix-perl/current/t/basic.t
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-tap-htmlmatrix-perl/current/t/basic.t?rev=21514&op=file
==============================================================================
--- branches/upstream/libtest-tap-htmlmatrix-perl/current/t/basic.t (added)
+++ branches/upstream/libtest-tap-htmlmatrix-perl/current/t/basic.t Sun Jun 15 15:38:48 2008
@@ -1,0 +1,23 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 6;
+
+
+my $m;
+BEGIN { use_ok($m = "Test::TAP::HTMLMatrix") }
+
+use Test::TAP::Model::Visual;
+my $r = Test::TAP::Model::Visual->new;
+
+isa_ok(my $v = $m->new($r), $m);
+
+can_ok($v, "html");
+
+can_ok($v, "petal");
+isa_ok($v->petal, "Petal");
+
+can_ok($v, "extra");
+
Added: branches/upstream/libtest-tap-htmlmatrix-perl/current/t/colorful.t
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-tap-htmlmatrix-perl/current/t/colorful.t?rev=21514&op=file
==============================================================================
--- branches/upstream/libtest-tap-htmlmatrix-perl/current/t/colorful.t (added)
+++ branches/upstream/libtest-tap-htmlmatrix-perl/current/t/colorful.t Sun Jun 15 15:38:48 2008
@@ -1,0 +1,32 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 6;
+
+my $m;
+BEGIN { use_ok($m = "Test::TAP::Model::Colorful") }
+
+my $ratio;
+{
+ package Foo;
+ use base $m;
+
+ sub ratio { $ratio }
+}
+
+
+can_ok($m, "color");
+
+$ratio = 0.5;
+
+like(Foo->color, qr/^#.{6}$/, "format is sane");
+
+$ratio = 1;
+
+like(Foo->color, qr/^#00ff00$/i, "ratio 1 -> green");
+
+can_ok($m, "color_css");
+
+like(Foo->color_css, qr/^\s*background-color:\s+#.{6}\s*$/, "css looks valid");
Added: branches/upstream/libtest-tap-htmlmatrix-perl/current/t/file_visual.t
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-tap-htmlmatrix-perl/current/t/file_visual.t?rev=21514&op=file
==============================================================================
--- branches/upstream/libtest-tap-htmlmatrix-perl/current/t/file_visual.t (added)
+++ branches/upstream/libtest-tap-htmlmatrix-perl/current/t/file_visual.t Sun Jun 15 15:38:48 2008
@@ -1,0 +1,55 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 15;
+
+my $m;
+
+BEGIN { use_ok($m = "Test::TAP::Model::File::Visual") }
+
+isa_ok((bless {}, $m), "Test::TAP::Model::Colorful");
+isa_ok((bless {}, $m), "Test::TAP::Model::File");
+
+can_ok($m, "subtest_class");
+like($m->subtest_class, qr/::Visual$/, "it's visual");
+
+can_ok($m, "link");
+can_ok($m, "case_rows");
+
+can_ok($m, "str_status");
+
+my $f= $m->new(my $r = {
+ file => "foo",
+});
+
+$r->{results}{max} = 1;
+$r->{results}{passing} = 1;
+$r->{results}{seen} = 1;
+is($f->str_status, "OK", "seen + ok = OK");
+
+$r->{results}{max} = 2;
+is($f->str_status, "FAILED", "seen != planned = FAILED");
+
+$r->{results}{max} = 1;
+$r->{results}{seen} = 0;
+is($f->str_status, "FAILED", "no tests + ok = FAILED");
+
+$r->{results}{passing} = 0;
+$r->{results}{seen} = 1;
+is($f->str_status, "FAILED", "seen + fail = FAILED");
+
+$r->{results}{passing} = 1;
+$r->{events}[0]{type} = "bailout";
+is($f->str_status, "BAILED OUT", "seen + ok + bailout = BAILED OUT");
+
+$r->{results}{passing} = 1;
+$r->{results}{skip_all} = "foo";
+$r->{events} = [];
+is($f->str_status, "SKIPPED", "seen + ok + skip_all = SKIPPED");
+
+$r->{results}{seen} = 0;
+$r->{results}{skip_all} = "foo";
+is($f->str_status, "SKIPPED", "no seen + ok + skip_all = SKIPPED");
+
Added: branches/upstream/libtest-tap-htmlmatrix-perl/current/t/model_visual.t
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-tap-htmlmatrix-perl/current/t/model_visual.t?rev=21514&op=file
==============================================================================
--- branches/upstream/libtest-tap-htmlmatrix-perl/current/t/model_visual.t (added)
+++ branches/upstream/libtest-tap-htmlmatrix-perl/current/t/model_visual.t Sun Jun 15 15:38:48 2008
@@ -1,0 +1,19 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 6;
+
+my $m;
+
+BEGIN { use_ok($m = "Test::TAP::Model::Visual") }
+
+isa_ok((bless {}, $m), "Test::TAP::Model::Colorful");
+isa_ok((bless {}, $m), "Test::TAP::Model");
+
+can_ok($m, "file_class");
+like($m->file_class, qr/::Visual$/, "it's visual");
+
+can_ok($m, "summary");
+
Added: branches/upstream/libtest-tap-htmlmatrix-perl/current/t/paths.t
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-tap-htmlmatrix-perl/current/t/paths.t?rev=21514&op=file
==============================================================================
--- branches/upstream/libtest-tap-htmlmatrix-perl/current/t/paths.t (added)
+++ branches/upstream/libtest-tap-htmlmatrix-perl/current/t/paths.t Sun Jun 15 15:38:48 2008
@@ -1,0 +1,24 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 7;
+
+use File::Spec;
+
+my $m;
+BEGIN { use_ok($m = "Test::TAP::HTMLMatrix") }
+
+my $template = $m->template_file;
+
+ok(-e $template, "template file exists");
+like($template, qr/template\.html$/, "name looks OK");
+ok(File::Spec->file_name_is_absolute($template), "abs path");
+
+my $css = $m->css_file;
+
+ok(-e $css, "css file exists");
+like($css, qr/htmlmatrix\.css$/, "name looks OK");
+ok(File::Spec->file_name_is_absolute($css), "abs path");
+
Added: branches/upstream/libtest-tap-htmlmatrix-perl/current/t/subtest_visual.t
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-tap-htmlmatrix-perl/current/t/subtest_visual.t?rev=21514&op=file
==============================================================================
--- branches/upstream/libtest-tap-htmlmatrix-perl/current/t/subtest_visual.t (added)
+++ branches/upstream/libtest-tap-htmlmatrix-perl/current/t/subtest_visual.t Sun Jun 15 15:38:48 2008
@@ -1,0 +1,16 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 4;
+
+my $m;
+
+BEGIN { use_ok($m = "Test::TAP::Model::Subtest::Visual") }
+
+isa_ok((bless {}, $m), "Test::TAP::Model::Subtest");
+
+can_ok($m, "link");
+can_ok($m, "css_class");
+
Added: branches/upstream/libtest-tap-htmlmatrix-perl/current/t/templ_output.t
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-tap-htmlmatrix-perl/current/t/templ_output.t?rev=21514&op=file
==============================================================================
--- branches/upstream/libtest-tap-htmlmatrix-perl/current/t/templ_output.t (added)
+++ branches/upstream/libtest-tap-htmlmatrix-perl/current/t/templ_output.t Sun Jun 15 15:38:48 2008
@@ -1,0 +1,49 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 14;
+
+use Test::TAP::Model::Visual;
+
+# TODO
+# use some kind of XML test module (They were all veeerrry slow)
+
+my $m;
+BEGIN { use_ok($m = "Test::TAP::HTMLMatrix") }
+
+my $s = Test::TAP::Model::Visual->new;
+
+my $f = $s->start_file("foo");
+eval { $f->{results} = { $s->analyze("foo", [split /\n/, <<TAP]) } };
+1..6
+ok 1 foo
+not ok 2 bar
+ok 3 gorch # skip foo
+ok 4 # TODO bah
+not ok 5 # TODO ding
+Bail out!
+TAP
+
+isa_ok(my $t = $m->new($s, "extra"), $m);
+
+my $html = "$t";
+
+like($html, qr{<html.*/html>}s, "has <html> tags");
+
+like($html, qr/ok 1 foo/, "contains subtest 1 line");
+like($html, qr/not ok 2 bar/, "subtest 2 line");
+like($html, qr/ok 3 gorch/, "subtest 3 line");
+
+like($html, qr/66.6\d%/, "contains percentage");
+
+like($html, qr/BAILED OUT/, "something bailed out in there");
+
+like($html, qr/4\s+ok/is, "ok summary");
+like($html, qr/2\s+failed/is, "contains fail summary");
+like($html, qr/1\s+skipped/is, "contains skip summary");
+like($html, qr/2\s+todo/is, "contains skip summary");
+like($html, qr/1\s+unexpectedly\s+succeeded/is, "contains skip summary");
+
+like($html, qr/6/, "the number 6 is mentioned, that was our plan");
Added: branches/upstream/libtest-tap-htmlmatrix-perl/current/t/uri.t
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-tap-htmlmatrix-perl/current/t/uri.t?rev=21514&op=file
==============================================================================
--- branches/upstream/libtest-tap-htmlmatrix-perl/current/t/uri.t (added)
+++ branches/upstream/libtest-tap-htmlmatrix-perl/current/t/uri.t Sun Jun 15 15:38:48 2008
@@ -1,0 +1,47 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 12;
+
+my ($f, $s);
+
+BEGIN {
+ use_ok($f = "Test::TAP::Model::File::Visual");
+ use_ok($s = "Test::TAP::Model::Subtest::Visual");
+}
+
+my ($ef, $es) = ("foo/bar.txt", "foo/bar.txt#line_4");
+
+my %cases = (
+ darwin => {
+ file => "foo/bar.txt",
+ subtest => "file foo/bar.txt line 4",
+ },
+ win32 => {
+ file => "foo\\bar.txt",
+ subtest => "file foo\\bar.txt line 4",
+ },
+);
+
+foreach $^O (keys %cases){
+ my $file = $f->new({
+ file => $cases{$^O}{file},
+ });
+
+ isa_ok($file->link, "URI::file", "file link");
+ is($file->link, $ef, "file link on $^O");
+
+
+ my $subtest = $s->new({
+ type => "test",
+ pos => $cases{$^O}{subtest},
+ });
+
+ isa_ok($subtest->link, "URI::file", "subtest link");
+ is(my $l = $subtest->link, $es, "subtest link on $^O");
+
+ is($l->fragment, "line_4", "fragment looks good");
+}
+
More information about the Pkg-perl-cvs-commits
mailing list