1# Device Configuration for localization_rendering_tests #
2
3## Setup ##
4Include the following three files in a new directory that you would want to run
5your test from. These files would be referred to as the configuration files.
6* Android.bp
7* TEST_MAPPING
8* test_main.cpp
9
10
11## Android.bp file ##
12Define a new module in the Android.bp file.
13
14The following is a template for the Android.bp file, only the <device name> needs to be replaced.
15
16cc_test_host {
17    name: "system.teeui_localization_rendering_test.<device name>",
18    cflags: [
19        "-Wall",
20        "-Werror",
21        "-Wextra",
22        "-O0",
23    ],
24    srcs: [
25        "test_main.cpp",
26    ],
27    test_suites: ["device-tests"],
28    shared_libs: [
29        "libbase",
30        "libteeui_localization_rendering_test",
31    ],
32    static_libs: [
33        "libgtest",
34    ]
35}
36
37
38## TEST_MAPPING ##
39The TEST_MAPPING file is going to run the test as a postsubmit test with the
40configuration parameters set within this file.
41
42The following is a template for the TEST_MAPPING file. All the flags should be
43configured with the values specific to the device. If no configuration is
44provided, the values will default to the values for Blueline.
45
46{
47  "postsubmit": [
48    {
49      "name": "system.teeui_localization_rendering_test.<device name>",
50      "host" : true,
51      "options": [
52          {
53            "native-test-flag": "--width=<device width in pixels>"
54          },
55          {
56            "native-test-flag": "--height=<device height in pixels>"
57          },
58          {
59            "native-test-flag": "--dp2px=<pixel per density independent pixel (px/dp) ratio of the device. Typically <width in pixels>/412 >"
60          },
61          {
62            "native-test-flag": "--mm2px=<pixel per millimeter (px/mm) ratio>"
63          },
64          {
65            "native-test-flag": "--powerButtonTop=<distance from the top of the power button to the top of the screen in mm>"
66          },
67          {
68            "native-test-flag": "--powerButtonBottom=<distance from the bottom of the power button to the top of the screen in mm>"
69          },
70          {
71            "native-test-flag": "--volUpButtonTop=<distance from the top of the UP volume button to the top of the screen in mm>"
72          },
73          {
74            "native-test-flag": "--volUpButtonBottom=<distance from the bottom of the UP power button to the top of the screen in mm>"
75          },
76          {
77             "native-test-flag": "--saveScreen"
78          }
79        ]
80    }
81  ]
82}
83
84## test_main.cpp ##
85The current directory contains a test_main.cpp that initiates the localization
86rendering test.
87Make a copy of the cpp file (found in this directory) and place it in the
88test configuration directory you will run the test from.
89
90## Run test ##
91To run the tests against the TEST_MAPPING configurations use the following
92command:
93	atest --test-mapping [src_path]:all
94more info on how to run atest can be found here: https://source.android.com/compatibility/tests/development/test-mapping
95
96It is possible to run the test as a binary and pass in configuration
97values as commandline parameters.
98The following command is how to run the test
99in the commandline.
100	atest system.teeui_localization_rendering_test.<device name> -- \
101	--test-arg
102	com.android.tradefed.testtype.HostGTest:native-test-flag:"--width=100"\
103	--test-arg
104	com.android.tradefed.testtype.HostGTest:native-test-flag:"--height=100"\
105	--test-arg
106        com.android.tradefed.testtype.HostGTest:native-test-flag:"--dp2px=100"\
107	 --test-arg
108        com.android.tradefed.testtype.HostGTest:native-test-flag:"--mm2px=100"
109	--test-arg
110        com.android.tradefed.testtype.HostGTest:native-test-flag:"--powerButtonTop=100"\
111	--test-arg
112        com.android.tradefed.testtype.HostGTest:native-test-flag:"--powerButtonBottom=100"\
113	--test-arg
114        com.android.tradefed.testtype.HostGTest:native-test-flag:"--volUpButtonTop=100"\
115	 --test-arg
116        com.android.tradefed.testtype.HostGTest:native-test-flag:"--volUpButtonBottom=100"\
117