Exemplo n.º 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());
  }
Exemplo n.º 2
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());
  }
Exemplo n.º 3
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());
  }