Commit ddf03de
hellocodenameone: stabilize DualAppearanceBaseTest screenshot timing
Two fixes in one:
1. Race in light->dark hand-off (visible in builds 25393887679 and
25396087564 as DialogTheme_dark.png containing the
"DialogTheme / light" form, FloatingActionButtonTheme_light.png
containing the dark dialog form).
The chain `light_screenshot -> next.run() -> setDarkMode(true) ->
refreshTheme() -> new Form -> form.show() -> onShowCompleted ->
UITimer 1500 ms -> emitCurrentFormScreenshot` completed every step
in order, but on iOS Metal the show transition was still drawing
the previous form into the back buffer when the timer fired.
cn1_captureView in IOSNative.m uses
`drawViewHierarchyInRect:afterScreenUpdates:NO` (the YES variant
stalls under UIScene), so the CAMetalLayer's front buffer still
held the previous form's pixels and the screenshot grabbed those.
Two changes guard against this:
- `setTransitionInAnimator(CommonTransitions.createEmpty())` on the
dual-appearance form (and matching out-animator) makes form.show()
switch synchronously, removing the ~300 ms transition window
during which the back buffer is still painting the previous form.
- Wrap emitCurrentFormScreenshot in three nested
Display.callSerially hops so at least three EDT paint cycles
(and three Metal display-link presents) land between
onShowCompleted's hand-off and the capture call.
2. landscape.png golden was the wrong artifact. The previous golden-
refresh commit (427ceaf) picked up the half-baked render from
build 25393887679 -- title bar background was still being painted
at capture time. Re-pulled from build 25396087564 which has the
fully-rendered title bar.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 427ceaf commit ddf03de
2 files changed
Lines changed: 28 additions & 1 deletion
File tree
- scripts
- hellocodenameone/common/src/main/java/com/codenameone/examples/hellocodenameone/tests
- ios/screenshots-metal
Lines changed: 28 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
150 | 151 | | |
151 | 152 | | |
152 | 153 | | |
153 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
154 | 172 | | |
155 | 173 | | |
156 | 174 | | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
157 | 184 | | |
158 | 185 | | |
159 | 186 | | |
| |||
Loading
0 commit comments