Allow negative coordinates in sprue coordinates

Fixes #336
This commit is contained in:
Andy Meneely
2021-08-11 15:00:54 -04:00
parent 62a2d54ed2
commit c795852fa8
7 changed files with 43 additions and 3 deletions
+7
View File
@@ -0,0 +1,7 @@
sheet_width: 8.5in
sheet_height: 11in
card_width: 2.5in
card_height: 3.5in
cards:
- x: -0.5in
y: -1in
+7
View File
@@ -158,6 +158,13 @@ describe Squib::Sprue do
expect(tmpl.cards.map { |card| card['flip_horizontal'] })
.to eq( [false, false, true] )
end
it 'parses negative coordinates' do
tmpl = Squib::Sprue.load(sprue_file('negatives.yml'), 100, 37.5)
expect(tmpl.cards.length).to eq(1)
expect(tmpl.cards.map { |card| card['x'] }) .to eq( [-50] )
expect(tmpl.cards.map { |card| card['y'] }) .to eq( [-100] )
end
it 'fails when sheet_width is not defined' do
expect do