fix(widget): 랭킹 순위 영역 위치를 보정한다

This commit is contained in:
2026-06-09 15:13:01 +09:00
parent ea076a5ac7
commit 64fb55db55
4 changed files with 64 additions and 16 deletions

View File

@@ -49,8 +49,8 @@ class CreatorRankingAdapterLayoutTest {
assertRankTextBox(
view = view.findViewById(R.id.tv_creator_ranking_rank),
expectedWidth = 112,
expectedHeight = 124,
expectedWidth = 86,
expectedHeight = 116,
expectedLeft = 0,
expectedTop = 0
)
@@ -64,8 +64,8 @@ class CreatorRankingAdapterLayoutTest {
assertRankTextBox(
view = view.findViewById(R.id.tv_creator_ranking_rank),
expectedWidth = 55,
expectedHeight = 75,
expectedWidth = 56,
expectedHeight = 70,
expectedLeft = 0,
expectedTop = 0
)
@@ -79,9 +79,9 @@ class CreatorRankingAdapterLayoutTest {
assertRankTextBox(
view = view.findViewById(R.id.tv_creator_ranking_rank),
expectedWidth = 42,
expectedHeight = 56,
expectedLeft = 8,
expectedWidth = 52,
expectedHeight = 50,
expectedLeft = 0,
expectedTop = 0
)
}
@@ -97,7 +97,41 @@ class CreatorRankingAdapterLayoutTest {
assertEquals(49, params.width)
assertEquals(ViewGroup.LayoutParams.WRAP_CONTENT, params.height)
assertEquals(14, params.leftMargin)
assertEquals(14, params.topMargin)
assertEquals(12, params.topMargin)
assertRankTextBox(
view = view.findViewById(R.id.tv_creator_ranking_rank),
expectedWidth = 48,
expectedHeight = 52,
expectedLeft = 0,
expectedTop = 0
)
}
@Test
fun `large card 순위 변화 표시는 Figma 위치를 유지한다`() {
val view = inflateView<CreatorRankingLargeCardView>(R.layout.view_creator_ranking_large_card)
view.setCardSize(CreatorRankingCardSize(widthPx = 374, heightPx = 374))
assertViewPosition(
view = view.findViewById(R.id.ll_creator_ranking_delta),
expectedLeft = 20,
expectedTop = 116
)
}
@Test
fun `compact small card 순위 변화 표시는 Figma 위치를 유지한다`() {
val view = inflateView<CreatorRankingCompactCardView>(R.layout.view_creator_ranking_compact_card)
view.setCardSize(CreatorRankingCardSize(widthPx = 122, heightPx = 122))
assertViewPosition(
view = view.findViewById(R.id.ll_creator_ranking_delta),
expectedLeft = 10,
expectedTop = 50
)
}
@Test
@@ -154,6 +188,16 @@ class CreatorRankingAdapterLayoutTest {
assertEquals(View.VISIBLE, view.findViewById<View>(R.id.ll_creator_ranking_delta).visibility)
}
private fun assertViewPosition(
view: View,
expectedLeft: Int,
expectedTop: Int
) {
val params = view.layoutParams as ViewGroup.MarginLayoutParams
assertEquals(expectedLeft, params.leftMargin)
assertEquals(expectedTop, params.topMargin)
}
private fun assertRankTextBox(
view: TextView,
expectedWidth: Int,