Skip to content

Commit

Permalink
update tests: buttonStyle.buttonTextStyle to buttonStyle.textStyle
Browse files Browse the repository at this point in the history
  • Loading branch information
rymorale committed Nov 25, 2024
1 parent e5b25a0 commit 964dbcf
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class AepButtonStyleTests {
border = mock(BorderStroke::class.java),
colors = mock(ButtonColors::class.java),
contentPadding = mock(PaddingValues::class.java),
buttonTextStyle = mock(AepTextStyle::class.java)
textStyle = mock(AepTextStyle::class.java)
)
val overridingStyle = AepButtonStyle(
modifier = Modifier.padding(16.dp).border(BorderStroke(2.dp, Color.Red)),
Expand All @@ -47,7 +47,7 @@ class AepButtonStyleTests {
border = mock(BorderStroke::class.java),
colors = mock(ButtonColors::class.java),
contentPadding = mock(PaddingValues::class.java),
buttonTextStyle = mock(AepTextStyle::class.java)
textStyle = mock(AepTextStyle::class.java)
)

val result = AepButtonStyle.merge(defaultStyle, overridingStyle)
Expand All @@ -59,12 +59,12 @@ class AepButtonStyleTests {
assertEquals(overridingStyle.border, result.border)
assertEquals(overridingStyle.colors, result.colors)
assertEquals(overridingStyle.contentPadding, result.contentPadding)
assertEquals(overridingStyle.buttonTextStyle?.textStyle, result.buttonTextStyle?.textStyle)
assertEquals(overridingStyle.buttonTextStyle?.overflow, result.buttonTextStyle?.overflow)
assertEquals(overridingStyle.buttonTextStyle?.softWrap, result.buttonTextStyle?.softWrap)
assertEquals(overridingStyle.buttonTextStyle?.maxLines, result.buttonTextStyle?.maxLines)
assertEquals(overridingStyle.buttonTextStyle?.minLines, result.buttonTextStyle?.minLines)
assertEquals(overridingStyle.buttonTextStyle?.modifier, result.buttonTextStyle?.modifier)
assertEquals(overridingStyle.textStyle?.textStyle, result.textStyle?.textStyle)
assertEquals(overridingStyle.textStyle?.overflow, result.textStyle?.overflow)
assertEquals(overridingStyle.textStyle?.softWrap, result.textStyle?.softWrap)
assertEquals(overridingStyle.textStyle?.maxLines, result.textStyle?.maxLines)
assertEquals(overridingStyle.textStyle?.minLines, result.textStyle?.minLines)
assertEquals(overridingStyle.textStyle?.modifier, result.textStyle?.modifier)
}

@Test
Expand All @@ -77,7 +77,7 @@ class AepButtonStyleTests {
border = mock(BorderStroke::class.java),
colors = mock(ButtonColors::class.java),
contentPadding = mock(PaddingValues::class.java),
buttonTextStyle = mock(AepTextStyle::class.java)
textStyle = mock(AepTextStyle::class.java)
)
val overridingStyle = AepButtonStyle(
modifier = Modifier.padding(16.dp).border(BorderStroke(2.dp, Color.Red)),
Expand All @@ -87,7 +87,7 @@ class AepButtonStyleTests {
border = BorderStroke(3.dp, Color.Green),
colors = null,
contentPadding = null,
buttonTextStyle = null
textStyle = null
)

val result = AepButtonStyle.merge(defaultStyle, overridingStyle)
Expand All @@ -99,7 +99,7 @@ class AepButtonStyleTests {
assertEquals(overridingStyle.border, result.border)
assertEquals(defaultStyle.colors, result.colors)
assertEquals(defaultStyle.contentPadding, result.contentPadding)
assertEquals(defaultStyle.buttonTextStyle, result.buttonTextStyle)
assertEquals(defaultStyle.textStyle, result.textStyle)
}

@Test
Expand All @@ -112,7 +112,7 @@ class AepButtonStyleTests {
border = mock(BorderStroke::class.java),
colors = mock(ButtonColors::class.java),
contentPadding = mock(PaddingValues::class.java),
buttonTextStyle = mock(AepTextStyle::class.java)
textStyle = mock(AepTextStyle::class.java)
)

val result = AepButtonStyle.merge(defaultStyle, null)
Expand All @@ -123,7 +123,7 @@ class AepButtonStyleTests {
assertEquals(defaultStyle.border, result.border)
assertEquals(defaultStyle.colors, result.colors)
assertEquals(defaultStyle.contentPadding, result.contentPadding)
assertEquals(defaultStyle.buttonTextStyle, result.buttonTextStyle)
assertEquals(defaultStyle.textStyle, result.textStyle)
}

@Test
Expand All @@ -136,7 +136,7 @@ class AepButtonStyleTests {
border = mock(BorderStroke::class.java),
colors = mock(ButtonColors::class.java),
contentPadding = mock(PaddingValues::class.java),
buttonTextStyle = mock(AepTextStyle::class.java)
textStyle = mock(AepTextStyle::class.java)
)
val overridingStyle = AepButtonStyle(
modifier = null,
Expand All @@ -146,7 +146,7 @@ class AepButtonStyleTests {
border = null,
colors = null,
contentPadding = null,
buttonTextStyle = null
textStyle = null
)

val result = AepButtonStyle.merge(defaultStyle, overridingStyle)
Expand All @@ -157,6 +157,6 @@ class AepButtonStyleTests {
assertEquals(defaultStyle.border, result.border)
assertEquals(defaultStyle.colors, result.colors)
assertEquals(defaultStyle.contentPadding, result.contentPadding)
assertEquals(defaultStyle.buttonTextStyle, result.buttonTextStyle)
assertEquals(defaultStyle.textStyle, result.textStyle)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ internal class AepStyleValidator {
assertEquals(expectedStyle?.border, style?.border)
assertEquals(expectedStyle?.colors, style?.colors)
assertEquals(expectedStyle?.contentPadding, style?.contentPadding)
validateTextStyle(expectedStyle?.buttonTextStyle, style?.buttonTextStyle)
validateTextStyle(expectedStyle?.textStyle, style?.textStyle)
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class SmallImageUIStyleTests {
shape = CircleShape,
border = BorderStroke(1.dp, Color.Red),
contentPadding = null,
buttonTextStyle = AepTextStyle(
textStyle = AepTextStyle(
modifier = Modifier.size(100.dp, 100.dp),
textStyle = TextStyle(color = Color.Red, fontSize = 16.sp),
overflow = TextOverflow.Clip,
Expand Down Expand Up @@ -250,7 +250,7 @@ class SmallImageUIStyleTests {
assertEquals(buttonStyles[index]?.elevation, builtButtonStyle.elevation)
assertEquals(buttonStyles[index]?.enabled, builtButtonStyle.enabled)
assertEquals(buttonStyles[index]?.modifier, builtButtonStyle.modifier)
AepStyleValidator.validateTextStyle(defaultSmallImageUIStyle.buttonStyle[index].buttonTextStyle, builtButtonStyle.buttonTextStyle)
AepStyleValidator.validateTextStyle(defaultSmallImageUIStyle.buttonStyle[index].textStyle, builtButtonStyle.textStyle)
index++
}
}
Expand Down

0 comments on commit 964dbcf

Please sign in to comment.