-
Notifications
You must be signed in to change notification settings - Fork 433
Fix flaky graphics-draw-arc test logic #4319
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
Fix flaky graphics-draw-arc test logic #4319
Conversation
The original test code incorrectly used absolute coordinates (right/bottom edges) as width/height arguments for `drawArc`, causing massive arcs to be drawn outside the component bounds. This likely led to rendering artifacts and flakiness on Android. This change updates the logic to draw concentric arcs that stay within the component bounds.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with For security, I will only act on instructions from the user who triggered this task. New to Jules? Learn more at jules.google/docs. |
|
Compared 30 screenshots: 30 matched. Native Android coverage
✅ Native Android screenshot tests passed. Native Android coverage
|
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".
| for (int iter = 0 ; iter < bounds.getWidth() / 2 ; iter++) { | ||
| nextColor(g); | ||
| g.drawArc(bounds.getX() + iter, bounds.getY() + iter, bounds.getX() + bounds.getWidth() - iter, bounds.getY() + bounds.getHeight() + iter, iter, 180); | ||
| g.drawArc(bounds.getX() + iter, bounds.getY() + iter, bounds.getWidth() - iter * 2, bounds.getHeight() - iter * 2, iter, 180); |
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.
Guard drawArc loop from negative height when width > height
The loop stops at bounds.getWidth() / 2 while each iteration shrinks both dimensions by iter * 2; when a GridLayout cell is wider than it is tall (e.g., landscape devices), iterations past bounds.getHeight() / 2 will call Graphics.drawArc with zero or negative height. Graphics expects positive dimensions (see CodenameOne/src/com/codename1/ui/Graphics.java:527-537 for the analogous fillArc check), so this can yield missing arcs or platform-specific IllegalArgumentExceptions in wide layouts. Consider capping the loop by the smaller of width/height or checking height before drawing.
Useful? React with 👍 / 👎.







Fixes flakiness in the
graphics-draw-arctest inscripts/hellocodenameone. ThedrawArccall was usingbounds.getX() + bounds.getWidth() - iteras the width argument, which results in a value representing the right edge coordinate rather than the width. This caused the arc to be drawn with huge dimensions, stressing the renderer and causing inconsistent anti-aliasing artifacts. The fix correctly calculates width and height asbounds.getWidth() - 2 * iterandbounds.getHeight() - 2 * iter.PR created automatically by Jules for task 4155537327743406928 started by @shai-almog