Debian Codegraph @

t/stringify.t

raw symbols SCIP
1 use strictscip-perl cpan Image-Scale 0.14 strict/;
2
3 use File::Pathscip-perl cpan Image-Scale 0.14 File/Path/ ();
4 use File::Spec::Functionsscip-perl cpan Image-Scale 0.14 File/Spec/Functions/;
5 use FindBinscip-perl cpan Image-Scale 0.14 FindBin/ ();
6 use Test::Morescip-perl cpan Image-Scale 0.14 Test/More/;
7
8 use Image::Scalescip-perl cpan Image-Scale 0.14 Image/Scale/;
9
10 eval { requirescip-perl cpan Image-Scale 0.14 main/require(). Path::Tiny };
11 if ( $@scip-perl cpan Image-Scale 0.14 main/`$@`. ) {
12 planscip-perl cpan Image-Scale 0.14 main/plan(). skip_all => 'Path::Tiny not installed';
13 }
14
15 planscip-perl cpan Image-Scale 0.14 main/plan(). tests => 3;
16
17 my $tmpdir = catdirscip-perl cpan Image-Scale 0.14 main/catdir().( $FindBin::Binscip-perl cpan Image-Scale 0.14 FindBin/$Bin., 'tmp' );
18 if ( -d $tmpdir ) {
19 File::Path::rmtreescip-perl cpan Image-Scale 0.14 File/Path/rmtree().($tmpdir);
20 }
21 mkdirscip-perl cpan Image-Scale 0.14 main/mkdir(). $tmpdir;
22
23 # Test Path::Tiny stringification
24 SKIP:
25 {
26 skipscip-perl cpan Image-Scale 0.14 main/skip(). "Image::Scale not built with libjpeg support", 2 unless Image::Scale->jpeg_versionscip-perl cpan Image-Scale 0.14 Image/Scale/jpeg_version().;
27
28 my $im = Image::Scale->newscip-perl cpan Image-Scale 0.14 Image/Scale/new().( Path::Tiny::pathscip-perl cpan Image-Scale 0.14 Path/Tiny/path().( _fscip-perl cpan Image-Scale 0.14 main/_f().("jpg/rgb.jpg") ) );
29 isscip-perl cpan Image-Scale 0.14 main/is().( $im->widthscip-perl cpan Image-Scale 0.14 Image/Scale/width()., 313, "Path::Tiny stringify in new() ok" );
30
31 $im->resize_gdscip-perl cpan Image-Scale 0.14 Image/Scale/resize_gd().( { width => 50, height => 50 } );
32
33 my $outjpg = _tmpscip-perl cpan Image-Scale 0.14 main/_tmp().("resized.jpg");
34 $im->save_jpegscip-perl cpan Image-Scale 0.14 Image/Scale/save_jpeg().( Path::Tiny::pathscip-perl cpan Image-Scale 0.14 Path/Tiny/path().($outjpg) );
35 okscip-perl cpan Image-Scale 0.14 main/ok().( -e $outjpg, 'Path::Tiny stringify in save_jpeg() ok' );
36 }
37
38 SKIP:
39 {
40 skipscip-perl cpan Image-Scale 0.14 main/skip(). "Image::Scale not built with libpng support", 1 unless Image::Scale->png_versionscip-perl cpan Image-Scale 0.14 Image/Scale/png_version().;
41
42 my $im = Image::Scale->newscip-perl cpan Image-Scale 0.14 Image/Scale/new().( _fscip-perl cpan Image-Scale 0.14 main/_f().("png/rgb.png") );
43
44 $im->resize_gdscip-perl cpan Image-Scale 0.14 Image/Scale/resize_gd().( { width => 50, height => 50 } );
45
46 my $outpng = _tmpscip-perl cpan Image-Scale 0.14 main/_tmp().("resized.png");
47 $im->save_pngscip-perl cpan Image-Scale 0.14 Image/Scale/save_png().( Path::Tiny::pathscip-perl cpan Image-Scale 0.14 Path/Tiny/path().($outpng) );
48 okscip-perl cpan Image-Scale 0.14 main/ok().( -e $outpng, 'Path::Tiny stringify in save_png() ok' );
49 }
50
51 sub _fscip-perl cpan Image-Scale 0.14 main/_f(). {
52 return catfilescip-perl cpan Image-Scale 0.14 main/catfile().( $FindBin::Binscip-perl cpan Image-Scale 0.14 FindBin/$Bin., 'images', shiftscip-perl cpan Image-Scale 0.14 main/shift(). );
53 }
54
55 sub _tmpscip-perl cpan Image-Scale 0.14 main/_tmp(). {
56 return catfilescip-perl cpan Image-Scale 0.14 main/catfile().( $tmpdir, shiftscip-perl cpan Image-Scale 0.14 main/shift(). );
57 }