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

项目:Fabric-Example-App-Android    文件:VastVideoViewControllerTest.java   
@Test
public void constructor_shouldAddCloseButtonWidgetToLayoutAndSetToGoneWithOnTouchListeners() throws Exception {
    initializeSubject();

    VastVideoCloseButtonWidget closeButtonWidget = subject.getCloseButtonWidget();
    assertThat(closeButtonWidget.getParent()).isEqualTo(subject.getLayout());
    assertThat(closeButtonWidget.getVisibility()).isEqualTo(View.GONE);

    ShadowRelativeLayout closeButtonWidgetShadow = (ShadowRelativeLayout) shadowOf(closeButtonWidget);
    assertThat(closeButtonWidgetShadow.getOnTouchListener()).isNull();

    ShadowImageView closeButtonImageViewShadow = shadowOf(closeButtonWidget.getImageView());
    assertThat(closeButtonImageViewShadow.getOnTouchListener()).isNotNull();

    ShadowTextView closeButtonTextViewShadow = shadowOf(closeButtonWidget.getTextView());
    assertThat(closeButtonTextViewShadow.getOnTouchListener()).isNotNull();
}
项目:Fabric-Example-App-Android    文件:VastVideoViewControllerTest.java   
@Config(reportSdk = VERSION_CODES.GINGERBREAD)
@Test
public void onPrepared_beforeGingerbreadMr1_shouldNotSetBlurredLastVideoFrame() throws Exception {
    VastVideoConfiguration vastVideoConfiguration = new VastVideoConfiguration();
    vastVideoConfiguration.setDiskMediaFileUrl("disk_video_path");
    bundle.putSerializable(VAST_VIDEO_CONFIGURATION, vastVideoConfiguration);

    initializeSubject();

    getShadowVideoView().getOnPreparedListener().onPrepared(null);

    assertThat(subject.getBlurredLastVideoFrameImageView().getDrawable()).isNull();

    ShadowImageView imageView = shadowOf(subject.getBlurredLastVideoFrameImageView());
    assertThat(imageView.getOnTouchListener()).isNull();
}
项目:Fabric-Example-App-Android    文件:VastVideoViewControllerTest.java   
@Config(reportSdk = VERSION_CODES.GINGERBREAD_MR1)
@Test
public void onPrepared_atLeastGingerbreadMr1_shouldSetBlurredLastVideoFrame() throws Exception {
    VastVideoConfiguration vastVideoConfiguration = new VastVideoConfiguration();
    vastVideoConfiguration.setDiskMediaFileUrl("disk_video_path");
    bundle.putSerializable(VAST_VIDEO_CONFIGURATION, vastVideoConfiguration);

    initializeSubject();

    getShadowVideoView().getOnPreparedListener().onPrepared(null);

    final ImageView blurredLastVideoFrameImageView = subject.getBlurredLastVideoFrameImageView();
    assertThat(blurredLastVideoFrameImageView.getDrawable()).isInstanceOf(BitmapDrawable.class);
    assertThat(((BitmapDrawable) blurredLastVideoFrameImageView.getDrawable()).getBitmap()).isNotNull();

    ShadowImageView imageView = shadowOf(subject.getBlurredLastVideoFrameImageView());
    assertThat(imageView.getOnTouchListener()).isNull();
}
项目:lmis-moz-mobile    文件:LoginActivityTest.java   
@Test
public void shouldSetPasswordVisibility() {
    ShadowImageView shadowPwdImageView = shadowOf(loginActivity.ivVisibilityPwd);

    assertThat(shadowPwdImageView.getImageResourceId()).isEqualTo(R.drawable.ic_visibility_off);
    assertThat(loginActivity.etPassword.getInputType()).isEqualTo(InputType.TYPE_CLASS_TEXT
            | EditorInfo.TYPE_TEXT_VARIATION_PASSWORD);

    loginActivity.ivVisibilityPwd.performClick();

    assertThat(shadowPwdImageView.getImageResourceId()).isEqualTo(R.drawable.ic_visibility);
    assertThat(loginActivity.etPassword.getInputType()).isEqualTo(InputType.TYPE_CLASS_TEXT
            | EditorInfo.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
}
项目:fogger    文件:DialogWithBlurredBackgroundLauncherTest.java   
@Test
public void shouldSetGivenBitmapWhenBlurredBackgroundIsReady() {
    //given
    mDialogWithBlurredBackgroundLauncher.showDialog(dialog);
    Bitmap bitmap = mock(Bitmap.class);

    //when
    mDialogWithBlurredBackgroundLauncher.onBlurringFinish(bitmap);

    //then
    ImageView blurLayer = (ImageView) exampleActivity.findViewById(R.id.blurLayer);
    ShadowImageView shadowImageView = Shadows.shadowOf(blurLayer);
    assertThat(shadowImageView.getImageBitmap()).isEqualTo(bitmap);
}
项目:Fabric-Example-App-Android    文件:VastVideoViewControllerTest.java   
@Test
public void constructor_shouldAddCtaButtonWidgetToLayoutAndSetInvisibleWithOnTouchListeners() throws Exception {
    initializeSubject();

    VastVideoCtaButtonWidget ctaButtonWidget = subject.getCtaButtonWidget();
    assertThat(ctaButtonWidget.getParent()).isEqualTo(subject.getLayout());
    assertThat(ctaButtonWidget.getVisibility()).isEqualTo(View.INVISIBLE);
    ShadowImageView ctaButtonWidgetShadow = shadowOf(ctaButtonWidget);
    assertThat(ctaButtonWidgetShadow.getOnTouchListener()).isNotNull();
    assertThat(ctaButtonWidgetShadow.getOnTouchListener()).isEqualTo(getShadowVideoView().getOnTouchListener());
}
项目:Fabric-Example-App-Android    文件:VastVideoViewControllerTest.java   
@Test
public void constructor_shouldAddProgressBarWidgetToLayoutAndSetInvisibleWithNoListeners() throws Exception {
    initializeSubject();

    VastVideoProgressBarWidget progressBarWidget = subject.getProgressBarWidget();
    assertThat(progressBarWidget.getParent()).isEqualTo(subject.getLayout());
    assertThat(progressBarWidget.getVisibility()).isEqualTo(View.INVISIBLE);
    ShadowImageView progressBarWidgetShadow = shadowOf(progressBarWidget);
    assertThat(progressBarWidgetShadow.getOnTouchListener()).isNull();
}
项目:Fabric-Example-App-Android    文件:VastVideoViewControllerTest.java   
@Test
public void constructor_shouldAddRadialCountdownWidgetToLayoutAndSetInvisibleWithNoListeners() throws Exception {
    initializeSubject();

    VastVideoRadialCountdownWidget radialCountdownWidget = subject.getRadialCountdownWidget();
    assertThat(radialCountdownWidget.getParent()).isEqualTo(subject.getLayout());
    assertThat(radialCountdownWidget.getVisibility()).isEqualTo(View.INVISIBLE);
    ShadowImageView radialCountdownWidgetShadow = shadowOf(radialCountdownWidget);
    assertThat(radialCountdownWidgetShadow.getOnTouchListener()).isNull();
}
项目:Fabric-Example-App-Android    文件:VastVideoViewControllerTest.java   
@Test
public void constructor_shouldAddTopGradientWidgetToLayoutAndSetVisibleWithNoListeners() throws Exception {
    initializeSubject();

    VastVideoGradientStripWidget topGradientStripWidget = subject.getTopGradientStripWidget();
    assertThat(topGradientStripWidget.getParent()).isEqualTo(subject.getLayout());
    assertThat(topGradientStripWidget.getVisibility()).isEqualTo(View.VISIBLE);
    ShadowImageView topGradientStripWidgetShadow = shadowOf(topGradientStripWidget);
    assertThat(topGradientStripWidgetShadow.getOnTouchListener()).isNull();
}
项目:Fabric-Example-App-Android    文件:VastVideoViewControllerTest.java   
@Test
public void constructor_shouldAddBottomGradientWidgetToLayoutAndSetVisibleWithNoListeners() throws Exception {
    initializeSubject();

    VastVideoGradientStripWidget bottomGradientStripWidget = subject.getBottomGradientStripWidget();
    assertThat(bottomGradientStripWidget.getParent()).isEqualTo(subject.getLayout());
    assertThat(bottomGradientStripWidget.getVisibility()).isEqualTo(View.VISIBLE);
    ShadowImageView bottomGradientStripWidgetShadow = shadowOf(bottomGradientStripWidget);
    assertThat(bottomGradientStripWidgetShadow.getOnTouchListener()).isNull();
}
项目:Fabric-Example-App-Android    文件:VastVideoViewControllerTest.java   
@Test
public void constructor_shouldAddBlurredLastVideoFrameWidgetToLayoutAndSetInvisibleWithNoListeners() throws Exception {
    initializeSubject();

    ImageView blurredLastVideoFrameImageView = subject.getBlurredLastVideoFrameImageView();
    assertThat(blurredLastVideoFrameImageView.getParent()).isEqualTo(subject.getLayout());
    assertThat(blurredLastVideoFrameImageView.getVisibility()).isEqualTo(View.INVISIBLE);
    ShadowImageView blurredLastVideoFrameImageViewShadow = shadowOf(blurredLastVideoFrameImageView);
    assertThat(blurredLastVideoFrameImageViewShadow.getOnTouchListener()).isNull();
}
项目:FullRobolectricTestSample    文件:Robolectric.java   
public static ShadowImageView shadowOf(ImageView instance) {
  return (ShadowImageView) shadowOf_(instance);
}