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.DatePickerModifier;
21 import android.theme.app.modifiers.ProgressBarModifier;
22 import android.theme.app.modifiers.SearchViewModifier;
23 import android.theme.app.modifiers.ViewCheckedModifier;
24 import android.theme.app.modifiers.ViewPressedModifier;
25 import android.theme.app.modifiers.TimePickerModifier;
26 
27 /**
28  * Constants defining the themes and layouts to be verified.
29  */
30 public class TestConfiguration {
31     @SuppressWarnings("deprecation")
32     static final ThemeInfo[] THEMES = {
33             // Holo
34             new ThemeInfo(ThemeInfo.HOLO, android.R.style.Theme_Holo,
35                     Build.VERSION_CODES.HONEYCOMB, "holo"),
36             new ThemeInfo(ThemeInfo.HOLO, android.R.style.Theme_Holo_Dialog,
37                     Build.VERSION_CODES.HONEYCOMB, "holo_dialog"),
38             new ThemeInfo(ThemeInfo.HOLO, android.R.style.Theme_Holo_Dialog_MinWidth,
39                     Build.VERSION_CODES.HONEYCOMB, "holo_dialog_minwidth"),
40             new ThemeInfo(ThemeInfo.HOLO, android.R.style.Theme_Holo_Dialog_NoActionBar,
41                     Build.VERSION_CODES.HONEYCOMB, "holo_dialog_noactionbar"),
42             new ThemeInfo(ThemeInfo.HOLO, android.R.style.Theme_Holo_Dialog_NoActionBar_MinWidth,
43                     Build.VERSION_CODES.HONEYCOMB, "holo_dialog_noactionbar_minwidth"),
44             new ThemeInfo(ThemeInfo.HOLO, android.R.style.Theme_Holo_DialogWhenLarge,
45                     Build.VERSION_CODES.HONEYCOMB, "holo_dialogwhenlarge"),
46             new ThemeInfo(ThemeInfo.HOLO, android.R.style.Theme_Holo_DialogWhenLarge_NoActionBar,
47                     Build.VERSION_CODES.HONEYCOMB, "holo_dialogwhenlarge_noactionbar"),
48             new ThemeInfo(ThemeInfo.HOLO, android.R.style.Theme_Holo_InputMethod,
49                     Build.VERSION_CODES.HONEYCOMB, "holo_inputmethod"),
50             new ThemeInfo(ThemeInfo.HOLO, android.R.style.Theme_Holo_NoActionBar,
51                     Build.VERSION_CODES.HONEYCOMB, "holo_noactionbar"),
52             new ThemeInfo(ThemeInfo.HOLO, android.R.style.Theme_Holo_NoActionBar_Fullscreen,
53                     Build.VERSION_CODES.HONEYCOMB, "holo_noactionbar_fullscreen"),
54             new ThemeInfo(ThemeInfo.HOLO, android.R.style.Theme_Holo_NoActionBar_Overscan,
55                     Build.VERSION_CODES.JELLY_BEAN_MR2, "holo_noactionbar_overscan"),
56             new ThemeInfo(ThemeInfo.HOLO, android.R.style.Theme_Holo_NoActionBar_TranslucentDecor,
57                     Build.VERSION_CODES.KITKAT, "holo_noactionbar_translucentdecor"),
58             new ThemeInfo(ThemeInfo.HOLO, android.R.style.Theme_Holo_Panel,
59                     Build.VERSION_CODES.HONEYCOMB, "holo_panel"),
60             new ThemeInfo(ThemeInfo.HOLO, android.R.style.Theme_Holo_Wallpaper,
61                     Build.VERSION_CODES.HONEYCOMB, "holo_wallpaper"),
62             new ThemeInfo(ThemeInfo.HOLO, android.R.style.Theme_Holo_Wallpaper_NoTitleBar,
63                     Build.VERSION_CODES.HONEYCOMB, "holo_wallpaper_notitlebar"),
64 
65             // Holo Light
66             new ThemeInfo(ThemeInfo.HOLO, android.R.style.Theme_Holo_Light,
67                     Build.VERSION_CODES.HONEYCOMB, "holo_light"),
68             new ThemeInfo(ThemeInfo.HOLO, android.R.style.Theme_Holo_Light_DarkActionBar,
69                     Build.VERSION_CODES.ICE_CREAM_SANDWICH, "holo_light_darkactionbar"),
70             new ThemeInfo(ThemeInfo.HOLO, android.R.style.Theme_Holo_Light_Dialog,
71                     Build.VERSION_CODES.HONEYCOMB, "holo_light_dialog"),
72             new ThemeInfo(ThemeInfo.HOLO, android.R.style.Theme_Holo_Light_Dialog_MinWidth,
73                     Build.VERSION_CODES.HONEYCOMB, "holo_light_dialog_minwidth"),
74             new ThemeInfo(ThemeInfo.HOLO, android.R.style.Theme_Holo_Light_Dialog_NoActionBar,
75                     Build.VERSION_CODES.HONEYCOMB, "holo_light_dialog_noactionbar"),
76             new ThemeInfo(ThemeInfo.HOLO, android.R.style.Theme_Holo_Light_Dialog_NoActionBar_MinWidth,
77                     Build.VERSION_CODES.HONEYCOMB, "holo_light_dialog_noactionbar_minwidth"),
78             new ThemeInfo(ThemeInfo.HOLO, android.R.style.Theme_Holo_Light_DialogWhenLarge,
79                     Build.VERSION_CODES.HONEYCOMB, "holo_light_dialogwhenlarge"),
80             new ThemeInfo(ThemeInfo.HOLO, android.R.style.Theme_Holo_Light_DialogWhenLarge_NoActionBar,
81                     Build.VERSION_CODES.HONEYCOMB, "holo_light_dialogwhenlarge_noactionbar"),
82             new ThemeInfo(ThemeInfo.HOLO, android.R.style.Theme_Holo_Light_NoActionBar,
83                     Build.VERSION_CODES.HONEYCOMB_MR2, "holo_light_noactionbar"),
84             new ThemeInfo(ThemeInfo.HOLO, android.R.style.Theme_Holo_Light_NoActionBar_Fullscreen,
85                     Build.VERSION_CODES.HONEYCOMB_MR2, "holo_light_noactionbar_fullscreen"),
86             new ThemeInfo(ThemeInfo.HOLO, android.R.style.Theme_Holo_Light_NoActionBar_Overscan,
87                     Build.VERSION_CODES.JELLY_BEAN_MR2, "holo_light_noactionbar_overscan"),
88             new ThemeInfo(ThemeInfo.HOLO, android.R.style.Theme_Holo_Light_NoActionBar_TranslucentDecor,
89                     Build.VERSION_CODES.KITKAT, "holo_light_noactionbar_translucentdecor"),
90             new ThemeInfo(ThemeInfo.HOLO, android.R.style.Theme_Holo_Light_Panel,
91                     Build.VERSION_CODES.HONEYCOMB, "holo_light_panel"),
92 
93             // Material
94             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material,
95                     Build.VERSION_CODES.LOLLIPOP, "material"),
96             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Dialog,
97                     Build.VERSION_CODES.LOLLIPOP, "material_dialog"),
98             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Dialog_Alert,
99                     Build.VERSION_CODES.LOLLIPOP, "material_dialog_alert"),
100             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Dialog_MinWidth,
101                     Build.VERSION_CODES.LOLLIPOP, "material_dialog_minwidth"),
102             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Dialog_NoActionBar,
103                     Build.VERSION_CODES.LOLLIPOP, "material_dialog_noactionbar"),
104             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Dialog_NoActionBar_MinWidth,
105                     Build.VERSION_CODES.LOLLIPOP, "material_dialog_noactionbar_minwidth"),
106             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Dialog_Presentation,
107                     Build.VERSION_CODES.LOLLIPOP, "material_dialog_presentation"),
108             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_DialogWhenLarge,
109                     Build.VERSION_CODES.LOLLIPOP, "material_dialogwhenlarge"),
110             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_DialogWhenLarge_NoActionBar,
111                     Build.VERSION_CODES.LOLLIPOP, "material_dialogwhenlarge_noactionbar"),
112             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_InputMethod,
113                     Build.VERSION_CODES.LOLLIPOP, "material_inputmethod"),
114             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_NoActionBar,
115                     Build.VERSION_CODES.LOLLIPOP, "material_noactionbar"),
116             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_NoActionBar_Fullscreen,
117                     Build.VERSION_CODES.LOLLIPOP, "material_noactionbar_fullscreen"),
118             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_NoActionBar_Overscan,
119                     Build.VERSION_CODES.LOLLIPOP, "material_noactionbar_overscan"),
120             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_NoActionBar_TranslucentDecor,
121                     Build.VERSION_CODES.LOLLIPOP, "material_noactionbar_translucentdecor"),
122             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Panel,
123                     Build.VERSION_CODES.LOLLIPOP, "material_panel"),
124             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Settings,
125                     Build.VERSION_CODES.LOLLIPOP, "material_settings"),
126             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Voice,
127                     Build.VERSION_CODES.LOLLIPOP, "material_voice"),
128             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Wallpaper,
129                     Build.VERSION_CODES.LOLLIPOP, "material_wallpaper"),
130             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Wallpaper_NoTitleBar,
131                     Build.VERSION_CODES.LOLLIPOP, "material_wallpaper_notitlebar"),
132 
133             // Material Light
134             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Light,
135                     Build.VERSION_CODES.LOLLIPOP, "material_light"),
136             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Light_DarkActionBar,
137                     Build.VERSION_CODES.LOLLIPOP, "material_light_darkactionbar"),
138             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Light_Dialog,
139                     Build.VERSION_CODES.LOLLIPOP, "material_light_dialog"),
140             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Light_Dialog_Alert,
141                     Build.VERSION_CODES.LOLLIPOP, "material_light_dialog_alert"),
142             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Light_Dialog_MinWidth,
143                     Build.VERSION_CODES.LOLLIPOP, "material_light_dialog_minwidth"),
144             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Light_Dialog_NoActionBar,
145                     Build.VERSION_CODES.LOLLIPOP, "material_light_dialog_noactionbar"),
146             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Light_Dialog_NoActionBar_MinWidth,
147                     Build.VERSION_CODES.LOLLIPOP, "material_light_dialog_noactionbar_minwidth"),
148             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Light_Dialog_Presentation,
149                     Build.VERSION_CODES.LOLLIPOP, "material_light_dialog_presentation"),
150             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Light_DialogWhenLarge,
151                     Build.VERSION_CODES.LOLLIPOP, "material_light_dialogwhenlarge"),
152             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Light_DialogWhenLarge_NoActionBar,
153                     Build.VERSION_CODES.LOLLIPOP, "material_light_dialogwhenlarge_noactionbar"),
154             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Light_LightStatusBar,
155                     Build.VERSION_CODES.M, "material_light_lightstatusbar"),
156             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Light_NoActionBar,
157                     Build.VERSION_CODES.LOLLIPOP, "material_light_noactionbar"),
158             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Light_NoActionBar_Fullscreen,
159                     Build.VERSION_CODES.LOLLIPOP, "material_light_noactionbar_fullscreen"),
160             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Light_NoActionBar_Overscan,
161                     Build.VERSION_CODES.LOLLIPOP, "material_light_noactionbar_overscan"),
162             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Light_NoActionBar_TranslucentDecor,
163                     Build.VERSION_CODES.LOLLIPOP, "material_light_noactionbar_translucentdecor"),
164             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Light_Panel,
165                     Build.VERSION_CODES.LOLLIPOP, "material_light_panel"),
166             new ThemeInfo(ThemeInfo.MATERIAL, android.R.style.Theme_Material_Light_Voice,
167                     Build.VERSION_CODES.LOLLIPOP, "material_light_voice")
168     };
169 
170     static final LayoutInfo[] LAYOUTS = {
171             new LayoutInfo(R.layout.button, "button"),
172             // Temporarily remove tests for pressed Button widget. The Material ripple is in
173             // flux, so this is going to be failing frequently on Material until it stablizes.
174             //new LayoutInfo(R.layout.button, "button_pressed",
175             //        new ViewPressedModifier()),
176             new LayoutInfo(R.layout.checkbox, "checkbox"),
177             new LayoutInfo(R.layout.checkbox, "checkbox_checked",
178                     new ViewCheckedModifier()),
179             new LayoutInfo(R.layout.chronometer, "chronometer"),
180             new LayoutInfo(R.layout.color_blue_bright, "color_blue_bright"),
181             new LayoutInfo(R.layout.color_blue_dark, "color_blue_dark"),
182             new LayoutInfo(R.layout.color_blue_light, "color_blue_light"),
183             new LayoutInfo(R.layout.color_green_dark, "color_green_dark"),
184             new LayoutInfo(R.layout.color_green_light, "color_green_light"),
185             new LayoutInfo(R.layout.color_orange_dark, "color_orange_dark"),
186             new LayoutInfo(R.layout.color_orange_light, "color_orange_light"),
187             new LayoutInfo(R.layout.color_purple, "color_purple"),
188             new LayoutInfo(R.layout.color_red_dark, "color_red_dark"),
189             new LayoutInfo(R.layout.color_red_light, "color_red_light"),
190             // Temporarily remove tests for the DatePicker widget. Something changed with font
191             // rendering behavior (likely ag/12562227 which upgraded Roboto to variable format)
192             // but we don't have resources available right now to update the golden images.
193             //new LayoutInfo(R.layout.datepicker, "datepicker",
194             //        new DatePickerModifier()),
195             new LayoutInfo(R.layout.edittext, "edittext"),
196             new LayoutInfo(R.layout.progressbar_horizontal_0, "progressbar_horizontal_0"),
197             new LayoutInfo(R.layout.progressbar_horizontal_100, "progressbar_horizontal_100"),
198             new LayoutInfo(R.layout.progressbar_horizontal_50, "progressbar_horizontal_50"),
199             new LayoutInfo(R.layout.progressbar_large, "progressbar_large",
200                     new ProgressBarModifier()),
201             new LayoutInfo(R.layout.progressbar_small, "progressbar_small",
202                     new ProgressBarModifier()),
203             new LayoutInfo(R.layout.progressbar, "progressbar",
204                     new ProgressBarModifier()),
205             new LayoutInfo(R.layout.radiobutton_checked, "radiobutton_checked"),
206             new LayoutInfo(R.layout.radiobutton, "radiobutton"),
207             new LayoutInfo(R.layout.radiogroup_horizontal, "radiogroup_horizontal"),
208             new LayoutInfo(R.layout.radiogroup_vertical, "radiogroup_vertical"),
209             // Temporarily remove tests for the RatingBar widget. It has indeterminate rendering
210             // behavior on 360dpi devices, but we don't know why yet.
211             //new LayoutInfo(R.layout.ratingbar_0, "ratingbar_0"),
212             //new LayoutInfo(R.layout.ratingbar_2point5, "ratingbar_2point5"),
213             //new LayoutInfo(R.layout.ratingbar_5, "ratingbar_5"),
214             //new LayoutInfo(R.layout.ratingbar_0, "ratingbar_0_pressed",
215             //        new ViewPressedModifier()),
216             //new LayoutInfo(R.layout.ratingbar_2point5, "ratingbar_2point5_pressed",
217             //        new ViewPressedModifier()),
218             //new LayoutInfo(R.layout.ratingbar_5, "ratingbar_5_pressed",
219             //        new ViewPressedModifier()),
220             // Temporarily remove tests for the SearchView widget with no hint. The "X" icon has
221             // indeterminate rendering behavior on 480dpi devices, but we don't know why yet.
222             //new LayoutInfo(R.layout.searchview, "searchview_query",
223             //        new SearchViewModifier(SearchViewModifier.QUERY)),
224             new LayoutInfo(R.layout.searchview, "searchview_query_hint",
225                     new SearchViewModifier(SearchViewModifier.QUERY_HINT)),
226             new LayoutInfo(R.layout.seekbar_0, "seekbar_0"),
227             new LayoutInfo(R.layout.seekbar_100, "seekbar_100"),
228             new LayoutInfo(R.layout.seekbar_50, "seekbar_50"),
229             new LayoutInfo(R.layout.spinner, "spinner"),
230             new LayoutInfo(R.layout.switch_button_checked, "switch_button_checked"),
231             new LayoutInfo(R.layout.switch_button, "switch_button"),
232             new LayoutInfo(R.layout.textview, "textview"),
233             new LayoutInfo(R.layout.timepicker, "timepicker",
234                     new TimePickerModifier()),
235             new LayoutInfo(R.layout.togglebutton_checked, "togglebutton_checked"),
236             new LayoutInfo(R.layout.togglebutton, "togglebutton"),
237     };
238 }
239