Jeff Brown | ebbd5d1 | 2011-02-17 13:01:34 -0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2011 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include <ui/Input.h> |
| 18 | #include <gtest/gtest.h> |
| 19 | #include <binder/Parcel.h> |
| 20 | |
| 21 | namespace android { |
| 22 | |
| 23 | class BaseTest : public testing::Test { |
| 24 | protected: |
| 25 | virtual void SetUp() { } |
| 26 | virtual void TearDown() { } |
| 27 | }; |
| 28 | |
| 29 | // --- PointerCoordsTest --- |
| 30 | |
| 31 | class PointerCoordsTest : public BaseTest { |
| 32 | }; |
| 33 | |
| 34 | TEST_F(PointerCoordsTest, ClearSetsBitsToZero) { |
| 35 | PointerCoords coords; |
| 36 | coords.clear(); |
| 37 | |
| 38 | ASSERT_EQ(0U, coords.bits); |
| 39 | } |
| 40 | |
| 41 | TEST_F(PointerCoordsTest, AxisValues) { |
| 42 | float* valuePtr; |
| 43 | PointerCoords coords; |
| 44 | coords.clear(); |
| 45 | |
| 46 | // Check invariants when no axes are present. |
| 47 | ASSERT_EQ(0, coords.getAxisValue(0)) |
| 48 | << "getAxisValue should return zero because axis is not present"; |
| 49 | ASSERT_EQ(0, coords.getAxisValue(1)) |
| 50 | << "getAxisValue should return zero because axis is not present"; |
| 51 | |
| 52 | ASSERT_EQ(NULL, coords.editAxisValue(0)) |
| 53 | << "editAxisValue should return null because axis is not present"; |
| 54 | |
| 55 | // Set first axis. |
| 56 | ASSERT_EQ(OK, coords.setAxisValue(1, 5)); |
| 57 | ASSERT_EQ(0x00000002U, coords.bits); |
| 58 | ASSERT_EQ(5, coords.values[0]); |
| 59 | |
| 60 | ASSERT_EQ(0, coords.getAxisValue(0)) |
| 61 | << "getAxisValue should return zero because axis is not present"; |
| 62 | ASSERT_EQ(5, coords.getAxisValue(1)) |
| 63 | << "getAxisValue should return value of axis"; |
| 64 | |
| 65 | // Set an axis with a higher id than all others. (appending value at the end) |
| 66 | ASSERT_EQ(OK, coords.setAxisValue(3, 2)); |
| 67 | ASSERT_EQ(0x0000000aU, coords.bits); |
| 68 | ASSERT_EQ(5, coords.values[0]); |
| 69 | ASSERT_EQ(2, coords.values[1]); |
| 70 | |
| 71 | ASSERT_EQ(0, coords.getAxisValue(0)) |
| 72 | << "getAxisValue should return zero because axis is not present"; |
| 73 | ASSERT_EQ(5, coords.getAxisValue(1)) |
| 74 | << "getAxisValue should return value of axis"; |
| 75 | ASSERT_EQ(0, coords.getAxisValue(2)) |
| 76 | << "getAxisValue should return zero because axis is not present"; |
| 77 | ASSERT_EQ(2, coords.getAxisValue(3)) |
| 78 | << "getAxisValue should return value of axis"; |
| 79 | |
| 80 | // Set an axis with an id lower than all others. (prepending value at beginning) |
| 81 | ASSERT_EQ(OK, coords.setAxisValue(0, 4)); |
| 82 | ASSERT_EQ(0x0000000bU, coords.bits); |
| 83 | ASSERT_EQ(4, coords.values[0]); |
| 84 | ASSERT_EQ(5, coords.values[1]); |
| 85 | ASSERT_EQ(2, coords.values[2]); |
| 86 | |
| 87 | ASSERT_EQ(4, coords.getAxisValue(0)) |
| 88 | << "getAxisValue should return value of axis"; |
| 89 | ASSERT_EQ(5, coords.getAxisValue(1)) |
| 90 | << "getAxisValue should return value of axis"; |
| 91 | ASSERT_EQ(0, coords.getAxisValue(2)) |
| 92 | << "getAxisValue should return zero because axis is not present"; |
| 93 | ASSERT_EQ(2, coords.getAxisValue(3)) |
| 94 | << "getAxisValue should return value of axis"; |
| 95 | |
| 96 | // Edit an existing axis value in place. |
| 97 | valuePtr = coords.editAxisValue(1); |
| 98 | ASSERT_EQ(5, *valuePtr) |
| 99 | << "editAxisValue should return pointer to axis value"; |
| 100 | |
| 101 | *valuePtr = 7; |
| 102 | ASSERT_EQ(7, coords.getAxisValue(1)) |
| 103 | << "getAxisValue should return value of axis"; |
| 104 | |
| 105 | // Set an axis with an id between the others. (inserting value in the middle) |
| 106 | ASSERT_EQ(OK, coords.setAxisValue(2, 1)); |
| 107 | ASSERT_EQ(0x0000000fU, coords.bits); |
| 108 | ASSERT_EQ(4, coords.values[0]); |
| 109 | ASSERT_EQ(7, coords.values[1]); |
| 110 | ASSERT_EQ(1, coords.values[2]); |
| 111 | ASSERT_EQ(2, coords.values[3]); |
| 112 | |
| 113 | ASSERT_EQ(4, coords.getAxisValue(0)) |
| 114 | << "getAxisValue should return value of axis"; |
| 115 | ASSERT_EQ(7, coords.getAxisValue(1)) |
| 116 | << "getAxisValue should return value of axis"; |
| 117 | ASSERT_EQ(1, coords.getAxisValue(2)) |
| 118 | << "getAxisValue should return value of axis"; |
| 119 | ASSERT_EQ(2, coords.getAxisValue(3)) |
| 120 | << "getAxisValue should return value of axis"; |
| 121 | |
| 122 | // Set an existing axis value in place. |
| 123 | ASSERT_EQ(OK, coords.setAxisValue(1, 6)); |
| 124 | ASSERT_EQ(0x0000000fU, coords.bits); |
| 125 | ASSERT_EQ(4, coords.values[0]); |
| 126 | ASSERT_EQ(6, coords.values[1]); |
| 127 | ASSERT_EQ(1, coords.values[2]); |
| 128 | ASSERT_EQ(2, coords.values[3]); |
| 129 | |
| 130 | ASSERT_EQ(4, coords.getAxisValue(0)) |
| 131 | << "getAxisValue should return value of axis"; |
| 132 | ASSERT_EQ(6, coords.getAxisValue(1)) |
| 133 | << "getAxisValue should return value of axis"; |
| 134 | ASSERT_EQ(1, coords.getAxisValue(2)) |
| 135 | << "getAxisValue should return value of axis"; |
| 136 | ASSERT_EQ(2, coords.getAxisValue(3)) |
| 137 | << "getAxisValue should return value of axis"; |
| 138 | |
| 139 | // Set maximum number of axes. |
| 140 | for (size_t axis = 4; axis < PointerCoords::MAX_AXES; axis++) { |
| 141 | ASSERT_EQ(OK, coords.setAxisValue(axis, axis)); |
| 142 | } |
| 143 | ASSERT_EQ(PointerCoords::MAX_AXES, __builtin_popcount(coords.bits)); |
| 144 | |
| 145 | // Try to set one more axis beyond maximum number. |
| 146 | // Ensure bits are unchanged. |
| 147 | ASSERT_EQ(NO_MEMORY, coords.setAxisValue(PointerCoords::MAX_AXES, 100)); |
| 148 | ASSERT_EQ(PointerCoords::MAX_AXES, __builtin_popcount(coords.bits)); |
| 149 | } |
| 150 | |
| 151 | TEST_F(PointerCoordsTest, ReadAndWriteParcel) { |
| 152 | Parcel parcel; |
| 153 | |
| 154 | PointerCoords inCoords; |
| 155 | inCoords.clear(); |
| 156 | PointerCoords outCoords; |
| 157 | |
| 158 | // Round trip with empty coords. |
| 159 | inCoords.writeToParcel(&parcel); |
| 160 | parcel.setDataPosition(0); |
| 161 | outCoords.readFromParcel(&parcel); |
| 162 | |
| 163 | ASSERT_EQ(0U, outCoords.bits); |
| 164 | |
| 165 | // Round trip with some values. |
| 166 | parcel.freeData(); |
| 167 | inCoords.setAxisValue(2, 5); |
| 168 | inCoords.setAxisValue(5, 8); |
| 169 | |
| 170 | inCoords.writeToParcel(&parcel); |
| 171 | parcel.setDataPosition(0); |
| 172 | outCoords.readFromParcel(&parcel); |
| 173 | |
| 174 | ASSERT_EQ(outCoords.bits, inCoords.bits); |
| 175 | ASSERT_EQ(outCoords.values[0], inCoords.values[0]); |
| 176 | ASSERT_EQ(outCoords.values[1], inCoords.values[1]); |
| 177 | } |
| 178 | |
| 179 | |
| 180 | // --- KeyEventTest --- |
| 181 | |
| 182 | class KeyEventTest : public BaseTest { |
| 183 | }; |
| 184 | |
| 185 | TEST_F(KeyEventTest, Properties) { |
| 186 | KeyEvent event; |
| 187 | |
| 188 | // Initialize and get properties. |
| 189 | const nsecs_t ARBITRARY_DOWN_TIME = 1; |
| 190 | const nsecs_t ARBITRARY_EVENT_TIME = 2; |
| 191 | event.initialize(2, AINPUT_SOURCE_GAMEPAD, AKEY_EVENT_ACTION_DOWN, |
| 192 | AKEY_EVENT_FLAG_FROM_SYSTEM, AKEYCODE_BUTTON_X, 121, |
| 193 | AMETA_ALT_ON, 1, ARBITRARY_DOWN_TIME, ARBITRARY_EVENT_TIME); |
| 194 | |
| 195 | ASSERT_EQ(AINPUT_EVENT_TYPE_KEY, event.getType()); |
| 196 | ASSERT_EQ(2, event.getDeviceId()); |
| 197 | ASSERT_EQ(AINPUT_SOURCE_GAMEPAD, event.getSource()); |
| 198 | ASSERT_EQ(AKEY_EVENT_ACTION_DOWN, event.getAction()); |
| 199 | ASSERT_EQ(AKEY_EVENT_FLAG_FROM_SYSTEM, event.getFlags()); |
| 200 | ASSERT_EQ(AKEYCODE_BUTTON_X, event.getKeyCode()); |
| 201 | ASSERT_EQ(121, event.getScanCode()); |
| 202 | ASSERT_EQ(AMETA_ALT_ON, event.getMetaState()); |
| 203 | ASSERT_EQ(1, event.getRepeatCount()); |
| 204 | ASSERT_EQ(ARBITRARY_DOWN_TIME, event.getDownTime()); |
| 205 | ASSERT_EQ(ARBITRARY_EVENT_TIME, event.getEventTime()); |
| 206 | |
| 207 | // Set source. |
| 208 | event.setSource(AINPUT_SOURCE_JOYSTICK); |
| 209 | ASSERT_EQ(AINPUT_SOURCE_JOYSTICK, event.getSource()); |
| 210 | } |
| 211 | |
| 212 | |
| 213 | // --- MotionEventTest --- |
| 214 | |
| 215 | class MotionEventTest : public BaseTest { |
| 216 | }; |
| 217 | |
| 218 | TEST_F(MotionEventTest, Properties) { |
| 219 | MotionEvent event; |
| 220 | |
| 221 | // Initialize, add samples and get properties. |
| 222 | const nsecs_t ARBITRARY_DOWN_TIME = 1; |
| 223 | const nsecs_t ARBITRARY_EVENT_TIME = 2; |
| 224 | const float X_OFFSET = 1.0f; |
| 225 | const float Y_OFFSET = 1.1f; |
| 226 | int32_t pointerIds[] = { 1, 2 }; |
| 227 | PointerCoords pointerCoords[2]; |
| 228 | pointerCoords[0].clear(); |
| 229 | pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_X, 10); |
| 230 | pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_Y, 11); |
| 231 | pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, 12); |
| 232 | pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_SIZE, 13); |
| 233 | pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MAJOR, 14); |
| 234 | pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MINOR, 15); |
| 235 | pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_TOOL_MAJOR, 16); |
| 236 | pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_TOOL_MINOR, 17); |
| 237 | pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_ORIENTATION, 18); |
| 238 | pointerCoords[1].clear(); |
| 239 | pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_X, 20); |
| 240 | pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_Y, 21); |
| 241 | pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, 22); |
| 242 | pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_SIZE, 23); |
| 243 | pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MAJOR, 24); |
| 244 | pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MINOR, 25); |
| 245 | pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_TOOL_MAJOR, 26); |
| 246 | pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_TOOL_MINOR, 27); |
| 247 | pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_ORIENTATION, 28); |
| 248 | event.initialize(2, AINPUT_SOURCE_TOUCHSCREEN, AMOTION_EVENT_ACTION_MOVE, |
| 249 | AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED, |
| 250 | AMOTION_EVENT_EDGE_FLAG_TOP, AMETA_ALT_ON, |
| 251 | X_OFFSET, Y_OFFSET, 2.0f, 2.1f, |
| 252 | ARBITRARY_DOWN_TIME, ARBITRARY_EVENT_TIME, |
| 253 | 2, pointerIds, pointerCoords); |
| 254 | |
| 255 | pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_X, 110); |
| 256 | pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_Y, 111); |
| 257 | pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, 112); |
| 258 | pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_SIZE, 113); |
| 259 | pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MAJOR, 114); |
| 260 | pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MINOR, 115); |
| 261 | pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_TOOL_MAJOR, 116); |
| 262 | pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_TOOL_MINOR, 117); |
| 263 | pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_ORIENTATION, 118); |
| 264 | pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_X, 120); |
| 265 | pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_Y, 121); |
| 266 | pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, 122); |
| 267 | pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_SIZE, 123); |
| 268 | pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MAJOR, 124); |
| 269 | pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MINOR, 125); |
| 270 | pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_TOOL_MAJOR, 126); |
| 271 | pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_TOOL_MINOR, 127); |
| 272 | pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_ORIENTATION, 128); |
| 273 | event.addSample(ARBITRARY_EVENT_TIME + 1, pointerCoords); |
| 274 | |
| 275 | pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_X, 210); |
| 276 | pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_Y, 211); |
| 277 | pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, 212); |
| 278 | pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_SIZE, 213); |
| 279 | pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MAJOR, 214); |
| 280 | pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MINOR, 215); |
| 281 | pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_TOOL_MAJOR, 216); |
| 282 | pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_TOOL_MINOR, 217); |
| 283 | pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_ORIENTATION, 218); |
| 284 | pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_X, 220); |
| 285 | pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_Y, 221); |
| 286 | pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, 222); |
| 287 | pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_SIZE, 223); |
| 288 | pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MAJOR, 224); |
| 289 | pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MINOR, 225); |
| 290 | pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_TOOL_MAJOR, 226); |
| 291 | pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_TOOL_MINOR, 227); |
| 292 | pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_ORIENTATION, 228); |
| 293 | event.addSample(ARBITRARY_EVENT_TIME + 2, pointerCoords); |
| 294 | |
| 295 | ASSERT_EQ(AINPUT_EVENT_TYPE_MOTION, event.getType()); |
| 296 | ASSERT_EQ(2, event.getDeviceId()); |
| 297 | ASSERT_EQ(AINPUT_SOURCE_TOUCHSCREEN, event.getSource()); |
| 298 | ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, event.getAction()); |
| 299 | ASSERT_EQ(AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED, event.getFlags()); |
| 300 | ASSERT_EQ(AMOTION_EVENT_EDGE_FLAG_TOP, event.getEdgeFlags()); |
| 301 | ASSERT_EQ(AMETA_ALT_ON, event.getMetaState()); |
| 302 | ASSERT_EQ(X_OFFSET, event.getXOffset()); |
| 303 | ASSERT_EQ(Y_OFFSET, event.getYOffset()); |
| 304 | ASSERT_EQ(2.0f, event.getXPrecision()); |
| 305 | ASSERT_EQ(2.1f, event.getYPrecision()); |
| 306 | ASSERT_EQ(ARBITRARY_DOWN_TIME, event.getDownTime()); |
| 307 | |
| 308 | ASSERT_EQ(2U, event.getPointerCount()); |
| 309 | ASSERT_EQ(1, event.getPointerId(0)); |
| 310 | ASSERT_EQ(2, event.getPointerId(1)); |
| 311 | |
| 312 | ASSERT_EQ(2U, event.getHistorySize()); |
| 313 | |
| 314 | // Get data. |
| 315 | ASSERT_EQ(ARBITRARY_EVENT_TIME, event.getHistoricalEventTime(0)); |
| 316 | ASSERT_EQ(ARBITRARY_EVENT_TIME + 1, event.getHistoricalEventTime(1)); |
| 317 | ASSERT_EQ(ARBITRARY_EVENT_TIME + 2, event.getEventTime()); |
| 318 | |
| 319 | ASSERT_EQ(11, event.getHistoricalRawPointerCoords(0, 0)-> |
| 320 | getAxisValue(AMOTION_EVENT_AXIS_Y)); |
| 321 | ASSERT_EQ(21, event.getHistoricalRawPointerCoords(1, 0)-> |
| 322 | getAxisValue(AMOTION_EVENT_AXIS_Y)); |
| 323 | ASSERT_EQ(111, event.getHistoricalRawPointerCoords(0, 1)-> |
| 324 | getAxisValue(AMOTION_EVENT_AXIS_Y)); |
| 325 | ASSERT_EQ(121, event.getHistoricalRawPointerCoords(1, 1)-> |
| 326 | getAxisValue(AMOTION_EVENT_AXIS_Y)); |
| 327 | ASSERT_EQ(211, event.getRawPointerCoords(0)-> |
| 328 | getAxisValue(AMOTION_EVENT_AXIS_Y)); |
| 329 | ASSERT_EQ(221, event.getRawPointerCoords(1)-> |
| 330 | getAxisValue(AMOTION_EVENT_AXIS_Y)); |
| 331 | |
| 332 | ASSERT_EQ(11, event.getHistoricalRawAxisValue(AMOTION_EVENT_AXIS_Y, 0, 0)); |
| 333 | ASSERT_EQ(21, event.getHistoricalRawAxisValue(AMOTION_EVENT_AXIS_Y, 1, 0)); |
| 334 | ASSERT_EQ(111, event.getHistoricalRawAxisValue(AMOTION_EVENT_AXIS_Y, 0, 1)); |
| 335 | ASSERT_EQ(121, event.getHistoricalRawAxisValue(AMOTION_EVENT_AXIS_Y, 1, 1)); |
| 336 | ASSERT_EQ(211, event.getRawAxisValue(AMOTION_EVENT_AXIS_Y, 0)); |
| 337 | ASSERT_EQ(221, event.getRawAxisValue(AMOTION_EVENT_AXIS_Y, 1)); |
| 338 | |
| 339 | ASSERT_EQ(10, event.getHistoricalRawX(0, 0)); |
| 340 | ASSERT_EQ(20, event.getHistoricalRawX(1, 0)); |
| 341 | ASSERT_EQ(110, event.getHistoricalRawX(0, 1)); |
| 342 | ASSERT_EQ(120, event.getHistoricalRawX(1, 1)); |
| 343 | ASSERT_EQ(210, event.getRawX(0)); |
| 344 | ASSERT_EQ(220, event.getRawX(1)); |
| 345 | |
| 346 | ASSERT_EQ(11, event.getHistoricalRawY(0, 0)); |
| 347 | ASSERT_EQ(21, event.getHistoricalRawY(1, 0)); |
| 348 | ASSERT_EQ(111, event.getHistoricalRawY(0, 1)); |
| 349 | ASSERT_EQ(121, event.getHistoricalRawY(1, 1)); |
| 350 | ASSERT_EQ(211, event.getRawY(0)); |
| 351 | ASSERT_EQ(221, event.getRawY(1)); |
| 352 | |
| 353 | ASSERT_EQ(X_OFFSET + 10, event.getHistoricalX(0, 0)); |
| 354 | ASSERT_EQ(X_OFFSET + 20, event.getHistoricalX(1, 0)); |
| 355 | ASSERT_EQ(X_OFFSET + 110, event.getHistoricalX(0, 1)); |
| 356 | ASSERT_EQ(X_OFFSET + 120, event.getHistoricalX(1, 1)); |
| 357 | ASSERT_EQ(X_OFFSET + 210, event.getX(0)); |
| 358 | ASSERT_EQ(X_OFFSET + 220, event.getX(1)); |
| 359 | |
| 360 | ASSERT_EQ(Y_OFFSET + 11, event.getHistoricalY(0, 0)); |
| 361 | ASSERT_EQ(Y_OFFSET + 21, event.getHistoricalY(1, 0)); |
| 362 | ASSERT_EQ(Y_OFFSET + 111, event.getHistoricalY(0, 1)); |
| 363 | ASSERT_EQ(Y_OFFSET + 121, event.getHistoricalY(1, 1)); |
| 364 | ASSERT_EQ(Y_OFFSET + 211, event.getY(0)); |
| 365 | ASSERT_EQ(Y_OFFSET + 221, event.getY(1)); |
| 366 | |
| 367 | ASSERT_EQ(12, event.getHistoricalPressure(0, 0)); |
| 368 | ASSERT_EQ(22, event.getHistoricalPressure(1, 0)); |
| 369 | ASSERT_EQ(112, event.getHistoricalPressure(0, 1)); |
| 370 | ASSERT_EQ(122, event.getHistoricalPressure(1, 1)); |
| 371 | ASSERT_EQ(212, event.getPressure(0)); |
| 372 | ASSERT_EQ(222, event.getPressure(1)); |
| 373 | |
| 374 | ASSERT_EQ(13, event.getHistoricalSize(0, 0)); |
| 375 | ASSERT_EQ(23, event.getHistoricalSize(1, 0)); |
| 376 | ASSERT_EQ(113, event.getHistoricalSize(0, 1)); |
| 377 | ASSERT_EQ(123, event.getHistoricalSize(1, 1)); |
| 378 | ASSERT_EQ(213, event.getSize(0)); |
| 379 | ASSERT_EQ(223, event.getSize(1)); |
| 380 | |
| 381 | ASSERT_EQ(14, event.getHistoricalTouchMajor(0, 0)); |
| 382 | ASSERT_EQ(24, event.getHistoricalTouchMajor(1, 0)); |
| 383 | ASSERT_EQ(114, event.getHistoricalTouchMajor(0, 1)); |
| 384 | ASSERT_EQ(124, event.getHistoricalTouchMajor(1, 1)); |
| 385 | ASSERT_EQ(214, event.getTouchMajor(0)); |
| 386 | ASSERT_EQ(224, event.getTouchMajor(1)); |
| 387 | |
| 388 | ASSERT_EQ(15, event.getHistoricalTouchMinor(0, 0)); |
| 389 | ASSERT_EQ(25, event.getHistoricalTouchMinor(1, 0)); |
| 390 | ASSERT_EQ(115, event.getHistoricalTouchMinor(0, 1)); |
| 391 | ASSERT_EQ(125, event.getHistoricalTouchMinor(1, 1)); |
| 392 | ASSERT_EQ(215, event.getTouchMinor(0)); |
| 393 | ASSERT_EQ(225, event.getTouchMinor(1)); |
| 394 | |
| 395 | ASSERT_EQ(16, event.getHistoricalToolMajor(0, 0)); |
| 396 | ASSERT_EQ(26, event.getHistoricalToolMajor(1, 0)); |
| 397 | ASSERT_EQ(116, event.getHistoricalToolMajor(0, 1)); |
| 398 | ASSERT_EQ(126, event.getHistoricalToolMajor(1, 1)); |
| 399 | ASSERT_EQ(216, event.getToolMajor(0)); |
| 400 | ASSERT_EQ(226, event.getToolMajor(1)); |
| 401 | |
| 402 | ASSERT_EQ(17, event.getHistoricalToolMinor(0, 0)); |
| 403 | ASSERT_EQ(27, event.getHistoricalToolMinor(1, 0)); |
| 404 | ASSERT_EQ(117, event.getHistoricalToolMinor(0, 1)); |
| 405 | ASSERT_EQ(127, event.getHistoricalToolMinor(1, 1)); |
| 406 | ASSERT_EQ(217, event.getToolMinor(0)); |
| 407 | ASSERT_EQ(227, event.getToolMinor(1)); |
| 408 | |
| 409 | ASSERT_EQ(18, event.getHistoricalOrientation(0, 0)); |
| 410 | ASSERT_EQ(28, event.getHistoricalOrientation(1, 0)); |
| 411 | ASSERT_EQ(118, event.getHistoricalOrientation(0, 1)); |
| 412 | ASSERT_EQ(128, event.getHistoricalOrientation(1, 1)); |
| 413 | ASSERT_EQ(218, event.getOrientation(0)); |
| 414 | ASSERT_EQ(228, event.getOrientation(1)); |
| 415 | } |
| 416 | |
| 417 | } // namespace android |