Skip to content

Fix ToastBar empty space above text when positioned at TOP#4721

Merged
shai-almog merged 7 commits intomasterfrom
copilot/fix-toastbar-top-position-issue
Apr 8, 2026
Merged

Fix ToastBar empty space above text when positioned at TOP#4721
shai-almog merged 7 commits intomasterfrom
copilot/fix-toastbar-top-position-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 8, 2026

  • Explore existing screenshot test patterns in scripts/hellocodenameone
  • Understand the ToastBar fix and existing regression tests
  • Create ToastBarTopPositionScreenshotTest.java screenshot test in scripts/hellocodenameone
  • Register the new test in Cn1ssDeviceRunner.java
  • Verify core-unittests still pass (14/14 pass)
  • Run parallel validation

Copilot AI and others added 4 commits April 8, 2026 00:53
The safe area top padding was unconditionally set to safeArea.getY(),
but the layered pane (which wraps the content pane) is already
positioned below the toolbar that accounts for the safe area inset.
This caused double-counting of the inset, creating empty space above
the ToastBar text.

Now computes the needed padding as the difference between the safe
area top inset and the parent container's absolute Y position, so
padding is only added when the ToastBar actually extends into the
unsafe area.

Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/c374fa90-ccba-426b-b2d3-5e2f430bf1fe

Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com>
Add five regression tests to ToastBarTest covering:
- TOP position with safe area inset when parent is below safe area
  (the original bug: should not double-count the inset)
- TOP position without safe area inset (no extra padding)
- BOTTOM position with safe area bottom inset (correct padding)
- BOTTOM position without safe area inset (no extra padding)
- TOP position with parent at Y=0 using FormLayeredPane
  (full safe area padding needed)

Also adds setDisplaySafeArea/getDisplaySafeArea to
TestCodenameOneImplementation to simulate devices with notches.

Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/d40eb36c-4528-4297-97d4-4f8144175502

Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com>
…ber with constant

Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/d40eb36c-4528-4297-97d4-4f8144175502

Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

✅ Continuous Quality Report

Test & Coverage

Static Analysis

Generated automatically by the PR CI workflow.

@shai-almog
Copy link
Copy Markdown
Collaborator

shai-almog commented Apr 8, 2026

Compared 36 screenshots: 36 matched.

Native Android coverage

  • 📊 Line coverage: 7.94% (4066/51218 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 6.25% (20109/321673), branch 2.97% (928/31205), complexity 3.71% (1109/29859), method 6.51% (907/13925), class 10.65% (197/1849)
    • 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/712 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: 7.94% (4066/51218 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 6.25% (20109/321673), branch 2.97% (928/31205), complexity 3.71% (1109/29859), method 6.51% (907/13925), class 10.65% (197/1849)
    • 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/712 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 1175.000 ms
Base64 CN1 encode 218.000 ms
Base64 encode ratio (CN1/native) 0.186x (81.4% faster)
Base64 native decode 1279.000 ms
Base64 CN1 decode 428.000 ms
Base64 decode ratio (CN1/native) 0.335x (66.5% faster)

@shai-almog
Copy link
Copy Markdown
Collaborator

shai-almog commented Apr 8, 2026

iOS screenshot updates

Compared 36 screenshots: 35 matched, 1 updated.

  • BrowserComponent — updated screenshot. Screenshot differs (1179x2556 px, bit depth 8).

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

Benchmark Results

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

Detailed Performance Metrics

Metric Duration
Simulator Boot 0 ms
Simulator Boot (Run) 1000 ms
App Install 3000 ms
App Launch 4000 ms
Test Execution 180000 ms
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 1491.000 ms
Base64 CN1 encode 2621.000 ms
Base64 encode ratio (CN1/native) 1.758x (75.8% slower)
Base64 native decode 1006.000 ms
Base64 CN1 decode 2151.000 ms
Base64 decode ratio (CN1/native) 2.138x (113.8% slower)

Add ToastBarTopPositionScreenshotTest that shows a ToastBar message
at the TOP position to visually verify no spurious empty space
appears above the toast text. Register it in Cn1ssDeviceRunner.

Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/eaa2d20f-fd1b-44cd-b3b8-fda8d8155d7a

Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com>
Signed-off-by: Shai Almog <67850168+shai-almog@users.noreply.github.com>
Signed-off-by: Shai Almog <67850168+shai-almog@users.noreply.github.com>
@shai-almog shai-almog merged commit 64b9c78 into master Apr 8, 2026
19 of 20 checks 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.

Incorrect top padding for ToastBar when shown using Component.TOP (since recent update)

2 participants