private void testTransition(boolean fadeUpToLayer) {
    // duration is set to 85 ms
    // 85 = 5 * 17; 5 frames of 17ms
    // 255 / 5 = 51; each frame alpha should increase by 51

    // reset drawable
    mFadeDrawable.reset();

    // start animation
    resetInteractions();
    mFadeDrawable.setTransitionDuration(85);
    if (fadeUpToLayer) {
      mFadeDrawable.fadeUpToLayer(1);
    } else {
      mFadeDrawable.fadeToLayer(1);
    }
    Assert.assertEquals(fadeUpToLayer, mFadeDrawable.mIsLayerOn[0]);
    Assert.assertEquals(true, mFadeDrawable.mIsLayerOn[1]);
    Assert.assertEquals(false, mFadeDrawable.mIsLayerOn[2]);
    verify(mCallback).invalidateDrawable(mFadeDrawable);
    verifyNoMoreInteractions(mCallback, mLayers[0], mLayers[1], mLayers[2]);

    // first frame
    resetInteractions();
    mFadeDrawable.draw(mCanvas);
    Assert.assertEquals(255, mFadeDrawable.mAlphas[0]);
    Assert.assertEquals(255, mFadeDrawable.mAlphas[1]);
    Assert.assertEquals(255, mFadeDrawable.mAlphas[2]);
    Assert.assertEquals(FadeDrawable.TRANSITION_RUNNING, mFadeDrawable.mTransitionState);
    verify(mLayers[0]).mutate();
    verify(mLayers[0]).setAlpha(255);
    verify(mLayers[0]).draw(mCanvas);
    verify(mLayers[1]).mutate();
    verify(mLayers[1]).setAlpha(255);
    verify(mLayers[1]).draw(mCanvas);
    verify(mLayers[2]).mutate();
    verify(mLayers[2]).setAlpha(255);
    verify(mLayers[2]).draw(mCanvas);
    verify(mCallback).invalidateDrawable(mFadeDrawable);
    verifyNoMoreInteractions(mCallback, mLayers[0], mLayers[1], mLayers[2]);

    // intermediate frames
    for (int i = 1; i < 5; i++) {
      resetInteractions();
      mFadeDrawable.incrementCurrentTimeMs(17);
      mFadeDrawable.draw(mCanvas);
      Assert.assertEquals(fadeUpToLayer ? 255 : 255 - 51 * i, mFadeDrawable.mAlphas[0]);
      Assert.assertEquals(255, mFadeDrawable.mAlphas[1]);
      Assert.assertEquals(255 - 51 * i, mFadeDrawable.mAlphas[2]);
      Assert.assertEquals(FadeDrawable.TRANSITION_RUNNING, mFadeDrawable.mTransitionState);
      if (fadeUpToLayer) {
        verify(mLayers[0]).mutate();
        verify(mLayers[0]).setAlpha(255);
        verify(mLayers[0]).draw(mCanvas);
      } else {
        verify(mLayers[0]).mutate();
        verify(mLayers[0]).setAlpha(255 - 51 * i);
        verify(mLayers[0]).draw(mCanvas);
      }
      verify(mLayers[1]).mutate();
      verify(mLayers[1]).setAlpha(255);
      verify(mLayers[1]).draw(mCanvas);
      verify(mLayers[2]).mutate();
      verify(mLayers[2]).setAlpha(255 - 51 * i);
      verify(mLayers[2]).draw(mCanvas);
      verify(mCallback).invalidateDrawable(mFadeDrawable);
      verifyNoMoreInteractions(mCallback, mLayers[0], mLayers[1], mLayers[2]);
    }

    // last frame
    resetInteractions();
    mFadeDrawable.incrementCurrentTimeMs(17);
    mFadeDrawable.draw(mCanvas);
    Assert.assertEquals(fadeUpToLayer ? 255 : 0, mFadeDrawable.mAlphas[0]);
    Assert.assertEquals(255, mFadeDrawable.mAlphas[1]);
    Assert.assertEquals(0, mFadeDrawable.mAlphas[2]);
    Assert.assertEquals(FadeDrawable.TRANSITION_NONE, mFadeDrawable.mTransitionState);
    if (fadeUpToLayer) {
      verify(mLayers[0]).mutate();
      verify(mLayers[0]).setAlpha(255);
      verify(mLayers[0]).draw(mCanvas);
    }
    verify(mLayers[1]).mutate();
    verify(mLayers[1]).setAlpha(255);
    verify(mLayers[1]).draw(mCanvas);
    verifyNoMoreInteractions(mCallback, mLayers[0], mLayers[1], mLayers[2]);
  }
Tests {@link FadeDrawable} where all layers are visible per default. * @see FadeDrawableTest for
more tests
drawee/src/test/java/com/facebook/drawee/drawable/FadeDrawableAllOnTest.java