Changeset 60667 for trunk/tests/phpunit/tests/image/editorImagick.php
- Timestamp:
- 08/26/2025 08:55:24 PM (5 months ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/image/editorImagick.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/image/editorImagick.php
r60246 r60667 874 874 ); 875 875 } 876 877 /** 878 * Tests that alpha transparency is preserved after resizing. 879 * 880 * @ticket 63448 881 * @dataProvider data_alpha_transparency_is_preserved_after_resize 882 * 883 * @param string $file_path Path to the image file. 884 */ 885 public function test_alpha_transparency_is_preserved_after_resize( $file_path ) { 886 887 $temp_file = DIR_TESTDATA . '/images/test-temp.png'; 888 889 $imagick_image_editor = new WP_Image_Editor_Imagick( $file_path ); 890 $imagick_image_editor->load(); 891 892 $size = $imagick_image_editor->get_size(); 893 $imagick_image_editor->resize( $size['width'] * 0.5, $size['height'] * 0.5 ); 894 $imagick_image_editor->save( $temp_file ); 895 896 $imagick = new Imagick( $temp_file ); 897 $alpha_channel_depth = $imagick->getImageChannelDepth( Imagick::CHANNEL_ALPHA ); 898 899 unlink( $temp_file ); 900 901 $this->assertGreaterThan( 1, $alpha_channel_depth, "Alpha transparency should be preserved after resize for {$file_path}." ); 902 } 903 904 public static function data_alpha_transparency_is_preserved_after_resize() { 905 return array( 906 'oval-or8' => array( 907 DIR_TESTDATA . '/images/png-tests/oval-or8.png', 908 ), 909 'oval-or8-grayscale-indexed' => array( 910 DIR_TESTDATA . '/images/png-tests/oval-or8-grayscale-indexed.png', 911 ), 912 ); 913 } 876 914 }
Note: See TracChangeset
for help on using the changeset viewer.