blob: ab3a3e126b3409e727699164c6dfc03741590eff [file] [log] [blame]
Lucas Dupin1fc01dc2018-09-24 16:43:06 -07001/*
2 * Copyright (C) 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License
15 */
16
17package com.android.keyguard
18
19import android.support.test.filters.SmallTest
20import android.testing.AndroidTestingRunner
21import android.testing.TestableLooper
22import android.view.LayoutInflater
23
24import com.android.systemui.SysuiTestCase
25import com.google.common.truth.Truth.assertThat
26
27import org.junit.Before
28import org.junit.Test
29import org.junit.runner.RunWith
30
31@SmallTest
32@RunWith(AndroidTestingRunner::class)
33@TestableLooper.RunWithLooper
34class KeyguardPatternViewTest : SysuiTestCase() {
35
36 private lateinit var mKeyguardPatternView: KeyguardPatternView
37 private lateinit var mSecurityMessage: KeyguardMessageArea
38
39 @Before
40 fun setup() {
41 val inflater = LayoutInflater.from(context)
42 mKeyguardPatternView = inflater.inflate(R.layout.keyguard_pattern_view, null)
43 as KeyguardPatternView
44 mSecurityMessage = KeyguardMessageArea.findSecurityMessageDisplay(mKeyguardPatternView)
45 as KeyguardMessageArea
46 }
47
48 @Test
Lucas Dupinc6b50c62018-10-09 20:00:35 -070049 fun onPause_clearsTextField() {
Lucas Dupin1fc01dc2018-09-24 16:43:06 -070050 mSecurityMessage.setMessage("an old message")
Lucas Dupinc6b50c62018-10-09 20:00:35 -070051 mKeyguardPatternView.onPause()
Lucas Dupin1fc01dc2018-09-24 16:43:06 -070052 assertThat(mSecurityMessage.text).isEqualTo("")
53 }
54}