change x= to *=, add unit tests and improve existing tests

This commit is contained in:
Clarence "Sparr" Risher
2017-10-05 19:41:43 -04:00
committed by Andy Meneely
parent b3bd8f03d8
commit 8509ab5728
4 changed files with 17 additions and 8 deletions
+6 -2
View File
@@ -1,8 +1,12 @@
parent:
x: 0.5in
x: 100
y: 1in
width: 200
height: 1cm
child:
extends: parent
x: += 1in
y: -= 0.5in
y: -= 1cm
width: "*= 1.5"
height: /= 4
+7 -2
View File
@@ -206,8 +206,13 @@ describe Squib::LayoutParser do
it 'does mixed unit conversion when extending' do
layout = subject.load_layout(layout_file('extends-units-mixed.yml'))
expect(layout).to eq({
'parent' => { 'x' => '0.5in', 'y' => '1in'},
'child' => { 'x' => 450.0, 'y' => 150.0, 'extends' => 'parent' },
'parent' => {
'x' => 100, 'y' => '1in',
'width' => 200, 'height' => '1cm' },
'child' => {
'x' => 400.0, 'y' => 181.8897639,
'width' => 300.0, 'height' => 29.527559025,
'extends' => 'parent' },
})
end