line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Image::Plugin::TestingImage; |
2
|
|
|
|
|
|
|
|
3
|
12
|
|
|
12
|
|
1131
|
use strict; |
|
12
|
|
|
|
|
25
|
|
|
12
|
|
|
|
|
4407
|
|
4
|
|
|
|
|
|
|
# use warnings; # I want this to work with old perls! |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = "0.01"; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Test::Image::Plugin::TestingImage - for testing only |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
use Test::Image; |
15
|
|
|
|
|
|
|
my $red = [255,0,0]; |
16
|
|
|
|
|
|
|
my $green = [0,255,0]; |
17
|
|
|
|
|
|
|
my $white = [255,255,255]; |
18
|
|
|
|
|
|
|
test_image([ |
19
|
|
|
|
|
|
|
[ $red, $red, $white, $white, $green, $green ], |
20
|
|
|
|
|
|
|
[ $red, $red, $white, $white, $green, $green ], |
21
|
|
|
|
|
|
|
[ $red, $red, $white, $white, $green, $green ], |
22
|
|
|
|
|
|
|
]); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 DESCRIPTION |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
This is an image designed for testing. This defines the standard |
27
|
|
|
|
|
|
|
method that you need to implement in order to provide an image. |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=over |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=item new |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=item width |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=item height |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=item color_at($x,$y) |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=back |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
See L for more details of what these should do. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub new { |
46
|
4
|
|
|
4
|
1
|
4943
|
my $class = shift; |
47
|
4
|
|
|
|
|
7
|
my $image = shift; |
48
|
4
|
100
|
100
|
|
|
35
|
return undef unless ref $image && ref $image eq "ARRAY"; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
1
|
|
|
|
|
3
|
return bless { |
52
|
|
|
|
|
|
|
image => $image, |
53
|
1
|
|
|
|
|
6
|
width => scalar(@{ $image->[0] }), |
54
|
1
|
|
|
|
|
1
|
height => scalar(@{ $image }), |
55
|
|
|
|
|
|
|
}, $class; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
1
|
|
|
1
|
1
|
7
|
sub width { $_[0]->{width} } |
59
|
1
|
|
|
1
|
1
|
6
|
sub height { $_[0]->{height} } |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub color_at { |
62
|
20
|
|
|
20
|
1
|
37
|
my $self = shift; |
63
|
20
|
|
|
|
|
32
|
my $image = $self->{image}; |
64
|
|
|
|
|
|
|
|
65
|
20
|
|
|
|
|
29
|
my $x = shift; |
66
|
20
|
|
|
|
|
22
|
my $y = shift; |
67
|
|
|
|
|
|
|
|
68
|
20
|
50
|
|
|
|
90
|
die "'$x' not a valid value for x" |
69
|
|
|
|
|
|
|
unless $x =~ /^\d+$/; |
70
|
|
|
|
|
|
|
|
71
|
20
|
50
|
|
|
|
69
|
die "'$y' not a valid value for y" |
72
|
|
|
|
|
|
|
unless $y =~ /^\d+$/; |
73
|
|
|
|
|
|
|
|
74
|
20
|
100
|
|
|
|
64
|
return unless $self->{image}->[$y][$x]; |
75
|
18
|
|
|
|
|
20
|
return @{ $self->{image}->[$y][$x] }; |
|
18
|
|
|
|
|
107
|
|
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 BUGS |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
None known. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Please report any bugs you find via the CPAN RT system. |
83
|
|
|
|
|
|
|
L |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 AUTHOR |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Written by Mark Fowler, Emark@twoshortplanks.comE. Please see |
88
|
|
|
|
|
|
|
L for details of how to contact me. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Copyright Fotango 2006. All rights reserved. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or modify it under |
93
|
|
|
|
|
|
|
the same terms as Perl itself. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 SEE ALSO |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=cut |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
1; |
102
|
|
|
|
|
|
|
|