Changeset 42813
- Timestamp:
- 03/09/2018 03:20:52 AM (7 years ago)
- Location:
- branches/4.9
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.9
-
branches/4.9/src/wp-admin/includes/image.php
r42450 r42813 242 242 } else { 243 243 // Force thumbnails to be soft crops. 244 if ( ! 'thumbnail' === $s ) {244 if ( 'thumbnail' !== $s ) { 245 245 $sizes[ $s ]['crop'] = get_option( "{$s}_crop" ); 246 246 } -
branches/4.9/tests/phpunit/tests/image/functions.php
r41841 r42813 417 417 418 418 /** 419 * Crop setting for PDF. 420 * 421 * @ticket 43226 422 */ 423 public function test_crop_setting_for_pdf() { 424 425 if ( ! wp_image_editor_supports( array( 'mime_type' => 'application/pdf' ) ) ) { 426 $this->markTestSkipped( 'Rendering PDFs is not supported on this system.' ); 427 } 428 429 update_option( 'medium_crop', 1 ); 430 431 $orig_file = DIR_TESTDATA . '/images/wordpress-gsoc-flyer.pdf'; 432 $test_file = get_temp_dir() . 'wordpress-gsoc-flyer.pdf'; 433 copy( $orig_file, $test_file ); 434 435 $attachment_id = $this->factory->attachment->create_object( 436 $test_file, 0, array( 437 'post_mime_type' => 'application/pdf', 438 ) 439 ); 440 441 $this->assertNotEmpty( $attachment_id ); 442 443 $expected = array( 444 'sizes' => array( 445 'thumbnail' => array( 446 'file' => 'wordpress-gsoc-flyer-pdf-116x150.jpg', 447 'width' => 116, 448 'height' => 150, 449 'mime-type' => 'image/jpeg', 450 ), 451 'medium' => array( 452 'file' => 'wordpress-gsoc-flyer-pdf-300x300.jpg', 453 'width' => 300, 454 'height' => 300, 455 'mime-type' => 'image/jpeg', 456 ), 457 'large' => array( 458 'file' => 'wordpress-gsoc-flyer-pdf-791x1024.jpg', 459 'width' => 791, 460 'height' => 1024, 461 'mime-type' => 'image/jpeg', 462 ), 463 'full' => array( 464 'file' => 'wordpress-gsoc-flyer-pdf.jpg', 465 'width' => 1088, 466 'height' => 1408, 467 'mime-type' => 'image/jpeg', 468 ), 469 ), 470 ); 471 472 $metadata = wp_generate_attachment_metadata( $attachment_id, $test_file ); 473 $this->assertSame( $expected, $metadata ); 474 475 unlink( $test_file ); 476 foreach ( $metadata['sizes'] as $size ) { 477 unlink( get_temp_dir() . $size['file'] ); 478 } 479 } 480 481 /** 419 482 * @ticket 39231 420 483 */
Note: See TracChangeset
for help on using the changeset viewer.