1--TEST-- 2Test Imagick, scaleImage 3--SKIPIF-- 4<?php 5$imageMagickRequiredVersion=0x675; 6require_once(dirname(__FILE__) . '/skipif.inc'); 7?> 8--FILE-- 9<?php 10 11 12$tests = array( 13 array(200, 200, true, 200, 150), 14 array(200, 200, false, 200, 200), 15 array(200, 0, false, 200, 150), 16); 17 18foreach ($tests as $test) { 19 list($width, $height, $bestFit, $expectedWidth, $expectedHeight) = $test; 20 21 $imagick = new \Imagick(); 22 $imagick->newPseudoImage(640, 480, "magick:logo"); 23 $imagick->scaleImage($width, $height, $bestFit); 24 25 $imageWidth = $imagick->getImageWidth(); 26 $imageHeight = $imagick->getImageHeight(); 27 28 $error = false; 29 30 if ($imageWidth != $expectedWidth) { 31 echo "Width $imageWidth does not match expected.\n"; 32 $error = true; 33 } 34 35 if ($imageHeight != $expectedHeight) { 36 echo "Height $imageHeight does not match expected.\n"; 37 $error = true; 38 } 39 40 if ($error) { 41 echo "test was ".var_export($test, true)."\n"; 42 }; 43} 44 45 46echo "Ok"; 47?> 48--EXPECTF-- 49Ok