Skip to content

Commit 206600e

Browse files
committed
Adjust slow motion usage during animation captures
1 parent fcecb5c commit 206600e

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

docs/demos/common/src/test/java/com/codenameone/developerguide/animations/AnimationDemosScreenshotTest.java

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,14 @@ public boolean runTest() throws Exception {
5353
clearPreviousScreenshots();
5454

5555
boolean previousSlowMotion = Motion.isSlowMotion();
56-
Motion.setSlowMotion(true);
56+
Motion.setSlowMotion(false);
5757
try {
5858
Form host = new DemoBrowserForm();
5959
host.show();
6060
TestUtils.waitForFormTitle(HOST_TITLE, FORM_TIMEOUT_MS);
6161

6262
for (Demo demo : DemoRegistry.getDemos()) {
63+
Motion.setSlowMotion(false);
6364
demo.show(host);
6465
Form demoForm = waitForDemoForm(host);
6566
waitForFormReady(demoForm);
@@ -69,12 +70,17 @@ public boolean runTest() throws Exception {
6970
triggerAnimationIfNeeded(demo, demoForm);
7071
Form activeForm = ensureCurrentFormReady(demoForm);
7172

72-
if (waitForAnimationStart(activeForm, ANIMATION_CAPTURE_TIMEOUT_MS)) {
73-
captureAnimationFrames(demo, activeForm);
74-
finalizeAnimations(activeForm);
75-
} else {
76-
Image screenshot = capture(activeForm);
77-
saveScreenshot(storageKeyFor(demo.getTitle()), screenshot);
73+
Motion.setSlowMotion(true);
74+
try {
75+
if (waitForAnimationStart(activeForm, ANIMATION_CAPTURE_TIMEOUT_MS)) {
76+
captureAnimationFrames(demo, activeForm);
77+
finalizeAnimations(activeForm);
78+
} else {
79+
Image screenshot = capture(activeForm);
80+
saveScreenshot(storageKeyFor(demo.getTitle()), screenshot);
81+
}
82+
} finally {
83+
Motion.setSlowMotion(false);
7884
}
7985

8086
returnToHost(activeForm, host);

0 commit comments

Comments
 (0)