robolectric / robolectric

Android Unit Testing Framework
http://robolectric.org
Other
5.89k stars 1.37k forks source link

ObjectAnimator doesn't execute immediately with API N and N_MR1 #2845

Open emartynov opened 7 years ago

emartynov commented 7 years ago

Description

It looks like ObjectAnimator is not executed immediately.

Steps to Reproduce

Code:

    final View topChild = getTopChild();

    animator = ObjectAnimator.ofFloat(topChild, "x", signum(topChild.getX()) * (getWidth() - 10));
    animator.start();

It is expected that top child x will be close to the width of the parent. But it actually only changes to several points from the position where it was before animation start.

It also doesn't invoke end method of animation listener.

Robolectric & Android Version

Robolectric 3.2.1 Android N(24) and N_MR1(25)

emartynov commented 7 years ago

Guys, any idea why it happens? This is only one issue that blocks us to use newest API in tests

Albul commented 3 years ago

@emartynov See my workaround with mocking https://stackoverflow.com/a/65076247/4288054