Make WordPress Core

Changeset 45067


Ignore:
Timestamp:
03/29/2019 02:48:08 AM (5 years ago)
Author:
mikeschroder
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.
Fixes #46073.

Location:
trunk/tests/phpunit
Files:
1 added
1 edited

Legend:

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

    r42863 r45067  
    422422     */
    423423    public function test_rotate() {
    424         $file = DIR_TESTDATA . '/images/gradient-square.jpg';
     424        $file = DIR_TESTDATA . '/images/one-blue-pixel-100x100.png';
    425425
    426426        $imagick_image_editor = new WP_Image_Editor_Imagick( $file );
     
    430430        $property->setAccessible( true );
    431431
    432         $color_top_left = $property->getValue( $imagick_image_editor )->getImagePixelColor( 1, 1 )->getColor();
     432        $color_top_left = $property->getValue( $imagick_image_editor )->getImagePixelColor( 0, 0 )->getColor();
    433433
    434434        $imagick_image_editor->rotate( 180 );
     
    441441     */
    442442    public function test_flip() {
    443         $file = DIR_TESTDATA . '/images/gradient-square.jpg';
     443        $file = DIR_TESTDATA . '/images/one-blue-pixel-100x100.png';
    444444
    445445        $imagick_image_editor = new WP_Image_Editor_Imagick( $file );
     
    449449        $property->setAccessible( true );
    450450
    451         $color_top_left = $property->getValue( $imagick_image_editor )->getImagePixelColor( 1, 1 )->getColor();
     451        $color_top_left = $property->getValue( $imagick_image_editor )->getImagePixelColor( 0, 0 )->getColor();
    452452
    453453        $imagick_image_editor->flip( true, false );
Note: See TracChangeset for help on using the changeset viewer.