blob: 64ca4160b6c3c791f6a878c921b82e0e2f75c15e [file] [log] [blame]
Alan Viverettec15ea9f2015-08-26 16:33:17 -04001* 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
16INTRODUCTION
17
18The Android theme tests ensure that the Holo and Material themes have not been
19modified. They consist of API-specific sets of reference images representing
20specific themes and widgets that must be identical across devices. To pass the
21theme tests, a device must be able to generate images that are identical to the
22reference images.
23
24NOTE: 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
28INSTRUCTIONS
29
30I. Generating reference images (CTS maintainers only)
31
32Reference images are typically only generated for new API revisions. To
33generate a new set of reference images, do the following:
34
Alan Viverette598c6922017-04-28 18:32:23 -040035 1. Obtain the emulator image for the current platform. You can either build
36 these from scratch (not recommended) via:
37
38 make PRODUCT-sdk_phone_x86_64-sdk sdk_repo -j32
39
40 Or obtain them from the sdk-repo-linux-system-images-<build-id>.zip
41 artifact from the sdk_phone_x86_64-sdk build server target.
42
43 2. Start one AVD emulator image for each DPI bucket (ldpi, xxxhdpi, etc.)
44 that you wish to generate references images for. Anecdotally, up to three
45 emulators can run reliably at the same time. Confirm that all emulators
46 are connected with:
Alan Viverettec15ea9f2015-08-26 16:33:17 -040047
48 adb devices
49
Alan Viverette598c6922017-04-28 18:32:23 -040050 3. Set up your build environment for x86_64 and build CTS:
51
52 lunch sdk_x86_64-eng && make cts -j32
53
54 2. Generate the reference images. Generation occurs on all devices in
55 parallel. Resulting sets of reference images are automatically saved in
56 assets/<platform>/<dpi>.zip and will overwrite any existing sets. Image
57 generation may be started using:
Alan Viverettec15ea9f2015-08-26 16:33:17 -040058
Alan Viverettee2da81e2016-05-31 12:08:24 -040059 ./cts/hostsidetests/theme/generate_images.sh
Alan Viverettec15ea9f2015-08-26 16:33:17 -040060
61A complete collection of reference images for a given API revision must include
62a set for each possible DPI bucket (tvdpi, xxhdpi, etc.) that may be tested.
63
Alan Viverette4f560b62016-06-06 09:58:40 -040064For a list of devices and their DPI buckets, see Device Metrics:
65
66 https://design.google.com/devices/
67
Alan Viverettec15ea9f2015-08-26 16:33:17 -040068
69II. Building theme tests
70
711. If you have not already built the CTS tests, run an initial make:
72
73 make cts -j32
74
752. Subsequent changes to the theme tests, including changes to the reference
76 images, may be built using mmm:
77
78 mmm cts/hostsidetests/theme -j32
79
80
81III. Running theme tests
82
Alan Viveretteb246d962016-08-03 12:38:20 -040083To obtain reliable results, theme tests should be run against the device's
84native density; however, many of the tests will also work in a scaled density.
85If you don't possess a device for a given density and would still like to run
86tests for that density, you can manually force scaling via:
Alan Viverettec15ea9f2015-08-26 16:33:17 -040087
Alan Viveretteb246d962016-08-03 12:38:20 -040088 adb shell wm density <dpi>
Alan Viverettec15ea9f2015-08-26 16:33:17 -040089
Alan Viveretteb246d962016-08-03 12:38:20 -040090As of API 24, the results will NOT be 100% reliable due to scaling artifacts.
91To reset the device to its native density, run:
Alan Viverettec15ea9f2015-08-26 16:33:17 -040092
Alan Viveretteb246d962016-08-03 12:38:20 -040093 adb shell wm density reset
Alan Viverettec15ea9f2015-08-26 16:33:17 -040094
Alan Viveretteb246d962016-08-03 12:38:20 -040095Once the device is in the desired state, do the following:
96
97 1. Connect the device that you wish to test. Confirm that is is connected with:
98
99 adb devices
100
101 2. Run the theme tests using cts-tradefed:
102
103 cts-tradefed run singleCommand cts-dev --module CtsThemeHostTestCases \
104 --test android.theme.cts.ThemeHostTest
105
106 3. Wait for the tests to complete. This should take less than five minutes.
107
Alan Viverette40115c42017-04-04 13:11:08 -0400108If any test failures are encountered, diff PNGs will be generated and collected
109in the "diffs" directory of the CTS results indicated by "Test Result:" in the
110test output.