/**
* Test multi_resize with multiple sizes
*
* ticket 26823
*/
public function test_multi_resize()
{
$file = DIR_TESTDATA . '/images/waffles.jpg';
$imagick_image_editor = new WP_Image_Editor_Imagick($file);
$imagick_image_editor->load();
$sizes_array = array(array('width' => 10, 'height' => 10, 'crop' => false), array('width' => 75, 'height' => 50, 'crop' => true), array('width' => 9999, 'height' => 20, 'crop' => false), array('width' => 45, 'height' => 9999, 'crop' => true), array('width' => 50), array('width' => 55, 'height' => null), array('height' => 55), array('width' => null, 'height' => 60), array('width' => -9999, 'height' => 70), array('width' => 200, 'height' => -9999));
$resized = $imagick_image_editor->multi_resize($sizes_array);
$expected_array = array(array('file' => 'waffles-10x7.jpg', 'width' => 10, 'height' => 7, 'mime-type' => 'image/jpeg'), array('file' => 'waffles-75x50.jpg', 'width' => 75, 'height' => 50, 'mime-type' => 'image/jpeg'), array('file' => 'waffles-30x20.jpg', 'width' => 30, 'height' => 20, 'mime-type' => 'image/jpeg'), array('file' => 'waffles-45x400.jpg', 'width' => 45, 'height' => 400, 'mime-type' => 'image/jpeg'), array('file' => 'waffles-50x33.jpg', 'width' => 50, 'height' => 33, 'mime-type' => 'image/jpeg'), array('file' => 'waffles-55x37.jpg', 'width' => 55, 'height' => 37, 'mime-type' => 'image/jpeg'), array('file' => 'waffles-83x55.jpg', 'width' => 83, 'height' => 55, 'mime-type' => 'image/jpeg'), array('file' => 'waffles-90x60.jpg', 'width' => 90, 'height' => 60, 'mime-type' => 'image/jpeg'), array('file' => 'waffles-105x70.jpg', 'width' => 105, 'height' => 70, 'mime-type' => 'image/jpeg'), array('file' => 'waffles-200x133.jpg', 'width' => 200, 'height' => 133, 'mime-type' => 'image/jpeg'));
$this->assertNotNull($resized);
$this->assertEquals($expected_array, $resized);
foreach ($resized as $key => $image_data) {
$image_path = DIR_TESTDATA . '/images/' . $image_data['file'];
// Now, verify real dimensions are as expected
$this->assertImageDimensions($image_path, $expected_array[$key]['width'], $expected_array[$key]['height']);
}
}