Tidied tests.

This commit is contained in:
Danack
2015-06-11 13:39:33 +00:00
parent a265079244
commit edb6f41a4f
18 changed files with 101 additions and 16 deletions
+1
View File
@@ -2559,6 +2559,7 @@ static zend_function_entry php_imagick_class_methods[] =
PHP_ME(imagick, getpackagename, imagick_zero_args, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
PHP_ME(imagick, getpage, imagick_zero_args, ZEND_ACC_PUBLIC)
PHP_ME(imagick, getquantum, imagick_zero_args, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
// PHP_ME(imagick, gethdrienabled, imagick_zero_args, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
PHP_ME(imagick, getquantumdepth, imagick_zero_args, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
PHP_ME(imagick, getquantumrange, imagick_zero_args, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
PHP_ME(imagick, getreleasedate, imagick_zero_args, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
+12
View File
@@ -10931,6 +10931,18 @@ PHP_METHOD(imagick, getpage)
}
/* }}} */
//Not implemented yet
///* {{{ proto int Imagick::getHdriEnabled()
// Returns the ImageMagick quantum range as an integer.
//*/
//PHP_METHOD(imagick, gethdrienabled)
//{
// RETURN_BOOL(MagickGetHdriEnabled());
//}
///* }}} */
//
/* {{{ proto int Imagick::getQuantum()
Returns the ImageMagick quantum range as an integer.
*/
+1
View File
@@ -803,6 +803,7 @@ PHP_METHOD(imagick, getinterlacescheme);
PHP_METHOD(imagick, getoption);
PHP_METHOD(imagick, getpackagename);
PHP_METHOD(imagick, getpage);
// not implemented yet PHP_METHOD(imagick, gethdrienabled);
PHP_METHOD(imagick, getquantum);
PHP_METHOD(imagick, getquantumdepth);
PHP_METHOD(imagick, getquantumrange);
+4 -1
View File
@@ -1,7 +1,10 @@
--TEST--
Test reading properties
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
<?php
require_once(dirname(__FILE__) . '/skipif.inc');
checkFormatPresent('png');
?>
--FILE--
<?php
+4 -1
View File
@@ -1,7 +1,10 @@
--TEST--
Imagick::readImageFile test
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
<?php
require_once(dirname(__FILE__) . '/skipif.inc');
checkFormatPresent('jpg');
?>
--FILE--
<?php
+3 -1
View File
@@ -1,7 +1,9 @@
--TEST--
Test ImagickDraw->setResolution
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc');
<?php
require_once(dirname(__FILE__) . '/skipif.inc');
checkFormatPresent('png');
?>
--FILE--
<?php
+4 -1
View File
@@ -1,7 +1,10 @@
--TEST--
Test clone length, this is expected upstream behaviour
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc');
<?php
require_once(dirname(__FILE__) . '/skipif.inc');
checkFormatPresent('png');
$v = imagick::getversion ();
+5 -1
View File
@@ -1,7 +1,11 @@
--TEST--
Test format support in writeImageFile
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
<?php
require_once(dirname(__FILE__) . '/skipif.inc');
checkFormatPresent('png');
checkFormatPresent('jpg');
?>
--FILE--
<?php
@@ -4,6 +4,7 @@ Test Imagick, colorMatrixImage
<?php
$imageMagickRequiredVersion=0x675;
require_once(dirname(__FILE__) . '/skipif.inc');
checkFormatPresent('png');
?>
--FILE--
<?php
+1
View File
@@ -4,6 +4,7 @@ Test Imagick, deskewImage
<?php
$imageMagickRequiredVersion=0x675;
require_once(dirname(__FILE__) . '/skipif.inc');
checkFormatPresent('jpg');
?>
--FILE--
<?php
@@ -4,6 +4,7 @@ Test Imagick, distortImage
<?php
$imageMagickRequiredVersion=0x675;
require_once(dirname(__FILE__) . '/skipif.inc');
checkFormatPresent('png');
?>
--FILE--
<?php
@@ -4,6 +4,7 @@ Test Imagick, evaluateImage
<?php
$imageMagickRequiredVersion=0x675;
require_once(dirname(__FILE__) . '/skipif.inc');
checkFormatPresent('png');
?>
--FILE--
<?php
+1
View File
@@ -4,6 +4,7 @@ Test Imagick, fxImage
<?php
$imageMagickRequiredVersion=0x675;
require_once(dirname(__FILE__) . '/skipif.inc');
checkFormatPresent('png');
?>
--FILE--
<?php
@@ -1,7 +1,10 @@
--TEST--
Test Imagick, getImageHistogram
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
<?php
require_once(dirname(__FILE__) . '/skipif.inc');
checkFormatPresent('png');
?>
--FILE--
<?php
+10 -2
View File
@@ -8,10 +8,14 @@ Test Imagick, progressMonitor
$radius = 5;
$sigma = 1;
$debug = "";
$status = 'Not cancelled';
$startTime = time();
$callback = function ($offset, $span) use (&$status, $startTime) {
$callback = function ($offset, $span) use (&$status, $startTime, $debug) {
static $x = 0;
if (((100 * $offset) / $span) > 20) {
$status = "Processing cancelled";
return false;
@@ -19,6 +23,9 @@ $callback = function ($offset, $span) use (&$status, $startTime) {
$nowTime = time();
$debug .= "$x: nowTime $nowTime - startTime $startTime".PHP_EOL;
$x++;
if ($nowTime - $startTime > 5) {
$status = "Processing cancelled";
return false;
@@ -36,7 +43,8 @@ try {
$imagick->charcoalImage($radius, $sigma);
$bytes = $imagick->getImageBlob();
echo "Progress monitor failed to interrupt.";
echo "Progress monitor failed to interrupt.".PHP_EOL;
echo $debug;
}
catch(\Exception $e) {
echo $status.PHP_EOL;
-6
View File
@@ -207,10 +207,4 @@ if ($kernelMatrix !== $matrix) {
echo "Complete".PHP_EOL;
?>
--EXPECTF--
Cannot create kernel, matrix is empty.
Values must be matrix, with the same number of columns in each row.
Values must be matrix, with the same number of columns in each row.
Values must be matrix, with the same number of columns in each row.
Only numbers or false are valid values in a kernel matrix.
For kernels with even numbered rows or columns, the origin position must be specified.
Complete
+27
View File
@@ -0,0 +1,27 @@
--TEST--
Test ImagickPixelIterator, construct
--SKIPIF--
<?php
require_once(dirname(__FILE__) . '/skipif.inc');
checkClassMethods('Imagick', array('getHDRIEnabled'));
?>
--FILE--
<?php
$enabled = Imagick::getHDRIEnabled();
if ($enabled === true || $enabled === false) {
echo "Ok";
}
else {
echo "Unexpected value for Imagick::getHDRIEnabled:\n";
var_dump($enabled);
}
?>
--EXPECTF--
Ok
+21 -2
View File
@@ -13,7 +13,12 @@ if (isset($imageMagickRequiredVersion)) {
$versionInstalled = $versionInfo["versionNumber"];
if ($versionInstalled < $imageMagickRequiredVersion) {
die("skip ImageMagick installed $versionInstalled <= required $imageMagickRequiredVersion");
$message = sprintf(
"skip ImageMagick installed %x <= required %x",
$versionInstalled,
$imageMagickRequiredVersion
);
die($message);
}
}
@@ -27,7 +32,12 @@ if (isset($imageMagickBelowVersion)) {
$versionInstalled = $versionInfo["versionNumber"];
if ($versionInstalled >= $imageMagickBelowVersion) {
die("skip ImageMagick installed $versionInstalled >= $imageMagickBelowVersion");
$message = sprintf(
"skip ImageMagick installed %x >= %x",
$versionInstalled,
$imageMagickBelowVersion
);
die($message);
}
}
@@ -40,5 +50,14 @@ function checkClassMethods($class, $methods)
}
}
function checkFormatPresent($format)
{
$result = Imagick::queryFormats(strtoupper($format));
if (count($result) == false) {
die("skip format $format not supported by ImageMagick as compiled.");
}
}
?>