blob: 637b30c6bc00f4e390fddb62d9bb40da13695ba6 [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 Monk25a52b62017-05-23 10:42:59 -040022import android.support.test.filters.SmallTest;
Jason Monk6dceace2018-05-15 20:24:07 -040023import android.testing.AndroidTestingRunner;
Jason Monka716bac2018-12-05 15:48:21 -050024import android.testing.TestableLooper;
Jason Monk6dceace2018-05-15 20:24:07 -040025import android.testing.TestableLooper.RunWithLooper;
Adrian Roos7c68e292017-04-04 17:22:03 -070026import android.view.View;
Lucas Dupin6cfa5cd2019-02-14 17:33:19 -080027import android.widget.LinearLayout;
28import android.widget.TextView;
Adrian Roos7c68e292017-04-04 17:22:03 -070029
Jason Monk25a52b62017-05-23 10:42:59 -040030import com.android.systemui.SysuiTestCase;
Selim Cinek131f1a42017-06-05 17:50:19 -070031import com.android.systemui.statusbar.NotificationTestHelper;
Jason Monka716bac2018-12-05 15:48:21 -050032import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
Jason Monka716bac2018-12-05 15:48:21 -050033import com.android.systemui.util.Assert;
Adrian Roos7c68e292017-04-04 17:22:03 -070034
Lucas Dupin6cfa5cd2019-02-14 17:33:19 -080035import org.junit.Before;
Adrian Roos7c68e292017-04-04 17:22:03 -070036import org.junit.Test;
37import org.junit.runner.RunWith;
38
Jason Monk6dceace2018-05-15 20:24:07 -040039@RunWith(AndroidTestingRunner.class)
Jason Monk25a52b62017-05-23 10:42:59 -040040@SmallTest
Jason Monka716bac2018-12-05 15:48:21 -050041@RunWithLooper
Jason Monk25a52b62017-05-23 10:42:59 -040042public class NotificationViewWrapperTest extends SysuiTestCase {
Adrian Roos7c68e292017-04-04 17:22:03 -070043
Lucas Dupin6cfa5cd2019-02-14 17:33:19 -080044 private View mView;
45 private ExpandableNotificationRow mRow;
46 private TestableNotificationViewWrapper mNotificationViewWrapper;
47
48 @Before
49 public void setup() throws Exception {
Jason Monka716bac2018-12-05 15:48:21 -050050 Assert.sMainLooper = TestableLooper.get(this).getLooper();
Lucas Dupin6cfa5cd2019-02-14 17:33:19 -080051 mView = mock(View.class);
52 mRow = new NotificationTestHelper(getContext()).createRow();
53 mNotificationViewWrapper = new TestableNotificationViewWrapper(mContext, mView, mRow);
54 }
55
56 @Test
57 public void childrenNeedInversion_doesntCrash_whenOpacity() {
58 LinearLayout viewGroup = new LinearLayout(mContext);
59 TextView textView = new TextView(mContext);
60 textView.setTextColor(0xcc000000);
61 viewGroup.addView(textView);
62
63 mNotificationViewWrapper.childrenNeedInversion(0xcc000000, viewGroup);
Adrian Roos7c68e292017-04-04 17:22:03 -070064 }
65
66 static class TestableNotificationViewWrapper extends NotificationViewWrapper {
67 protected TestableNotificationViewWrapper(Context ctx, View view,
68 ExpandableNotificationRow row) {
69 super(ctx, view, row);
70 }
71 }
Jason Monka716bac2018-12-05 15:48:21 -050072}