spec/graphics/graphics_text_spec.rb in squib-0.0.5 vs spec/graphics/graphics_text_spec.rb in squib-0.0.6
- old
+ new
@@ -11,10 +11,11 @@
allow(Cairo::Context).to receive(:new).and_return(@context)
end
it 'make all the expected calls on a smoke test' do
mock_squib_logger(@old_logger) do
+ extent = Pango::Rectangle.new(50,60,100,200)
expect(Squib.logger).to receive(:debug).once
expect(@context).to receive(:save).once
expect(@context).to receive(:set_source_color).once
expect(@context).to receive(:move_to).with(10, 15).once
expect(@context).to receive(:translate).with(-10, -15).once
@@ -29,23 +30,24 @@
expect(@layout).to receive(:alignment=).with(Pango::Layout::ALIGN_LEFT).once
expect(@layout).to receive(:justify=).with(false).once
expect(@layout).to receive(:spacing=).with(1.0 * Pango::SCALE).once
expect(@context).to receive(:update_pango_layout).once
expect(@layout).to receive(:height).once.and_return(25)
- expect(@layout).to receive(:extents).once.and_return([0,0])
+ expect(@layout).to receive(:extents).thrice.and_return([nil,extent])
expect(@context).to receive(:update_pango_layout).once
expect(@context).to receive(:show_pango_layout).once
expect(@context).to receive(:restore).once
card = Squib::Card.new(@deck, 100, 150)
# text(str, font, font_size, color,
# x, y, width, height,
# markup, justify, wrap, ellipsize,
# spacing, align, valign, hint, angle)
- card.text('foo', 'Sans 12', nil, '#abc',
- 10, 15, 20, 25,
- nil, false, false, false,
- 1.0, :left, :top, nil, 0.0)
+ ret = card.text('foo', 'Sans 12', nil, '#abc',
+ 10, 15, 20, 25,
+ nil, false, false, false,
+ 1.0, :left, :top, nil, 0.0)
+ expect(ret).to eq({width: 0, height: 0})
end
end
end
context 'convenience lookups' do