Home | History | Annotate | only in /cts/hostsidetests/theme
Up to higher level directory
NameDateSize
Android.mk21-Aug-20181.5K
android_device.py21-Aug-20184.7K
AndroidTest.xml21-Aug-20181.3K
app/21-Aug-2018
assets/21-Aug-2018
avd.py21-Aug-20182.7K
generate_images.py21-Aug-20187.3K
README21-Aug-20185.1K
src/21-Aug-2018

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 from an emulator, do the following:
     34 
     35   1. Ensure the Android SDK is installed locally. Either a public or internal
     36      distribution is fine. From the console, set the ANDROID_SDK_ROOT env var:
     37 
     38      export ANDROID_SDK_ROOT = /path/to/sdk
     39 
     40   2. Obtain an x86_64 emulator image from the build server by using the script
     41      available internally at go/emu-dev. This script will install the image in
     42      your SDK.
     43 
     44   3. Use the SDK's AVD Manager tool to create a single virtual device using the
     45      emulator image from step 2. The exact configuration doesn't really matter;
     46      you can use Nexus 5 as a template. Name the emulator "theme_emulator".
     47 
     48   4. From the console, set up your build environment for x86_64 and build CTS:
     49 
     50      lunch sdk_x86_64-eng && make cts -j32
     51 
     52   5. Use the reference image script to generate the reference images. The script
     53      will automatically start the emulator in the required configurations and
     54      install the resulting reference images in assets/<platform>/<dpi>.zip,
     55      overwriting any existing images.
     56 
     57      ./cts/hostsidetests/theme/generate_images.py theme_emulator
     58 
     59 You can also generate reference images using a real device. To generate a new set
     60 of reference images from a real device, do the following:
     61 
     62   1. Connect the device. Verify the device is connected:
     63 
     64      adb devices
     65 
     66   2. Use the reference image script to generate the reference images:
     67 
     68      ./cts/hostsidetests/theme/generate_images.py
     69 
     70 There is an option to build locally an Android system image and use an emulator that is stored in
     71 Android source tree under "prebuilts/android-emulator/linux-x86_64/emulator". This option does not
     72 require a SDK and can be used to generate images with locally modified source code: for example
     73 right before making a test breaking change.
     74 
     75   1. From the console, set up your build environment for sdk_phone_x86_64 and build Android and CTS:
     76 
     77      lunch sdk_phone_x86_64-userdebug && make -j32 && make cts -j32
     78 
     79   2. Use the reference image script to generate the reference images. The script
     80      will automatically start the emulator in the required configurations and
     81      install the resulting reference images in assets/<platform>/<dpi>.zip,
     82      overwriting any existing images.
     83 
     84      ./cts/hostsidetests/theme/generate_images.py local
     85 
     86 A complete collection of reference images for a given API revision must include
     87 a set for each possible DPI bucket (tvdpi, xxhdpi, etc.) that may be tested.
     88 
     89 For a list of devices and their DPI buckets, see Device Metrics:
     90 
     91     https://design.google.com/devices/
     92 
     93 
     94 II. Building theme tests
     95 
     96 1. If you have not already built the CTS tests, run an initial make:
     97 
     98    make cts -j32
     99 
    100 2. Subsequent changes to the theme tests, including changes to the reference
    101    images, may be built using mmm:
    102 
    103    mmm cts/hostsidetests/theme -j32
    104 
    105 
    106 III. Running theme tests
    107 
    108 To obtain reliable results, theme tests should be run against the device's
    109 native density; however, many of the tests will also work in a scaled density.
    110 If you don't possess a device for a given density and would still like to run
    111 tests for that density, you can manually force scaling via:
    112 
    113   adb shell wm density <dpi>
    114 
    115 As of API 24, the results will NOT be 100% reliable due to scaling artifacts.
    116 To reset the device to its native density, run:
    117 
    118   adb shell wm density reset
    119 
    120 Once the device is in the desired state, do the following:
    121 
    122   1. Connect the device that you wish to test. Confirm that is is connected with:
    123 
    124      adb devices
    125 
    126   2. Run the theme tests using cts-tradefed:
    127 
    128      cts-tradefed run singleCommand cts-dev --module CtsThemeHostTestCases \
    129          --test android.theme.cts.ThemeHostTest
    130 
    131   3. Wait for the tests to complete. This should take less than five minutes.
    132 
    133 If any test failures are encountered, diff PNGs will be generated and collected
    134 in the "diffs" directory of the CTS results indicated by "Test Result:" in the
    135 test output.
    136