Changeset 54417 for trunk/tests/phpunit/tests/image/editor.php
- Timestamp:
- 10/07/2022 07:15:59 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/image/editor.php
r54226 r54417 106 106 // Ensure wp_editor_set_quality filter applies if it exists before editor instantiation. 107 107 $this->assertSame( 100, $editor->get_quality() ); 108 109 // Clean up.110 remove_filter( 'wp_editor_set_quality', $func_100_percent );111 108 } 112 109 … … 120 117 $editor->set_mime_type( 'image/png' ); // Ensure mime-specific filters act properly. 121 118 119 // Quality setting for the source image. For PNG the fallback default of 82 is used. 120 $this->assertSame( 82, $editor->get_quality(), 'Default quality setting is 82.' ); 121 122 122 // Set conversions for uploaded images. 123 123 add_filter( 'image_editor_output_format', array( $this, 'image_editor_output_formats' ) ); … … 126 126 $this->assertSame( 82, $editor->get_quality(), 'Default quality setting is 82.' ); 127 127 128 // Quality should change to the output format's value. 129 // A PNG image will be converted to WEBP whose quialty should be 86. 130 $editor->save(); 131 $this->assertSame( 86, $editor->get_quality(), 'Output image format is WEBP. Quality setting for it should be 86.' ); 132 133 // Removing PNG to WEBP conversion on save. Quality setting should reset to the default. 128 // When saving, quality should change to the output format's value. 129 // A PNG image will be converted to WebP whose quality should be 86. 130 $editor->save(); 131 $this->assertSame( 86, $editor->get_quality(), 'Output image format is WebP. Quality setting for it should be 86.' ); 132 133 // Saving again should not change the quality. 134 $editor->save(); 135 $this->assertSame( 86, $editor->get_quality(), 'Output image format is WebP. Quality setting for it should be 86.' ); 136 137 // Removing PNG to WebP conversion on save. Quality setting should reset to the default. 134 138 remove_filter( 'image_editor_output_format', array( $this, 'image_editor_output_formats' ) ); 135 139 $editor->save(); … … 150 154 151 155 // Quality should change to the output format's value as filtered above. 152 // A JPEG image will be converted to W EBP whose quialty should be 42.153 $editor->save(); 154 $this->assertSame( 42, $editor->get_quality(), 'Image conversion from JPEG to WEBP. Filtered WEBP quality sho ild be 42.' );156 // A JPEG image will be converted to WebP whose quialty should be 42. 157 $editor->save(); 158 $this->assertSame( 42, $editor->get_quality(), 'Image conversion from JPEG to WEBP. Filtered WEBP quality should be 42.' ); 155 159 156 160 // After removing the conversion the quality setting should reset to the filtered value for the original image type, JPEG. … … 162 166 'After removing image conversion the quality setting should reset to the filtered value for JPEG, 56.' 163 167 ); 164 165 remove_filter( 'wp_editor_set_quality', array( $this, 'image_editor_change_quality' ) );166 168 } 167 169
Note: See TracChangeset
for help on using the changeset viewer.