From 4bdf37e4dc56cffc4650d9086341ede3b79b4984 Mon Sep 17 00:00:00 2001 From: Andy Meneely Date: Mon, 3 Nov 2014 09:08:12 -0500 Subject: [PATCH] Some more tests to round out the coverage --- spec/graphics/graphics_text_spec.rb | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/spec/graphics/graphics_text_spec.rb b/spec/graphics/graphics_text_spec.rb index cbf2bfc..67c8eae 100644 --- a/spec/graphics/graphics_text_spec.rb +++ b/spec/graphics/graphics_text_spec.rb @@ -84,6 +84,15 @@ describe Squib::Card, '#text' do 1.0, :left, :top, nil, 0.0) 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 card = Squib::Card.new(@deck, 100, 150) 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) 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