WordPress.org

Make WordPress Core

Changeset 1182 in tests


Ignore:
Timestamp:
01/04/13 10:56:13 (16 months ago)
Author:
joehoyle
Message:

Add some tests for WP_Image_Editor_GD, specifically testing image alpha testing. see #23039

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

Legend:

Unmodified
Added
Removed
  • trunk/tests/image/base.php

    r1157 r1182  
    3131        return array( $this->editor_engine ); 
    3232    } 
     33 
     34    /** 
     35     * Helper assertion for testing alpha on images 
     36     *  
     37     * @param  string $image_path 
     38     * @param  array $point      array(x,y) 
     39     * @param  int $alpha 
     40     */ 
     41    protected function assertImageAlphaAtPoint( $image_path, $point, $alpha ) { 
     42 
     43        $im = imagecreatefrompng( $image_path ); 
     44        $rgb = imagecolorat($im, $point[0], $point[1]); 
     45 
     46        $colors = imagecolorsforindex($im, $rgb); 
     47 
     48        $this->assertEquals( $alpha, $colors['alpha'] ); 
     49    } 
    3350} 
Note: See TracChangeset for help on using the changeset viewer.