Code example for ColorDrawable

0
 
  @SmallTest 
  public void testGetDrawableDrawable() { 
    // Make sure that the resource whose type is "drawable" should be loaded by resources directly. 
    Resources resources = createMock(MockResources.class);
    Drawable drawable = new ColorDrawable(Color.WHITE);
    expect(resources.getResourceTypeName(1)).andReturn("drawable");
    expect(resources.getDrawable(1)).andReturn(drawable);
    replayAll(); 
 
    MozcDrawableFactory factory = new MozcDrawableFactory(resources);
    assertSame(drawable, factory.getDrawable(1));
 
    verifyAll(); 
  } 
 
  @SmallTest 
  public void testEmojiDrawable() { 
    // Try to parse all emoji Drawable. 
    Resources resources = getInstrumentation().getTargetContext().getResources();