Julia Reynolds | ed1c9af | 2018-03-21 15:21:09 -0400 | [diff] [blame] | 1 | /* |
| 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 Shah | 20790b8 | 2018-07-02 17:21:04 -0700 | [diff] [blame] | 17 | package com.android.systemui.statusbar.notification.row; |
Julia Reynolds | ed1c9af | 2018-03-21 15:21:09 -0400 | [diff] [blame] | 18 | |
| 19 | import static junit.framework.Assert.assertEquals; |
| 20 | import static junit.framework.Assert.assertFalse; |
| 21 | import static junit.framework.Assert.assertNotNull; |
| 22 | import static junit.framework.Assert.assertNull; |
| 23 | import static junit.framework.Assert.assertTrue; |
| 24 | |
| 25 | import static org.mockito.ArgumentMatchers.any; |
Julia Reynolds | ed1c9af | 2018-03-21 15:21:09 -0400 | [diff] [blame] | 26 | import static org.mockito.ArgumentMatchers.eq; |
| 27 | import static org.mockito.Mockito.doReturn; |
| 28 | import static org.mockito.Mockito.mock; |
| 29 | import static org.mockito.Mockito.spy; |
Julia Reynolds | ed1c9af | 2018-03-21 15:21:09 -0400 | [diff] [blame] | 30 | |
Julia Reynolds | ed1c9af | 2018-03-21 15:21:09 -0400 | [diff] [blame] | 31 | import android.support.test.filters.SmallTest; |
| 32 | import android.support.test.runner.AndroidJUnit4; |
Julia Reynolds | ed1c9af | 2018-03-21 15:21:09 -0400 | [diff] [blame] | 33 | import android.view.LayoutInflater; |
| 34 | import android.view.View; |
| 35 | |
Julia Reynolds | ed1c9af | 2018-03-21 15:21:09 -0400 | [diff] [blame] | 36 | import com.android.systemui.R; |
| 37 | import com.android.systemui.SysuiTestCase; |
| 38 | |
| 39 | import org.junit.Before; |
Julia Reynolds | ed1c9af | 2018-03-21 15:21:09 -0400 | [diff] [blame] | 40 | import org.junit.Test; |
Julia Reynolds | ed1c9af | 2018-03-21 15:21:09 -0400 | [diff] [blame] | 41 | import org.junit.runner.RunWith; |
Julia Reynolds | ed1c9af | 2018-03-21 15:21:09 -0400 | [diff] [blame] | 42 | |
| 43 | @SmallTest |
| 44 | @RunWith(AndroidJUnit4.class) |
| 45 | public 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 Cinek | d60ef9e | 2018-05-16 16:01:05 -0700 | [diff] [blame] | 76 | mView.setVisible(false /* visible */, false /* animate */); |
Julia Reynolds | ed1c9af | 2018-03-21 15:21:09 -0400 | [diff] [blame] | 77 | assertFalse(mView.isVisible()); |
| 78 | |
Selim Cinek | d60ef9e | 2018-05-16 16:01:05 -0700 | [diff] [blame] | 79 | mView.setVisible(true /* visible */, true /* animate */); |
Julia Reynolds | ed1c9af | 2018-03-21 15:21:09 -0400 | [diff] [blame] | 80 | } |
| 81 | |
| 82 | @Test |
| 83 | public void testPerformSecondaryVisibilityAnimation() { |
Selim Cinek | d60ef9e | 2018-05-16 16:01:05 -0700 | [diff] [blame] | 84 | mView.setSecondaryVisible(false /* visible */, false /* animate */); |
Julia Reynolds | ed1c9af | 2018-03-21 15:21:09 -0400 | [diff] [blame] | 85 | assertFalse(mView.isSecondaryVisible()); |
| 86 | |
Selim Cinek | d60ef9e | 2018-05-16 16:01:05 -0700 | [diff] [blame] | 87 | mView.setSecondaryVisible(true /* visible */, true /* animate */); |
Julia Reynolds | ed1c9af | 2018-03-21 15:21:09 -0400 | [diff] [blame] | 88 | } |
| 89 | } |
| 90 | |