Changeset 30660 for trunk/tests/phpunit/tests/image/resize.php
- Timestamp:
- 11/30/2014 07:53:18 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/image/resize.php
r29120 r30660 14 14 $image = $this->resize_helper( DIR_TESTDATA.'/images/test-image.jpg', 25, 25 ); 15 15 16 $this->assertEquals( 'test-image-25x25.jpg', basename( $image) );16 $this->assertEquals( 'test-image-25x25.jpg', basename( $image ) ); 17 17 list($w, $h, $type) = getimagesize($image); 18 18 $this->assertEquals( 25, $w ); … … 26 26 $image = $this->resize_helper( DIR_TESTDATA.'/images/test-image.png', 25, 25 ); 27 27 28 $this->assertEquals( 'test-image-25x25.png', basename($image) ); 28 if ( ! is_string( $image ) ) { // WP_Error, stop GLib-GObject-CRITICAL assertion 29 $this->markTestSkipped( sprintf( 'No PNG support in the editor engine %s on this system', $this->editor_engine ) ); 30 return; 31 } 32 33 $this->assertEquals( 'test-image-25x25.png', basename( $image ) ); 29 34 list($w, $h, $type) = getimagesize($image); 30 35 $this->assertEquals( 25, $w ); … … 38 43 $image = $this->resize_helper( DIR_TESTDATA.'/images/test-image.gif', 25, 25 ); 39 44 40 $this->assertEquals( 'test-image-25x25.gif', basename($image) ); 45 if ( ! is_string( $image ) ) { // WP_Error, stop GLib-GObject-CRITICAL assertion 46 $this->markTestSkipped( sprintf( 'No GIF support in the editor engine %s on this system', $this->editor_engine ) ); 47 return; 48 } 49 50 $this->assertEquals( 'test-image-25x25.gif', basename( $image ) ); 41 51 list($w, $h, $type) = getimagesize($image); 42 52 $this->assertEquals( 25, $w ); … … 58 68 $image = $this->resize_helper( DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG', 128, 96 ); 59 69 60 $this->assertEquals( '2007-06-17DSC_4173-6 3x96.jpg', basename($image) );70 $this->assertEquals( '2007-06-17DSC_4173-64x96.jpg', basename( $image ) ); 61 71 list($w, $h, $type) = getimagesize($image); 62 $this->assertEquals( 6 3, $w );72 $this->assertEquals( 64, $w ); 63 73 $this->assertEquals( 96, $h ); 64 74 $this->assertEquals( IMAGETYPE_JPEG, $type ); … … 70 80 $image = $this->resize_helper( DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG', 128, 0 ); 71 81 72 $this->assertEquals( '2007-06-17DSC_4173-128x19 2.jpg', basename($image) );82 $this->assertEquals( '2007-06-17DSC_4173-128x193.jpg', basename( $image ) ); 73 83 list($w, $h, $type) = getimagesize($image); 74 84 $this->assertEquals( 128, $w ); 75 $this->assertEquals( 19 2, $h );85 $this->assertEquals( 193, $h ); 76 86 $this->assertEquals( IMAGETYPE_JPEG, $type ); 77 87 … … 82 92 $image = $this->resize_helper( DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG', 0, 96 ); 83 93 84 $this->assertEquals( '2007-06-17DSC_4173-6 3x96.jpg', basename($image) );94 $this->assertEquals( '2007-06-17DSC_4173-64x96.jpg', basename( $image ) ); 85 95 list($w, $h, $type) = getimagesize($image); 86 $this->assertEquals( 6 3, $w );96 $this->assertEquals( 64, $w ); 87 97 $this->assertEquals( 96, $h ); 88 98 $this->assertEquals( IMAGETYPE_JPEG, $type ); … … 94 104 $image = $this->resize_helper( DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG', 150, 150, true ); 95 105 96 $this->assertEquals( '2007-06-17DSC_4173-150x150.jpg', basename( $image) );106 $this->assertEquals( '2007-06-17DSC_4173-150x150.jpg', basename( $image ) ); 97 107 list($w, $h, $type) = getimagesize($image); 98 108 $this->assertEquals( 150, $w ); … … 106 116 $image = $this->resize_helper( DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG', 150, 100, true ); 107 117 108 $this->assertEquals( '2007-06-17DSC_4173-150x100.jpg', basename( $image) );118 $this->assertEquals( '2007-06-17DSC_4173-150x100.jpg', basename( $image ) ); 109 119 list($w, $h, $type) = getimagesize($image); 110 120 $this->assertEquals( 150, $w ); … … 118 128 $image = $this->resize_helper( DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG', 50, 150, true ); 119 129 120 $this->assertEquals( '2007-06-17DSC_4173-50x150.jpg', basename( $image) );130 $this->assertEquals( '2007-06-17DSC_4173-50x150.jpg', basename( $image ) ); 121 131 list($w, $h, $type) = getimagesize($image); 122 132 $this->assertEquals( 50, $w ); … … 143 153 */ 144 154 public function test_resize_bad_image() { 155 156 if ( $this->editor_engine == 'WP_Image_Editor_Imagick' ) { 157 $this->markTestSkipped( sprintf( 'Avoid GLib-GObject-CRITICAL assertion in %s', $this->editor_engine ) ); 158 return; 159 } 160 145 161 $image = $this->resize_helper( DIR_TESTDATA.'/export/crazy-cdata.xml', 25, 25 ); 146 162 $this->assertInstanceOf( 'WP_Error', $image );
Note: See TracChangeset
for help on using the changeset viewer.