mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Responsive images: omit full size images from srcset attributes when the original file is an intermediate sized GIF so we don't accidentally add animation to an otherwise flat image. Update the tests to cover this case.
Props joemcgill, H-Shredder, SergeyBiryukov. Fixes #34528. git-svn-id: https://develop.svn.wordpress.org/trunk@35561 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1012,10 +1012,15 @@ EOF;
|
||||
)
|
||||
);
|
||||
|
||||
$image_src = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $image_meta['file'];
|
||||
$full_src = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $image_meta['file'];
|
||||
$large_src = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $image_meta['sizes']['large']['file'];
|
||||
|
||||
// Test with soft resized size array.
|
||||
$size_array = array(900, 450);
|
||||
|
||||
$this->assertFalse( wp_calculate_image_srcset( $image_src, $size_array, $image_meta ) );
|
||||
// Full size GIFs should not return a srcset.
|
||||
$this->assertFalse( wp_calculate_image_srcset( $full_src, $size_array, $image_meta ) );
|
||||
// Intermediate sized GIFs should not include the full size in the srcset.
|
||||
$this->assertFalse( strpos( wp_calculate_image_srcset( $large_src, $size_array, $image_meta ), $full_src ) );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user