Make WordPress Core


Ignore:
Timestamp:
11/30/2014 06:26:26 AM (12 years ago)
Author:
wonderboymusic
Message:

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

Adds unit tests.

Props mboynes.
Fixes #19793.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/image/dimensions.php

    r27472 r30639  
    129129        }
    130130
     131        function test_640x480() {
     132                // crop 640x480 to fit 640x480 (no change)
     133                $out = image_resize_dimensions(640, 480, 640, 480, true);
     134                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
     135                $this->assertEquals( array(0, 0, 0, 0, 640, 480, 640, 480), $out );
     136
     137                // resize 640x480 to fit 640x480 (no change)
     138                $out = image_resize_dimensions(640, 480, 640, 480, false);
     139                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
     140                $this->assertEquals( array(0, 0, 0, 0, 640, 480, 640, 480), $out );
     141        }
     142
    131143        /**
    132144         * @ticket 19393
Note: See TracChangeset for help on using the changeset viewer.