示例#1
0
  @Test
  public void shouldPostInvalidateDelayed() throws Exception {
    Robolectric.pauseMainLooper();

    view.postInvalidateDelayed(100);
    ShadowView shadowView = shadowOf(view);
    assertFalse(shadowView.wasInvalidated());

    Robolectric.unPauseMainLooper();
    assertTrue(shadowView.wasInvalidated());
  }
示例#2
0
 @Override
 public void applyAttributes() {
   super.applyAttributes();
   applyTextAttribute();
   applyTextColorAttribute();
   applyHintAttribute();
   applyHintColorAttribute();
   applyCompoundDrawablesWithIntrinsicBoundsAttributes();
 }
示例#3
0
  @Implementation
  @Override
  public void clearFocus() {
    if (hasFocus()) {
      super.clearFocus();

      for (View child : children) {
        child.clearFocus();
      }
    }
  }
示例#4
0
  @Test
  public void testFocusableWhenLoadedFromXml() {
    LinearLayout root = new LinearLayout(null);
    ShadowView.inflate(new Activity(), R.layout.views, root);

    View defaultView = root.findViewById(R.id.default_view);
    assertFalse(defaultView.isFocusable());

    View focusableFalseView = root.findViewById(R.id.focusable_false_view);
    assertFalse(focusableFalseView.isFocusable());

    View focusableTrueView = root.findViewById(R.id.focusable_true_view);
    assertTrue(focusableTrueView.isFocusable());
  }
示例#5
0
  @Test
  public void testFilterTouchesWhenObscuredWhenLoadedFromXml() {
    LinearLayout root = new LinearLayout(null);
    ShadowView.inflate(new Activity(), R.layout.views, root);

    View defaultView = root.findViewById(R.id.default_view);
    assertFalse(defaultView.getFilterTouchesWhenObscured());

    View filterFalseView = root.findViewById(R.id.filter_touches_false_view);
    assertFalse(filterFalseView.getFilterTouchesWhenObscured());

    View filterTrueView = root.findViewById(R.id.filter_touches_true_view);
    assertTrue(filterTrueView.getFilterTouchesWhenObscured());
  }