feat(creator): 시리즈 탭 pager 연결을 추가한다
This commit is contained in:
@@ -6,6 +6,7 @@ import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.audio.CreatorChannelAudioFragment
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.live.CreatorChannelLiveFragment
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.model.CreatorChannelTab
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.series.CreatorChannelSeriesFragment
|
||||
|
||||
class CreatorChannelPagerAdapter(
|
||||
activity: FragmentActivity,
|
||||
@@ -21,6 +22,7 @@ class CreatorChannelPagerAdapter(
|
||||
CreatorChannelTab.Home -> CreatorChannelHomeFragment.newInstance(creatorId)
|
||||
CreatorChannelTab.Live -> CreatorChannelLiveFragment.newInstance(creatorId)
|
||||
CreatorChannelTab.Audio -> CreatorChannelAudioFragment.newInstance(creatorId)
|
||||
CreatorChannelTab.Series -> CreatorChannelSeriesFragment.newInstance(creatorId)
|
||||
else -> CreatorChannelPlaceholderFragment.newInstance(tab)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import androidx.fragment.app.FragmentActivity
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.audio.CreatorChannelAudioFragment
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.live.CreatorChannelLiveFragment
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.model.CreatorChannelTab
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.series.CreatorChannelSeriesFragment
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
@@ -18,15 +19,21 @@ import org.robolectric.annotation.Config
|
||||
class CreatorChannelPagerAdapterTest {
|
||||
|
||||
@Test
|
||||
fun `createFragment는 Home Live Audio를 실제 Fragment로 생성하고 나머지는 placeholder를 유지한다`() {
|
||||
fun `createFragment는 Home Live Audio Series를 실제 Fragment로 생성하고 나머지는 placeholder를 유지한다`() {
|
||||
val activity = Robolectric.buildActivity(FragmentActivity::class.java).setup().get()
|
||||
val adapter = CreatorChannelPagerAdapter(activity, creatorId = 123L)
|
||||
|
||||
assertTrue(adapter.createFragment(CreatorChannelTab.Home.ordinal) is CreatorChannelHomeFragment)
|
||||
assertTrue(adapter.createFragment(CreatorChannelTab.Live.ordinal) is CreatorChannelLiveFragment)
|
||||
assertTrue(adapter.createFragment(CreatorChannelTab.Audio.ordinal) is CreatorChannelAudioFragment)
|
||||
assertTrue(adapter.createFragment(CreatorChannelTab.Series.ordinal) is CreatorChannelSeriesFragment)
|
||||
CreatorChannelTab.entries
|
||||
.filterNot { it == CreatorChannelTab.Home || it == CreatorChannelTab.Live || it == CreatorChannelTab.Audio }
|
||||
.filterNot {
|
||||
it == CreatorChannelTab.Home ||
|
||||
it == CreatorChannelTab.Live ||
|
||||
it == CreatorChannelTab.Audio ||
|
||||
it == CreatorChannelTab.Series
|
||||
}
|
||||
.forEach { tab ->
|
||||
assertTrue(adapter.createFragment(tab.ordinal) is CreatorChannelPlaceholderFragment)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user