Skip to content

Commit

Permalink
Add arrow visibility test
Browse files Browse the repository at this point in the history
  • Loading branch information
ertugrulkaragoz1 committed Sep 19, 2023
1 parent 8770caa commit 713aba1
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ internal object TooltipViewStateFactory {
imageUrl: String = "",
customContent: Int? = null,
isStatusBarVisible: Boolean = false,
arrowMargin: Int = 0
arrowMargin: Int = 0,
isArrowVisible: Boolean = true
): TooltipViewState {
val showcaseModel = ShowcaseModel(
rectF = RectF(),
Expand Down Expand Up @@ -67,7 +68,8 @@ internal object TooltipViewStateFactory {
descriptionTextStyle = Typeface.NORMAL,
titleTextFontFamily = "sans-serif",
showDuration = 2000L,
isShowcaseViewVisibleIndefinitely = true
isShowcaseViewVisibleIndefinitely = true,
isArrowVisible = isArrowVisible
)
return provideTooltipViewState(showcaseModel, absoluteArrowPosition, arrowMargin)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,34 @@ class TooltipViewStateTest {
actualResult `should be` expectedResult
}

@Test
fun `Given isArrowVisible false, When getTopArrowVisibility called, Then it should return GONE`() {
// Given
val isArrowVisible = false
val expectedResult = View.GONE
val tooltipViewState = TooltipViewStateFactory.provideTooltipViewState(isArrowVisible = isArrowVisible)

// When
val actualResult = tooltipViewState.getTopArrowVisibility()

// Then
actualResult `should be` expectedResult
}

@Test
fun `Given isArrowVisible false, When getBottomArrowVisibility called, Then it should return GONE`() {
// Given
val isArrowVisible = false
val expectedResult = View.GONE
val tooltipViewState = TooltipViewStateFactory.provideTooltipViewState(isArrowVisible = isArrowVisible)

// When
val actualResult = tooltipViewState.getBottomArrowVisibility()

// Then
actualResult `should be` expectedResult
}

@Test
fun `when showCloseButton is true then getCloseButtonVisibility() returns VISIBLE`() {
//when
Expand Down Expand Up @@ -237,4 +265,4 @@ class TooltipViewStateTest {

actualResult `should be` expectedResult
}
}
}

0 comments on commit 713aba1

Please sign in to comment.