blob: aa7889a1ac95ec93a4be252d989f68753bae96e6 [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
19import static junit.framework.Assert.assertEquals;
20import static junit.framework.Assert.assertFalse;
21import static junit.framework.Assert.assertNotNull;
22import static junit.framework.Assert.assertNull;
23import static junit.framework.Assert.assertTrue;
24
25import static org.mockito.ArgumentMatchers.any;
Julia Reynoldsed1c9af2018-03-21 15:21:09 -040026import static org.mockito.ArgumentMatchers.eq;
27import static org.mockito.Mockito.doReturn;
28import static org.mockito.Mockito.mock;
29import static org.mockito.Mockito.spy;
Julia Reynoldsed1c9af2018-03-21 15:21:09 -040030
Julia Reynoldsed1c9af2018-03-21 15:21:09 -040031import android.support.test.filters.SmallTest;
32import android.support.test.runner.AndroidJUnit4;
Julia Reynoldsed1c9af2018-03-21 15:21:09 -040033import android.view.LayoutInflater;
34import android.view.View;
35
Julia Reynoldsed1c9af2018-03-21 15:21:09 -040036import com.android.systemui.R;
37import com.android.systemui.SysuiTestCase;
38
39import org.junit.Before;
Julia Reynoldsed1c9af2018-03-21 15:21:09 -040040import org.junit.Test;
Julia Reynoldsed1c9af2018-03-21 15:21:09 -040041import org.junit.runner.RunWith;
Julia Reynoldsed1c9af2018-03-21 15:21:09 -040042
43@SmallTest
44@RunWith(AndroidJUnit4.class)
45public class FooterViewTest extends SysuiTestCase {
46
47 FooterView mView;
48
49 @Before
50 public void setUp() {
51 mView = (FooterView) LayoutInflater.from(mContext).inflate(
52 R.layout.status_bar_notification_footer, null, false);
53 mView.setDuration(0);
54 }
55
56 @Test
57 public void testViewsNotNull() {
58 assertNotNull(mView.findContentView());
59 assertNotNull(mView.findSecondaryView());
60 }
61
62 @Test
63 public void setDismissOnClick() {
64 mView.setDismissButtonClickListener(mock(View.OnClickListener.class));
65 assertTrue(mView.findSecondaryView().hasOnClickListeners());
66 }
67
68 @Test
69 public void setManageOnClick() {
70 mView.setManageButtonClickListener(mock(View.OnClickListener.class));
71 assertTrue(mView.findViewById(R.id.manage_text).hasOnClickListeners());
72 }
73
74 @Test
75 public void testPerformVisibilityAnimation() {
Selim Cinekd60ef9e2018-05-16 16:01:05 -070076 mView.setVisible(false /* visible */, false /* animate */);
Julia Reynoldsed1c9af2018-03-21 15:21:09 -040077 assertFalse(mView.isVisible());
78
Selim Cinekd60ef9e2018-05-16 16:01:05 -070079 mView.setVisible(true /* visible */, true /* animate */);
Julia Reynoldsed1c9af2018-03-21 15:21:09 -040080 }
81
82 @Test
83 public void testPerformSecondaryVisibilityAnimation() {
Selim Cinekd60ef9e2018-05-16 16:01:05 -070084 mView.setSecondaryVisible(false /* visible */, false /* animate */);
Julia Reynoldsed1c9af2018-03-21 15:21:09 -040085 assertFalse(mView.isSecondaryVisible());
86
Selim Cinekd60ef9e2018-05-16 16:01:05 -070087 mView.setSecondaryVisible(true /* visible */, true /* animate */);
Julia Reynoldsed1c9af2018-03-21 15:21:09 -040088 }
89}
90