Browse Source

Some more tests to round out the coverage

dev
Andy Meneely 11 years ago
parent
commit
4bdf37e4dc
  1. 27
      spec/graphics/graphics_text_spec.rb

27
spec/graphics/graphics_text_spec.rb

@ -84,6 +84,15 @@ describe Squib::Card, '#text' do
1.0, :left, :top, nil, 0.0) 1.0, :left, :top, nil, 0.0)
end end
it 'sets wrap to word with word string' do
card = Squib::Card.new(@deck, 100, 150)
expect(@layout).to receive(:wrap=).with(Pango::Layout::WRAP_WORD).once
card.text('foo', 'Sans 12', nil, '#abc',
10, 15, 20, 50,
nil, false, 'word', false,
1.0, :left, :top, nil, 0.0)
end
it 'sets wrap to word_char with symbol word_char' do it 'sets wrap to word_char with symbol word_char' do
card = Squib::Card.new(@deck, 100, 150) card = Squib::Card.new(@deck, 100, 150)
expect(@layout).to receive(:wrap=).with(Pango::Layout::WRAP_WORD_CHAR).once expect(@layout).to receive(:wrap=).with(Pango::Layout::WRAP_WORD_CHAR).once
@ -102,5 +111,23 @@ describe Squib::Card, '#text' do
1.0, :left, :top, nil, 0.0) 1.0, :left, :top, nil, 0.0)
end end
it 'sets ellipsize to start properly' do
card = Squib::Card.new(@deck, 100, 150)
expect(@layout).to receive(:ellipsize=).with(Pango::Layout::ELLIPSIZE_START).once
card.text('foo', 'Sans 12', nil, '#abc',
10, 15, 20, 50,
nil, false, true, :start,
1.0, :left, :top, nil, 0.0)
end
it 'sets ellipsize to middle properly' do
card = Squib::Card.new(@deck, 100, 150)
expect(@layout).to receive(:ellipsize=).with(Pango::Layout::ELLIPSIZE_MIDDLE).once
card.text('foo', 'Sans 12', nil, '#abc',
10, 15, 20, 50,
nil, false, true, 'middle',
1.0, :left, :top, nil, 0.0)
end
end end
end end

Loading…
Cancel
Save