Add dash option to drawing operations

Currently only impacts rect, but it will impact others with the new design shortly
This commit is contained in:
Andy Meneely
2015-06-08 15:26:33 -04:00
parent 12c5cd675b
commit 8a7841d64f
8 changed files with 47 additions and 7 deletions
+22 -1
View File
@@ -19,7 +19,28 @@ describe Squib::Args::Draw do
it 'converts to Cairo options' do
args = {join: 'bevel', cap: 'round'}
draw.load!(args)
expect(draw).to have_attributes(join: [Cairo::LINE_JOIN_BEVEL])
expect(draw).to have_attributes(
join: [Cairo::LINE_JOIN_BEVEL],
cap: [Cairo::LINE_CAP_ROUND]
)
end
it 'parses dash options' do
args = {dash: '3 4 5'}
draw.load!(args)
expect(draw).to have_attributes(dash: [[3, 4, 5]])
end
it 'parses more complex dash options' do
args = {dash: '30.5, 90, 5'}
draw.load!(args)
expect(draw).to have_attributes(dash: [[30.5, 90, 5]])
end
it 'does unit conversion on dash options' do
args = {dash: '3in 4in 5in'}
draw.load!(args)
expect(draw).to have_attributes(dash: [[900, 1200, 1500]])
end
end