Changeset 53463 for trunk/tests/phpunit/tests/image/resize.php
- Timestamp:
- 06/04/2022 12:55:15 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/image/resize.php
r52010 r53463 24 24 $image = $this->resize_helper( DIR_TESTDATA . '/images/test-image.jpg', 25, 25 ); 25 25 26 list( $w, $h, $type ) = getimagesize( $image ); 27 28 unlink( $image ); 29 26 30 $this->assertSame( 'test-image-25x25.jpg', wp_basename( $image ) ); 27 list($w, $h, $type) = getimagesize( $image ); 28 $this->assertSame( 25, $w ); 29 $this->assertSame( 25, $h ); 30 $this->assertSame( IMAGETYPE_JPEG, $type ); 31 32 unlink( $image ); 31 $this->assertSame( 25, $w ); 32 $this->assertSame( 25, $h ); 33 $this->assertSame( IMAGETYPE_JPEG, $type ); 33 34 } 34 35 … … 40 41 } 41 42 43 list( $w, $h, $type ) = getimagesize( $image ); 44 45 unlink( $image ); 46 42 47 $this->assertSame( 'test-image-25x25.png', wp_basename( $image ) ); 43 list($w, $h, $type) = getimagesize( $image );44 48 $this->assertSame( 25, $w ); 45 49 $this->assertSame( 25, $h ); 46 50 $this->assertSame( IMAGETYPE_PNG, $type ); 47 48 unlink( $image );49 51 } 50 52 … … 56 58 } 57 59 60 list( $w, $h, $type ) = getimagesize( $image ); 61 62 unlink( $image ); 63 58 64 $this->assertSame( 'test-image-25x25.gif', wp_basename( $image ) ); 59 list($w, $h, $type) = getimagesize( $image );60 65 $this->assertSame( 25, $w ); 61 66 $this->assertSame( 25, $h ); 62 67 $this->assertSame( IMAGETYPE_GIF, $type ); 63 64 unlink( $image );65 68 } 66 69 … … 75 78 76 79 $image = $this->resize_helper( $file, 25, 25 ); 80 81 list( $w, $h, $type ) = wp_getimagesize( $image ); 82 83 unlink( $image ); 84 77 85 $this->assertSame( 'test-image-25x25.webp', wp_basename( $image ) ); 78 list($w, $h, $type) = wp_getimagesize( $image );79 86 $this->assertSame( 25, $w ); 80 87 $this->assertSame( 25, $h ); 81 88 $this->assertSame( IMAGETYPE_WEBP, $type ); 82 unlink( $image );83 89 } 84 90 … … 94 100 $image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 128, 96 ); 95 101 102 list( $w, $h, $type ) = getimagesize( $image ); 103 104 unlink( $image ); 105 96 106 $this->assertSame( '2007-06-17DSC_4173-64x96.jpg', wp_basename( $image ) ); 97 list($w, $h, $type) = getimagesize( $image );98 107 $this->assertSame( 64, $w ); 99 108 $this->assertSame( 96, $h ); 100 109 $this->assertSame( IMAGETYPE_JPEG, $type ); 101 102 unlink( $image );103 110 } 104 111 … … 106 113 $image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 128, 0 ); 107 114 115 list( $w, $h, $type ) = getimagesize( $image ); 116 117 unlink( $image ); 118 108 119 $this->assertSame( '2007-06-17DSC_4173-128x193.jpg', wp_basename( $image ) ); 109 list($w, $h, $type) = getimagesize( $image );110 120 $this->assertSame( 128, $w ); 111 121 $this->assertSame( 193, $h ); 112 122 $this->assertSame( IMAGETYPE_JPEG, $type ); 113 114 unlink( $image );115 123 } 116 124 … … 118 126 $image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 0, 96 ); 119 127 128 list( $w, $h, $type ) = getimagesize( $image ); 129 130 unlink( $image ); 131 120 132 $this->assertSame( '2007-06-17DSC_4173-64x96.jpg', wp_basename( $image ) ); 121 list($w, $h, $type) = getimagesize( $image );122 133 $this->assertSame( 64, $w ); 123 134 $this->assertSame( 96, $h ); 124 135 $this->assertSame( IMAGETYPE_JPEG, $type ); 125 126 unlink( $image );127 136 } 128 137 … … 130 139 $image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 150, 150, true ); 131 140 141 list( $w, $h, $type ) = getimagesize( $image ); 142 143 unlink( $image ); 144 132 145 $this->assertSame( '2007-06-17DSC_4173-150x150.jpg', wp_basename( $image ) ); 133 list($w, $h, $type) = getimagesize( $image );134 146 $this->assertSame( 150, $w ); 135 147 $this->assertSame( 150, $h ); 136 148 $this->assertSame( IMAGETYPE_JPEG, $type ); 137 138 unlink( $image );139 149 } 140 150 … … 142 152 $image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 150, 100, true ); 143 153 154 list( $w, $h, $type ) = getimagesize( $image ); 155 156 unlink( $image ); 157 144 158 $this->assertSame( '2007-06-17DSC_4173-150x100.jpg', wp_basename( $image ) ); 145 list($w, $h, $type) = getimagesize( $image );146 159 $this->assertSame( 150, $w ); 147 160 $this->assertSame( 100, $h ); 148 161 $this->assertSame( IMAGETYPE_JPEG, $type ); 149 150 unlink( $image );151 162 } 152 163 … … 154 165 $image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 50, 150, true ); 155 166 167 list( $w, $h, $type ) = getimagesize( $image ); 168 169 unlink( $image ); 170 156 171 $this->assertSame( '2007-06-17DSC_4173-50x150.jpg', wp_basename( $image ) ); 157 list($w, $h, $type) = getimagesize( $image );158 172 $this->assertSame( 50, $w ); 159 173 $this->assertSame( 150, $h ); 160 174 $this->assertSame( IMAGETYPE_JPEG, $type ); 161 162 unlink( $image );163 175 } 164 176 … … 186 198 187 199 $resized = $editor->resize( $width, $height, $crop ); 200 188 201 if ( is_wp_error( $resized ) ) { 189 202 return $resized;
Note: See TracChangeset
for help on using the changeset viewer.