mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 15:50:09 +00:00
Add ->get_quality() method to WP_Image_Editor class.
Adds unit tests. Props markoheijnen. Fixes #28154. git-svn-id: https://develop.svn.wordpress.org/trunk@28879 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -52,19 +52,15 @@ class Tests_Image_Editor extends WP_Image_UnitTestCase {
|
||||
// Get an editor
|
||||
$editor = wp_get_image_editor( DIR_TESTDATA . '/images/canola.jpg' );
|
||||
|
||||
// Make quality readable
|
||||
$property = new ReflectionProperty( $editor, 'quality' );
|
||||
$property->setAccessible( true );
|
||||
|
||||
// Ensure set_quality works
|
||||
$this->assertTrue( $editor->set_quality( 75 ) );
|
||||
$this->assertEquals( 75, $property->getValue( $editor ) );
|
||||
$this->assertEquals( 75, $editor->get_quality() );
|
||||
|
||||
// Ensure the quality filter works
|
||||
$func = create_function( '', "return 100;");
|
||||
add_filter( 'wp_editor_set_quality', $func );
|
||||
$this->assertTrue( $editor->set_quality( 75 ) );
|
||||
$this->assertEquals( 100, $property->getValue( $editor ) );
|
||||
$this->assertEquals( 75, $editor->get_quality() );
|
||||
|
||||
// Clean up
|
||||
remove_filter( 'wp_editor_set_quality', $func );
|
||||
|
||||
Reference in New Issue
Block a user