File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ def convert_color(value, options: nil)
4545
4646 if val . match /\A #([a-f0-9]{3})\Z / # rubocop:disable Performance/RedundantMatch
4747 r , g , b = Regexp . last_match [ 1 ] . chars
48- return r * 2 + g * 2 + b * 2
48+ return ( r * 2 ) + ( g * 2 ) + ( b * 2 )
4949 end
5050 if val . match /\A rgb\s *\( \s *(\d +)\s *,\s *(\d +)\s *,\s *(\d +)\s *\) \Z / # rubocop:disable Performance/RedundantMatch
5151 r , g , b = Regexp . last_match [ 1 ..3 ] . map { |v | v . to_i . to_s ( 16 ) }
Original file line number Diff line number Diff line change 5151 expected_array = [
5252 [ x , y . round ( 5 ) ] ,
5353 [ x , ( y - font . height - TestUtils . adjust_leading ) . round ( 5 ) ] ,
54- [ x , ( y - font . height * 2 - TestUtils . adjust_leading * 2 ) . round ( 5 ) ]
54+ [ x , ( y - ( font . height * 2 ) - ( TestUtils . adjust_leading * 2 ) ) . round ( 5 ) ]
5555 ]
5656
5757 expect ( text_analysis . positions ) . to match_array ( expected_array )
Original file line number Diff line number Diff line change 2929 let ( :expected_content ) { [ 'Some content' ] }
3030 let ( :expected_positions ) do
3131 [ [
32- ( pdf . page . margins [ :left ] + ( pdf . bounds . width - content_width ) / 2 ) . round ( 4 ) ,
32+ ( pdf . page . margins [ :left ] + ( ( pdf . bounds . width - content_width ) / 2 ) ) . round ( 4 ) ,
3333 ( pdf . y - TestUtils . default_font . ascender ) . round ( 4 )
3434 ] ]
3535 end
151151 text_analysis = PDF ::Inspector ::Text . analyze ( pdf . render )
152152
153153 expect ( text_analysis . strings ) . to eq ( [ 'aaa' , 'bbb' , 'ccc' ] )
154- expect ( text_analysis . character_spacing ) . to eq ( [ 1.5 , 0.0 ] * 3 + [ 2.0 , 0.0 ] * 3 )
154+ expect ( text_analysis . character_spacing ) . to eq ( ( [ 1.5 , 0.0 ] * 3 ) + ( [ 2.0 , 0.0 ] * 3 ) )
155155 end
156156 end
157157
You can’t perform that action at this time.
0 commit comments