Lucas Dupin | cea7dee | 2018-10-16 12:43:37 -0700 | [diff] [blame] | 1 | package com.android.systemui.statusbar.phone |
| 2 | |
Brett Chabot | 84151d9 | 2019-02-27 15:37:59 -0800 | [diff] [blame] | 3 | import androidx.test.filters.SmallTest |
Lucas Dupin | cea7dee | 2018-10-16 12:43:37 -0700 | [diff] [blame] | 4 | import android.testing.AndroidTestingRunner |
| 5 | import android.testing.TestableLooper |
| 6 | import android.view.LayoutInflater |
| 7 | |
| 8 | import com.android.systemui.R |
| 9 | import com.android.systemui.SysuiTestCase |
| 10 | import com.android.systemui.statusbar.KeyguardIndicationController |
| 11 | |
| 12 | import org.junit.Before |
| 13 | import org.junit.Test |
| 14 | import org.junit.runner.RunWith |
| 15 | import org.mockito.Mock |
| 16 | import org.mockito.MockitoAnnotations |
| 17 | |
| 18 | @SmallTest |
| 19 | @RunWith(AndroidTestingRunner::class) |
| 20 | @TestableLooper.RunWithLooper |
| 21 | class KeyguardBottomAreaTest : SysuiTestCase() { |
| 22 | |
| 23 | @Mock |
| 24 | private lateinit var mStatusBar: StatusBar |
| 25 | @Mock |
| 26 | private lateinit var mKeyguardIndicationController: KeyguardIndicationController |
| 27 | private lateinit var mKeyguardBottomArea: KeyguardBottomAreaView |
| 28 | |
| 29 | @Before |
| 30 | fun setup() { |
| 31 | MockitoAnnotations.initMocks(this) |
| 32 | mKeyguardBottomArea = LayoutInflater.from(mContext).inflate( |
| 33 | R.layout.keyguard_bottom_area, null, false) as KeyguardBottomAreaView |
| 34 | mKeyguardBottomArea.setStatusBar(mStatusBar) |
| 35 | mKeyguardBottomArea.setKeyguardIndicationController(mKeyguardIndicationController) |
| 36 | } |
| 37 | |
| 38 | @Test |
| 39 | fun initFrom_doesntCrash() { |
| 40 | val other = LayoutInflater.from(mContext).inflate( |
| 41 | R.layout.keyguard_bottom_area, null, false) as KeyguardBottomAreaView |
| 42 | |
| 43 | other.initFrom(mKeyguardBottomArea) |
| 44 | other.launchVoiceAssist() |
| 45 | other.onLongClick(null) |
| 46 | } |
| 47 | } |