Changeset 47122 for trunk/tests/phpunit/tests/image/editor.php
- Timestamp:
- 01/29/2020 12:43:23 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/image/editor.php
r46586 r47122 70 70 public function test_set_quality() { 71 71 72 // Get an editor 72 // Get an editor. 73 73 $editor = wp_get_image_editor( DIR_TESTDATA . '/images/canola.jpg' ); 74 74 $editor->set_mime_type( 'image/jpeg' ); // Ensure mime-specific filters act properly. 75 75 76 // Check default value 76 // Check default value. 77 77 $this->assertEquals( 82, $editor->get_quality() ); 78 78 … … 86 86 $this->assertEquals( 82, $editor->get_quality() ); 87 87 88 // Ensure set_quality() works and overrides the filters 88 // Ensure set_quality() works and overrides the filters. 89 89 $this->assertTrue( $editor->set_quality( 75 ) ); 90 90 $this->assertEquals( 75, $editor->get_quality() ); 91 91 92 // Get a new editor to clear default quality state 92 // Get a new editor to clear default quality state. 93 93 unset( $editor ); 94 94 $editor = wp_get_image_editor( DIR_TESTDATA . '/images/canola.jpg' ); … … 98 98 $this->assertEquals( 95, $editor->get_quality() ); 99 99 100 // Get a new editor to clear jpeg_quality state 100 // Get a new editor to clear jpeg_quality state. 101 101 remove_filter( 'jpeg_quality', $func_95_percent ); 102 102 unset( $editor ); … … 106 106 $this->assertEquals( 100, $editor->get_quality() ); 107 107 108 // Clean up 108 // Clean up. 109 109 remove_filter( 'wp_editor_set_quality', $func_100_percent ); 110 110 } … … 117 117 public function test_generate_filename() { 118 118 119 // Get an editor 119 // Get an editor. 120 120 $editor = wp_get_image_editor( DIR_TESTDATA . '/images/canola.jpg' ); 121 121 … … 130 130 ); 131 131 132 // Test with no parameters 132 // Test with no parameters. 133 133 $this->assertEquals( 'canola-100x50.jpg', wp_basename( $editor->generate_filename() ) ); 134 134 135 // Test with a suffix only 135 // Test with a suffix only. 136 136 $this->assertEquals( 'canola-new.jpg', wp_basename( $editor->generate_filename( 'new' ) ) ); 137 137 138 // Test with a destination dir only 138 // Test with a destination dir only. 139 139 $this->assertEquals( trailingslashit( realpath( get_temp_dir() ) ), trailingslashit( realpath( dirname( $editor->generate_filename( null, get_temp_dir() ) ) ) ) ); 140 140 141 // Test with a suffix only 141 // Test with a suffix only. 142 142 $this->assertEquals( 'canola-100x50.png', wp_basename( $editor->generate_filename( null, null, 'png' ) ) ); 143 143 … … 155 155 $editor = wp_get_image_editor( DIR_TESTDATA . '/images/canola.jpg' ); 156 156 157 // Size should be false by default 157 // Size should be false by default. 158 158 $this->assertNull( $editor->get_size() ); 159 159 160 // Set a size 160 // Set a size. 161 161 $size = array( 162 162 'height' => 50, … … 178 178 $editor = wp_get_image_editor( DIR_TESTDATA . '/images/canola.jpg' ); 179 179 180 // Size should be false by default 180 // Size should be false by default. 181 181 $this->assertFalse( $editor->get_suffix() ); 182 182 183 // Set a size 183 // Set a size. 184 184 $size = array( 185 185 'height' => 50,
Note: See TracChangeset
for help on using the changeset viewer.