@@ 793-807 (lines=15) @@ | ||
790 | * @covers Jetpack_Photon::filter_image_downsize |
|
791 | * @since 3.9.0 |
|
792 | */ |
|
793 | public function test_photon_return_custom_size_array_dimensions_larger_than_original() { |
|
794 | global $content_width; |
|
795 | $content_width = 0; |
|
796 | ||
797 | $test_image = $this->helper_get_image( 'medium' ); // Original 1024x768. |
|
798 | ||
799 | // Declaring the size array directly, unknown size of 1200 by 1200. Should return original. |
|
800 | $this->assertEquals( |
|
801 | 'fit=1024%2C768', |
|
802 | $this->helper_get_query( Jetpack_Photon::instance()->filter_image_downsize( false, $test_image, array( 1200, 1200 ) ) ) |
|
803 | ); |
|
804 | ||
805 | wp_delete_attachment( $test_image ); |
|
806 | $this->helper_remove_image_sizes(); |
|
807 | } |
|
808 | ||
809 | /** |
|
810 | * Tests image_downsize filter for a defined size with no meta. |
|
@@ 956-970 (lines=15) @@ | ||
953 | * @covers Jetpack_Photon::filter_image_downsize |
|
954 | * @since 3.9.0 |
|
955 | */ |
|
956 | public function test_photon_return_custom_size_array_dimensions_no_meta() { |
|
957 | global $content_width; |
|
958 | $content_width = 0; |
|
959 | ||
960 | $test_image = $this->helper_get_image( 'large', false ); |
|
961 | ||
962 | // Declaring the size array directly, unknown size of 400 by 400. Scaled, it should be 400 by 300. |
|
963 | $this->assertEquals( |
|
964 | 'fit=400%2C400', |
|
965 | $this->helper_get_query( Jetpack_Photon::instance()->filter_image_downsize( false, $test_image, array( 400, 400 ) ) ) |
|
966 | ); |
|
967 | ||
968 | wp_delete_attachment( $test_image ); |
|
969 | $this->helper_remove_image_sizes(); |
|
970 | } |
|
971 | ||
972 | /** |
|
973 | * Tests Photon's filtering of the_content when both height/width are known. |