feat(home): 응원 크리에이터 카드 바인딩을 추가한다
This commit is contained in:
@@ -25,6 +25,7 @@ import kr.co.vividnext.sodalive.v2.main.home.model.HomeRecommendationGenreCreato
|
||||
import kr.co.vividnext.sodalive.v2.main.home.model.HomeRecommendationLiveUiModel
|
||||
import kr.co.vividnext.sodalive.v2.main.home.model.visibleHomeGenreCreatorGroups
|
||||
import kr.co.vividnext.sodalive.v2.main.home.ui.HomeAiCharacterAdapter
|
||||
import kr.co.vividnext.sodalive.v2.main.home.ui.HomeCheerCreatorAdapter
|
||||
import kr.co.vividnext.sodalive.v2.main.home.ui.HomeFirstAudioAdapter
|
||||
import kr.co.vividnext.sodalive.v2.main.home.ui.HomeFollowAllButtonBinder
|
||||
import kr.co.vividnext.sodalive.v2.main.home.ui.HomeGenreCreatorAdapter
|
||||
@@ -293,6 +294,10 @@ class HomeMainFragmentLayoutTest {
|
||||
assertEquals(4, creatorGrid.columnCount)
|
||||
assertEquals(2, creatorGrid.rowCount)
|
||||
assertNotNull(followAllButton)
|
||||
val followAllLayoutParams = followAllButton.layoutParams as ViewGroup.MarginLayoutParams
|
||||
assertEquals(0, followAllLayoutParams.marginStart)
|
||||
assertEquals(14.dpToPx(), followAllLayoutParams.topMargin)
|
||||
assertEquals(0, followAllLayoutParams.marginEnd)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -473,6 +478,79 @@ class HomeMainFragmentLayoutTest {
|
||||
assertEquals((10L..17L).toList(), clickedCreatorIds)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `cheer creator group item matches figma card structure`() {
|
||||
val group = inflateViewWithParent(R.layout.item_home_cheer_creator_group)
|
||||
val creatorGrid = group.findViewById<GridLayout>(R.id.gl_home_cheer_creator_profiles)
|
||||
val followAllButton = group.findViewById<View>(R.id.view_home_cheer_group_follow_all)
|
||||
|
||||
assertEquals(ViewGroup.LayoutParams.MATCH_PARENT, group.layoutParams.width)
|
||||
assertEquals(ViewGroup.LayoutParams.WRAP_CONTENT, group.layoutParams.height)
|
||||
assertEquals(R.drawable.bg_home_cheer_creator_group, shadowOf(group.background).createdFromResId)
|
||||
assertEquals(14.dpToPx(), group.paddingStart)
|
||||
assertEquals(14.dpToPx(), group.paddingTop)
|
||||
assertEquals(14.dpToPx(), group.paddingEnd)
|
||||
assertEquals(14.dpToPx(), group.paddingBottom)
|
||||
assertEquals(ViewGroup.LayoutParams.MATCH_PARENT, creatorGrid.layoutParams.width)
|
||||
assertEquals(4, creatorGrid.columnCount)
|
||||
assertEquals(2, creatorGrid.rowCount)
|
||||
assertNotNull(followAllButton)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `home cheer creator section uses full width card with horizontal padding`() {
|
||||
val root = inflateView(R.layout.fragment_v2_main_home)
|
||||
val cheerList = root.findViewById<RecyclerView>(R.id.rv_home_cheer_creators)
|
||||
|
||||
assertEquals(ViewGroup.LayoutParams.WRAP_CONTENT, cheerList.layoutParams.height)
|
||||
assertEquals(14.dpToPx(), cheerList.paddingStart)
|
||||
assertEquals(14.dpToPx(), cheerList.paddingEnd)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `cheer creator adapter sizes card to parent width minus horizontal padding`() {
|
||||
val context = ApplicationProvider.getApplicationContext<Context>()
|
||||
val parent = RecyclerView(context)
|
||||
parent.setPadding(14.dpToPx(), 0, 14.dpToPx(), 0)
|
||||
parent.layoutManager = LinearLayoutManager(context, RecyclerView.HORIZONTAL, false)
|
||||
parent.layout(0, 0, 402.dpToPx(), 600.dpToPx())
|
||||
|
||||
val viewHolder = HomeCheerCreatorAdapter(onFollowAllClick = {}).onCreateViewHolder(parent, 0)
|
||||
|
||||
assertEquals(374.dpToPx(), viewHolder.itemView.layoutParams.width)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `cheer creator adapter renders max eight creators`() {
|
||||
val context = ApplicationProvider.getApplicationContext<Context>()
|
||||
val parent = RecyclerView(context)
|
||||
parent.layoutManager = LinearLayoutManager(context, RecyclerView.HORIZONTAL, false)
|
||||
val adapter = HomeCheerCreatorAdapter(onFollowAllClick = {})
|
||||
adapter.submitSection(genreCreators(1L) + genreCreators(11L), isFollowCompleted = false)
|
||||
val viewHolder = adapter.onCreateViewHolder(parent, 0)
|
||||
|
||||
adapter.onBindViewHolder(viewHolder, 0)
|
||||
|
||||
assertEquals(1, adapter.itemCount)
|
||||
assertEquals(8, viewHolder.itemView.findViewById<GridLayout>(R.id.gl_home_cheer_creator_profiles).childCount)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `cheer creator adapter follow all uses all cheer creator ids`() {
|
||||
val context = ApplicationProvider.getApplicationContext<Context>()
|
||||
val parent = RecyclerView(context)
|
||||
parent.layoutManager = LinearLayoutManager(context, RecyclerView.HORIZONTAL, false)
|
||||
val clickedCreatorIds = mutableListOf<Long>()
|
||||
val adapter = HomeCheerCreatorAdapter(onFollowAllClick = { clickedCreatorIds.addAll(it) })
|
||||
adapter.submitSection(genreCreators(10L), isFollowCompleted = false)
|
||||
val viewHolder = adapter.onCreateViewHolder(parent, 0)
|
||||
|
||||
adapter.onBindViewHolder(viewHolder, 0)
|
||||
viewHolder.itemView.findViewById<View>(R.id.view_home_cheer_group_follow_all).performClick()
|
||||
|
||||
assertEquals((10L..17L).toList(), clickedCreatorIds)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `genre creator visible groups hide all empty groups before fragment visibility`() {
|
||||
val section = HomeRecommendationGenreCreatorSection(
|
||||
|
||||
Reference in New Issue
Block a user