Skip to content

Conversation

@shai-almog
Copy link
Collaborator

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.

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.
- 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
- 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
@github-actions
Copy link

✅ Continuous Quality Report

Test & Coverage

Static Analysis

Generated automatically by the PR CI workflow.

@shai-almog shai-almog merged commit 6dd396e into master Oct 31, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants