diff --git a/tests/phpunit/tests/image/intermediateSize.php b/tests/phpunit/tests/image/intermediateSize.php index c2ac785058..6b7427c8fa 100644 --- a/tests/phpunit/tests/image/intermediateSize.php +++ b/tests/phpunit/tests/image/intermediateSize.php @@ -69,6 +69,10 @@ class Tests_Image_Intermediate_Size extends WP_UnitTestCase { * @ticket 17626 */ function test_get_intermediate_sizes_by_name() { + if ( ! function_exists( 'imagejpeg' ) ) { + $this->fail( 'jpeg support unavailable' ); + } + add_image_size( 'test-size', 330, 220, true ); $file = DIR_TESTDATA . '/images/waffles.jpg'; @@ -89,6 +93,10 @@ class Tests_Image_Intermediate_Size extends WP_UnitTestCase { * @ticket 17626 */ function test_get_intermediate_sizes_by_array_exact() { + if ( ! function_exists( 'imagejpeg' ) ) { + $this->fail( 'jpeg support unavailable' ); + } + // Only one dimention match shouldn't return false positive (see: #17626). add_image_size( 'test-size', 330, 220, true ); add_image_size( 'false-height', 330, 400, true ); @@ -110,6 +118,10 @@ class Tests_Image_Intermediate_Size extends WP_UnitTestCase { * @ticket 17626 */ function test_get_intermediate_sizes_by_array_nearest() { + if ( ! function_exists( 'imagejpeg' ) ) { + $this->fail( 'jpeg support unavailable' ); + } + // If an exact size is not found, it should be returned. // If not, find nearest size that is larger (see: #17626). add_image_size( 'test-size', 450, 300, true ); @@ -153,6 +165,10 @@ class Tests_Image_Intermediate_Size extends WP_UnitTestCase { * @ticket 17626 */ function test_get_intermediate_sizes_by_array_zero_height() { + if ( ! function_exists( 'imagejpeg' ) ) { + $this->fail( 'jpeg support unavailable' ); + } + // Generate random width. $random_w = rand( 300, 400 ); @@ -181,6 +197,10 @@ class Tests_Image_Intermediate_Size extends WP_UnitTestCase { * @ticket 34087 */ function test_get_intermediate_sizes_by_array_zero_width() { + if ( ! function_exists( 'imagejpeg' ) ) { + $this->fail( 'jpeg support unavailable' ); + } + // 202 is the smallest height that will trigger a miss for 'false-height'. $height = 202; @@ -209,6 +229,10 @@ class Tests_Image_Intermediate_Size extends WP_UnitTestCase { * @ticket 34087 */ public function test_get_intermediate_sizes_should_match_size_with_off_by_one_aspect_ratio() { + if ( ! function_exists( 'imagejpeg' ) ) { + $this->fail( 'jpeg support unavailable' ); + } + // Original is 600x400. 300x201 is close enough to match. $width = 300; $height = 201; @@ -232,6 +256,10 @@ class Tests_Image_Intermediate_Size extends WP_UnitTestCase { * @ticket 34384 */ public function test_get_intermediate_size_with_small_size_array() { + if ( ! function_exists( 'imagejpeg' ) ) { + $this->fail( 'jpeg support unavailable' ); + } + // Add a hard cropped size that matches the aspect ratio we're going to test. add_image_size( 'test-size', 200, 100, true ); @@ -249,6 +277,10 @@ class Tests_Image_Intermediate_Size extends WP_UnitTestCase { * @ticket 34384 */ public function test_get_intermediate_size_with_small_size_array_fallback() { + if ( ! function_exists( 'imagejpeg' ) ) { + $this->fail( 'jpeg support unavailable' ); + } + $file = DIR_TESTDATA . '/images/waffles.jpg'; $id = $this->_make_attachment( $file, 0 );