mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Responsive images: do not generate srcset for GIFs that are inserted at full size. Prevents breaking animated GIFs.
Props joemcgill. Fixes #34528. git-svn-id: https://develop.svn.wordpress.org/trunk@35524 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -963,4 +963,43 @@ EOF;
|
||||
// The content filter should return the image unchanged.
|
||||
$this->assertSame( $image_html, wp_make_content_images_responsive( $image_html ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 33641
|
||||
* @ticket 34528
|
||||
*/
|
||||
function test_wp_calculate_image_srcset_animated_gifs() {
|
||||
// Mock meta for an animated gif.
|
||||
$image_meta = array(
|
||||
'width' => 1200,
|
||||
'height' => 600,
|
||||
'file' => 'animated.gif',
|
||||
'sizes' => array(
|
||||
'thumbnail' => array(
|
||||
'file' => 'animated-150x150.gif',
|
||||
'width' => 150,
|
||||
'height' => 150,
|
||||
'mime-type' => 'image/gif'
|
||||
),
|
||||
'medium' => array(
|
||||
'file' => 'animated-300x150.gif',
|
||||
'width' => 300,
|
||||
'height' => 150,
|
||||
'mime-type' => 'image/gif'
|
||||
),
|
||||
'large' => array(
|
||||
'file' => 'animated-1024x512.gif',
|
||||
'width' => 1024,
|
||||
'height' => 512,
|
||||
'mime-type' => 'image/gif'
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
$image_src = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $image_meta['file'];
|
||||
// Test with soft resized size array.
|
||||
$size_array = array(900, 450);
|
||||
|
||||
$this->assertFalse( wp_calculate_image_srcset( $image_src, $size_array, $image_meta ) );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user