Changeset 42343 for trunk/tests/phpunit/tests/image/editorImagick.php
- Timestamp:
- 11/30/2017 11:09:33 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/image/editorImagick.php
r41261 r42343 3 3 /** 4 4 * Test the WP_Image_Editor_Imagick class 5 * 5 6 * @group image 6 7 * @group media … … 72 73 $imagick_image_editor->load(); 73 74 74 $sizes_array = array(75 $sizes_array = array( 75 76 array( 76 77 'width' => 50, … … 94 95 95 96 // Now, verify real dimensions are as expected 96 $image_path = DIR_TESTDATA . '/images/' . $resized[0]['file'];97 $image_path = DIR_TESTDATA . '/images/' . $resized[0]['file']; 97 98 $this->assertImageDimensions( 98 99 $image_path, … … 143 144 ), 144 145 array( 145 'width' => 0,146 ), 147 array( 148 'width' => 0,149 'crop' => true,150 ), 151 array( 152 'width' => null,153 ), 154 array( 155 'width' => null,156 'crop' => true,157 ), 158 array( 159 'width' => '',160 ), 161 array( 162 'width' => '',163 'crop' => true,146 'width' => 0, 147 ), 148 array( 149 'width' => 0, 150 'crop' => true, 151 ), 152 array( 153 'width' => null, 154 ), 155 array( 156 'width' => null, 157 'crop' => true, 158 ), 159 array( 160 'width' => '', 161 ), 162 array( 163 'width' => '', 164 'crop' => true, 164 165 ), 165 166 ); … … 365 366 $this->assertEquals( $expected_array, $resized ); 366 367 367 foreach ( $resized as $key => $image_data ){368 foreach ( $resized as $key => $image_data ) { 368 369 $image_path = DIR_TESTDATA . '/images/' . $image_data['file']; 369 370 … … 371 372 $this->assertImageDimensions( 372 373 $image_path, 373 $expected_array[ $key]['width'],374 $expected_array[ $key]['height']374 $expected_array[ $key ]['width'], 375 $expected_array[ $key ]['height'] 375 376 ); 376 377 } … … 410 411 $this->assertEquals( 411 412 array( 412 'width' => 50,413 'width' => 50, 413 414 'height' => 50, 414 415 ), … … 466 467 467 468 $this->assertNotInstanceOf( 'WP_Error', $editor ); 468 469 469 470 $editor->load(); 470 471 $editor->resize( 5, 5 ); … … 473 474 $editor->save( $save_to_file ); 474 475 475 $im = new Imagick( $save_to_file );476 $pixel = $im->getImagePixelColor( 0, 0 );476 $im = new Imagick( $save_to_file ); 477 $pixel = $im->getImagePixelColor( 0, 0 ); 477 478 $expected = $pixel->getColorValue( imagick::COLOR_ALPHA ); 478 479 479 $this->assertImageAlphaAtPointImagick( $save_to_file, array( 0, 0 ), $expected );480 $this->assertImageAlphaAtPointImagick( $save_to_file, array( 0, 0 ), $expected ); 480 481 481 482 unlink( $save_to_file ); … … 500 501 $editor->save( $save_to_file ); 501 502 502 $im = new Imagick( $save_to_file );503 $pixel = $im->getImagePixelColor( 0, 0 );503 $im = new Imagick( $save_to_file ); 504 $pixel = $im->getImagePixelColor( 0, 0 ); 504 505 $expected = $pixel->getColorValue( imagick::COLOR_ALPHA ); 505 506 506 $this->assertImageAlphaAtPointImagick( $save_to_file, array( 0, 0 ), $expected );507 $this->assertImageAlphaAtPointImagick( $save_to_file, array( 0, 0 ), $expected ); 507 508 508 509 unlink( $save_to_file ); … … 510 511 511 512 /** 512 *513 513 * @ticket 30596 514 514 */ … … 517 517 518 518 $pre_rotate_editor = new Imagick( $file ); 519 $pre_rotate_pixel = $pre_rotate_editor->getImagePixelColor( 0, 0 );520 $pre_rotate_alpha = $pre_rotate_pixel->getColorValue( imagick::COLOR_ALPHA );521 $save_to_file = tempnam( get_temp_dir(),'' ) . '.png';519 $pre_rotate_pixel = $pre_rotate_editor->getImagePixelColor( 0, 0 ); 520 $pre_rotate_alpha = $pre_rotate_pixel->getColorValue( imagick::COLOR_ALPHA ); 521 $save_to_file = tempnam( get_temp_dir(), '' ) . '.png'; 522 522 $pre_rotate_editor->writeImage( $save_to_file ); 523 523 $pre_rotate_editor->destroy(); … … 535 535 /** 536 536 * Test WP_Image_Editor_Imagick handles extension-less images 537 * 537 538 * @ticket 39195 538 539 */ 539 540 public function test_image_non_existent_extension() { 540 $image_editor = new WP_Image_Editor_Imagick( DIR_TESTDATA .'/images/test-image-no-extension' );541 $result = $image_editor->load();541 $image_editor = new WP_Image_Editor_Imagick( DIR_TESTDATA . '/images/test-image-no-extension' ); 542 $result = $image_editor->load(); 542 543 543 544 $this->assertTrue( $result ); … … 550 551 */ 551 552 public function test_remove_orientation_data_on_rotate() { 552 $file = DIR_TESTDATA . "/images/test-image-upside-down.jpg";553 $file = DIR_TESTDATA . '/images/test-image-upside-down.jpg'; 553 554 $data = wp_read_image_metadata( $file ); 554 555 … … 557 558 558 559 $temp_file = wp_tempnam( $file ); 559 $image = wp_get_image_editor( $file );560 $image = wp_get_image_editor( $file ); 560 561 561 562 // Test a value that would not lead back to 1, as WP is resetting the value to 1 manually.
Note: See TracChangeset
for help on using the changeset viewer.