feat(auth): 콘텐츠 보기 설정 시트를 추가한다
This commit is contained in:
+48
@@ -0,0 +1,48 @@
|
||||
package kr.co.vividnext.sodalive.v2.auth
|
||||
|
||||
import android.app.Application
|
||||
import android.os.Looper
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.settings.ContentType
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.Robolectric
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.Shadows.shadowOf
|
||||
import org.robolectric.annotation.Config
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [28], application = Application::class)
|
||||
class ContentPreferenceBottomSheetTest {
|
||||
@Test
|
||||
fun `선택이 잠긴 GET 재시도도 완료 터치로 닫힌 뒤 확인을 한 번 전달한다`() {
|
||||
val controller = Robolectric.buildActivity(AppCompatActivity::class.java)
|
||||
controller.get().setTheme(R.style.Theme_SodaLive)
|
||||
controller.setup()
|
||||
var confirmations = 0
|
||||
lateinit var sheet: ContentPreferenceBottomSheet
|
||||
sheet = ContentPreferenceBottomSheet(controller.get(), {}, {}, {
|
||||
assertFalse(sheet.isShowing)
|
||||
confirmations += 1
|
||||
})
|
||||
sheet.render(true, ContentType.FEMALE, selectionEnabled = false)
|
||||
sheet.show()
|
||||
val confirm = sheet.findViewById<View>(R.id.btn_confirm)!!
|
||||
repeat(2) {
|
||||
listOf(MotionEvent.ACTION_DOWN, MotionEvent.ACTION_UP).forEach { action ->
|
||||
val event = MotionEvent.obtain(0, 10, action, 1f, 1f, 0)
|
||||
confirm.dispatchTouchEvent(event)
|
||||
event.recycle()
|
||||
}
|
||||
shadowOf(Looper.getMainLooper()).idle()
|
||||
}
|
||||
assertEquals(1, confirmations)
|
||||
sheet.dismiss()
|
||||
controller.pause().stop().destroy()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user