コード例 #1
0
  @TestTargetNew(
      level = TestLevel.COMPLETE,
      method = "getOpacity",
      args = {})
  public void testGetOpacity() {
    Drawable d = mContext.getResources().getDrawable(R.drawable.testimage);
    InsetDrawable insetDrawable = new InsetDrawable(d, 0);
    insetDrawable.setAlpha(255);
    assertEquals(PixelFormat.OPAQUE, insetDrawable.getOpacity());

    insetDrawable.setAlpha(100);
    assertEquals(PixelFormat.TRANSLUCENT, insetDrawable.getOpacity());
  }
コード例 #2
0
  @TestTargetNew(
      level = TestLevel.COMPLETE,
      method = "setAlpha",
      args = {int.class})
  @ToBeFixed(bug = "1386429", explanation = "no getter can not be tested")
  public void testSetAlpha() {
    Drawable d = mContext.getResources().getDrawable(R.drawable.pass);
    InsetDrawable insetDrawable = new InsetDrawable(d, 0);

    insetDrawable.setAlpha(1);
    insetDrawable.setAlpha(-1);

    insetDrawable.setAlpha(0);
    insetDrawable.setAlpha(Integer.MAX_VALUE);
    insetDrawable.setAlpha(Integer.MIN_VALUE);
  }