Home | History | Annotate | Download | only in t
      1 #!/usr/bin/perl
      2 #  Copyright 1999-2016 ImageMagick Studio LLC, a non-profit organization
      3 #  dedicated to making software imaging solutions freely available.
      4 #
      5 #  You may not use this file except in compliance with the License.  You may
      6 #  obtain a copy of the License at
      7 #
      8 #    http://www.imagemagick.org/script/license.php
      9 #
     10 #  Unless required by applicable law or agreed to in writing, software
     11 #  distributed under the License is distributed on an "AS IS" BASIS,
     12 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13 #  See the License for the specific language governing permissions and
     14 #  limitations under the License.
     15 #
     16 # Test reading blobs supported directly by ImageMagick.
     17 #
     18 BEGIN { $| = 1; $test=1; print "1..2\n"; }
     19 END {print "not ok $test\n" unless $loaded;}
     20 use Image::Magick;
     21 $loaded=1;
     22 
     23 require 't/subroutines.pl';
     24 
     25 chdir 't' || die 'Cd failed';
     26 
     27 my (@blob, $filename, $format, $height, $image, $size, $status, $width);
     28 
     29 $filename='input_p6.ppm';
     30 print "Ping \"$filename\" ...\n";
     31 $image=Image::Magick->new;
     32 ($width, $height, $size, $format)=$image->Ping("$filename");
     33 if (($width == 70) && ($height == 46) && ($size == 9673) && ($format eq "PPM"))
     34   {
     35     print "ok $test\n";
     36   }
     37  else
     38   {
     39     print "not ok $test\n";
     40   }
     41 undef $image;
     42 $test++;
     43 
     44 print("Ping blob ...\n");
     45 $image=Image::Magick->new;
     46 $status=$image->Read($filename);
     47 warn "$status" if "$status";
     48 @blob=$image->ImageToBlob();
     49 undef $image;
     50 $image=Image::Magick->new;
     51 ($width, $height, $size, $format)=$image->Ping(blob=>@blob);
     52 undef @blob;
     53 undef $image;
     54 if (($width == 70) && ($height == 46) && ($size == 9673) && ($format eq "PPM"))
     55   {
     56     print "ok $test\n";
     57   }
     58 else
     59   {
     60     print "not ok $test\n";
     61   }
     62 
     63 1;
     64