]> git.imager.perl.org - imager.git/blob - t/t07iolayer.t
added has_chars() method to Imager::Font::FreeType2
[imager.git] / t / t07iolayer.t
1 BEGIN { $|=1; print "1..7\n"; }
2 END { print "not ok 1\n" unless $loaded; };
3 use Imager qw(:all);
4 ++$loaded;
5 print "ok 1\n";
6 init_log("testout/t07iolayer.log", 1);
7
8
9 undef($/);
10 # start by testing io buffer
11
12 $data="P2\n2 2\n255\n 255 0\n0 255\n";
13 $IO = Imager::io_new_buffer($data);
14 $im = Imager::i_readpnm_wiol($IO, -1);
15
16 print "ok 2\n";
17
18
19 open(FH, ">testout/t07.ppm") or die $!;
20 binmode(FH);
21 $fd = fileno(FH);
22 $IO2 = Imager::io_new_fd( $fd );
23 Imager::i_writeppm_wiol($im, $IO2);
24 close(FH);
25 undef($im);
26
27
28
29 open(FH, "<testimg/penguin-base.ppm");
30 binmode(FH);
31 $data = <FH>;
32 close(FH);
33 $IO3 = Imager::io_new_buffer($data);
34 #undef($data);
35 $im = Imager::i_readpnm_wiol($IO3, -1);
36
37 print "ok 3\n";
38
39
40 open(FH, "<testimg/penguin-base.ppm") or die $!;
41 binmode(FH);
42 $fd = fileno(FH);
43 $IO4 = Imager::io_new_fd( $fd );
44 $im2 = Imager::i_readpnm_wiol($IO4, -1);
45 close(FH);
46 undef($IO4);
47
48 print "ok 4\n";
49
50 Imager::i_img_diff($im, $im2) ? print "not ok 5\n" : print "ok 5\n";
51 undef($im2);
52
53
54 $IO5 = Imager::io_new_bufchain();
55 Imager::i_writeppm_wiol($im, $IO5);
56 $data2 = Imager::io_slurp($IO5);
57 undef($IO5);
58
59 print "ok 6\n";
60
61 $IO6 = Imager::io_new_buffer($data2);
62 $im3 = Imager::i_readpnm_wiol($IO6, -1);
63
64 Imager::i_img_diff($im, $im3) ? print "not ok 7\n" : print "ok 7\n";
65
66
67
68