@Test public void shouldPostInvalidateDelayed() throws Exception { Robolectric.pauseMainLooper(); view.postInvalidateDelayed(100); ShadowView shadowView = shadowOf(view); assertFalse(shadowView.wasInvalidated()); Robolectric.unPauseMainLooper(); assertTrue(shadowView.wasInvalidated()); }
@Override public void applyAttributes() { super.applyAttributes(); applyTextAttribute(); applyTextColorAttribute(); applyHintAttribute(); applyHintColorAttribute(); applyCompoundDrawablesWithIntrinsicBoundsAttributes(); }
@Implementation @Override public void clearFocus() { if (hasFocus()) { super.clearFocus(); for (View child : children) { child.clearFocus(); } } }
@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()); }
@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()); }