public void testOfFloatBase() throws Throwable { Object object = mActivity.view.newBall; String property = "y"; float startY = mActivity.mStartY; float endY = mActivity.mStartY + mActivity.mDeltaY; ObjectAnimator animator = ObjectAnimator.ofFloat(object, property, startY, endY); ObjectAnimator objAnimator = new ObjectAnimator(); objAnimator.setTarget(object); objAnimator.setPropertyName(property); assertEquals(animator.getTarget(), objAnimator.getTarget()); assertEquals(animator.getPropertyName(), objAnimator.getPropertyName()); }
public void testGetTarget() throws Throwable { Object object = mActivity.view.newBall; String propertyName = "backgroundColor"; int startColor = mActivity.view.RED; int endColor = mActivity.view.BLUE; Object[] values = {new Integer(startColor), new Integer(endColor)}; ArgbEvaluator evaluator = new ArgbEvaluator(); ObjectAnimator colorAnimator = ObjectAnimator.ofObject(object, propertyName, evaluator, values); Object target = colorAnimator.getTarget(); assertEquals(object, target); }
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()); }