• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
17 package com.android.documentsui.ui;
18 
19 import android.content.res.Configuration;
20 import android.graphics.Color;
21 
22 import androidx.test.filters.SmallTest;
23 import androidx.test.runner.AndroidJUnit4;
24 
25 import com.android.documentsui.tests.R;
26 
27 import org.junit.Before;
28 import org.junit.Test;
29 import org.junit.runner.RunWith;
30 
31 /**
32  * This class test default Light Theme (Night Mode Disable)
33  * Verify ActionBar background, Window background, and GridItem background to meet Light style
34  */
35 @SmallTest
36 @RunWith(AndroidJUnit4.class)
37 public class ThemeUiTest extends ThemeUiTestBase {
38 
39     @Before
setUp()40     public void setUp() throws Exception {
41         super.setUp();
42         mTheme = getThemeByUiMode(mTargetContext, Configuration.UI_MODE_NIGHT_NO);
43     }
44 
45     @Test
themeNightModeDisable_actionBarColorShouldBeLight()46     public void themeNightModeDisable_actionBarColorShouldBeLight() {
47         assertTheme(R.styleable.ThemeColor, R.styleable.ThemeColor_android_colorBackground,
48                 Color.WHITE);
49     }
50 
51     @Test
themeNightModeDisable_windowLightNavigationBarShouldBeTrue()52     public void themeNightModeDisable_windowLightNavigationBarShouldBeTrue() {
53         assertTheme(R.styleable.SystemWindow,
54                 R.styleable.SystemWindow_android_windowLightNavigationBar, true);
55     }
56 
57     @Test
themeNightModeDisable_windowLightStatusBarShouldBeTrue()58     public void themeNightModeDisable_windowLightStatusBarShouldBeTrue() {
59         assertTheme(R.styleable.SystemWindow, R.styleable.SystemWindow_android_windowLightStatusBar,
60                 true);
61     }
62 
63     @Test
themeNightModeDisable_navigationBarColorShouldBeLight()64     public void themeNightModeDisable_navigationBarColorShouldBeLight() {
65         assertTheme(R.styleable.SystemWindow, R.styleable.SystemWindow_android_navigationBarColor,
66                 Color.WHITE);
67     }
68 
69     @Test
themeNightModeDisable_windowBackgroundColorShouldBeLight()70     public void themeNightModeDisable_windowBackgroundColorShouldBeLight() {
71         assertTheme(R.styleable.SystemWindow, R.styleable.SystemWindow_android_windowBackground,
72                 Color.WHITE);
73     }
74 
75     @Test
themeNightModeDisable_statusBarColorShouldBeLight()76     public void themeNightModeDisable_statusBarColorShouldBeLight() {
77         assertTheme(R.styleable.SystemWindow, R.styleable.SystemWindow_android_statusBarColor,
78                 Color.WHITE);
79     }
80 
81     @Test
appCompatThemeNightModeDisable_colorPrimaryShouldBeThemeable()82     public void appCompatThemeNightModeDisable_colorPrimaryShouldBeThemeable() {
83         assertTheme(R.styleable.ThemeColor, R.styleable.ThemeColor_android_colorPrimary,
84                 mTheme.getResources().getColor(com.android.documentsui.R.color.primary, mTheme));
85     }
86 }
87