Java 类org.robolectric.shadows.ShadowView 实例源码

项目:fogger    文件:ActivityWithContextMenuTest.java   
@Test
public void shouldUnregisteredLongClickListenerWhenContextMenuUnregisteredOnView() {
    //given
    TextView view = new TextView(RuntimeEnvironment.application.getBaseContext());
    activityWithContextMenu.registerForContextMenu(view);
    ShadowView shadowView = shadowOf(view);

    //expected
    assertThat(shadowView.getOnLongClickListener()).isNotNull();

    //when
    activityWithContextMenu.unregisterForContextMenu(view);

    //then
    assertThat(shadowView.getOnLongClickListener()).isNull();
}
项目:FullRobolectricTestSample    文件:TemporaryBindingsTest.java   
@Test
//    @Values(shadows = TemporaryShadowView.class)
  public void overridingShadowBindingsShouldNotAffectBindingsInLaterTestsAgain() throws Exception {
// todo test this properly
    assertThat(shadowOf(new View(Robolectric.application)).getClass().getSimpleName()).isEqualTo(ShadowView.class.getSimpleName());
//        assertThat(Robolectric.shadowOf_(new View(Robolectric.application)).getClass().getSimpleName()).isEqualTo(TemporaryShadowView.class.getSimpleName());
  }
项目:FullRobolectricTestSample    文件:RobolectricTestRunnerTest.java   
@Test public void shouldLoadDefaultsFromPropertiesFile() throws Exception {
  Properties properties = properties(
      "emulateSdk: 432\n" +
          "manifest: --none\n" +
          "qualifiers: from-properties-file\n" +
          "resourceDir: from/properties/file/res\n" +
          "reportSdk: 234\n" +
          "shadows: org.robolectric.shadows.ShadowView, org.robolectric.shadows.ShadowViewGroup\n");
  assertConfig(configFor(Test2.class, "withoutAnnotation", properties),
      432, "--none", "from-properties-file", "from/properties/file/res", 234, new Class[] {ShadowView.class, ShadowViewGroup.class});
}
项目:CardFlasher    文件:CardCreatorActivityTest.java   
@Test
public void cardDeckCreatorReturnsList() throws Exception {
    Activity cardDecCreActivity = Robolectric.buildActivity(CardCreatorActivity.class)
            .create().resume().get();
    createCardButton = cardDecCreActivity.findViewById(R.id.button_save);
    final ShadowView shadowView = Robolectric.shadowOf(createCardButton);
    View.OnClickListener listener = shadowView.getOnClickListener();
    assertNotNull(listener);
}
项目:tooltip-view    文件:TooltipViewTest.java   
@Test
public void settersInvalidateView() {
    TooltipView view = createView();
    ShadowView shadow = shadowOf(view);
    shadow.clearWasInvalidated();

    view.setAnchoredViewId(sampleId);
    assertThat(shadow).wasInvalidated();
    shadow.clearWasInvalidated();

    view.setArrowHeight(123);
    assertThat(shadow).wasInvalidated();
    shadow.clearWasInvalidated();

    view.setArrowHeightResource(R.dimen.tooltip_default_arrow_height);
    assertThat(shadow).wasInvalidated();
    shadow.clearWasInvalidated();

    view.setArrowWidth(123);
    assertThat(shadow).wasInvalidated();
    shadow.clearWasInvalidated();

    view.setArrowWidthResource(R.dimen.tooltip_default_arrow_width);
    assertThat(shadow).wasInvalidated();
    shadow.clearWasInvalidated();

    view.setCornerRadius(123);
    assertThat(shadow).wasInvalidated();
    shadow.clearWasInvalidated();

    view.setCornerRadiusResource(R.dimen.tooltip_default_corner_radius);
    assertThat(shadow).wasInvalidated();
    shadow.clearWasInvalidated();

    view.setTooltipColor(123);
    assertThat(shadow).wasInvalidated();
    shadow.clearWasInvalidated();
}
项目:open    文件:RouteFragmentTest.java   
private void simulateTwoFingerDrag() {
    MotionEvent e = mock(MotionEvent.class);
    Mockito.when(e.getPointerCount()).thenReturn(2);
    Mockito.when(e.getAction()).thenReturn(MotionEvent.ACTION_MOVE);
    ShadowView view = shadowOf(act.findViewById(R.id.map));
    view.getOnTouchListener().onTouch(null, e);
}
项目:CCDroid    文件:ListViewItemClickListenerTest.java   
private void clickOnOpenButton() {
    AlertDialog alertDialog = ShadowAlertDialog.getLatestAlertDialog();
    Button openButton = alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
    ShadowView.clickOn(openButton);
}
项目:FullRobolectricTestSample    文件:Robolectric.java   
public static ShadowView shadowOf(View instance) {
  return (ShadowView) shadowOf_(instance);
}
项目:tooltip-view    文件:ShadowViewAssert.java   
public ShadowViewAssert(ShadowView actual) {
    super(actual, ShadowViewAssert.class);
}
项目:tooltip-view    文件:Assertions.java   
public static ShadowViewAssert assertThat(ShadowView actual) {
    return new ShadowViewAssert(actual);
}
项目:open    文件:RouteFragmentTest.java   
private void simulateUserDrag() {
    MotionEvent e = MotionEvent.obtain(0L, 0L, MotionEvent.ACTION_MOVE, 120f, 100f, 0);
    ShadowView view = shadowOf(act.findViewById(R.id.map));
    fragment.setCurrentXCor(3.0f);
    view.getOnTouchListener().onTouch(null, e);
}