blob: 54631590027596686a51914522130c533442a7d5 [file] [log] [blame]
Adrian Roos7c68e292017-04-04 17:22:03 -07001/*
2 * Copyright (C) 2017 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
Lucas Dupin6cfa5cd2019-02-14 17:33:19 -080017package com.android.systemui.statusbar.notification.row.wrapper;
18
19import static org.mockito.Mockito.mock;
Adrian Roos7c68e292017-04-04 17:22:03 -070020
21import android.content.Context;
Jason Monk6dceace2018-05-15 20:24:07 -040022import android.testing.AndroidTestingRunner;
Jason Monka716bac2018-12-05 15:48:21 -050023import android.testing.TestableLooper;
Jason Monk6dceace2018-05-15 20:24:07 -040024import android.testing.TestableLooper.RunWithLooper;
Adrian Roos7c68e292017-04-04 17:22:03 -070025import android.view.View;
Lucas Dupin6cfa5cd2019-02-14 17:33:19 -080026import android.widget.LinearLayout;
27import android.widget.TextView;
Adrian Roos7c68e292017-04-04 17:22:03 -070028
Brett Chabot84151d92019-02-27 15:37:59 -080029import androidx.test.filters.SmallTest;
30
Jason Monk25a52b62017-05-23 10:42:59 -040031import com.android.systemui.SysuiTestCase;
Selim Cinek131f1a42017-06-05 17:50:19 -070032import com.android.systemui.statusbar.NotificationTestHelper;
Jason Monka716bac2018-12-05 15:48:21 -050033import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
Jason Monka716bac2018-12-05 15:48:21 -050034import com.android.systemui.util.Assert;
Adrian Roos7c68e292017-04-04 17:22:03 -070035
Lucas Dupin6cfa5cd2019-02-14 17:33:19 -080036import org.junit.Before;
Adrian Roos7c68e292017-04-04 17:22:03 -070037import org.junit.Test;
38import org.junit.runner.RunWith;
39
Jason Monk6dceace2018-05-15 20:24:07 -040040@RunWith(AndroidTestingRunner.class)
Jason Monk25a52b62017-05-23 10:42:59 -040041@SmallTest
Jason Monka716bac2018-12-05 15:48:21 -050042@RunWithLooper
Jason Monk25a52b62017-05-23 10:42:59 -040043public class NotificationViewWrapperTest extends SysuiTestCase {
Adrian Roos7c68e292017-04-04 17:22:03 -070044
Lucas Dupin6cfa5cd2019-02-14 17:33:19 -080045 private View mView;
46 private ExpandableNotificationRow mRow;
47 private TestableNotificationViewWrapper mNotificationViewWrapper;
48
49 @Before
50 public void setup() throws Exception {
Jason Monka716bac2018-12-05 15:48:21 -050051 Assert.sMainLooper = TestableLooper.get(this).getLooper();
Lucas Dupin6cfa5cd2019-02-14 17:33:19 -080052 mView = mock(View.class);
53 mRow = new NotificationTestHelper(getContext()).createRow();
54 mNotificationViewWrapper = new TestableNotificationViewWrapper(mContext, mView, mRow);
55 }
56
57 @Test
58 public void childrenNeedInversion_doesntCrash_whenOpacity() {
59 LinearLayout viewGroup = new LinearLayout(mContext);
60 TextView textView = new TextView(mContext);
61 textView.setTextColor(0xcc000000);
62 viewGroup.addView(textView);
63
64 mNotificationViewWrapper.childrenNeedInversion(0xcc000000, viewGroup);
Adrian Roos7c68e292017-04-04 17:22:03 -070065 }
66
67 static class TestableNotificationViewWrapper extends NotificationViewWrapper {
68 protected TestableNotificationViewWrapper(Context ctx, View view,
69 ExpandableNotificationRow row) {
70 super(ctx, view, row);
71 }
72 }
Jason Monka716bac2018-12-05 15:48:21 -050073}