Changeset 57652
- Timestamp:
- 02/18/2024 02:57:23 PM (8 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-duotone.php
r57135 r57652 210 210 ); 211 211 212 $factor = $angle_units[ $unit ]; 213 if ( ! $factor ) { 214 $factor = 1; 215 } 212 $factor = isset( $angle_units[ $unit ] ) ? $angle_units[ $unit ] : 1; 216 213 217 214 return (float) $value * $factor; -
trunk/tests/phpunit/tests/block-supports/duotone.php
r57062 r57652 6 6 * @group block-supports 7 7 * 8 * @ package WordPress8 * @coversDefaultClass WP_Duotone 9 9 */ 10 10 … … 167 167 ); 168 168 } 169 170 /** 171 * @dataProvider data_colord_parse_hue 172 * @ticket 59496 173 */ 174 public function test_colord_parse_hue( $value, $unit, $expected ) { 175 $reflection = new ReflectionMethod( 'WP_Duotone', 'colord_parse_hue' ); 176 $reflection->setAccessible( true ); 177 178 $this->assertSame( $expected, $reflection->invoke( null, $value, $unit ) ); 179 } 180 181 /** 182 * Data provider. 183 * 184 * @return array[]. 185 */ 186 public function data_colord_parse_hue() { 187 return array( 188 'deg-angle-unit' => array( 120, 'deg', 120.0 ), 189 'grad-angle-unit' => array( 120, 'grad', 108.0 ), 190 'turn-angle-unit' => array( 120, 'turn', 43200.0 ), 191 'rad-angle-unit' => array( 120, 'rad', 6875.493541569878 ), 192 'empty-angle-unit' => array( 120, '', 120.0 ), 193 'invalid-angle-unit' => array( 120, 'invalid', 120.0 ), 194 'negative-value-deg-angle-unit' => array( -120, 'deg', -120.0 ), 195 ); 196 } 169 197 }
Note: See TracChangeset
for help on using the changeset viewer.