- Timestamp:
- 11/24/2014 08:56:36 PM (10 years ago)
- Location:
- trunk/tests/phpunit/tests/image
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/image/base.php
r29120 r30549 37 37 38 38 /** 39 * Helper assertion for testing alpha on images 39 * Helper assertion for testing alpha on images using GD library 40 40 * 41 41 * @param string $image_path … … 43 43 * @param int $alpha 44 44 */ 45 protected function assertImageAlphaAtPoint ( $image_path, $point, $alpha ) {45 protected function assertImageAlphaAtPointGD( $image_path, $point, $alpha ) { 46 46 $im = imagecreatefrompng( $image_path ); 47 47 $rgb = imagecolorat( $im, $point[0], $point[1] ); … … 50 50 51 51 $this->assertEquals( $alpha, $colors['alpha'] ); 52 } 53 54 /** 55 * Helper assertion for testing alpha on images using Imagick 56 * 57 * @param string $image_path 58 * @param array $point array(x,y) 59 * @param int $expected 60 */ 61 protected function assertImageAlphaAtPointImagick( $image_path, $point, $expected ) { 62 $im = new Imagick( $image_path ); 63 $pixel = $im->getImagePixelColor( $point[0], $point[1] ); 64 $color = $pixel->getColorValue( imagick::COLOR_ALPHA ); 65 $this->assertEquals( $expected, $color ); 52 66 } 53 67 -
trunk/tests/phpunit/tests/image/editor_gd.php
r29834 r30549 473 473 $editor->save( $save_to_file ); 474 474 475 $this->assertImageAlphaAtPoint ( $save_to_file, array( 0,0 ), 127 );475 $this->assertImageAlphaAtPointGD( $save_to_file, array( 0,0 ), 127 ); 476 476 477 477 unlink( $save_to_file ); … … 496 496 $editor->save( $save_to_file ); 497 497 498 $this->assertImageAlphaAtPoint ( $save_to_file, array( 0,0 ), 127 );498 $this->assertImageAlphaAtPointGD( $save_to_file, array( 0,0 ), 127 ); 499 499 500 500 unlink( $save_to_file ); -
trunk/tests/phpunit/tests/image/editor_imagick.php
r29834 r30549 473 473 $editor->save( $save_to_file ); 474 474 475 $this->assertImageAlphaAtPoint( $save_to_file, array( 0,0 ), 127 ); 475 $im = new Imagick( $save_to_file ); 476 $pixel = $im->getImagePixelColor( 0, 0 ); 477 $expected = $pixel->getColorValue( imagick::COLOR_ALPHA ); 478 479 $this->assertImageAlphaAtPointImagick( $save_to_file, array( 0,0 ), $expected ); 476 480 477 481 unlink( $save_to_file ); … … 496 500 $editor->save( $save_to_file ); 497 501 498 $this->assertImageAlphaAtPoint( $save_to_file, array( 0,0 ), 127 ); 502 $im = new Imagick( $save_to_file ); 503 $pixel = $im->getImagePixelColor( 0, 0 ); 504 $expected = $pixel->getColorValue( imagick::COLOR_ALPHA ); 505 506 $this->assertImageAlphaAtPointImagick( $save_to_file, array( 0,0 ), $expected ); 499 507 500 508 unlink( $save_to_file );
Note: See TracChangeset
for help on using the changeset viewer.