Skip to content

Use explicit half-stroke inset for RoundRectBorder and update regression test to avoid reflection#4459

Merged
shai-almog merged 2 commits intomasterfrom
codex/review-ui-changes-in-codenameone
Jan 24, 2026
Merged

Use explicit half-stroke inset for RoundRectBorder and update regression test to avoid reflection#4459
shai-almog merged 2 commits intomasterfrom
codex/review-ui-changes-in-codenameone

Conversation

@shai-almog
Copy link
Collaborator

Motivation

  • Prevent asymmetric or excessive inset for rounded-rectangle borders when using odd-pixel stroke widths by applying the true half-stroke inset instead of an extra 0.5px adjustment.
  • Improve the regression test by avoiding reflection and asserting rendering behavior through the existing test graphics implementation.

Description

  • Replace the odd-pixel + 0.5f adjustment with an explicit float halfStroke = strokePx / 2f; and apply x += halfStroke; y += halfStroke; in CodenameOne/src/com/codename1/ui/plaf/RoundRectBorder.java to inset shapes by the true half stroke.
  • Remove the branch that added an additional 0.5f for odd strokePx values so only the true half-stroke inset is applied.
  • Rewrite the regression unit test testRoundRectBorderOddStrokeInsetsEvenly in maven/core-unittests/src/test/java/com/codename1/ui/plaf/BorderAndPlafTest.java to instantiate a Label, set the RoundRectBorder, call paintBorderBackground on a test Graphics, use TestCodenameOneImplementation shape tracking (resetShapeTracking, wasDrawShapeInvoked, getLastDrawShape) and assert the recorded shape bounds rather than using reflection.

Testing

  • No automated tests were executed as part of this change; the updated unit test was added/modified but not run.

Codex Task

@shai-almog
Copy link
Collaborator Author

shai-almog commented Jan 24, 2026

Compared 30 screenshots: 30 matched.

Native Android coverage

  • 📊 Line coverage: 24.87% (2665/10717 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 24.48% (12367/50528), branch 15.35% (717/4672), complexity 17.54% (744/4241), method 33.08% (602/1820), class 34.98% (106/303)
    • Lowest covered classes
      • com.codename1.impl.android.com.codename1.impl.android.AndroidContactsManager – 0.00% (0/400 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.AndroidImplementation$Video – 0.00% (0/168 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.IntentIntegrator – 0.00% (0/139 lines covered)
      • com.codename1.impl.android.util.com.codename1.impl.android.util.Base64 – 0.00% (0/117 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.AndroidImplementation$SocketImpl – 0.00% (0/77 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.AndroidTextureView – 0.00% (0/76 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.AndroidSurfaceView – 0.00% (0/73 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.LocalNotificationPublisher – 0.00% (0/65 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.FridaDetectionUtil – 0.00% (0/64 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.PushNotificationService – 0.00% (0/59 lines covered)

✅ Native Android screenshot tests passed.

Native Android coverage

  • 📊 Line coverage: 24.87% (2665/10717 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 24.48% (12367/50528), branch 15.35% (717/4672), complexity 17.54% (744/4241), method 33.08% (602/1820), class 34.98% (106/303)
    • Lowest covered classes
      • com.codename1.impl.android.com.codename1.impl.android.AndroidContactsManager – 0.00% (0/400 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.AndroidImplementation$Video – 0.00% (0/168 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.IntentIntegrator – 0.00% (0/139 lines covered)
      • com.codename1.impl.android.util.com.codename1.impl.android.util.Base64 – 0.00% (0/117 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.AndroidImplementation$SocketImpl – 0.00% (0/77 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.AndroidTextureView – 0.00% (0/76 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.AndroidSurfaceView – 0.00% (0/73 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.LocalNotificationPublisher – 0.00% (0/65 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.FridaDetectionUtil – 0.00% (0/64 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.PushNotificationService – 0.00% (0/59 lines covered)

@github-actions
Copy link

✅ Continuous Quality Report

Test & Coverage

Static Analysis

Generated automatically by the PR CI workflow.

@shai-almog
Copy link
Collaborator Author

shai-almog commented Jan 24, 2026

iOS screenshot updates

Compared 30 screenshots: 23 matched, 6 updated, 1 missing reference.

  • BrowserComponent — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    BrowserComponent
    Preview info: Preview provided by instrumentation.
    Full-resolution PNG saved as BrowserComponent.png in workflow artifacts.

  • graphics-draw-arc — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    graphics-draw-arc
    Preview info: JPEG preview quality 20; JPEG preview quality 20; downscaled to 603x1311.
    Full-resolution PNG saved as graphics-draw-arc.png in workflow artifacts.

  • graphics-draw-gradient — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    graphics-draw-gradient
    Preview info: JPEG preview quality 10; JPEG preview quality 10; downscaled to 844x1835.
    Full-resolution PNG saved as graphics-draw-gradient.png in workflow artifacts.

  • graphics-draw-round-rect — missing reference. Reference screenshot missing at /Users/runner/work/CodenameOne/CodenameOne/scripts/ios/screenshots/graphics-draw-round-rect.png.

    graphics-draw-round-rect
    Preview info: JPEG preview quality 10; JPEG preview quality 10; downscaled to 844x1835.
    Full-resolution PNG saved as graphics-draw-round-rect.png in workflow artifacts.

  • graphics-draw-string — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    graphics-draw-string
    Preview info: JPEG preview quality 10; JPEG preview quality 10; downscaled to 422x918.
    Full-resolution PNG saved as graphics-draw-string.png in workflow artifacts.

  • graphics-draw-string-decorated — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    graphics-draw-string-decorated
    Preview info: JPEG preview quality 10; JPEG preview quality 10; downscaled to 603x1311.
    Full-resolution PNG saved as graphics-draw-string-decorated.png in workflow artifacts.

  • kotlin — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    kotlin
    Preview info: Preview provided by instrumentation.
    Full-resolution PNG saved as kotlin.png in workflow artifacts.

Benchmark Results

  • VM Translation Time: 283 seconds
  • Compilation Time: 209 seconds

Detailed Performance Metrics

Metric Duration
Build Time Statistics
Setup & Unzip 24173 ms
Extract Extensions 12 ms
Google Services Setup 2 ms
Scan Classes 803 ms
Extract Libs 550 ms
Inject Build Hints 37 ms
Generate Unit Tests 3 ms
Generate Stubs 896 ms
Compile Stubs 1877 ms
Generate Icons 1091 ms
Prepare ParparVM 163 ms
ParparVM Execution 166857 ms
Post-VM Setup 274 ms
CocoaPods 5079 ms
Finalize 21 ms
Total Time 201839 msMaven Overhead : 82000 ms
CocoaPods Install (Script) 1000 ms
Simulator Boot 56000 ms
Simulator Boot (Run) 2000 ms
App Install 13000 ms
App Launch 6000 ms
Test Execution 144000 ms

@shai-almog shai-almog merged commit 9336366 into master Jan 24, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant