Add antialias config option

Closes #41
This commit is contained in:
Andy Meneely
2015-02-28 19:34:46 -05:00
parent b5016f90c0
commit f49bff2388
33 changed files with 109 additions and 8 deletions
+4
View File
@@ -15,10 +15,13 @@ describe Squib::Card do
allow(@deck).to receive(:dir).and_return('_output')
allow(@deck).to receive(:count_format).and_return('%02d')
allow(@deck).to receive(:prefix).and_return('card_')
allow(@deck).to receive(:antialias).and_return('best')
end
context '#png' do
it 'makes all the expected calls on a smoke test' do
expect(@context).to receive(:antialias=).with('best')
expect(@context).to receive(:save).once
expect(@context).to receive(:translate).with(-37, -38).once
expect(@context).to receive(:rotate).with(0.0).once
@@ -45,6 +48,7 @@ describe Squib::Card do
it 'makes all the expected calls on a smoke test' do
expect(@svg).to receive(:width).and_return(100).twice
expect(@svg).to receive(:height).and_return(100).twice
expect(@context).to receive(:antialias=).with('best').once
expect(@context).to receive(:save).once
expect(@context).to receive(:rotate).with(0.0).once
expect(@context).to receive(:translate).with(37, 38).once
+2 -1
View File
@@ -20,13 +20,14 @@ describe Squib::Deck, '#save_pdf' do
before(:each) do
allow(Cairo::PDFSurface).to receive(:new).and_return(nil) #don't create the file
allow(Cairo::Context).to receive(:new).and_return(cxt)
allow(cxt).to receive(:antialias=)
end
it 'make all the expected calls on a smoke test' do
num_cards = 9
deck = Squib::Deck.new(cards: 9, width: 825, height: 1125)
expect(Squib.logger).to receive(:debug).at_least(:once)
expect(deck).to receive(:dirify) { |arg| arg } #don't create the dir
expect(Squib.logger).to receive(:debug).at_least(:once)
expect_card_place(75, 75)
expect_card_place(831, 75)
+5
View File
@@ -18,10 +18,12 @@ describe Squib::Card do
allow(@deck).to receive(:dir).and_return('_output')
allow(@deck).to receive(:count_format).and_return('%02d')
allow(@deck).to receive(:prefix).and_return('card_')
allow(@deck).to receive(:antialias).and_return('best')
end
context 'rect' do
it 'make all the expected calls on a smoke test' do
expect(@context).to receive(:antialias=).with('best')
expect(@context).to receive(:save).once
expect(@context).to receive(:rounded_rectangle).with(37, 38, 50, 100, 10, 15).twice
expect_stroke('#fff', '#f00', 2.0)
@@ -36,6 +38,7 @@ describe Squib::Card do
context 'circle' do
it 'make all the expected calls on a smoke test' do
expect(@context).to receive(:antialias=).with('best')
expect(@context).to receive(:save).once
expect(@context).to receive(:move_to).with(137, 38)
expect(@context).to receive(:circle).with(37, 38, 100).twice
@@ -51,6 +54,7 @@ describe Squib::Card do
context 'triangle' do
it 'make all the expected calls on a smoke test' do
expect(@context).to receive(:antialias=).with('best')
expect(@context).to receive(:save).once
expect(@context).to receive(:triangle).with(1, 2, 3, 4, 5, 6).twice
expect_stroke('#fff', '#f00', 2.0)
@@ -63,6 +67,7 @@ describe Squib::Card do
context 'line' do
it 'make all the expected calls on a smoke test' do
expect(@context).to receive(:antialias=).with('best')
expect(@context).to receive(:save).once
expect(@context).to receive(:move_to).with(1, 2).once
expect(@context).to receive(:line_to).with(3, 4).once
+3
View File
@@ -14,11 +14,13 @@ describe Squib::Card, '#text' do
allow(deck).to receive(:dir).and_return('_output')
allow(deck).to receive(:count_format).and_return('%02d')
allow(deck).to receive(:prefix).and_return('card_')
allow(deck).to receive(:antialias).and_return('best')
end
it 'make all the expected calls on a smoke test' do
extent = Pango::Rectangle.new(50,60,100,200)
expect(Squib.logger).to receive(:debug).once
expect(context).to receive(:antialias=).with('best').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
@@ -67,6 +69,7 @@ describe Squib::Card, '#text' do
allow(deck).to receive(:dir).and_return('_output')
allow(deck).to receive(:count_format).and_return('%02d')
allow(deck).to receive(:prefix).and_return('card_')
allow(deck).to receive(:antialias).and_return('best')
end
it 'aligns right with strings' do