Code example for ByteArrayInputStream

Methods: createFromStream

0
        assertEquals("Bitmap for resource:org.robolectric:drawable/an_image", shadowOf(canvas).getDescription());
    } 
 
    @Test 
    public void shouldInheritSourceStringFromDrawableDotCreateFromStream() throws Exception { 
        InputStream emptyInputStream = new ByteArrayInputStream("".getBytes());
        BitmapDrawable drawable = (BitmapDrawable) Drawable.createFromStream(emptyInputStream, "source string value");
        assertEquals("source string value", shadowOf(drawable).getSource());
    } 
 
    @Test 
    public void withColorFilterSet_draw_shouldCopyDescriptionToCanvas() throws Exception { 
        BitmapDrawable drawable = (BitmapDrawable) resources.getDrawable(R.drawable.an_image);
        drawable.setColorFilter(new ColorMatrixColorFilter(new ColorMatrix()));
        Canvas canvas = new Canvas();
        drawable.draw(canvas);
 
        assertEquals("Bitmap for resource:org.robolectric:drawable/an_image with ColorMatrixColorFilter<1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0>", 
                shadowOf(canvas).getDescription());
    }