SpriteBuilder/ImageDriver/Fake.pm

filter: Statementstmt 88.2% 30 / 34 Branchbran 66.6% 4 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 81.8% 9 / 11 Podpod 100% 8 / 8 totaltotal 86.4% 51 / 59 CC 4 SCAR 5.1
CC
4
Cov
85%
write
3.1
reset
2.0
extent
2.0
CRAP 1.7
« SpriteBuilder/ImageDriver/Common.pm ↑ Summary SpriteBuilder/ImageDriver/GD.pm »
1 package CSS::SpriteBuilder::ImageDriver::Fake;
2  
3 =head1 NAME
4  
5 CSS::SpriteBuilder::ImageDriver::Fake - Fake class.
6  
7 =cut
8  
9 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 4 ▶use base 'CSS::SpriteBuilder::ImageDriver::Common';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 6 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
14 6 my ($class, @args) = @_;
15  
16 6 my $self = $class->SUPER::new(
17 _width => 0,
18 _height => 0,
19 @args,
20 );
21  
22 6 return $self;
23 }
24  
25 24 ▶sub width { $_[0]->{_width} }
Subroutine width: called CC=1 SCAR=0.0
Pod documented
26 12 ▶sub height { $_[0]->{_height} }
Subroutine height: called CC=1 SCAR=0.0
Pod documented
27  
28 12 ▶sub reset {
Subroutine reset: called CC=2 SCAR=6.9
Pod documented
29 12 my ($self, $image) = @_;
30  
31 12 ▶ if ($image) {
Branch: 1 branch
BranchTrueFalseTotal
if ($image) { } 3 9 12
32 3 $self->{_width} = $image->width();
33 3 $self->{_height} = $image->height();
34 }
35 else {
36 9 $self->{_width} = $self->{_height} = 0;
37 }
38  
39 12 return;
40 }
41  
42 3 ▶sub read {
Subroutine read: called CC=1 SCAR=0.0
Pod documented
43 3 my ($self, $filename) = @_;
44  
45 3 $self->{_width} = $self->{_height} = 32;
46  
47 3 return;
48 }
49  
50 3 ▶sub write {
Subroutine write: called CC=3 SCAR=11.2
Pod documented
51 3 my ($self, $filename) = @_;
52  
53 3 ▶ open(my $fh, '>', $filename) or die "Failed to open file '$filename' due: $!";
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, ">", $filename or die "Failed to open file '${filename}' due: $!" 3 0 3
54 3 binmode $fh;
55 3 print $fh "Fake";
56 3 ▶ close $fh or die "Failed to close file '$filename' due: $!";
Branch: 1 branch
BranchTrueFalseTotal
close $fh or die "Failed to close file '${filename}' due: $!" 3 0 3
57  
58 3 return;
59 }
60  
61 0 ▶sub extent {
Subroutine extent: not called CC=1 SCAR=6.9
Pod documented
62 0 my ($self, $width, $height) = @_;
63  
64 0 $self->{_width} = $width;
65 0 $self->{_height} = $height;
66  
67 0 return;
68 }
69  
70 0 ▶sub composite {
Subroutine composite: not called CC=1 SCAR=0.0
Pod documented
71 #Nothing
72 }
73  
74 4 1;
« SpriteBuilder/ImageDriver/Common.pm ↑ Summary SpriteBuilder/ImageDriver/GD.pm »