Search in sources :

Example 1 with ShadowView

use of org.robolectric.shadows.ShadowView in project RoboBinding by RoboBinding.

the class ViewAddOnForViewTest method shouldSupportMultipleOnFocusChangeListeners.

@Test
public void shouldSupportMultipleOnFocusChangeListeners() {
    MockOnFocusChangeListener listener1 = new MockOnFocusChangeListener();
    MockOnFocusChangeListener listener2 = new MockOnFocusChangeListener();
    viewAddOn.addOnFocusChangeListener(listener1);
    viewAddOn.addOnFocusChangeListener(listener2);
    ShadowView shadowView = Shadows.shadowOf(view);
    shadowView.setViewFocus(!view.isFocused());
    assertTrue(listener1.focusChangeEventFired);
    assertTrue(listener2.focusChangeEventFired);
}
Also used : ShadowView(org.robolectric.shadows.ShadowView) Test(org.junit.Test) OnTouchAttributeTest(org.robobinding.widget.view.OnTouchAttributeTest)

Example 2 with ShadowView

use of org.robolectric.shadows.ShadowView in project RoboBinding by RoboBinding.

the class OnFocusAttributeTest method setViewFocus.

private void setViewFocus() {
    ShadowView shadowView = Shadows.shadowOf(view);
    shadowView.setViewFocus(true);
}
Also used : ShadowView(org.robolectric.shadows.ShadowView)

Example 3 with ShadowView

use of org.robolectric.shadows.ShadowView in project RoboBinding by RoboBinding.

the class OnFocusLostAttributeTest method clearViewFocus.

private void clearViewFocus() {
    ShadowView shadowView = Shadows.shadowOf(view);
    shadowView.setViewFocus(false);
}
Also used : ShadowView(org.robolectric.shadows.ShadowView)

Example 4 with ShadowView

use of org.robolectric.shadows.ShadowView in project glide by bumptech.

the class ViewTargetTest method setUp.

@Before
public void setUp() {
    view = new View(RuntimeEnvironment.application);
    target = new TestViewTarget(view);
    shadowView = (SizedShadowView) ShadowExtractor.extract(view);
    shadowObserver = (PreDrawShadowViewTreeObserver) ShadowExtractor.extract(view.getViewTreeObserver());
}
Also used : View(android.view.View) ShadowView(org.robolectric.shadows.ShadowView) Before(org.junit.Before)

Example 5 with ShadowView

use of org.robolectric.shadows.ShadowView in project RoboBinding by RoboBinding.

the class OnFocusChangeAttributeTest method changeViewFocus.

private void changeViewFocus() {
    ShadowView shadowView = Shadows.shadowOf(view);
    shadowView.setViewFocus(RandomValues.trueOrFalse());
}
Also used : ShadowView(org.robolectric.shadows.ShadowView)

Aggregations

ShadowView (org.robolectric.shadows.ShadowView)5 View (android.view.View)1 Before (org.junit.Before)1 Test (org.junit.Test)1 OnTouchAttributeTest (org.robobinding.widget.view.OnTouchAttributeTest)1