blob: 2336958482986a74badab77be9de16d6ecc149cc [file] [log] [blame]
Julia Reynoldsed1c9af2018-03-21 15:21:09 -04001/*
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
Rohan Shah20790b82018-07-02 17:21:04 -070017package com.android.systemui.statusbar.notification.row;
Julia Reynoldsed1c9af2018-03-21 15:21:09 -040018
Julia Reynoldsed1c9af2018-03-21 15:21:09 -040019import static junit.framework.Assert.assertFalse;
20import static junit.framework.Assert.assertNotNull;
Julia Reynoldsed1c9af2018-03-21 15:21:09 -040021import static junit.framework.Assert.assertTrue;
22
Julia Reynoldsed1c9af2018-03-21 15:21:09 -040023import static org.mockito.Mockito.mock;
Julia Reynoldsed1c9af2018-03-21 15:21:09 -040024
Julia Reynoldsed1c9af2018-03-21 15:21:09 -040025import android.view.LayoutInflater;
26import android.view.View;
27
Brett Chabot84151d92019-02-27 15:37:59 -080028import androidx.test.filters.SmallTest;
29import androidx.test.runner.AndroidJUnit4;
30
Julia Reynoldsed1c9af2018-03-21 15:21:09 -040031import com.android.systemui.R;
32import com.android.systemui.SysuiTestCase;
33
34import org.junit.Before;
Julia Reynoldsed1c9af2018-03-21 15:21:09 -040035import org.junit.Test;
Julia Reynoldsed1c9af2018-03-21 15:21:09 -040036import org.junit.runner.RunWith;
Julia Reynoldsed1c9af2018-03-21 15:21:09 -040037
38@SmallTest
39@RunWith(AndroidJUnit4.class)
40public class FooterViewTest extends SysuiTestCase {
41
42 FooterView mView;
43
44 @Before
45 public void setUp() {
46 mView = (FooterView) LayoutInflater.from(mContext).inflate(
47 R.layout.status_bar_notification_footer, null, false);
48 mView.setDuration(0);
49 }
50
51 @Test
52 public void testViewsNotNull() {
53 assertNotNull(mView.findContentView());
54 assertNotNull(mView.findSecondaryView());
55 }
56
57 @Test
58 public void setDismissOnClick() {
59 mView.setDismissButtonClickListener(mock(View.OnClickListener.class));
60 assertTrue(mView.findSecondaryView().hasOnClickListeners());
61 }
62
63 @Test
64 public void setManageOnClick() {
65 mView.setManageButtonClickListener(mock(View.OnClickListener.class));
66 assertTrue(mView.findViewById(R.id.manage_text).hasOnClickListeners());
67 }
68
69 @Test
70 public void testPerformVisibilityAnimation() {
Selim Cinekd60ef9e2018-05-16 16:01:05 -070071 mView.setVisible(false /* visible */, false /* animate */);
Julia Reynoldsed1c9af2018-03-21 15:21:09 -040072 assertFalse(mView.isVisible());
73
Selim Cinekd60ef9e2018-05-16 16:01:05 -070074 mView.setVisible(true /* visible */, true /* animate */);
Julia Reynoldsed1c9af2018-03-21 15:21:09 -040075 }
76
77 @Test
78 public void testPerformSecondaryVisibilityAnimation() {
Selim Cinekd60ef9e2018-05-16 16:01:05 -070079 mView.setSecondaryVisible(false /* visible */, false /* animate */);
Julia Reynoldsed1c9af2018-03-21 15:21:09 -040080 assertFalse(mView.isSecondaryVisible());
81
Selim Cinekd60ef9e2018-05-16 16:01:05 -070082 mView.setSecondaryVisible(true /* visible */, true /* animate */);
Julia Reynoldsed1c9af2018-03-21 15:21:09 -040083 }
84}
85