ToggleImageButton extends ImageButton { public boolean isToggledOn() { return isToggledOn; } ToggleImageButton(Context context);  ToggleImageButton(Context context, AttributeSet attrs);  ToggleImageButton(Context context, AttributeSet attrs, int defStyle); @Override int[] onCreateDrawableState(int extraSpace); @Override boolean performClick(); void setToggledOn(boolean isToggledOn); void toggle(); boolean isToggledOn();  }
@Test public void testInit() { final ToggleImageButton button = createDefaultButton(); assertNull(button.contentDescriptionOn); assertNull(button.contentDescriptionOff); assertFalse(button.isToggledOn()); assertTrue(button.toggleOnClick); }
@Test public void testXmlInit() { final ToggleImageButton button = createButtonWithAttributes(); assertEquals(CONTENT_DESCRIPTION_ON, button.contentDescriptionOn); assertEquals(CONTENT_DESCRIPTION_OFF, button.contentDescriptionOff); assertFalse(button.isToggledOn()); assertEquals(CONTENT_DESCRIPTION_OFF, button.getContentDescription()); assertFalse(button.toggleOnClick); }