PopUpCoachMarkPresenter { protected CoachMarkPixelInfo createCoachMarkPixelInfo() { final CoachMarkLayoutMargin coachMarkLayoutMargin = mCoachMarkBuilder.getCoachMarkLayoutMargin(); int leftMargin = mDimensionResourceProvider.getDimensionInPixel( coachMarkLayoutMargin.getLeftMarginForCoachMark()); int rightMargin = mDimensionResourceProvider.getDimensionInPixel( coachMarkLayoutMargin.getRightMarginForCoachMark()); int topMargin = mDimensionResourceProvider.getDimensionInPixel( coachMarkLayoutMargin.getTopMarginForCoachMark()); int bottomMargin = mDimensionResourceProvider.getDimensionInPixel( coachMarkLayoutMargin.getBottomMarginForCoachMark()); int actionBarHeightPixels = mDimensionResourceProvider.getDimensionInPixel( mCoachMarkBuilder.getActionBarHeight()); int footerHeightPixels = mDimensionResourceProvider.getDimensionInPixel( mCoachMarkBuilder.getFooterHeight()); int imageHeightInPixels = mDimensionResourceProvider.getDimensionInPixel( mCoachMarkBuilder.getImageLayoutInformation().getImageHeight()); int imageWidthInPixels = mDimensionResourceProvider.getDimensionInPixel( mCoachMarkBuilder.getImageLayoutInformation().getImageWidth()); int coachMarkPopUpHeightInPixels = mDimensionResourceProvider.getDimensionInPixel(R.dimen.coach_mark_pop_up_height); int coachMarkPopUpWidthInPixels = mDimensionResourceProvider.getDimensionInPixel(R.dimen.coach_mark_pop_up_width); int notchDimenInPixels = mDimensionResourceProvider.getDimensionInPixel(R.dimen.coach_mark_notch_width_height); int marginOffsetForNotchInPixels = mDimensionResourceProvider.getDimensionInPixel(R.dimen.coach_mark_notch_margin_offset); int widthHeightOffsetForCoachMarkPopUp = mDimensionResourceProvider.getDimensionInPixel(R.dimen.coach_mark_pop_up_width_height_offset); int coachMarkPopUpWidthInPixelsWithOffset = coachMarkPopUpWidthInPixels + widthHeightOffsetForCoachMarkPopUp + imageWidthInPixels; int coachMarkPopUpHeightInPixelsWithOffset = coachMarkPopUpHeightInPixels + widthHeightOffsetForCoachMarkPopUp + imageHeightInPixels; int screenHeightInPixels = mScreenInfoProvider.getScreenHeightInPixels(); int screenWidthInPixels = mScreenInfoProvider.getScreenWidthInPixels(); return CoachMarkPixelInfo.create() .setMarginRectInPixels(new Rect(leftMargin, topMargin, rightMargin, bottomMargin)) .setPopUpHeightInPixels(coachMarkPopUpHeightInPixels) .setPopUpHeightInPixelsWithOffset(coachMarkPopUpHeightInPixelsWithOffset) .setPopUpWidthInPixels(coachMarkPopUpWidthInPixels) .setPopUpWidthInPixelsWithOffset(coachMarkPopUpWidthInPixelsWithOffset) .setWidthHeightOffsetForCoachMarkPopUp(widthHeightOffsetForCoachMarkPopUp) .setActionBarHeightPixels(actionBarHeightPixels) .setFooterHeightPixels(footerHeightPixels) .setNotchDimenInPixels(notchDimenInPixels) .setMarginOffsetForNotchInPixels(marginOffsetForNotchInPixels) .setImageHeightInPixels(imageHeightInPixels) .setImageWidthInPixels(imageWidthInPixels) .setScreenHeightInPixels(screenHeightInPixels) .setScreenWidthInPixels(screenWidthInPixels) .build(); } PopUpCoachMarkPresenter(final IStringResourceProvider stringResourceProvider,
                                   final IDimensionResourceProvider dimensionResourceProvider,
                                   final ITypeFaceProvider typeFaceProvider,
                                   final IScreenInfoProvider screenInfoProvider); void onCreate(CoachMarkBuilder coachMarkBuilder); void onCreateView(IPopUpCoachMarkPresentation popUpCoachMarkPresentation); void onViewCreated(); void onDestroyView(); void onDestroy(); void onOkButtonClicked(); void onShimClicked();  }
@Test public void createCoachMarkPixelInfoTest(){ Mockito.when(mCoachMarkBuilder.getCoachMarkLayoutMargin()).thenReturn(mCoachMarkLayoutMargin); Mockito.when(mCoachMarkBuilder.getImageLayoutInformation()).thenReturn(mImageLayoutInformation); Mockito.when(mCoachMarkLayoutMargin.getBottomMarginForCoachMark()).thenReturn(mockedDimenRes); Mockito.when(mCoachMarkLayoutMargin.getLeftMarginForCoachMark()).thenReturn(mockedDimenRes); Mockito.when(mCoachMarkLayoutMargin.getRightMarginForCoachMark()).thenReturn(mockedDimenRes); Mockito.when(mCoachMarkLayoutMargin.getTopMarginForCoachMark()).thenReturn(mockedDimenRes); Mockito.when(mCoachMarkBuilder.getActionBarHeight()).thenReturn(mockedDimenRes); Mockito.when(mCoachMarkBuilder.getFooterHeight()).thenReturn(mockedDimenRes); Mockito.when(mImageLayoutInformation.getImageHeight()).thenReturn(mockedDimenRes); Mockito.when(mImageLayoutInformation.getImageWidth()).thenReturn(mockedDimenRes); Mockito.when(mDimensionResourceProvider.getDimensionInPixel(Matchers.anyInt())).thenReturn(10); CoachMarkPixelInfo coachMarkPixelInfo = mPopUpCoachMarkPresenter.createCoachMarkPixelInfo(); assertEquals(10, coachMarkPixelInfo.getImageHeightInPixels()); assertEquals(10, coachMarkPixelInfo.getImageWidthInPixels()); assertEquals(30, coachMarkPixelInfo.getPopUpHeightInPixelsWithOffset()); assertEquals(30, coachMarkPixelInfo.getPopUpWidthInPixelsWithOffset()); assertEquals(10, coachMarkPixelInfo.getWidthHeightOffsetForCoachMarkPopUp()); assertEquals(10, coachMarkPixelInfo.getNotchDimenInPixels()); assertEquals(10, coachMarkPixelInfo.getActionBarHeightPixels()); assertEquals(10, coachMarkPixelInfo.getFooterHeightPixels()); }