1 /*
2  * Copyright (C) 2019 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 android.theme.app;
18 
19 import android.os.Build;
20 import android.theme.app.modifiers.ProgressBarModifier;
21 import android.theme.app.modifiers.SearchViewModifier;
22 import android.theme.app.modifiers.TimePickerModifier;
23 import android.theme.app.modifiers.ViewCheckedModifier;
24 
25 /**
26  * Constants defining the themes and layouts to be verified.
27  */
28 public class TestConfiguration {
29     static final ThemeInfo[] THEMES = {
30             // Material
31             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material,
32                     Build.VERSION_CODES.LOLLIPOP, "material"),
33             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Dialog,
34                     Build.VERSION_CODES.LOLLIPOP, "material_dialog"),
35             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Dialog_Alert,
36                     Build.VERSION_CODES.LOLLIPOP, "material_dialog_alert"),
37             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Dialog_MinWidth,
38                     Build.VERSION_CODES.LOLLIPOP, "material_dialog_minwidth"),
39             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Dialog_NoActionBar,
40                     Build.VERSION_CODES.LOLLIPOP, "material_dialog_noactionbar"),
41             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Dialog_NoActionBar_MinWidth,
42                     Build.VERSION_CODES.LOLLIPOP, "material_dialog_noactionbar_minwidth"),
43             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Dialog_Presentation,
44                     Build.VERSION_CODES.LOLLIPOP, "material_dialog_presentation"),
45             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_DialogWhenLarge,
46                     Build.VERSION_CODES.LOLLIPOP, "material_dialogwhenlarge"),
47             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_DialogWhenLarge_NoActionBar,
48                     Build.VERSION_CODES.LOLLIPOP, "material_dialogwhenlarge_noactionbar"),
49             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_InputMethod,
50                     Build.VERSION_CODES.LOLLIPOP, "material_inputmethod"),
51             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_NoActionBar,
52                     Build.VERSION_CODES.LOLLIPOP, "material_noactionbar"),
53             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_NoActionBar_Fullscreen,
54                     Build.VERSION_CODES.LOLLIPOP, "material_noactionbar_fullscreen"),
55             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_NoActionBar_Overscan,
56                     Build.VERSION_CODES.LOLLIPOP, "material_noactionbar_overscan"),
57             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_NoActionBar_TranslucentDecor,
58                     Build.VERSION_CODES.LOLLIPOP, "material_noactionbar_translucentdecor"),
59             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Panel,
60                     Build.VERSION_CODES.LOLLIPOP, "material_panel"),
61             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Settings,
62                     Build.VERSION_CODES.LOLLIPOP, "material_settings"),
63             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Voice,
64                     Build.VERSION_CODES.LOLLIPOP, "material_voice"),
65             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Wallpaper,
66                     Build.VERSION_CODES.LOLLIPOP, "material_wallpaper"),
67             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Wallpaper_NoTitleBar,
68                     Build.VERSION_CODES.LOLLIPOP, "material_wallpaper_notitlebar"),
69 
70             // Material Light
71             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Light,
72                     Build.VERSION_CODES.LOLLIPOP, "material_light"),
73             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Light_DarkActionBar,
74                     Build.VERSION_CODES.LOLLIPOP, "material_light_darkactionbar"),
75             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Light_Dialog,
76                     Build.VERSION_CODES.LOLLIPOP, "material_light_dialog"),
77             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Light_Dialog_Alert,
78                     Build.VERSION_CODES.LOLLIPOP, "material_light_dialog_alert"),
79             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Light_Dialog_MinWidth,
80                     Build.VERSION_CODES.LOLLIPOP, "material_light_dialog_minwidth"),
81             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Light_Dialog_NoActionBar,
82                     Build.VERSION_CODES.LOLLIPOP, "material_light_dialog_noactionbar"),
83             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Light_Dialog_NoActionBar_MinWidth,
84                     Build.VERSION_CODES.LOLLIPOP, "material_light_dialog_noactionbar_minwidth"),
85             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Light_Dialog_Presentation,
86                     Build.VERSION_CODES.LOLLIPOP, "material_light_dialog_presentation"),
87             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Light_DialogWhenLarge,
88                     Build.VERSION_CODES.LOLLIPOP, "material_light_dialogwhenlarge"),
89             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Light_DialogWhenLarge_NoActionBar,
90                     Build.VERSION_CODES.LOLLIPOP, "material_light_dialogwhenlarge_noactionbar"),
91             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Light_LightStatusBar,
92                     Build.VERSION_CODES.M, "material_light_lightstatusbar"),
93             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Light_NoActionBar,
94                     Build.VERSION_CODES.LOLLIPOP, "material_light_noactionbar"),
95             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Light_NoActionBar_Fullscreen,
96                     Build.VERSION_CODES.LOLLIPOP, "material_light_noactionbar_fullscreen"),
97             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Light_NoActionBar_Overscan,
98                     Build.VERSION_CODES.LOLLIPOP, "material_light_noactionbar_overscan"),
99             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Light_NoActionBar_TranslucentDecor,
100                     Build.VERSION_CODES.LOLLIPOP, "material_light_noactionbar_translucentdecor"),
101             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Light_Panel,
102                     Build.VERSION_CODES.LOLLIPOP, "material_light_panel"),
103             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Light_Voice,
104                     Build.VERSION_CODES.LOLLIPOP, "material_light_voice")
105     };
106 
107     static final LayoutInfo[] LAYOUTS = {
108             //new LayoutInfo(R.layout.button, "button"),
109             // Temporarily remove tests for pressed Button widget. The Material ripple is in
110             // flux, so this is going to be failing frequently on Material until it stablizes.
111             //new LayoutInfo(R.layout.button, "button_pressed",
112             //        new ViewPressedModifier()),
113             new LayoutInfo(R.layout.checkbox, "checkbox"),
114             new LayoutInfo(R.layout.checkbox, "checkbox_checked",
115                     new ViewCheckedModifier()),
116             new LayoutInfo(R.layout.chronometer, "chronometer"),
117             new LayoutInfo(R.layout.color_blue_bright, "color_blue_bright"),
118             new LayoutInfo(R.layout.color_blue_dark, "color_blue_dark"),
119             new LayoutInfo(R.layout.color_blue_light, "color_blue_light"),
120             new LayoutInfo(R.layout.color_green_dark, "color_green_dark"),
121             new LayoutInfo(R.layout.color_green_light, "color_green_light"),
122             new LayoutInfo(R.layout.color_orange_dark, "color_orange_dark"),
123             new LayoutInfo(R.layout.color_orange_light, "color_orange_light"),
124             new LayoutInfo(R.layout.color_purple, "color_purple"),
125             new LayoutInfo(R.layout.color_red_dark, "color_red_dark"),
126             new LayoutInfo(R.layout.color_red_light, "color_red_light"),
127             // Temporarily remove tests for the DatePicker widget. Something changed with font
128             // rendering behavior (likely ag/12562227 which upgraded Roboto to variable format)
129             // but we don't have resources available right now to update the golden images.
130             //new LayoutInfo(R.layout.datepicker, "datepicker",
131             //        new DatePickerModifier()),
132             new LayoutInfo(R.layout.edittext, "edittext"),
133             new LayoutInfo(R.layout.progressbar_horizontal_0, "progressbar_horizontal_0"),
134             new LayoutInfo(R.layout.progressbar_horizontal_100, "progressbar_horizontal_100"),
135             new LayoutInfo(R.layout.progressbar_horizontal_50, "progressbar_horizontal_50"),
136             new LayoutInfo(R.layout.progressbar_large, "progressbar_large",
137                     new ProgressBarModifier()),
138             new LayoutInfo(R.layout.progressbar_small, "progressbar_small",
139                     new ProgressBarModifier()),
140             new LayoutInfo(R.layout.progressbar, "progressbar",
141                     new ProgressBarModifier()),
142             new LayoutInfo(R.layout.radiobutton_checked, "radiobutton_checked"),
143             new LayoutInfo(R.layout.radiobutton, "radiobutton"),
144             new LayoutInfo(R.layout.radiogroup_horizontal, "radiogroup_horizontal"),
145             new LayoutInfo(R.layout.radiogroup_vertical, "radiogroup_vertical"),
146             // Temporarily remove tests for the RatingBar widget. It has indeterminate rendering
147             // behavior on 360dpi devices, but we don't know why yet.
148             //new LayoutInfo(R.layout.ratingbar_0, "ratingbar_0"),
149             //new LayoutInfo(R.layout.ratingbar_2point5, "ratingbar_2point5"),
150             //new LayoutInfo(R.layout.ratingbar_5, "ratingbar_5"),
151             //new LayoutInfo(R.layout.ratingbar_0, "ratingbar_0_pressed",
152             //        new ViewPressedModifier()),
153             //new LayoutInfo(R.layout.ratingbar_2point5, "ratingbar_2point5_pressed",
154             //        new ViewPressedModifier()),
155             //new LayoutInfo(R.layout.ratingbar_5, "ratingbar_5_pressed",
156             //        new ViewPressedModifier()),
157             // Temporarily remove tests for the SearchView widget with no hint. The "X" icon has
158             // indeterminate rendering behavior on 480dpi devices, but we don't know why yet.
159             //new LayoutInfo(R.layout.searchview, "searchview_query",
160             //        new SearchViewModifier(SearchViewModifier.QUERY)),
161             new LayoutInfo(R.layout.searchview, "searchview_query_hint",
162                     new SearchViewModifier(SearchViewModifier.QUERY_HINT)),
163             new LayoutInfo(R.layout.seekbar_0, "seekbar_0"),
164             new LayoutInfo(R.layout.seekbar_100, "seekbar_100"),
165             new LayoutInfo(R.layout.seekbar_50, "seekbar_50"),
166             new LayoutInfo(R.layout.spinner, "spinner"),
167             new LayoutInfo(R.layout.switch_button_checked, "switch_button_checked"),
168             new LayoutInfo(R.layout.switch_button, "switch_button"),
169             new LayoutInfo(R.layout.textview, "textview"),
170             new LayoutInfo(R.layout.timepicker, "timepicker",
171                     new TimePickerModifier()),
172             new LayoutInfo(R.layout.togglebutton_checked, "togglebutton_checked"),
173             new LayoutInfo(R.layout.togglebutton, "togglebutton"),
174     };
175 }
176