コード例 #1
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());
  }
コード例 #2
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());
  }