update core to 7.36
This commit is contained in:
@@ -261,6 +261,7 @@ class ImageToolkitGdTestCase extends DrupalWebTestCase {
|
||||
*/
|
||||
function testManipulations() {
|
||||
// If GD isn't available don't bother testing this.
|
||||
module_load_include('inc', 'system', 'image.gd');
|
||||
if (!function_exists('image_gd_check_settings') || !image_gd_check_settings()) {
|
||||
$this->pass(t('Image manipulations for the GD toolkit were skipped because the GD toolkit is not available.'));
|
||||
return;
|
||||
@@ -379,7 +380,7 @@ class ImageToolkitGdTestCase extends DrupalWebTestCase {
|
||||
array_fill(0, 3, 76) + array(3 => 0),
|
||||
array_fill(0, 3, 149) + array(3 => 0),
|
||||
array_fill(0, 3, 29) + array(3 => 0),
|
||||
array_fill(0, 3, 0) + array(3 => 127)
|
||||
array_fill(0, 3, 225) + array(3 => 127)
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -394,11 +395,14 @@ class ImageToolkitGdTestCase extends DrupalWebTestCase {
|
||||
continue 2;
|
||||
}
|
||||
|
||||
// Transparent GIFs and the imagefilter function don't work together.
|
||||
// There is a todo in image.gd.inc to correct this.
|
||||
// All images should be converted to truecolor when loaded.
|
||||
$image_truecolor = imageistruecolor($image->resource);
|
||||
$this->assertTrue($image_truecolor, format_string('Image %file after load is a truecolor image.', array('%file' => $file)));
|
||||
|
||||
if ($image->info['extension'] == 'gif') {
|
||||
if ($op == 'desaturate') {
|
||||
$values['corners'][3] = $this->white;
|
||||
// Transparent GIFs and the imagefilter function don't work together.
|
||||
$values['corners'][3][3] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -451,7 +455,8 @@ class ImageToolkitGdTestCase extends DrupalWebTestCase {
|
||||
|
||||
$directory = file_default_scheme() . '://imagetests';
|
||||
file_prepare_directory($directory, FILE_CREATE_DIRECTORY);
|
||||
image_save($image, $directory . '/' . $op . '.' . $image->info['extension']);
|
||||
$file_path = $directory . '/' . $op . '.' . $image->info['extension'];
|
||||
image_save($image, $file_path);
|
||||
|
||||
$this->assertTrue($correct_dimensions_real, format_string('Image %file after %action action has proper dimensions.', array('%file' => $file, '%action' => $op)));
|
||||
$this->assertTrue($correct_dimensions_object, format_string('Image %file object after %action action is reporting the proper height and width values.', array('%file' => $file, '%action' => $op)));
|
||||
@@ -460,8 +465,37 @@ class ImageToolkitGdTestCase extends DrupalWebTestCase {
|
||||
$this->assertTrue($correct_colors, format_string('Image %file object after %action action has the correct color placement.', array('%file' => $file, '%action' => $op)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check that saved image reloads without raising PHP errors.
|
||||
$image_reloaded = image_load($file_path);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests loading an image whose transparent color index is out of range.
|
||||
*/
|
||||
function testTransparentColorOutOfRange() {
|
||||
// This image was generated by taking an initial image with a palette size
|
||||
// of 6 colors, and setting the transparent color index to 6 (one higher
|
||||
// than the largest allowed index), as follows:
|
||||
// @code
|
||||
// $image = imagecreatefromgif('modules/simpletest/files/image-test.gif');
|
||||
// imagecolortransparent($image, 6);
|
||||
// imagegif($image, 'modules/simpletest/files/image-test-transparent-out-of-range.gif');
|
||||
// @endcode
|
||||
// This allows us to test that an image with an out-of-range color index
|
||||
// can be loaded correctly.
|
||||
$file = 'image-test-transparent-out-of-range.gif';
|
||||
$image = image_load(drupal_get_path('module', 'simpletest') . '/files/' . $file);
|
||||
|
||||
if (!$image) {
|
||||
$this->fail(format_string('Could not load image %file.', array('%file' => $file)));
|
||||
}
|
||||
else {
|
||||
// All images should be converted to truecolor when loaded.
|
||||
$image_truecolor = imageistruecolor($image->resource);
|
||||
$this->assertTrue($image_truecolor, format_string('Image %file after load is a truecolor image.', array('%file' => $file)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user