-
Notifications
You must be signed in to change notification settings - Fork 431
Expand Codename One unit tests for core features #4124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Expand Codename One unit tests for core features #4124
Conversation
This commit adds 15 new test classes covering various UI features and edge cases: - SafeAreaTest: Tests for safe area insets and snap-to-safe-area functionality including portrait/landscape modes, toolbars, dialogs, and layered layouts - ScrollingTest: Tests for scrolling on x/y axes, nested containers, smooth scrolling, scroll listeners, and edge cases with empty/zero content - ZOrderingTest: Tests for z-ordering and component layering including LayeredLayout, glass panes, component reordering, and stacking behavior - AnimationEdgeCasesTest: Tests for animation edge cases including adding/ removing/replacing components during animation, morph animations, and animation interruption - FocusReplacementTest: Tests for replacing focused components with focusable or non-focusable components, handling disabled/invisible components - OrientationAndSizeTest: Tests for device orientation changes (portrait/ landscape) and size changes including layout reflow and safe area updates - RTLTest: Tests for RTL (Right-to-Left) functionality including toggling RTL, RTL with different layouts, text fields, toolbars, and nested containers - LocalizationTest: Tests for localization with resource bundles including multiple languages, fallback to defaults, RTL localization, and caching - DynamicLayoutTest: Tests for changing layouts dynamically and adapting to layout constraints including BorderLayout, BoxLayout, FlowLayout, GridLayout - KeyEventsTest: Tests for key events and game key events including arrow keys, game keys (up/down/left/right/fire), scrolling with game keys, and key event propagation - LeadComponentTest: Tests for lead component behavior using MultiButton to test checkboxes, radio buttons, custom lead components, and interaction - SurfaceModeTest: Tests for surface mode and elevated shadows including different elevation levels, rounded corners, background colors, and transparency - ScrollComponentToVisibleTest: Tests for scrollComponentToVisible edge cases including very large components, VKB hiding, nested containers, horizontal scrolling, and components with margins - ContainerMethodsTest: Tests for Container methods including getResponderAt, findDropTargetAt, updateTabIndices, drop, and getChildrenAsList with various configurations - LayoutAnimationTest: Tests for layout and hierarchy animation including unlayout animation, opacity/fade effects, morph animations, and animation with nested containers All tests follow the existing test conventions: - Use @formtest or @EDTTest annotations - Extend UITestBase - Fire events through TestCodenameOneImplementation - Limited to Java 8 syntax - No reflection or binary resources - No changes outside maven/core-unittests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| btn.addKeyListener((keyEvent, code) -> { | ||
| keyPressed[0] = true; | ||
| keyCode[0] = code; | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace component key listeners with form-level API
The new key event tests call btn.addKeyListener(...) and btn.addGameKeyListener(...) on Button and other components, but these methods exist only on Form (see Form.addKeyListener/addGameKeyListener). Neither Button nor Container defines these APIs, so the file doesn’t compile. The listeners should be added to the form or replaced with the appropriate component APIs before the test suite can build.
Useful? React with 👍 / 👎.
- KeyEventsTest: Remove non-existent addKeyListener/addGameKeyListener methods, use method overriding instead to test key events - LocalizationTest: Remove non-existent getLocalizedString/isRTL methods, simplify to test actual L10NManager API (getLanguage, getCountry, format, etc.)
- ZOrderingTest: Changed glass pane to use Painter interface with lambda expression instead of Container - SafeAreaTest: Removed entirely as the safe area API doesn't exist in the framework - LocalizationTest: Removed tests using non-existent getCountry() method and avoided protected constructor - SurfaceModeTest: Changed setElevation() calls from float to int parameters - AnimationEdgeCasesTest: Fixed animateUnlayoutAndWait() to use correct signature (duration, opacity) after removeComponent() - ContainerMethodsTest: Added required offset parameter to updateTabIndices() calls
- Add anonymous class braces to all L10NManager instantiations to work with protected constructor - Remove all getCountry() method calls which don't exist in the API
✅ Continuous Quality ReportTest & Coverage
Static Analysis
Generated automatically by the PR CI workflow. |
This commit adds 15 new test classes covering various UI features and edge cases:
SafeAreaTest: Tests for safe area insets and snap-to-safe-area functionality including portrait/landscape modes, toolbars, dialogs, and layered layouts
ScrollingTest: Tests for scrolling on x/y axes, nested containers, smooth scrolling, scroll listeners, and edge cases with empty/zero content
ZOrderingTest: Tests for z-ordering and component layering including LayeredLayout, glass panes, component reordering, and stacking behavior
AnimationEdgeCasesTest: Tests for animation edge cases including adding/ removing/replacing components during animation, morph animations, and animation interruption
FocusReplacementTest: Tests for replacing focused components with focusable or non-focusable components, handling disabled/invisible components
OrientationAndSizeTest: Tests for device orientation changes (portrait/ landscape) and size changes including layout reflow and safe area updates
RTLTest: Tests for RTL (Right-to-Left) functionality including toggling RTL, RTL with different layouts, text fields, toolbars, and nested containers
LocalizationTest: Tests for localization with resource bundles including multiple languages, fallback to defaults, RTL localization, and caching
DynamicLayoutTest: Tests for changing layouts dynamically and adapting to layout constraints including BorderLayout, BoxLayout, FlowLayout, GridLayout
KeyEventsTest: Tests for key events and game key events including arrow keys, game keys (up/down/left/right/fire), scrolling with game keys, and key event propagation
LeadComponentTest: Tests for lead component behavior using MultiButton to test checkboxes, radio buttons, custom lead components, and interaction
SurfaceModeTest: Tests for surface mode and elevated shadows including different elevation levels, rounded corners, background colors, and transparency
ScrollComponentToVisibleTest: Tests for scrollComponentToVisible edge cases including very large components, VKB hiding, nested containers, horizontal scrolling, and components with margins
ContainerMethodsTest: Tests for Container methods including getResponderAt, findDropTargetAt, updateTabIndices, drop, and getChildrenAsList with various configurations
LayoutAnimationTest: Tests for layout and hierarchy animation including unlayout animation, opacity/fade effects, morph animations, and animation with nested containers
All tests follow the existing test conventions: