Make WordPress Core

Changeset 49518 for branches/5.0


Ignore:
Timestamp:
11/06/2020 04:46:12 PM (4 years ago)
Author:
desrosj
Message:

Media: Improve and fix rotate/flip image tests.

Fix off-by-one error in pixel color checks for rotate and flip image tests. Change to using PNG with single pixel to ensure that errors are caught in the future, rather than lost in JPEG noise.

Props Fuegas, mikeschroder.
Merges [45067] to the 5.0 branch.
See #46073, #48301.

Location:
branches/5.0
Files:
2 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/5.0

  • branches/5.0/tests/phpunit/tests/image/editorImagick.php

    r41261 r49518  
    421421     */
    422422    public function test_rotate() {
    423         $file = DIR_TESTDATA . '/images/gradient-square.jpg';
     423        $file = DIR_TESTDATA . '/images/one-blue-pixel-100x100.png';
    424424
    425425        $imagick_image_editor = new WP_Image_Editor_Imagick( $file );
     
    429429        $property->setAccessible( true );
    430430
    431         $color_top_left = $property->getValue( $imagick_image_editor )->getImagePixelColor( 1, 1 )->getColor();
     431        $color_top_left = $property->getValue( $imagick_image_editor )->getImagePixelColor( 0, 0 )->getColor();
    432432
    433433        $imagick_image_editor->rotate( 180 );
     
    440440     */
    441441    public function test_flip() {
    442         $file = DIR_TESTDATA . '/images/gradient-square.jpg';
     442        $file = DIR_TESTDATA . '/images/one-blue-pixel-100x100.png';
    443443
    444444        $imagick_image_editor = new WP_Image_Editor_Imagick( $file );
     
    448448        $property->setAccessible( true );
    449449
    450         $color_top_left = $property->getValue( $imagick_image_editor )->getImagePixelColor( 1, 1 )->getColor();
     450        $color_top_left = $property->getValue( $imagick_image_editor )->getImagePixelColor( 0, 0 )->getColor();
    451451
    452452        $imagick_image_editor->flip( true, false );
Note: See TracChangeset for help on using the changeset viewer.