Skip to content

Simulator: split Skins menu, fix Native Theme menu, add regression test#4984

Merged
liannacasper merged 4 commits into
masterfrom
simulator-skin-menu-split-native-theme-fix
May 19, 2026
Merged

Simulator: split Skins menu, fix Native Theme menu, add regression test#4984
liannacasper merged 4 commits into
masterfrom
simulator-skin-menu-split-native-theme-fix

Conversation

@shai-almog
Copy link
Copy Markdown
Collaborator

Summary

  • Skins menu: only OTA downloads from the codenameone.com gallery live behind the new "Legacy Skins" submenu now. The framework default, Desktop / UWP Desktop pseudo-skins, and any local skin picked via Add Skin all stay at the top level. A single shared ButtonGroup spans both levels so the active skin shows as selected wherever it lives. Add Skin now persists the pick to the skins preference immediately (it relied on loadSkinFile on the reload path before, so the entry could vanish if the reload was dismissed).
  • Native Theme menu: was silently broken for iOS Modern and Android Material. The ant Ports/JavaSE/build.xml only copied iOS7Theme.res and winTheme.res into the JavaSE jar, so a menu pick of either modern theme hit JavaSEPort.class.getResourceAsStream("/iOSModernTheme.res") == null and silently fell back to the embedded theme. Added the modern + Android legacy themes to the ant copy with failonerror=false, matching the existing maven pom pattern.
  • Regression test: the existing JavaSE simulator screenshot suite gains four native-theme-* scenarios that drive the same preference + reload mechanism the menu uses and assert the simulator actually loaded the expected .res. A new JavaSEPort.getCurrentSimulatorNativeTheme() exposes the resolved override key; SimulatorModeTestApp reads it back, writes a result=PASS|FAIL line, and the verifier asserts on it. The runner now invokes scripts/build-native-themes.sh before the ant build so fresh checkouts have the CSS-compiled .res files ready.

Test plan

  • CI: Test JavaSE simulator integration scripts workflow runs the four new javase-single-native-theme-* scenarios green
  • Local: open the Skins menu in the simulator — confirm default + user skins are top-level, OTA-downloaded skins are behind "Legacy Skins", Desktop / UWP Desktop show as radios
  • Local: pick a .skin via Add Skin, then dismiss the reload prompt — verify the entry persists in the menu on next open
  • Local: pick "iOS Modern (Liquid Glass)" from the Native Theme menu — confirm the simulator reloads with that theme applied
  • Local: pick "Android Material" from the Native Theme menu — confirm the simulator reloads with that theme applied

🤖 Generated with Claude Code

…ion test

The Skin Designer landing moved every shipped skin behind a "Legacy
Skins" submenu. That was overreach: the framework default, the
desktop pseudo-skins, and any local skin the user picks via Add
Skin all belong at the top level. Only the codenameone.com OTA
downloads (and the gallery that fetches them) are "legacy."

createSkinsMenu now partitions the "skins" preference via a new
classifySkin helper that canonicalises paths and checks whether
they live under ~/.codenameone/. A single ButtonGroup spans the
top-level radios and the Legacy submenu so the active skin shows
as selected wherever it lives. Desktop.skin / UWP Desktop.skin are
radios in that same group so the active chrome mode is visible at
a glance. Add Skin now calls addSkinName immediately so a picked
skin shows up at the top level even if the user dismisses the
reload before loadSkinFile's own addSkinName runs.

While testing the menu, the Native Theme submenu turned out to be
silently broken for the modern themes: Ports/JavaSE/build.xml
copied iOS7Theme.res and winTheme.res into the JavaSE jar but not
iOSModernTheme.res or AndroidMaterialTheme.res, so a menu pick of
"iOS Modern" or "Android Material" resolved through
getResourceAsStream to null and fell back to the embedded theme.
Add the modern themes (plus the Android legacy pair) to the ant
copy with failonerror=false, matching the existing maven pom
pattern.

Cover the menu's reload path with an integration screenshot test.
A new currentSimulatorNativeTheme static on JavaSEPort captures
the override key that loadSkinFile actually resolved; the
SimulatorModeTestApp reads it back and emits a PASS/FAIL line to
both stdout and a sentinel file. SimulatorWindowModeVerifier
gained --native-theme, which writes the simulatorNativeTheme
preference exactly the way the menu does, then asserts the
sentinel reports PASS. The runner script invokes
scripts/build-native-themes.sh before the ant build so fresh
checkouts have the modern .res files ready, and adds four new
scenarios (iOSModernTheme, iOS7Theme, AndroidMaterialTheme,
android_holo_light) to lock the regression.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented May 19, 2026

Compared 11 screenshots: 11 matched.
✅ JavaSE simulator integration screenshots matched stored baselines.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 19, 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 and others added 3 commits May 19, 2026 12:50
The test app's init() loaded /theme.res and silently ignored the
IOException when it wasn't present. That left UIManager at the bare
DefaultLookAndFeel, so every captured screenshot rendered with the
same unstyled chrome regardless of which simulatorNativeTheme the
verifier was exercising. The PASS assertion fired because
JavaSEPort.nativeThemeRes was loaded - the UI just never reflected
it.

Install the native theme directly when no app theme is bundled, via
Display.installNativeTheme() (JavaSEPort.loadSkinFile has already
cached nativeThemeRes by the time init() runs, so this is a
non-allocating push into UIManager). Now the screenshot for iOS
Modern, Android Material, iOS 7 and Android Holo Light each
renders with the corresponding chrome - confirmed locally on macOS:
rounded blue iOS buttons, Material purple raised buttons, flat
iOS 7, and HOLO all-caps respectively.

Enrich the test form with the global Toolbar, a CheckBox, and a
TextField so the captured screenshot carries enough theme-bearing
chrome to make the active theme obvious - a screenshot with only
two plain buttons looks nearly identical across themes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Locks the four new javase-single-native-theme-* scenarios to a
baseline so the cn1ss compare step has something concrete to diff
against. Captured locally on macOS (1470x956); CI's Xvfb run
(2200x1400) will produce a diff comment on the first PR build,
which is the normal cn1ss flow for adopting fresh baselines into
the Linux-rendered canonical set.

Each baseline visibly carries the expected native theme:
- iOS Modern: rounded blue buttons, modern iOS title bar
- iOS 7: flat blue/grey 2014-era chrome
- Android Material: raised purple buttons, Material title chrome
- Android Holo Light: all-caps button labels in light blue

This confirms that the simulatorNativeTheme preference the
"Native Theme" menu writes flows all the way through to a
visually distinct UI, not just through the static
JavaSEPort.getCurrentSimulatorNativeTheme() assertion the test
already had.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replace the macOS-captured goldens (1470x956, wrong resolution +
unrelated terminal in the background) with the Linux Xvfb captures
from CI run 26092505053 on this branch. These reflect the current
SimulatorModeTestApp shape: global Toolbar with the hamburger icon,
CheckBox + TextField in the body, and the Native Theme menu entry
on the simulator menu bar.

Includes the four new native-theme baselines for iOS Modern,
iOS 7, Android Material, and Android Holo Light - each visually
distinct as expected (rounded blue iOS buttons, flat iOS 7 chrome,
raised purple Material buttons, all-caps Holo labels).

Refreshes the seven pre-existing scenarios too - they shifted
because the test app now embeds a Toolbar + extra theme-bearing
components.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@liannacasper liannacasper merged commit 9787359 into master May 19, 2026
12 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.

2 participants