| | 939 | * @ticket 35108 |
| | 940 | */ |
| | 941 | function test_wp_calculate_image_srcset_include_src() { |
| | 942 | // Mock data for this test. |
| | 943 | $size_array = array( 2000, 1000); |
| | 944 | $image_src = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/2015/12/test.png'; |
| | 945 | $image_meta = array( |
| | 946 | 'width' => 2000, |
| | 947 | 'height' => 1000, |
| | 948 | 'file' => '2015/12/test.png', |
| | 949 | 'sizes' => array( |
| | 950 | 'thumbnail' => array( |
| | 951 | 'file' => 'test-150x150.png', |
| | 952 | 'width' => 150, |
| | 953 | 'height' => 150, |
| | 954 | 'mime-type' => 'image/png', |
| | 955 | ), |
| | 956 | 'medium' => array( |
| | 957 | 'file' => 'test-300x150.png', |
| | 958 | 'width' => 300, |
| | 959 | 'height' => 150, |
| | 960 | 'mime-type' => 'image/png', |
| | 961 | ), |
| | 962 | 'medium_large' => array( |
| | 963 | 'file' => 'test-768x384.png', |
| | 964 | 'width' => 768, |
| | 965 | 'height' => 384, |
| | 966 | 'mime-type' => 'image/png', |
| | 967 | ), |
| | 968 | 'large' => array( |
| | 969 | 'file' => 'test-1024x512.png', |
| | 970 | 'width' => 1024, |
| | 971 | 'height' => 512, |
| | 972 | 'mime-type' => 'image/png', |
| | 973 | ), |
| | 974 | ), |
| | 975 | ); |
| | 976 | |
| | 977 | $expected_srcset = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/2015/12/test-300x150.png 300w, http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/2015/12/test-768x384.png 768w, http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/2015/12/test-1024x512.png 1024w, http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/2015/12/test.png 2000w'; |
| | 978 | |
| | 979 | $this->assertSame( $expected_srcset, wp_calculate_image_srcset( $size_array, $image_src, $image_meta ) ); |
| | 980 | } |
| | 981 | |
| | 982 | /** |