removing examples for a min
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package.path = package.path .. ";./?.lua;./game/?.lua;./game/utils/?.lua;./game/components/?.lua;./game/systems/?.lua"
|
||||
|
||||
local luaunit = require("testing.luaunit")
|
||||
require("testing/loveStub") -- Required to mock LOVE functions
|
||||
require("testing.loveStub") -- Required to mock LOVE functions
|
||||
local FlexLove = require("FlexLove")
|
||||
local Gui, enums = FlexLove.GUI, FlexLove.enums
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
package.path = package.path .. ";?.lua"
|
||||
|
||||
local luaunit = require("testing/luaunit")
|
||||
require("testing/loveStub") -- Required to mock LOVE functions
|
||||
local luaunit = require("testing.luaunit")
|
||||
require("testing.loveStub") -- Required to mock LOVE functions
|
||||
local FlexLove = require("FlexLove")
|
||||
local Gui, enums = FlexLove.GUI, FlexLove.enums
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
package.path = package.path .. ";?.lua"
|
||||
|
||||
local luaunit = require("testing/luaunit")
|
||||
require("testing/loveStub") -- Required to mock LOVE functions
|
||||
local luaunit = require("testing.luaunit")
|
||||
require("testing.loveStub") -- Required to mock LOVE functions
|
||||
local FlexLove = require("FlexLove")
|
||||
local Gui, enums = FlexLove.GUI, FlexLove.enums
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
package.path = package.path .. ";?.lua"
|
||||
|
||||
local luaunit = require("testing/luaunit")
|
||||
require("testing/loveStub") -- Required to mock LOVE functions
|
||||
local luaunit = require("testing.luaunit")
|
||||
require("testing.loveStub") -- Required to mock LOVE functions
|
||||
local FlexLove = require("FlexLove")
|
||||
local Gui, enums = FlexLove.GUI, FlexLove.enums
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
-- Load test framework and dependencies
|
||||
package.path = package.path .. ";?.lua"
|
||||
|
||||
local luaunit = require("testing/luaunit")
|
||||
require("testing/loveStub") -- Required to mock LOVE functions
|
||||
local luaunit = require("testing.luaunit")
|
||||
require("testing.loveStub") -- Required to mock LOVE functions
|
||||
local FlexLove = require("FlexLove")
|
||||
local Gui, enums = FlexLove.GUI, FlexLove.enums
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
-- Load test framework and dependencies
|
||||
package.path = package.path .. ";?.lua"
|
||||
|
||||
local luaunit = require("testing/luaunit")
|
||||
require("testing/loveStub") -- Required to mock LOVE functions
|
||||
local luaunit = require("testing.luaunit")
|
||||
require("testing.loveStub") -- Required to mock LOVE functions
|
||||
local FlexLove = require("FlexLove")
|
||||
local Gui, enums = FlexLove.GUI, FlexLove.enums
|
||||
|
||||
@@ -192,8 +192,8 @@ function TestAlignItems:testHorizontalFlexAlignItemsStretch()
|
||||
-- Children with explicit heights should NOT be stretched (CSS flexbox behavior)
|
||||
luaunit.assertEquals(child1.y, 0)
|
||||
luaunit.assertEquals(child2.y, 0)
|
||||
luaunit.assertEquals(child1.height, 30) -- Keeps explicit height
|
||||
luaunit.assertEquals(child2.height, 40) -- Keeps explicit height
|
||||
luaunit.assertEquals(child1.height, 30) -- Keeps explicit height
|
||||
luaunit.assertEquals(child2.height, 40) -- Keeps explicit height
|
||||
end
|
||||
|
||||
-- Test 5: Vertical Flex with AlignItems.FLEX_START
|
||||
@@ -360,8 +360,8 @@ function TestAlignItems:testVerticalFlexAlignItemsStretch()
|
||||
-- Children with explicit widths should NOT be stretched (CSS flexbox behavior)
|
||||
luaunit.assertEquals(child1.x, 0)
|
||||
luaunit.assertEquals(child2.x, 0)
|
||||
luaunit.assertEquals(child1.width, 50) -- Keeps explicit width
|
||||
luaunit.assertEquals(child2.width, 80) -- Keeps explicit width
|
||||
luaunit.assertEquals(child1.width, 50) -- Keeps explicit width
|
||||
luaunit.assertEquals(child2.width, 80) -- Keeps explicit width
|
||||
end
|
||||
|
||||
-- Test 9: Default AlignItems value (should be STRETCH)
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package.path = package.path .. ";./?.lua;./game/?.lua;./game/utils/?.lua;./game/components/?.lua;./game/systems/?.lua"
|
||||
|
||||
local luaunit = require("testing.luaunit")
|
||||
|
||||
-- Import the love stub and FlexLove
|
||||
require("testing.loveStub")
|
||||
local FlexLove = require("FlexLove")
|
||||
local Gui, enums = FlexLove.GUI, FlexLove.enums
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package.path = package.path .. ";./?.lua;./game/?.lua;./game/utils/?.lua;./game/components/?.lua;./game/systems/?.lua"
|
||||
|
||||
local luaunit = require("testing.luaunit")
|
||||
|
||||
-- Import the love stub and FlexLove
|
||||
require("testing.loveStub")
|
||||
local FlexLove = require("FlexLove")
|
||||
local Gui, enums = FlexLove.GUI, FlexLove.enums
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package.path = package.path .. ";?.lua"
|
||||
|
||||
local luaunit = require("testing/luaunit")
|
||||
require("testing/loveStub") -- Required to mock LOVE functions
|
||||
local luaunit = require("testing.luaunit")
|
||||
require("testing.loveStub")
|
||||
local FlexLove = require("FlexLove")
|
||||
local Gui, enums = FlexLove.GUI, FlexLove.enums
|
||||
local Color = FlexLove.Color
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package.path = package.path .. ";?.lua"
|
||||
|
||||
local luaunit = require("testing/luaunit")
|
||||
require("testing/loveStub") -- Required to mock LOVE functions
|
||||
local luaunit = require("testing.luaunit")
|
||||
require("testing.loveStub")
|
||||
local FlexLove = require("FlexLove")
|
||||
local Gui, enums = FlexLove.GUI, FlexLove.enums
|
||||
local Positioning = enums.Positioning
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package.path = package.path .. ";?.lua"
|
||||
|
||||
local luaunit = require("testing/luaunit")
|
||||
require("testing/loveStub") -- Required to mock LOVE functions
|
||||
local luaunit = require("testing.luaunit")
|
||||
require("testing.loveStub")
|
||||
local FlexLove = require("FlexLove")
|
||||
local Gui, Color, enums = FlexLove.GUI, FlexLove.Color, FlexLove.enums
|
||||
|
||||
@@ -493,21 +493,21 @@ function TestAuxiliaryFunctions:testAnimationInterpolationAtBoundaries()
|
||||
|
||||
-- At start (elapsed = 0)
|
||||
scaleAnim.elapsed = 0
|
||||
scaleAnim._resultDirty = true -- Mark dirty after changing elapsed
|
||||
scaleAnim._resultDirty = true -- Mark dirty after changing elapsed
|
||||
local result = scaleAnim:interpolate()
|
||||
luaunit.assertEquals(result.width, 100)
|
||||
luaunit.assertEquals(result.height, 50)
|
||||
|
||||
-- At end (elapsed = duration)
|
||||
scaleAnim.elapsed = 1.0
|
||||
scaleAnim._resultDirty = true -- Mark dirty after changing elapsed
|
||||
scaleAnim._resultDirty = true -- Mark dirty after changing elapsed
|
||||
result = scaleAnim:interpolate()
|
||||
luaunit.assertEquals(result.width, 200)
|
||||
luaunit.assertEquals(result.height, 100)
|
||||
|
||||
-- Beyond end (elapsed > duration) - should clamp to end values
|
||||
scaleAnim.elapsed = 1.5
|
||||
scaleAnim._resultDirty = true -- Mark dirty after changing elapsed
|
||||
scaleAnim._resultDirty = true -- Mark dirty after changing elapsed
|
||||
result = scaleAnim:interpolate()
|
||||
luaunit.assertEquals(result.width, 200)
|
||||
luaunit.assertEquals(result.height, 100)
|
||||
@@ -683,7 +683,7 @@ function TestAuxiliaryFunctions:testComplexColorManagementSystem()
|
||||
ui_container:layoutChildren()
|
||||
|
||||
luaunit.assertEquals(#ui_container.children, 5, "Should have 5 themed components")
|
||||
|
||||
|
||||
-- Count theme_colors (it's a table with string keys, not an array)
|
||||
local theme_color_count = 0
|
||||
for _ in pairs(theme_colors) do
|
||||
@@ -952,7 +952,7 @@ function TestAuxiliaryFunctions:testAdvancedTextAndAutoSizingSystem()
|
||||
#text_scenarios + 1,
|
||||
"Should have scenario containers plus nested container"
|
||||
)
|
||||
|
||||
|
||||
-- Count text_metrics (it's a table with string keys, not an array)
|
||||
local metrics_count = 0
|
||||
for _ in pairs(content_manager.text_metrics) do
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package.path = package.path .. ";?.lua"
|
||||
|
||||
local luaunit = require("testing/luaunit")
|
||||
require("testing/loveStub") -- Required to mock LOVE functions
|
||||
local luaunit = require("testing.luaunit")
|
||||
require("testing.loveStub")
|
||||
local FlexLove = require("FlexLove")
|
||||
local Gui, enums = FlexLove.GUI, FlexLove.enums
|
||||
|
||||
@@ -152,7 +152,7 @@ function TestUnitsSystem:testResizeViewportUnits()
|
||||
|
||||
luaunit.assertEquals(container.width, 800) -- 50% of 1600
|
||||
luaunit.assertEquals(container.height, 250) -- 25% of 1000
|
||||
|
||||
|
||||
-- Restore viewport
|
||||
love.window.setMode(1200, 800)
|
||||
end
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
-- Test relative positioning functionality
|
||||
package.path = package.path .. ";?.lua"
|
||||
require("testing/loveStub")
|
||||
require("testing.loveStub")
|
||||
local FlexLove = require("FlexLove")
|
||||
local luaunit = require("testing/luaunit")
|
||||
local luaunit = require("testing.luaunit")
|
||||
|
||||
local Gui, enums = FlexLove.GUI, FlexLove.enums
|
||||
local Color = FlexLove.Color
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
package.path = package.path .. ";?.lua"
|
||||
|
||||
local luaunit = require("testing/luaunit")
|
||||
require("testing/loveStub") -- Required to mock LOVE functions
|
||||
local luaunit = require("testing.luaunit")
|
||||
require("testing.loveStub") -- Required to mock LOVE functions
|
||||
local FlexLove = require("FlexLove")
|
||||
local Gui = FlexLove.GUI
|
||||
|
||||
@@ -135,7 +135,7 @@ function TestTextScaling.testNoTextSize()
|
||||
-- Resize should scale the text
|
||||
element:resize(1600, 1200)
|
||||
luaunit.assertEquals(element.textSize, 18.0) -- 1.5% of 1200px
|
||||
|
||||
|
||||
-- Test with auto-scaling disabled
|
||||
local elementNoScale = Gui.new({
|
||||
id = "testElementNoScale",
|
||||
@@ -144,11 +144,11 @@ function TestTextScaling.testNoTextSize()
|
||||
text = "Hello World",
|
||||
autoScaleText = false,
|
||||
})
|
||||
|
||||
|
||||
luaunit.assertEquals(elementNoScale.autoScaleText, false)
|
||||
luaunit.assertEquals(elementNoScale.units.textSize.value, nil)
|
||||
luaunit.assertEquals(elementNoScale.textSize, 12) -- Fixed 12px
|
||||
|
||||
|
||||
-- Resize should not affect textSize when auto-scaling is disabled
|
||||
elementNoScale:resize(1600, 1200)
|
||||
luaunit.assertEquals(elementNoScale.textSize, 12)
|
||||
|
||||
@@ -3,11 +3,10 @@
|
||||
|
||||
package.path = package.path .. ";?.lua"
|
||||
|
||||
local lu = require("testing/luaunit")
|
||||
require("testing/loveStub") -- Required to mock LOVE functions
|
||||
local lu = require("testing.luaunit")
|
||||
require("testing.loveStub") -- Required to mock LOVE functions
|
||||
local FlexLove = require("FlexLove")
|
||||
local Gui = FlexLove.GUI
|
||||
local Color = FlexLove.Color
|
||||
local enums = FlexLove.enums
|
||||
|
||||
TestGridLayout = {}
|
||||
|
||||
@@ -6,9 +6,7 @@ package.path = package.path .. ";?.lua"
|
||||
local lu = require("testing.luaunit")
|
||||
require("testing.loveStub") -- Required to mock LOVE functions
|
||||
local FlexLove = require("FlexLove")
|
||||
|
||||
local Gui = FlexLove.GUI
|
||||
local Color = FlexLove.Color
|
||||
|
||||
TestEventSystem = {}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package.path = package.path .. ";?.lua"
|
||||
|
||||
local lu = require("testing.luaunit")
|
||||
require("testing.loveStub") -- Required to mock LOVE functions
|
||||
require("testing.loveStub")
|
||||
local FlexLove = require("FlexLove")
|
||||
local Gui = FlexLove.GUI
|
||||
local Color = FlexLove.Color
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package.path = package.path .. ";?.lua"
|
||||
|
||||
local lu = require("testing.luaunit")
|
||||
require("testing.loveStub") -- Required to mock LOVE functions
|
||||
require("testing.loveStub")
|
||||
local FlexLove = require("FlexLove")
|
||||
|
||||
TestFontFamilyInheritance = {}
|
||||
@@ -94,8 +94,8 @@ function TestFontFamilyInheritance:testInheritanceInFlexContainer()
|
||||
local flexParent = FlexLove.Element.new({
|
||||
width = 300,
|
||||
height = 300,
|
||||
positioning = FlexLove.Positioning.FLEX,
|
||||
flexDirection = FlexLove.FlexDirection.HORIZONTAL,
|
||||
positioning = FlexLove.enums.Positioning.FLEX,
|
||||
flexDirection = FlexLove.enums.FlexDirection.HORIZONTAL,
|
||||
fontFamily = "Courier",
|
||||
})
|
||||
|
||||
@@ -121,7 +121,7 @@ function TestFontFamilyInheritance:testInheritanceInGridContainer()
|
||||
local gridParent = FlexLove.Element.new({
|
||||
width = 300,
|
||||
height = 300,
|
||||
positioning = FlexLove.Positioning.GRID,
|
||||
positioning = FlexLove.enums.Positioning.GRID,
|
||||
gridRows = 2,
|
||||
gridColumns = 2,
|
||||
fontFamily = "Verdana",
|
||||
@@ -183,7 +183,7 @@ function TestFontFamilyInheritance:testInheritanceWithAbsolutePositioning()
|
||||
|
||||
local child = FlexLove.Element.new({
|
||||
parent = parent,
|
||||
positioning = FlexLove.Positioning.ABSOLUTE,
|
||||
positioning = FlexLove.enums.Positioning.ABSOLUTE,
|
||||
x = 50,
|
||||
y = 50,
|
||||
width = 100,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package.path = package.path .. ";?.lua"
|
||||
|
||||
local lu = require("testing.luaunit")
|
||||
require("testing.loveStub") -- Required to mock LOVE functions
|
||||
require("testing.loveStub")
|
||||
local FlexLove = require("FlexLove")
|
||||
|
||||
TestNegativeMargin = {}
|
||||
@@ -19,8 +19,8 @@ function TestNegativeMargin:testBasicNegativeMarginTop()
|
||||
local parent = FlexLove.Element.new({
|
||||
width = 200,
|
||||
height = 200,
|
||||
positioning = FlexLove.Positioning.FLEX,
|
||||
flexDirection = FlexLove.FlexDirection.VERTICAL,
|
||||
positioning = FlexLove.enums.Positioning.FLEX,
|
||||
flexDirection = FlexLove.enums.FlexDirection.VERTICAL,
|
||||
})
|
||||
|
||||
local child1 = FlexLove.Element.new({
|
||||
@@ -46,8 +46,8 @@ function TestNegativeMargin:testNegativeMarginLeft()
|
||||
local parent = FlexLove.Element.new({
|
||||
width = 300,
|
||||
height = 100,
|
||||
positioning = FlexLove.Positioning.FLEX,
|
||||
flexDirection = FlexLove.FlexDirection.HORIZONTAL,
|
||||
positioning = FlexLove.enums.Positioning.FLEX,
|
||||
flexDirection = FlexLove.enums.FlexDirection.HORIZONTAL,
|
||||
})
|
||||
|
||||
local child1 = FlexLove.Element.new({
|
||||
@@ -72,8 +72,8 @@ function TestNegativeMargin:testNegativeMarginRight()
|
||||
local parent = FlexLove.Element.new({
|
||||
width = 300,
|
||||
height = 100,
|
||||
positioning = FlexLove.Positioning.FLEX,
|
||||
flexDirection = FlexLove.FlexDirection.HORIZONTAL,
|
||||
positioning = FlexLove.enums.Positioning.FLEX,
|
||||
flexDirection = FlexLove.enums.FlexDirection.HORIZONTAL,
|
||||
})
|
||||
|
||||
local child = FlexLove.Element.new({
|
||||
@@ -92,8 +92,8 @@ function TestNegativeMargin:testNegativeMarginBottom()
|
||||
local parent = FlexLove.Element.new({
|
||||
width = 200,
|
||||
height = 200,
|
||||
positioning = FlexLove.Positioning.FLEX,
|
||||
flexDirection = FlexLove.FlexDirection.VERTICAL,
|
||||
positioning = FlexLove.enums.Positioning.FLEX,
|
||||
flexDirection = FlexLove.enums.FlexDirection.VERTICAL,
|
||||
})
|
||||
|
||||
local child = FlexLove.Element.new({
|
||||
@@ -181,7 +181,7 @@ function TestNegativeMargin:testNegativeMarginInGridLayout()
|
||||
local gridParent = FlexLove.Element.new({
|
||||
width = 300,
|
||||
height = 300,
|
||||
positioning = FlexLove.Positioning.GRID,
|
||||
positioning = FlexLove.enums.Positioning.GRID,
|
||||
gridRows = 2,
|
||||
gridColumns = 2,
|
||||
})
|
||||
@@ -258,7 +258,7 @@ function TestNegativeMargin:testNegativeMarginWithAbsolutePositioning()
|
||||
|
||||
local child = FlexLove.Element.new({
|
||||
parent = parent,
|
||||
positioning = FlexLove.Positioning.ABSOLUTE,
|
||||
positioning = FlexLove.enums.Positioning.ABSOLUTE,
|
||||
x = 50,
|
||||
y = 50,
|
||||
width = 100,
|
||||
|
||||
@@ -102,8 +102,8 @@ function TestPaddingResize:testNestedPercentagePadding()
|
||||
width = "100%",
|
||||
height = "100%",
|
||||
padding = { horizontal = "10%", vertical = "10%" },
|
||||
positioning = FlexLove.Positioning.FLEX,
|
||||
flexDirection = FlexLove.FlexDirection.VERTICAL,
|
||||
positioning = FlexLove.enums.Positioning.FLEX,
|
||||
flexDirection = FlexLove.enums.FlexDirection.VERTICAL,
|
||||
})
|
||||
|
||||
-- Create child with percentage padding (relative to parent's content area)
|
||||
|
||||
@@ -275,14 +275,17 @@ function TestImageScalerBilinear:testComparison_SmootherThanNearest()
|
||||
end
|
||||
|
||||
local bilinearCount = 0
|
||||
for _ in pairs(bilinearValues) do bilinearCount = bilinearCount + 1 end
|
||||
|
||||
for _ in pairs(bilinearValues) do
|
||||
bilinearCount = bilinearCount + 1
|
||||
end
|
||||
|
||||
local nearestCount = 0
|
||||
for _ in pairs(nearestValues) do nearestCount = nearestCount + 1 end
|
||||
for _ in pairs(nearestValues) do
|
||||
nearestCount = nearestCount + 1
|
||||
end
|
||||
|
||||
-- Bilinear should have more unique values (smoother gradient)
|
||||
luaunit.assertTrue(bilinearCount >= nearestCount,
|
||||
"Bilinear should produce smoother gradient with more unique values")
|
||||
luaunit.assertTrue(bilinearCount >= nearestCount, "Bilinear should produce smoother gradient with more unique values")
|
||||
end
|
||||
|
||||
luaunit.LuaUnit.run()
|
||||
@@ -25,6 +25,7 @@ local testFiles = {
|
||||
"testing/__tests__/19_negative_margin_tests.lua",
|
||||
"testing/__tests__/20_padding_resize_tests.lua",
|
||||
"testing/__tests__/21_image_scaler_nearest_tests.lua",
|
||||
"testing/__tests__/22_image_scaler_bilinear_tests.lua",
|
||||
}
|
||||
|
||||
local success = true
|
||||
|
||||
Reference in New Issue
Block a user