Search in sources :

Example 16 with FadeDrawable

use of com.facebook.drawee.drawable.FadeDrawable in project fresco by facebook.

the class GenericDraweeHierarchyTest method testSetRoundingParams_ToRoundedLeafsFrom.

private void testSetRoundingParams_ToRoundedLeafsFrom(RoundingParams prev) {
    RoundingParams roundingParams = RoundingParams.asCircle().setBorder(0xAAAAAAAA, 4);
    GenericDraweeHierarchy dh = testRoundingParams_createHierarchy(prev, roundingParams);
    RootDrawable rootDrawable = (RootDrawable) dh.getTopLevelDrawable();
    FadeDrawable fadeDrawable = (FadeDrawable) rootDrawable.getCurrent();
    testRoundingParams_RoundedLeafs(rootDrawable, fadeDrawable, roundingParams);
}
Also used : FadeDrawable(com.facebook.drawee.drawable.FadeDrawable)

Example 17 with FadeDrawable

use of com.facebook.drawee.drawable.FadeDrawable in project fresco by facebook.

the class GenericDraweeHierarchyTest method testHierarchy_NoBranches.

@Test
public void testHierarchy_NoBranches() throws Exception {
    GenericDraweeHierarchy dh = mBuilder.build();
    RootDrawable rootDrawable = (RootDrawable) dh.getTopLevelDrawable();
    FadeDrawable fadeDrawable = (FadeDrawable) rootDrawable.getCurrent();
    assertEquals(7, fadeDrawable.getNumberOfLayers());
    assertNull(fadeDrawable.getDrawable(0));
    assertNull(fadeDrawable.getDrawable(1));
    assertActualImageScaleType(ScaleType.CENTER_CROP, null, fadeDrawable.getDrawable(2));
    assertNull(fadeDrawable.getDrawable(3));
    assertNull(fadeDrawable.getDrawable(4));
    assertNull(fadeDrawable.getDrawable(5));
    assertNull(fadeDrawable.getDrawable(6));
    verifyCallback(rootDrawable, fadeDrawable);
}
Also used : FadeDrawable(com.facebook.drawee.drawable.FadeDrawable) Test(org.junit.Test)

Example 18 with FadeDrawable

use of com.facebook.drawee.drawable.FadeDrawable in project fresco by facebook.

the class GenericDraweeHierarchyTest method testHierarchy_WithScaleType.

@Test
public void testHierarchy_WithScaleType() throws Exception {
    GenericDraweeHierarchy dh = mBuilder.setPlaceholderImage(mPlaceholderImage, ScaleType.CENTER).setRetryImage(mRetryImage, ScaleType.FIT_CENTER).setFailureImage(mFailureImage, ScaleType.CENTER_INSIDE).setProgressBarImage(mProgressBarImage, ScaleType.CENTER).setActualImageScaleType(ScaleType.FOCUS_CROP).setActualImageFocusPoint(mFocusPoint).build();
    RootDrawable rootDrawable = (RootDrawable) dh.getTopLevelDrawable();
    FadeDrawable fadeDrawable = (FadeDrawable) rootDrawable.getCurrent();
    assertEquals(7, fadeDrawable.getNumberOfLayers());
    assertNull(fadeDrawable.getDrawable(0));
    assertScaleTypeAndDrawable(mPlaceholderImage, ScaleType.CENTER, fadeDrawable.getDrawable(1));
    assertActualImageScaleType(ScaleType.FOCUS_CROP, mFocusPoint, fadeDrawable.getDrawable(2));
    assertScaleTypeAndDrawable(mProgressBarImage, ScaleType.CENTER, fadeDrawable.getDrawable(3));
    assertScaleTypeAndDrawable(mRetryImage, ScaleType.FIT_CENTER, fadeDrawable.getDrawable(4));
    assertScaleTypeAndDrawable(mFailureImage, ScaleType.CENTER_INSIDE, fadeDrawable.getDrawable(5));
    assertNull(fadeDrawable.getDrawable(6));
    verifyCallback(rootDrawable, mPlaceholderImage);
}
Also used : FadeDrawable(com.facebook.drawee.drawable.FadeDrawable) Test(org.junit.Test)

Example 19 with FadeDrawable

use of com.facebook.drawee.drawable.FadeDrawable in project fresco by facebook.

the class GenericDraweeHierarchyTest method testHierarchy_WithFailureImage.

@Test
public void testHierarchy_WithFailureImage() throws Exception {
    GenericDraweeHierarchy dh = mBuilder.setFailureImage(mFailureImage, ScaleType.CENTER).build();
    RootDrawable rootDrawable = (RootDrawable) dh.getTopLevelDrawable();
    FadeDrawable fadeDrawable = (FadeDrawable) rootDrawable.getCurrent();
    assertScaleTypeAndDrawable(mFailureImage, ScaleType.CENTER, fadeDrawable.getDrawable(5));
    verifyCallback(rootDrawable, mFailureImage);
}
Also used : FadeDrawable(com.facebook.drawee.drawable.FadeDrawable) Test(org.junit.Test)

Example 20 with FadeDrawable

use of com.facebook.drawee.drawable.FadeDrawable in project fresco by facebook.

the class GenericDraweeHierarchyTest method testHierarchy_WithBackground.

@Test
public void testHierarchy_WithBackground() throws Exception {
    GenericDraweeHierarchy dh = mBuilder.setBackground(mBackground).build();
    RootDrawable rootDrawable = (RootDrawable) dh.getTopLevelDrawable();
    FadeDrawable fadeDrawable = (FadeDrawable) rootDrawable.getCurrent();
    assertEquals(7, fadeDrawable.getNumberOfLayers());
    assertSame(mBackground, fadeDrawable.getDrawable(0));
    verifyCallback(rootDrawable, mBackground);
}
Also used : FadeDrawable(com.facebook.drawee.drawable.FadeDrawable) Test(org.junit.Test)

Aggregations

FadeDrawable (com.facebook.drawee.drawable.FadeDrawable)26 Test (org.junit.Test)22 ForwardingDrawable (com.facebook.drawee.drawable.ForwardingDrawable)4 RoundedCornersDrawable (com.facebook.drawee.drawable.RoundedCornersDrawable)3 ScaleTypeDrawable (com.facebook.drawee.drawable.ScaleTypeDrawable)3 StateListDrawable (android.graphics.drawable.StateListDrawable)2 PointF (android.graphics.PointF)1 BitmapDrawable (android.graphics.drawable.BitmapDrawable)1 ColorDrawable (android.graphics.drawable.ColorDrawable)1 Drawable (android.graphics.drawable.Drawable)1 MatrixDrawable (com.facebook.drawee.drawable.MatrixDrawable)1 Rounded (com.facebook.drawee.drawable.Rounded)1 RoundedBitmapDrawable (com.facebook.drawee.drawable.RoundedBitmapDrawable)1 ScaleType (com.facebook.drawee.drawable.ScalingUtils.ScaleType)1