Skip to content

Fix #1592: pointerDragged honours isEnabled() like pointerPressed/Released#5119

Merged
shai-almog merged 2 commits into
masterfrom
fix-1592-pointerdragged-disabled
May 31, 2026
Merged

Fix #1592: pointerDragged honours isEnabled() like pointerPressed/Released#5119
shai-almog merged 2 commits into
masterfrom
fix-1592-pointerdragged-disabled

Conversation

@shai-almog
Copy link
Copy Markdown
Collaborator

Summary

Closes #1592. The 2015 reporter noted that Form.pointerDragged was routing drag events to a sub-component regardless of cmp.isEnabled(), even though pointerPressed and the sidemenu drag branch in the same class already gate on isEnabled. A disabled component could therefore still observe drag events that originated over its bounds — an inconsistency the reporter flagged as a "Minor bug".

Fix

Both overloads of Form.pointerDraggedpointerDragged(int, int) and pointerDragged(int[], int[]) — now wrap the routed LeadUtil.pointerDragged(cmp, x, y) call in an if (cmp.isEnabled()) block, matching the pattern already used in the sidemenu branch (cmp != null && cmp.isEnabled()) and in pointerPressed.

The setFocused() helper above the gate is already guarded by cmp.isEnabled() so focus-on-drag behaviour is unchanged.

Test plan

  • New regression test DisabledPointerDraggedRoutingTest drives form.pointerPressed/Dragged/Released through a Component subclass whose pointerDragged increments a counter, with two cases:
    • enabled component: counter > 0 (sanity).
    • disabled component: counter == 0 (regression).
  • Before the fix the disabled-component test reports 1 (proving the bug); after the fix it reports 0.
  • Full drag/pointer/form sweep — 60 tests across DragEventsTest, PointerEventsTest, FormTest, DraggableLeadComponentTest, DragFinishedListener#3056Test and the LongPointerPressSample / NullPointerOnEDTSample#2992 regression samples — all green.
  • ASCII-only sources verified.
  • CI verification.

🤖 Generated with Claude Code

@github-actions
Copy link
Copy Markdown
Contributor

Cloudflare Preview

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 30, 2026

✅ Continuous Quality Report

Test & Coverage

Static Analysis

  • SpotBugs [Report archive]
    • ByteCodeTranslator: 0 findings (no issues)
    • android: 0 findings (no issues)
    • codenameone-maven-plugin: 0 findings (no issues)
    • core-unittests: 0 findings (no issues)
    • ios: 0 findings (no issues)
  • PMD: 0 findings (no issues) [Report archive]
  • Checkstyle: 0 findings (no issues) [Report archive]

Generated automatically by the PR CI workflow.

@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented May 30, 2026

Compared 122 screenshots: 122 matched.

Native Android coverage

  • 📊 Line coverage: 12.89% (7500/58189 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 10.46% (37495/358309), branch 4.38% (1476/33720), complexity 5.47% (1777/32474), method 9.54% (1456/15256), class 15.61% (332/2127)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6327 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader – 0.00% (0/1519 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1148 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.MethodWriter – 0.00% (0/923 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/730 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.Frame – 0.00% (0/564 lines covered)
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysJvmKt – 0.00% (0/495 lines covered)
      • kotlinx.coroutines.kotlinx.coroutines.JobSupport – 0.00% (0/423 lines covered)

✅ Native Android screenshot tests passed.

Native Android coverage

  • 📊 Line coverage: 12.89% (7500/58189 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 10.46% (37495/358309), branch 4.38% (1476/33720), complexity 5.47% (1777/32474), method 9.54% (1456/15256), class 15.61% (332/2127)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6327 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader – 0.00% (0/1519 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1148 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.MethodWriter – 0.00% (0/923 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/730 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.Frame – 0.00% (0/564 lines covered)
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysJvmKt – 0.00% (0/495 lines covered)
      • kotlinx.coroutines.kotlinx.coroutines.JobSupport – 0.00% (0/423 lines covered)

Benchmark Results

Detailed Performance Metrics

Metric Duration
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 768.000 ms
Base64 CN1 encode 270.000 ms
Base64 encode ratio (CN1/native) 0.352x (64.8% faster)
Base64 native decode 837.000 ms
Base64 CN1 decode 310.000 ms
Base64 decode ratio (CN1/native) 0.370x (63.0% faster)
Image encode benchmark status skipped (SIMD unsupported)

@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented May 30, 2026

Compared 66 screenshots: 66 matched.
✅ Native iOS screenshot tests passed.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 168 seconds

Build and Run Timing

Metric Duration
Simulator Boot 59000 ms
Simulator Boot (Run) 1000 ms
App Install 11000 ms
App Launch 4000 ms
Test Execution 1505000 ms

@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented May 30, 2026

Compared 122 screenshots: 122 matched.
✅ Native iOS Metal screenshot tests passed.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 334 seconds

Build and Run Timing

Metric Duration
Simulator Boot 69000 ms
Simulator Boot (Run) 1000 ms
App Install 14000 ms
App Launch 6000 ms
Test Execution 333000 ms

Detailed Performance Metrics

Metric Duration
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 1251.000 ms
Base64 CN1 encode 2201.000 ms
Base64 encode ratio (CN1/native) 1.759x (75.9% slower)
Base64 native decode 778.000 ms
Base64 CN1 decode 1440.000 ms
Base64 decode ratio (CN1/native) 1.851x (85.1% slower)
Base64 SIMD encode 452.000 ms
Base64 encode ratio (SIMD/native) 0.361x (63.9% faster)
Base64 encode ratio (SIMD/CN1) 0.205x (79.5% faster)
Base64 SIMD decode 613.000 ms
Base64 decode ratio (SIMD/native) 0.788x (21.2% faster)
Base64 decode ratio (SIMD/CN1) 0.426x (57.4% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 68.000 ms
Image createMask (SIMD on) 9.000 ms
Image createMask ratio (SIMD on/off) 0.132x (86.8% faster)
Image applyMask (SIMD off) 152.000 ms
Image applyMask (SIMD on) 59.000 ms
Image applyMask ratio (SIMD on/off) 0.388x (61.2% faster)
Image modifyAlpha (SIMD off) 169.000 ms
Image modifyAlpha (SIMD on) 94.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.556x (44.4% faster)
Image modifyAlpha removeColor (SIMD off) 160.000 ms
Image modifyAlpha removeColor (SIMD on) 122.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.763x (23.8% faster)
Image PNG encode (SIMD off) 1566.000 ms
Image PNG encode (SIMD on) 1363.000 ms
Image PNG encode ratio (SIMD on/off) 0.870x (13.0% faster)
Image JPEG encode 828.000 ms

The 2015 reporter noted that Form.pointerDragged would invoke the
sub-component's pointerDragged(...) regardless of cmp.isEnabled(),
even though pointerPressed and the sidemenu drag branch in the same
class already gate on isEnabled. That meant a disabled component
could still observe drag events that originated over its bounds --
an inconsistency the reporter flagged as a "Minor bug".

Add the isEnabled() gate to both the int and int[] pointerDragged
overloads of Form, immediately around the routed LeadUtil.pointerDragged
call. The setFocused() helper above the gate is already guarded by
cmp.isEnabled() so focus behaviour is unchanged.

Closes #1592.

Adds maven/core-unittests/.../DisabledPointerDraggedRoutingTest.java
with two cases that drive Form.pointerPressed/Dragged/Released through
a Component subclass whose pointerDragged increments a counter:

- enabled component: counter > 0 (sanity)
- disabled component: counter == 0 (regression)

Before the fix the disabled-component test reports 1; after the fix
it reports 0. Full drag/pointer/form regression sweep (60 tests across
DragEventsTest, PointerEventsTest, FormTest, the dragged-lead and
long-press samples, etc.) stays green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@shai-almog shai-almog force-pushed the fix-1592-pointerdragged-disabled branch from d45d7dd to 762c5e2 Compare May 30, 2026 17:32
shai-almog added a commit that referenced this pull request May 30, 2026
Previous CI run on this PR hit three orthogonal infrastructure
flakes that have nothing to do with the cubic-bezier code:

- build-linux-jdk8: corrupted master.zip downloaded from the
  codenameone-skins GitHub release endpoint (unzip: cannot find
  zipfile directory in master.zip).
- Build Android JDK 17 / 21: install-cn1 tried to write
  tmpProject/lib/CLDC11.jar before the parent lib/ directory had
  been created. PR #5119 has these same Android jobs passing on
  the identical master base, so the failure is a setup race.

Empty commit to retrigger CI.
The 'Input validation gesture suite' iOS job crashed during the
long-press phase (t = 23-26s of testGestureSuite), not during the
drag this PR touches. Sequence in the failed run:
- driveTap   (t = 15.45s)  -- completed
- driveDrag  (t = 19.22s)  -- completed
- driveLongPress (t = 23.12s) -- app died at 25.94s with
  'Lost connection to the application' and the action then hit the
  15-min timeout. Upload-artifact then errored on a half-written
  simctl_diagnostics tracev3 file (ENOENT).

The Form.pointerDragged isEnabled() gate in this PR can't affect
long-press handling (long-press is a single static touch, not a
drag). Classic iOS-simulator+XCUITest flake. Empty commit to
re-trigger.
shai-almog added a commit that referenced this pull request May 30, 2026
Previous CI run on this PR hit three orthogonal infrastructure
flakes that have nothing to do with the cubic-bezier code:

- build-linux-jdk8: corrupted master.zip downloaded from the
  codenameone-skins GitHub release endpoint (unzip: cannot find
  zipfile directory in master.zip).
- Build Android JDK 17 / 21: install-cn1 tried to write
  tmpProject/lib/CLDC11.jar before the parent lib/ directory had
  been created. PR #5119 has these same Android jobs passing on
  the identical master base, so the failure is a setup race.

Empty commit to retrigger CI.
@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented May 30, 2026

Compared 122 screenshots: 122 matched.
✅ Native Mac screenshot tests passed.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 91 seconds

Detailed Performance Metrics

Metric Duration
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 645.000 ms
Base64 CN1 encode 1125.000 ms
Base64 encode ratio (CN1/native) 1.744x (74.4% slower)
Base64 native decode 341.000 ms
Base64 CN1 decode 846.000 ms
Base64 decode ratio (CN1/native) 2.481x (148.1% slower)
Base64 SIMD encode 403.000 ms
Base64 encode ratio (SIMD/native) 0.625x (37.5% faster)
Base64 encode ratio (SIMD/CN1) 0.358x (64.2% faster)
Base64 SIMD decode 365.000 ms
Base64 decode ratio (SIMD/native) 1.070x (7.0% slower)
Base64 decode ratio (SIMD/CN1) 0.431x (56.9% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 57.000 ms
Image createMask (SIMD on) 11.000 ms
Image createMask ratio (SIMD on/off) 0.193x (80.7% faster)
Image applyMask (SIMD off) 165.000 ms
Image applyMask (SIMD on) 72.000 ms
Image applyMask ratio (SIMD on/off) 0.436x (56.4% faster)
Image modifyAlpha (SIMD off) 121.000 ms
Image modifyAlpha (SIMD on) 65.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.537x (46.3% faster)
Image modifyAlpha removeColor (SIMD off) 156.000 ms
Image modifyAlpha removeColor (SIMD on) 67.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.429x (57.1% faster)
Image PNG encode (SIMD off) 949.000 ms
Image PNG encode (SIMD on) 792.000 ms
Image PNG encode ratio (SIMD on/off) 0.835x (16.5% faster)
Image JPEG encode 404.000 ms

shai-almog added a commit that referenced this pull request May 31, 2026
Previous CI run on this PR hit three orthogonal infrastructure
flakes that have nothing to do with the cubic-bezier code:

- build-linux-jdk8: corrupted master.zip downloaded from the
  codenameone-skins GitHub release endpoint (unzip: cannot find
  zipfile directory in master.zip).
- Build Android JDK 17 / 21: install-cn1 tried to write
  tmpProject/lib/CLDC11.jar before the parent lib/ directory had
  been created. PR #5119 has these same Android jobs passing on
  the identical master base, so the failure is a setup race.

Empty commit to retrigger CI.
@shai-almog shai-almog merged commit a6d0ea5 into master May 31, 2026
25 of 26 checks passed
@shai-almog shai-almog deleted the fix-1592-pointerdragged-disabled branch May 31, 2026 01:22
liannacasper pushed a commit that referenced this pull request May 31, 2026
…r semantics (#5122)

* fix(Motion): cubic-bezier follows CSS cubic-bezier(x1,y1,x2,y2) semantics (#1524)

The 2015 reporter at ftp27/cn1-cubic-bezier-motion observed that
Motion.createCubicBezierMotion(start, dest, dur, p0, p1, p2, p3) did
not animate along the expected CSS cubic-bezier curve. Reviewing
his demo confirms it: the four floats are documented as control
points yet the implementation just plugged them into a 1D Bernstein-
basis polynomial directly, so cubic-bezier(0, 0, 0.75, 1) for example
returned ~0.41 at t=0.5 when the CSS-correct value is ~0.62.

Implement the standard CSS solver:

- The four floats are now treated as the X/Y coordinates of the two
  control points P1=(x1,y1) and P2=(x2,y2). P0=(0,0) and P3=(1,1) are
  implicit (matching CSS cubic-bezier(), Web Animations, browser
  ease-* curves, cubic-bezier.com etc.).
- For a given time t, solve Bx(u) = t for u via Newton-Raphson (8
  iterations) with a bisection fallback for nearly-degenerate
  derivatives.
- Evaluate y = By(u) and project onto [sourceValue, destinationValue].

Also drops the duplicated `if (currentMotionTime > -1) { currentTime
-= startTime; }` block in getCubicValue. That block was dead under
real-time playback (because currentMotionTime stays at -1 and
getCurrentMotionTime() returns now - startTime, which is already
motion-relative) and actively wrong under manual playback (because
subtracting startTime from a motion-relative number produces a huge
negative). Replace with a simple Math.min/max clamp.

Closes #1524.

Adds maven/core-unittests/.../CubicBezierMotionTest.java with five
cases. The two most diagnostic:

- easeOutCurveMatchesCSSReferenceAtMidpoint asserts cubic-bezier(0,
  0, 0.75, 1) at t=0.5 lands in the 580-660 band. CSS-correct ~619;
  pre-fix value ~406 would fail loudly.
- easeInOutCurveStartsSlowEndsSlow asserts the canonical ease-in-out
  S-shape (lags linear at 0.25, leads linear at 0.75, hits midpoint
  at 0.5 by symmetry).

Plus endpoint exactness, linear cubic-bezier(0,0,1,1) sanity, and a
decreasing-range sweep that asserts the value never escapes the
[source, dest] envelope.

Full Motion/Animation/Transition sweep (68 tests) stays green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* ci: re-trigger after flaky infrastructure failures

Previous CI run on this PR hit three orthogonal infrastructure
flakes that have nothing to do with the cubic-bezier code:

- build-linux-jdk8: corrupted master.zip downloaded from the
  codenameone-skins GitHub release endpoint (unzip: cannot find
  zipfile directory in master.zip).
- Build Android JDK 17 / 21: install-cn1 tried to write
  tmpProject/lib/CLDC11.jar before the parent lib/ directory had
  been created. PR #5119 has these same Android jobs passing on
  the identical master base, so the failure is a setup race.

Empty commit to retrigger CI.

* goldens(Android): refresh animation screenshots for cubic-bezier fix (#1524)

The CSS-correct cubic-bezier curve in PR #5122 changes the per-frame
position of every animated transition, so all 20 transition/animation
screenshot baselines need to be refreshed.

Source: emulator-screenshot artifact from the failing Android JDK 21
instrumentation run on this branch's pre-rebase commit. Screenshots
match the prior tests by name and size order; the only differences are
the easing-curve-driven pixel positions during transitions, which is
the expected outcome of the fix.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* goldens(Android): restore StatusBarTap to master version (#1524)

StatusBarTapDiagnosticScreenshotTest isn't animation-related and was
swept up by the bulk goldens refresh. The previous commit replaced the
master golden (28910 B, matching JDK 8 Default) with the JDK 21 mismatch
output (30032 B). JDK 17 / 21 produce a different image for this test
regardless of the cubic-bezier change, so this is a pre-existing
JDK-version flake. Restoring master's golden so the JDK 8 Default job
keeps passing and this PR doesn't conflate two unrelated issues.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* goldens(iOS+Metal+Mac): refresh animation screenshots for cubic-bezier fix (#1524)

The earlier goldens commit only refreshed scripts/android/screenshots
and missed the three other animation-affected pipelines. CI on PR #5122
flagged the same 19 transition/animation tests as "updated" on iOS GL,
iOS Metal, and Mac native. Source: the failing run's ios-ui-tests,
ios-ui-tests-metal, and mac-native-ui-tests artifacts on this branch.

All 19 PNGs are now refreshed in all three baseline dirs - same set of
animation tests whose per-frame position is governed by the CSS-correct
cubic-bezier curve.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

Minor bug - pointerDragged is incorrectly routed to disabled components, pointerPressed and releasedPressed - not.

1 participant