Fix edge-case in media cropping where selection and destination are the same size.

Adds unit tests.

Props mboynes.
Fixes #19793.


git-svn-id: https://develop.svn.wordpress.org/trunk@30639 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2014-11-30 06:26:26 +00:00
parent ac2c986831
commit b59b9f466a
2 changed files with 14 additions and 1 deletions
+12
View File
@@ -128,6 +128,18 @@ class Tests_Image_Dimensions extends WP_UnitTestCase {
$this->assertEquals( array(0, 0, 0, 20, 400, 500, 480, 600), $out );
}
function test_640x480() {
// crop 640x480 to fit 640x480 (no change)
$out = image_resize_dimensions(640, 480, 640, 480, true);
// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
$this->assertEquals( array(0, 0, 0, 0, 640, 480, 640, 480), $out );
// resize 640x480 to fit 640x480 (no change)
$out = image_resize_dimensions(640, 480, 640, 480, false);
// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
$this->assertEquals( array(0, 0, 0, 0, 640, 480, 640, 480), $out );
}
/**
* @ticket 19393
*/