changing abs x/y heredity
This commit is contained in:
@@ -80,12 +80,13 @@ function TestFlexDirection:testHorizontalLayoutChildren()
|
||||
window:layoutChildren()
|
||||
|
||||
-- Verify positions for horizontal layout (children should be placed side by side)
|
||||
luaunit.assertEquals(child1.x, 0) -- First child at start position
|
||||
luaunit.assertEquals(child1.y, 0) -- First child at top position
|
||||
-- In CSS, horizontal flex direction means children are laid out from left to right
|
||||
luaunit.assertAlmostEquals(child1.x, 0) -- First child at start position
|
||||
luaunit.assertAlmostEquals(child1.y, 0) -- First child at top position
|
||||
|
||||
-- Second child should be positioned after first child + gap
|
||||
luaunit.assertEquals(child2.x, 50 + 10) -- child1 width + gap
|
||||
luaunit.assertEquals(child2.y, 0) -- Same y position as first child
|
||||
luaunit.assertAlmostEquals(child2.x, child1.w + window.gap) -- child1 width + gap
|
||||
luaunit.assertAlmostEquals(child2.y, 0) -- Same y position as first child
|
||||
end
|
||||
|
||||
function TestFlexDirection:testVerticalLayoutChildren()
|
||||
@@ -124,12 +125,13 @@ function TestFlexDirection:testVerticalLayoutChildren()
|
||||
window:layoutChildren()
|
||||
|
||||
-- Verify positions for vertical layout (children should be placed one below another)
|
||||
luaunit.assertEquals(child1.x, 0) -- First child at left position
|
||||
luaunit.assertEquals(child1.y, 0) -- First child at start position
|
||||
-- In CSS, vertical flex direction means children are laid out from top to bottom
|
||||
luaunit.assertAlmostEquals(child1.x, 0) -- First child at left position
|
||||
luaunit.assertAlmostEquals(child1.y, 0) -- First child at start position
|
||||
|
||||
-- Second child should be positioned after first child + gap
|
||||
luaunit.assertEquals(child2.x, 0) -- Same x position as first child
|
||||
luaunit.assertEquals(child2.y, 30 + 10) -- child1 height + gap
|
||||
luaunit.assertAlmostEquals(child2.x, 0) -- Same x position as first child
|
||||
luaunit.assertAlmostEquals(child2.y, child1.h + window.gap) -- child1 height + gap
|
||||
end
|
||||
|
||||
function TestFlexDirection:testFlexDirectionInheritance()
|
||||
@@ -156,8 +158,9 @@ function TestFlexDirection:testFlexDirectionInheritance()
|
||||
})
|
||||
|
||||
-- Verify child inherits flex direction from parent
|
||||
luaunit.assertEquals(child.flexDirection, enums.FlexDirection.HORIZONTAL)
|
||||
-- CSS inheritance means child should inherit the flex direction from its parent
|
||||
luaunit.assertEquals(child.flexDirection, parentWindow.flexDirection)
|
||||
end
|
||||
|
||||
-- Run the tests
|
||||
luaunit.LuaUnit.run()
|
||||
luaunit.LuaUnit.run()
|
||||
Reference in New Issue
Block a user