• Home
Name Date Size #Lines LOC

..--

READMED03-May-20243.8 KiB114101

test_main.cppD03-May-2024841 267

README

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    }
78  ]
79}
80
81## test_main.cpp ##
82The current directory contains a test_main.cpp that initiates the localization
83rendering test.
84Make a copy of the cpp file (found in this directory) and place it in the
85test configuration directory you will run the test from.
86
87## Run test ##
88To run the tests against the TEST_MAPPING configurations use the following
89command:
90	atest --test-mapping [src_path]:all
91more info on how to run atest can be found here: https://source.android.com/compatibility/tests/development/test-mapping
92
93It is possible to run the test as a binary and pass in configuration
94values as commandline parameters.
95The following command is how to run the test
96in the commandline.
97	atest system.teeui_localization_rendering_test.<device name> -- \
98	--test-arg
99	com.android.tradefed.testtype.HostGTest:native-test-flag:"--width=100"\
100	--test-arg
101	com.android.tradefed.testtype.HostGTest:native-test-flag:"--height=100"\
102	--test-arg
103        com.android.tradefed.testtype.HostGTest:native-test-flag:"--dp2px=100"\
104	 --test-arg
105        com.android.tradefed.testtype.HostGTest:native-test-flag:"--mm2px=100"
106	--test-arg
107        com.android.tradefed.testtype.HostGTest:native-test-flag:"--powerButtonTop=100"\
108	--test-arg
109        com.android.tradefed.testtype.HostGTest:native-test-flag:"--powerButtonBottom=100"\
110	--test-arg
111        com.android.tradefed.testtype.HostGTest:native-test-flag:"--volUpButtonTop=100"\
112	 --test-arg
113        com.android.tradefed.testtype.HostGTest:native-test-flag:"--volUpButtonBottom=100"\
114