File: | blib/lib/Image/Caa/DriverTest.pm |
Coverage: | 100.0% |
line | stmt | bran | cond | sub | time | code |
---|---|---|---|---|---|---|
1 | package Image::Caa::DriverTest; | |||||
2 | ||||||
3 | 1 1 1 | 4 1 8 | use strict; | |||
4 | 1 1 1 | 5 2 6 | use warnings; | |||
5 | ||||||
6 | sub new { | |||||
7 | 5 | 23 | my ($class, $args) = @_; | |||
8 | ||||||
9 | 5 | 18 | my $self = bless {}, $class; | |||
10 | ||||||
11 | 5 | 36 | return $self; | |||
12 | } | |||||
13 | ||||||
14 | sub init { | |||||
15 | 5 | 15 | my ($self) = @_; | |||
16 | ||||||
17 | 5 | 20 | $self->{color} = ''; | |||
18 | 5 | 19 | $self->{data} = {}; | |||
19 | 5 | 20 | $self->{buffer} = ''; | |||
20 | } | |||||
21 | ||||||
22 | sub set_color{ | |||||
23 | 20 | 62 | my ($self, $fg, $bg) = @_; | |||
24 | ||||||
25 | 20 | 76 | $self->{color} = "$fg:$bg"; | |||
26 | 20 | 97 | $self->{buffer} .= "($fg:$bg)"; | |||
27 | } | |||||
28 | ||||||
29 | sub putchar{ | |||||
30 | 20 | 66 | my ($self, $x, $y, $outch) = @_; | |||
31 | ||||||
32 | 20 | 125 | $self->{data}->{"$x,$y"} = "$self->{color}:$outch"; | |||
33 | 20 | 61 | $self->{buffer} .= $outch; | |||
34 | } | |||||
35 | ||||||
36 | sub fini { | |||||
37 | 5 | 34 | my ($self) = @_; | |||
38 | } | |||||
39 | ||||||
40 | 1; |