TextViewTarget extends ViewTarget<TextView> { @Override protected void onResult(TextView view, Drawable drawable, Mirage.Source source, MirageRequest request) { if (animation() != null) { if (!animation().animate(view, drawable, source)) { placeDrawable(view, drawable); } } else { placeDrawable(view, drawable); } } TextViewTarget(TextView textView);  TextViewTarget(MirageRequest request, TextView textView); TextViewTarget location(@Location int location); TextViewTarget bounds(int left, int top, int right, int bottom); @Override ViewTarget<TextView> fade(); static final int LEFT; static final int TOP; static final int RIGHT; static final int BOTTOM; }
@Test public void testOnResult() { TextView textView = new TextView(RuntimeEnvironment.application); TextViewTarget target = new TextViewTarget(textView); target.location(TextViewTarget.LEFT); target.bounds(0, 0, 300, 200); target.placeHolder(new ColorDrawable(Color.BLUE)); target.onPreparingLoad(); target.onResult(Bitmap.createBitmap(300, 200, Bitmap.Config.ARGB_8888), Mirage.Source.EXTERNAL, new MirageRequest()); Assert.assertEquals(new Rect(0, 0, 300, 200), textView.getCompoundDrawables()[0].getBounds()); Assert.assertEquals(300, textView.getCompoundDrawables()[0].getIntrinsicWidth()); Assert.assertEquals(200, textView.getCompoundDrawables()[0].getIntrinsicHeight()); Assert.assertTrue(textView.getCompoundDrawables()[0] instanceof BitmapDrawable); Assert.assertNull(textView.getCompoundDrawables()[1]); Assert.assertNull(textView.getCompoundDrawables()[2]); Assert.assertNull(textView.getCompoundDrawables()[3]); }