ObjectAnimatorTest.java 文件源码

java
阅读 19 收藏 0 点赞 0 评论 0

项目:FullRobolectricTestSample 作者:
@Test
public void objectAnimator_shouldSetTheStartingAndEndingValues() throws Exception {
  ValueObject object = new ValueObject();
  ObjectAnimator animator = ObjectAnimator.ofObject(object, "value", new TypeEvaluator<String>() {
    @Override
    public String evaluate(float fraction, String startValue, String endValue) {
      if (fraction < 0.5) {
        return startValue;
      } else {
        return endValue;
      }
    }
  }, "human", "replicant", "unicorn");
  animator.setDuration(2000);

  animator.start();

  assertThat(object.getValue()).isEqualTo("human");
  Robolectric.idleMainLooper(1000);
  assertThat(object.getValue()).isEqualTo("replicant");
  Robolectric.idleMainLooper(1000);
  assertThat(object.getValue()).isEqualTo("unicorn");
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号