Test::TAP::Model::Subtest::Visual - A subtest with additional display oriented


Test-TAP-HTMLMatrix documentation Contained in the Test-TAP-HTMLMatrix distribution.

Index


Code Index:

NAME

Top

Test::TAP::Model::Subtest::Visual - A subtest with additional display oriented methods.

SYNOPSIS

Top

	See template

DESCRIPTION

Top

This object knows is used by the template to display per case cells, with a class, and a link, and a tooltip.

METHODS

Top

css_class

The correct css class for a case as defined in testgraph.css.

A concatenation of the test line and it's diagnosis, used for tooltips.

Extracted from the pos:

	$file#line_$line


Test-TAP-HTMLMatrix documentation Contained in the Test-TAP-HTMLMatrix distribution.

#!/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__