test(creator): 라이브 공통 UI 검증을 갱신한다
This commit is contained in:
@@ -91,20 +91,20 @@ class CreatorChannelLiveFragmentLayoutTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `라이브 sort popup layout은 Figma 기준 option row와 선택 배경을 제공한다`() {
|
fun `라이브 sort popup layout은 Figma 기준 option row와 선택 배경을 제공한다`() {
|
||||||
val popup = inflateView(R.layout.view_creator_channel_live_sort_menu)
|
val popup = inflateView(R.layout.view_creator_channel_sort_menu)
|
||||||
val popupLayout = projectFile(
|
val popupLayout = projectFile(
|
||||||
"app/src/main/res/layout/view_creator_channel_live_sort_menu.xml"
|
"app/src/main/res/layout/view_creator_channel_sort_menu.xml"
|
||||||
).readText()
|
).readText()
|
||||||
val popupBackground = projectFile(
|
val popupBackground = projectFile(
|
||||||
"app/src/main/res/drawable/bg_creator_channel_live_sort_popup.xml"
|
"app/src/main/res/drawable/bg_creator_channel_sort_popup.xml"
|
||||||
).readText()
|
).readText()
|
||||||
val selectedBackground = projectFile(
|
val selectedBackground = projectFile(
|
||||||
"app/src/main/res/drawable/bg_creator_channel_live_sort_selected.xml"
|
"app/src/main/res/drawable/bg_creator_channel_sort_selected.xml"
|
||||||
).readText()
|
).readText()
|
||||||
|
|
||||||
assertNotNull(popup.findViewById<View>(R.id.layout_creator_channel_live_sort_options))
|
assertNotNull(popup.findViewById<View>(R.id.layout_creator_channel_sort_options))
|
||||||
assertTrue(popupLayout.contains("@drawable/bg_creator_channel_live_sort_popup"))
|
assertTrue(popupLayout.contains("@drawable/bg_creator_channel_sort_popup"))
|
||||||
assertTrue(popupLayout.contains("@+id/layout_creator_channel_live_sort_options"))
|
assertTrue(popupLayout.contains("@+id/layout_creator_channel_sort_options"))
|
||||||
assertTrue(popupLayout.contains("android:paddingHorizontal=\"@dimen/spacing_12\""))
|
assertTrue(popupLayout.contains("android:paddingHorizontal=\"@dimen/spacing_12\""))
|
||||||
assertTrue(popupLayout.contains("android:paddingVertical=\"@dimen/spacing_8\""))
|
assertTrue(popupLayout.contains("android:paddingVertical=\"@dimen/spacing_8\""))
|
||||||
assertTrue(popupLayout.contains("android:fontFamily=\"@font/medium\""))
|
assertTrue(popupLayout.contains("android:fontFamily=\"@font/medium\""))
|
||||||
@@ -115,49 +115,49 @@ class CreatorChannelLiveFragmentLayoutTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `라이브 다시듣기 item layout은 썸네일 tag title duration action 영역을 제공한다`() {
|
fun `라이브 다시듣기 공통 item layout은 썸네일 tag title secondary action 영역을 제공한다`() {
|
||||||
val item = inflateView(R.layout.item_creator_channel_live_replay)
|
val item = inflateView(R.layout.item_creator_channel_audio_content)
|
||||||
val itemLayout = projectFile("app/src/main/res/layout/item_creator_channel_live_replay.xml").readText()
|
val itemLayout = projectFile("app/src/main/res/layout/item_creator_channel_audio_content.xml").readText()
|
||||||
val adapter = projectFile(
|
val adapter = projectFile(
|
||||||
"app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/live/ui/CreatorChannelLiveReplayAdapter.kt"
|
"app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/live/ui/CreatorChannelLiveReplayAdapter.kt"
|
||||||
).readText()
|
).readText()
|
||||||
val thumbnail = requireNotNull(item.findViewById<View>(R.id.layout_creator_channel_live_replay_thumbnail))
|
val thumbnail = requireNotNull(item.findViewById<View>(R.id.layout_creator_channel_audio_content_thumbnail))
|
||||||
|
|
||||||
assertNotNull(item.findViewById<ImageView>(R.id.iv_creator_channel_live_replay_thumbnail))
|
assertNotNull(item.findViewById<ImageView>(R.id.iv_creator_channel_audio_content_thumbnail))
|
||||||
assertNotNull(item.findViewById<ImageView>(R.id.iv_creator_channel_live_replay_adult_badge))
|
assertNotNull(item.findViewById<ImageView>(R.id.iv_creator_channel_audio_content_adult_badge))
|
||||||
assertNotNull(item.findViewById<ImageView>(R.id.iv_creator_channel_live_replay_original_tag))
|
assertNotNull(item.findViewById<ImageView>(R.id.iv_creator_channel_audio_content_original_tag))
|
||||||
assertNotNull(item.findViewById<ImageView>(R.id.iv_creator_channel_live_replay_first_tag))
|
assertNotNull(item.findViewById<ImageView>(R.id.iv_creator_channel_audio_content_first_tag))
|
||||||
assertNotNull(item.findViewById<ImageView>(R.id.iv_creator_channel_live_replay_point_tag))
|
assertNotNull(item.findViewById<ImageView>(R.id.iv_creator_channel_audio_content_point_tag))
|
||||||
assertNotNull(item.findViewById<TextView>(R.id.tv_creator_channel_live_replay_free_tag))
|
assertNotNull(item.findViewById<TextView>(R.id.tv_creator_channel_audio_content_free_tag))
|
||||||
assertNotNull(item.findViewById<TextView>(R.id.tv_creator_channel_live_replay_title))
|
assertNotNull(item.findViewById<TextView>(R.id.tv_creator_channel_audio_content_title))
|
||||||
assertNotNull(item.findViewById<TextView>(R.id.tv_creator_channel_live_replay_duration))
|
assertNotNull(item.findViewById<TextView>(R.id.tv_creator_channel_audio_content_secondary_text))
|
||||||
assertNotNull(item.findViewById<View>(R.id.layout_creator_channel_live_replay_action))
|
assertNotNull(item.findViewById<View>(R.id.layout_creator_channel_audio_content_action))
|
||||||
assertNotNull(item.findViewById<ImageView>(R.id.iv_creator_channel_live_replay_play))
|
assertNotNull(item.findViewById<ImageView>(R.id.iv_creator_channel_audio_content_play))
|
||||||
assertNotNull(item.findViewById<ImageView>(R.id.iv_creator_channel_live_replay_can))
|
assertNotNull(item.findViewById<ImageView>(R.id.iv_creator_channel_audio_content_can))
|
||||||
assertNotNull(item.findViewById<View>(R.id.layout_creator_channel_live_replay_action_text))
|
assertNotNull(item.findViewById<View>(R.id.layout_creator_channel_audio_content_action_text))
|
||||||
assertNotNull(item.findViewById<TextView>(R.id.tv_creator_channel_live_replay_action_text))
|
assertNotNull(item.findViewById<TextView>(R.id.tv_creator_channel_audio_content_action_text))
|
||||||
assertEquals(dp(88), thumbnail.layoutParams.width)
|
assertEquals(dp(88), thumbnail.layoutParams.width)
|
||||||
assertEquals(dp(88), thumbnail.layoutParams.height)
|
assertEquals(dp(88), thumbnail.layoutParams.height)
|
||||||
assertTrue(itemLayout.contains("android:layout_marginBottom=\"@dimen/spacing_8\""))
|
assertTrue(itemLayout.contains("android:layout_marginBottom=\"@dimen/spacing_8\""))
|
||||||
assertTrue(itemLayout.contains("android:clipToOutline=\"true\""))
|
assertTrue(itemLayout.contains("android:clipToOutline=\"true\""))
|
||||||
assertTrue(itemLayout.contains("android:outlineProvider=\"background\""))
|
assertTrue(itemLayout.contains("android:outlineProvider=\"background\""))
|
||||||
assertTrue(itemLayout.contains("@drawable/bg_audio_content_card_thumbnail"))
|
assertTrue(itemLayout.contains("@drawable/bg_audio_content_card_thumbnail"))
|
||||||
assertTrue(adapter.contains("layoutCreatorChannelLiveReplayThumbnail.clipToOutline = true"))
|
assertTrue(adapter.contains("layoutCreatorChannelAudioContentThumbnail.clipToOutline = true"))
|
||||||
assertTrue(adapter.contains("resources.getDimension(R.dimen.radius_14)"))
|
assertTrue(adapter.contains("resources.getDimension(R.dimen.radius_14)"))
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `라이브 layout은 가격 영역을 유연한 너비와 bar cash icon으로 제공한다`() {
|
fun `라이브 layout은 가격 영역을 유연한 너비와 bar cash icon으로 제공한다`() {
|
||||||
val fragmentLayout = projectFile("app/src/main/res/layout/fragment_creator_channel_live.xml").readText()
|
val fragmentLayout = projectFile("app/src/main/res/layout/fragment_creator_channel_live.xml").readText()
|
||||||
val itemLayout = projectFile("app/src/main/res/layout/item_creator_channel_live_replay.xml").readText()
|
val itemLayout = projectFile("app/src/main/res/layout/item_creator_channel_audio_content.xml").readText()
|
||||||
val root = inflateView(R.layout.fragment_creator_channel_live)
|
val root = inflateView(R.layout.fragment_creator_channel_live)
|
||||||
val item = inflateView(R.layout.item_creator_channel_live_replay)
|
val item = inflateView(R.layout.item_creator_channel_audio_content)
|
||||||
val currentPrice = requireNotNull(root.findViewById<View>(R.id.layout_creator_channel_live_current_price))
|
val currentPrice = requireNotNull(root.findViewById<View>(R.id.layout_creator_channel_live_current_price))
|
||||||
val currentPriceCash = requireNotNull(root.findViewById<ImageView>(R.id.iv_creator_channel_live_current_price_cash))
|
val currentPriceCash = requireNotNull(root.findViewById<ImageView>(R.id.iv_creator_channel_live_current_price_cash))
|
||||||
val replayAction = requireNotNull(item.findViewById<View>(R.id.layout_creator_channel_live_replay_action))
|
val replayAction = requireNotNull(item.findViewById<View>(R.id.layout_creator_channel_audio_content_action))
|
||||||
val replayPlay = requireNotNull(item.findViewById<ImageView>(R.id.iv_creator_channel_live_replay_play))
|
val replayPlay = requireNotNull(item.findViewById<ImageView>(R.id.iv_creator_channel_audio_content_play))
|
||||||
val actionText = requireNotNull(item.findViewById<View>(R.id.layout_creator_channel_live_replay_action_text))
|
val actionText = requireNotNull(item.findViewById<View>(R.id.layout_creator_channel_audio_content_action_text))
|
||||||
val adultBadge = requireNotNull(item.findViewById<ImageView>(R.id.iv_creator_channel_live_replay_adult_badge))
|
val adultBadge = requireNotNull(item.findViewById<ImageView>(R.id.iv_creator_channel_audio_content_adult_badge))
|
||||||
val adultBadgeParams = adultBadge.layoutParams as ViewGroup.MarginLayoutParams
|
val adultBadgeParams = adultBadge.layoutParams as ViewGroup.MarginLayoutParams
|
||||||
|
|
||||||
assertEquals(ViewGroup.LayoutParams.WRAP_CONTENT, currentPrice.layoutParams.width)
|
assertEquals(ViewGroup.LayoutParams.WRAP_CONTENT, currentPrice.layoutParams.width)
|
||||||
@@ -183,7 +183,7 @@ class CreatorChannelLiveFragmentLayoutTest {
|
|||||||
)
|
)
|
||||||
assertFalse(
|
assertFalse(
|
||||||
itemLayout.contains(
|
itemLayout.contains(
|
||||||
"android:id=\"@+id/layout_creator_channel_live_replay_action\"\n" +
|
"android:id=\"@+id/layout_creator_channel_audio_content_action\"\n" +
|
||||||
" android:layout_width=\"60dp\""
|
" android:layout_width=\"60dp\""
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -208,7 +208,7 @@ class CreatorChannelLiveFragmentLayoutTest {
|
|||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
|
|
||||||
assertTrue(fragment.contains("R.drawable.ic_new_sort"))
|
assertTrue(fragment.contains("R.drawable.ic_new_sort"))
|
||||||
assertTrue(fragment.contains("CreatorChannelLiveSortPopup"))
|
assertTrue(fragment.contains("CreatorChannelSortPopup"))
|
||||||
assertTrue(fragment.contains("layoutCreatorChannelLiveSortButton.setOnClickListener"))
|
assertTrue(fragment.contains("layoutCreatorChannelLiveSortButton.setOnClickListener"))
|
||||||
assertTrue(fragment.contains("showSortPopup"))
|
assertTrue(fragment.contains("showSortPopup"))
|
||||||
assertTrue(fragment.contains("viewModel.changeSort(sort)"))
|
assertTrue(fragment.contains("viewModel.changeSort(sort)"))
|
||||||
@@ -234,9 +234,9 @@ class CreatorChannelLiveFragmentLayoutTest {
|
|||||||
assertFalse(fragment.contains("addOnScrollListener(object : RecyclerView.OnScrollListener()"))
|
assertFalse(fragment.contains("addOnScrollListener(object : RecyclerView.OnScrollListener()"))
|
||||||
assertTrue(adapter.contains("R.drawable.ic_new_shield_small"))
|
assertTrue(adapter.contains("R.drawable.ic_new_shield_small"))
|
||||||
assertTrue(adapter.contains("R.drawable.ic_new_player_play"))
|
assertTrue(adapter.contains("R.drawable.ic_new_player_play"))
|
||||||
assertTrue(adapter.contains("ivCreatorChannelLiveReplayPlay.isVisible = true"))
|
assertTrue(adapter.contains("ivCreatorChannelAudioContentPlay.isVisible = true"))
|
||||||
assertTrue(adapter.contains("layoutCreatorChannelLiveReplayActionText.isVisible = false"))
|
assertTrue(adapter.contains("layoutCreatorChannelAudioContentActionText.isVisible = false"))
|
||||||
assertTrue(adapter.contains("layoutCreatorChannelLiveReplayActionText.isVisible = true"))
|
assertTrue(adapter.contains("layoutCreatorChannelAudioContentActionText.isVisible = true"))
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -282,7 +282,7 @@ class CreatorChannelLiveFragmentLayoutTest {
|
|||||||
@Test
|
@Test
|
||||||
fun `라이브 sort popup source는 outside dismiss와 화면 밖 보정 및 같은 정렬 dismiss를 포함한다`() {
|
fun `라이브 sort popup source는 outside dismiss와 화면 밖 보정 및 같은 정렬 dismiss를 포함한다`() {
|
||||||
val popup = projectFile(
|
val popup = projectFile(
|
||||||
"app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/live/ui/CreatorChannelLiveSortPopup.kt"
|
"app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/ui/CreatorChannelSortPopup.kt"
|
||||||
).readText()
|
).readText()
|
||||||
|
|
||||||
assertTrue(popup.contains("PopupWindow"))
|
assertTrue(popup.contains("PopupWindow"))
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import kr.co.vividnext.sodalive.R
|
|||||||
import kr.co.vividnext.sodalive.v2.common.data.ContentSort
|
import kr.co.vividnext.sodalive.v2.common.data.ContentSort
|
||||||
import kr.co.vividnext.sodalive.v2.creator.channel.data.CreatorChannelAudioContentResponse
|
import kr.co.vividnext.sodalive.v2.creator.channel.data.CreatorChannelAudioContentResponse
|
||||||
import kr.co.vividnext.sodalive.v2.creator.channel.live.model.CreatorChannelLiveReplayStatus
|
import kr.co.vividnext.sodalive.v2.creator.channel.live.model.CreatorChannelLiveReplayStatus
|
||||||
import kr.co.vividnext.sodalive.v2.creator.channel.live.model.toLabelResId
|
|
||||||
import kr.co.vividnext.sodalive.v2.creator.channel.live.model.toReplayUiModel
|
import kr.co.vividnext.sodalive.v2.creator.channel.live.model.toReplayUiModel
|
||||||
|
import kr.co.vividnext.sodalive.v2.creator.channel.model.toLabelResId
|
||||||
import kr.co.vividnext.sodalive.v2.widget.AudioContentTag
|
import kr.co.vividnext.sodalive.v2.widget.AudioContentTag
|
||||||
import org.junit.Assert.assertEquals
|
import org.junit.Assert.assertEquals
|
||||||
import org.junit.Assert.assertFalse
|
import org.junit.Assert.assertFalse
|
||||||
|
|||||||
Reference in New Issue
Block a user