コード例 #1
0
 public void testDuration() throws Throwable {
   final long duration = 2000;
   ObjectAnimator objectAnimatorLocal =
       (ObjectAnimator) mActivity.createAnimatorWithDuration(duration);
   startAnimation(objectAnimatorLocal);
   assertEquals(duration, objectAnimatorLocal.getDuration());
 }
コード例 #2
0
  public void testClone() throws Throwable {
    Object object = mActivity.view.newBall;
    String property = "y";
    float startY = mActivity.mStartY;
    float endY = mActivity.mStartY + mActivity.mDeltaY;
    Interpolator interpolator = new AccelerateInterpolator();
    ObjectAnimator objAnimator = ObjectAnimator.ofFloat(object, property, startY, endY);
    objAnimator.setDuration(mDuration);
    objAnimator.setRepeatCount(ValueAnimator.INFINITE);
    objAnimator.setInterpolator(interpolator);
    objAnimator.setRepeatMode(ValueAnimator.REVERSE);
    ObjectAnimator cloneAnimator = objAnimator.clone();

    assertEquals(mDuration, cloneAnimator.getDuration());
    assertEquals(ValueAnimator.INFINITE, cloneAnimator.getRepeatCount());
    assertEquals(ValueAnimator.REVERSE, cloneAnimator.getRepeatMode());
    assertEquals(object, cloneAnimator.getTarget());
    assertEquals(property, cloneAnimator.getPropertyName());
    assertEquals(interpolator, cloneAnimator.getInterpolator());
  }