Code example for BitmapDrawable

Methods: getIntrinsicHeight, getIntrinsicWidth

0
    } 
 
    @Test 
    public void constructor_shouldSetTheIntrinsicWidthAndHeightToTheWidthAndHeightOfTheBitmap() throws Exception { 
        Bitmap bitmap = Bitmap.createBitmap(5, 10, Bitmap.Config.ARGB_8888);
        BitmapDrawable drawable = new BitmapDrawable(Robolectric.application.getResources(), bitmap);
        assertEquals(5, drawable.getIntrinsicWidth());
        assertEquals(10, drawable.getIntrinsicHeight());
    } 
 
    @Test 
    public void constructor_shouldAcceptNullBitmap() throws Exception { 
        BitmapDrawable drawable = new BitmapDrawable(Robolectric.application.getResources(), (Bitmap) null);
        assertNotNull(drawable);
    } 
}