blob: c827ac7ab96359fbfef255d176d44c8a56557fa3 [file] [log] [blame]
Bill Lin35b1c202019-12-06 13:25:25 +08001/*
2 * Copyright (C) 2019 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.systemui.glwallpaper;
18
19import static com.google.common.truth.Truth.assertThat;
20
21import android.testing.AndroidTestingRunner;
22import android.testing.TestableLooper;
23
24import androidx.test.filters.SmallTest;
25
26import com.android.systemui.SysuiTestCase;
27
28import org.junit.Before;
29import org.junit.Test;
30import org.junit.runner.RunWith;
31
32@SmallTest
33@RunWith(AndroidTestingRunner.class)
34@TestableLooper.RunWithLooper
35public class ImageRevealHelperTest extends SysuiTestCase {
36
37 static final int ANIMATION_DURATION = 500;
38 ImageRevealHelper mImageRevealHelper;
39 ImageRevealHelper.RevealStateListener mRevealStateListener;
40
41 @Before
42 public void setUp() throws Exception {
43 mRevealStateListener = new ImageRevealHelper.RevealStateListener() {
44 @Override
45 public void onRevealStateChanged() {
46 // no-op
47 }
48
49 @Override
50 public void onRevealStart(boolean animate) {
51 // no-op
52 }
53
54 @Override
55 public void onRevealEnd() {
56 // no-op
57 }
58 };
59 mImageRevealHelper = new ImageRevealHelper(mRevealStateListener);
60 }
61
62 @Test
63 public void testBiometricAuthUnlockAnimateImageRevealState_shouldNotBlackoutScreen() {
64 assertThat(mImageRevealHelper.getReveal()).isEqualTo(0f);
65
66 mImageRevealHelper.updateAwake(true /* awake */, ANIMATION_DURATION);
67 assertThat(mImageRevealHelper.getReveal()).isEqualTo(0f);
68
69 // When device unlock through Biometric, should not show reveal transition
70 mImageRevealHelper.updateAwake(false /* awake */, 0);
71 assertThat(mImageRevealHelper.getReveal()).isEqualTo(1f);
72 }
73}