README
1 * Copyright (C) 2015 The Android Open Source Project
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14
15
16 INTRODUCTION
17
18 The Android theme tests ensure that the Holo and Material themes have not been
19 modified. They consist of API-specific sets of reference images representing
20 specific themes and widgets that must be identical across devices. To pass the
21 theme tests, a device must be able to generate images that are identical to the
22 reference images.
23
24 NOTE: Reference images should only be updated by the CTS test maintainers. Any
25 modifications to the reference images will invalidate the test results.
26
27
28 INSTRUCTIONS
29
30 I. Generating reference images (CTS maintainers only)
31
32 Reference images are typically only generated for new API revisions. To
33 generate a new set of reference images, do the following:
34
35 1. Connect one device for each DPI bucket (ldpi, xxxhdpi, etc.) that you wish
36 to generate references images for. Confirm that all devices are connected
37 with:
38
39 adb devices
40
41 2. Image generation occurs on all devices in parallel. Resulting sets of
42 reference images are saved in assets/<api>/<dpi>.zip and will overwrite
43 any existing sets. Image generation may be started using:
44
45 ./cts/hostsidetests/theme/generate_images.sh
46
47 A complete collection of reference images for a given API revision must include
48 a set for each possible DPI bucket (tvdpi, xxhdpi, etc.) that may be tested.
49
50 For a list of devices and their DPI buckets, see Device Metrics:
51
52 https://design.google.com/devices/
53
54
55 II. Building theme tests
56
57 1. If you have not already built the CTS tests, run an initial make:
58
59 make cts -j32
60
61 2. Subsequent changes to the theme tests, including changes to the reference
62 images, may be built using mmm:
63
64 mmm cts/hostsidetests/theme -j32
65
66
67 III. Running theme tests
68
69 To obtain reliable results, theme tests should be run against the device's
70 native density; however, many of the tests will also work in a scaled density.
71 If you don't possess a device for a given density and would still like to run
72 tests for that density, you can manually force scaling via:
73
74 adb shell wm density <dpi>
75
76 As of API 24, the results will NOT be 100% reliable due to scaling artifacts.
77 To reset the device to its native density, run:
78
79 adb shell wm density reset
80
81 Once the device is in the desired state, do the following:
82
83 1. Connect the device that you wish to test. Confirm that is is connected with:
84
85 adb devices
86
87 2. Run the theme tests using cts-tradefed:
88
89 cts-tradefed run singleCommand cts-dev --module CtsThemeHostTestCases \
90 --test android.theme.cts.ThemeHostTest
91
92 3. Wait for the tests to complete. This should take less than five minutes.
93
94 If any tests failures are encountered, diff PNGs will be generated and collected
95 in a ZIP file in the tmp directory. Look for the following test output:
96
97 I/ThemeHostTest: Wrote <N> failures to file: /tmp/failures<random-number>.zip
98