@ -62,17 +62,17 @@ def overwrite_sample(sample_name, log)
end
def scrub_hex ( str )
str . gsub ( / 0x \ w{1,8} / , '' )
. gsub ( / ptr= \ w{1,8} / , '' )
. gsub ( / # <Pango::FontDescription:.*> / , '' )
. gsub ( / # <Cairo::ImageSurface:.*> / , 'ImageSurface' )
. gsub ( / # <Cairo::LinearPattern:.*> / , 'LinearPattern' )
. gsub ( / # <Cairo::RadialPattern:.*> / , 'RadialPattern' )
. gsub ( / # <Cairo::Matrix:.*> / , 'Matrix' )
. gsub ( / # <RSVG::Handle.*> / , 'RSVG::Handle' )
. gsub ( / # <RSpec::Mocks::Double:.*> / , 'MockDouble' )
. gsub ( / # <Double .*> / , 'MockDouble' )
. gsub ( / RGB: \ w{1,8} / , 'RGB:' )
str . gsub ( / 0x \ w{1,8} / , '' )
. gsub ( / ptr= \ w{1,8} / , '' )
. gsub ( / # <Pango::FontDescription:.*> / , '' )
. gsub ( / # <Cairo::ImageSurface:.*> / , 'ImageSurface' )
. gsub ( / # <Cairo::LinearPattern:.*> / , 'LinearPattern' )
. gsub ( / # <Cairo::RadialPattern:.*> / , 'RadialPattern' )
. gsub ( / # <Cairo::Matrix:.*> / , 'Matrix' )
. gsub ( / # <RSVG::Handle.*> / , 'RSVG::Handle' )
. gsub ( / # <RSpec::Mocks::Double:.*> / , 'MockDouble' )
. gsub ( / # <Double .*> / , 'MockDouble' )
. gsub ( / RGB: \ w{1,8} / , 'RGB:' )
end
# Build a mock cairo instance that allows basically any method
@ -90,22 +90,22 @@ def mock_cairo(strio)
allow ( Cairo :: ImageSurface ) . to receive ( :new ) . and_return ( surface )
allow ( surface ) . to receive ( :width ) . and_return ( 100 )
allow ( surface ) . to receive ( :height ) . and_return ( 101 )
allow ( surface ) . to receive ( :ink_extents ) . and_return ( [ 0 , 0 , 100 , 100 ] )
allow ( surface ) . to receive ( :ink_extents ) . and_return ( [ 0 , 0 , 100 , 100 ] )
allow ( Cairo :: Context ) . to receive ( :new ) . and_return ( cxt )
allow ( cxt ) . to receive ( :create_pango_layout ) . and_return ( pango )
allow ( cxt ) . to receive ( :target ) . and_return ( surface )
allow ( cxt ) . to receive ( :matrix ) . and_return ( Cairo :: Matrix . new ( 1 , 0 , 0 , 1 , 0 , 0 ) )
allow ( cxt ) . to receive ( :matrix ) . and_return ( Cairo :: Matrix . new ( 1 , 0 , 0 , 1 , 0 , 0 ) )
allow ( pango ) . to receive ( :height ) . and_return ( 25 )
allow ( pango ) . to receive ( :width ) . and_return ( 25 )
allow ( pango ) . to receive ( :index_to_pos ) . and_return ( Pango :: Rectangle . new ( 0 , 0 , 0 , 0 ) )
allow ( pango ) . to receive ( :extents ) . and_return ( [ Pango :: Rectangle . new ( 0 , 0 , 0 , 0 ) ] * 2 )
allow ( pango ) . to receive ( :index_to_pos ) . and_return ( Pango :: Rectangle . new ( 0 , 0 , 0 , 0 ) )
allow ( pango ) . to receive ( :extents ) . and_return ( [ Pango :: Rectangle . new ( 0 , 0 , 0 , 0 ) ] * 2 )
allow ( pango ) . to receive ( :iter ) . and_return ( iter )
allow ( pango ) . to receive ( :alignment ) . and_return ( Pango :: Layout :: Alignment :: LEFT )
allow ( pango ) . to receive ( :text ) . and_return ( " foo " )
allow ( pango ) . to receive ( :context ) . and_return ( pango_cxt )
allow ( pango_cxt ) . to receive ( :font_options = )
allow ( iter ) . to receive ( :next_char! ) . and_return ( false )
allow ( iter ) . to receive ( :char_extents ) . and_return ( Pango :: Rectangle . new ( 5 , 5 , 5 , 5 ) )
allow ( iter ) . to receive ( :char_extents ) . and_return ( Pango :: Rectangle . new ( 5 , 5 , 5 , 5 ) )
allow ( iter ) . to receive ( :index ) . and_return ( 1000 )
allow ( Pango :: FontDescription ) . to receive ( :new ) . and_return ( font )
allow ( Cairo :: PDFSurface ) . to receive ( :new ) . and_return ( nil )