blob: aaaf2e7b533fed66b3c8fd4faaae354aa0aa7421 [file] [log] [blame]
cristy3ed852e2009-09-05 21:47:34 +00001#!/usr/bin/perl
2# Copyright 1999-2009 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#
18BEGIN { $| = 1; $test=1; print "1..2\n"; }
19END {print "not ok $test\n" unless $loaded;}
20use Image::Magick;
21$loaded=1;
22
23require 't/subroutines.pl';
24
25chdir 't' || die 'Cd failed';
26
27my (@blob, $filename, $format, $height, $image, $size, $status, $width);
28
29$filename='input_p6.ppm';
30print "Ping \"$filename\" ...\n";
31$image=Image::Magick->new;
32($width, $height, $size, $format)=$image->Ping("$filename");
33if (($width == 70) && ($height == 46) && ($size == 9673) && ($format eq "PNM"))
34 {
35 print "ok $test\n";
36 }
37 else
38 {
39 print "not ok $test\n";
40 }
41undef $image;
42$test++;
43
44print("Ping blob ...\n");
45$image=Image::Magick->new;
46$status=$image->Read($filename);
47warn "$status" if "$status";
48@blob=$image->ImageToBlob();
49undef $image;
50$image=Image::Magick->new;
51($width, $height, $size, $format)=$image->Ping(blob=>@blob);
52undef @blob;
53undef $image;
54if (($width == 70) && ($height == 46) && ($size == 9673) && ($format eq "PNM"))
55 {
56 print "ok $test\n";
57 }
58else
59 {
60 print "not ok $test\n";
61 }
62
631;