Changeset 50810 for trunk/tests/phpunit/tests/image/editor.php
- Timestamp:
- 05/04/2021 02:43:36 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/image/editor.php
r50449 r50810 196 196 $this->assertSame( '100x50', $editor->get_suffix() ); 197 197 } 198 199 /** 200 * Test wp_get_webp_info. 201 * 202 * @ticket 35725 203 * @dataProvider _test_wp_get_webp_info 204 * 205 */ 206 public function test_wp_get_webp_info( $file, $expected ) { 207 $editor = wp_get_image_editor( $file ); 208 if ( is_wp_error( $editor ) || ! $editor->supports_mime_type( 'image/webp' ) ) { 209 $this->markTestSkipped( sprintf( 'Skipping test: no WebP support in the editor engine %s on this system.', $this->editor_engine ) ); 210 } else { 211 $file_data = wp_get_webp_info( $file ); 212 $this->assertSame( $file_data, $expected ); 213 } 214 } 215 216 /** 217 * Data provider for test_wp_get_webp_info(); 218 */ 219 public function _test_wp_get_webp_info() { 220 return array( 221 // Standard JPEG. 222 array( 223 DIR_TESTDATA . '/images/test-image.jpg', 224 array( 225 'width' => false, 226 'height' => false, 227 'type' => false, 228 ), 229 ), 230 // Standard GIF. 231 array( 232 DIR_TESTDATA . '/images/test-image.gif', 233 array( 234 'width' => false, 235 'height' => false, 236 'type' => false, 237 ), 238 ), 239 // Animated WebP. 240 array( 241 DIR_TESTDATA . '/images/webp-animated.webp', 242 array( 243 'width' => 100, 244 'height' => 100, 245 'type' => 'animated-alpha', 246 ), 247 ), 248 // Lossless WebP. 249 array( 250 DIR_TESTDATA . '/images/webp-lossless.webp', 251 array( 252 'width' => 1200, 253 'height' => 675, 254 'type' => 'lossless', 255 ), 256 ), 257 // Lossy WebP. 258 array( 259 DIR_TESTDATA . '/images/webp-lossy.webp', 260 array( 261 'width' => 1200, 262 'height' => 675, 263 'type' => 'lossy', 264 ), 265 ), 266 // Transparent WebP. 267 array( 268 DIR_TESTDATA . '/images/webp-transparent.webp', 269 array( 270 'width' => 1200, 271 'height' => 675, 272 'type' => 'animated-alpha', 273 ), 274 ), 275 ); 276 } 277 198 278 }
Note: See TracChangeset
for help on using the changeset viewer.