Make WordPress Core


Ignore:
Timestamp:
11/07/2015 02:09:56 AM (10 years ago)
Author:
azaozz
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/media.php

    r35560 r35561  
    10131013        );
    10141014
    1015         $image_src = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $image_meta['file'];
     1015        $full_src  = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $image_meta['file'];
     1016        $large_src = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $image_meta['sizes']['large']['file'];
     1017
    10161018        // Test with soft resized size array.
    10171019        $size_array = array(900, 450);
    10181020
    1019         $this->assertFalse( wp_calculate_image_srcset( $image_src, $size_array, $image_meta ) );
     1021        // Full size GIFs should not return a srcset.
     1022        $this->assertFalse( wp_calculate_image_srcset( $full_src, $size_array, $image_meta ) );
     1023        // Intermediate sized GIFs should not include the full size in the srcset.
     1024        $this->assertFalse( strpos( wp_calculate_image_srcset( $large_src, $size_array, $image_meta ), $full_src ) );
    10201025    }
    10211026}
Note: See TracChangeset for help on using the changeset viewer.