Skip to content

Commit 6dd396e

Browse files
shai-almogclaude
andauthored
Add unit tests for UI layouts package (#4095)
* Add comprehensive unit tests for layouts package Created extensive unit tests for the following layout classes: - BorderLayoutTest: Tests for all constraints (NORTH, SOUTH, EAST, WEST, CENTER, OVERLAY), center behaviors, landscape swap, scale edges, and factory methods - BoxLayoutTest: Tests for X_AXIS, Y_AXIS, X_AXIS_NO_GROW, Y_AXIS_BOTTOM_LAST, alignment options, and all factory methods - FlowLayoutTest: Tests for horizontal/vertical alignment, fill rows, valign by row, and all enclose factory methods - GridLayoutTest: Tests for row/column configuration, auto-fit, fill last row, hide zero sized, and landscape mode - LayeredLayoutTest: Tests for component layering, preferred size in MM, and overlap behavior - CoordinateLayoutTest: Tests for absolute positioning, scaling, and coordinate transformation All tests follow existing conventions: - Extend UITestBase for Display initialization - Use JUnit 5 annotations and assertions - Avoid Mockito (use TestCodenameOneImplementation instead) - Test both API and layout behavior - Aim for high code coverage Tests cover constructors, getters/setters, factory methods, layout calculations, preferred size calculations, edge cases, and equals/toString methods for each layout class. * Fix layout tests: Use @formtest and Dimension for setSize - Changed setSize(int, int) to setSize(new Dimension(int, int)) - Changed @test to @formtest for tests that call layoutContainer() - Added FormTest import to all test files - Tests that only test API methods remain as @test - Layout tests that need Form context now use @formtest * Fix BorderLayoutTest failures - Changed exact position check to allow for container padding - Fixed component reuse across multiple containers in factory tests - Each factory method now tests with a separate label instance --------- Co-authored-by: Claude <[email protected]>
1 parent b509123 commit 6dd396e

File tree

6 files changed

+2551
-0
lines changed

6 files changed

+2551
-0
lines changed

0 commit comments

Comments
 (0)