| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "remoting/client/plugin/touch_input_scaler.h" | 5 #include "remoting/client/plugin/touch_input_scaler.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "remoting/protocol/protocol_mock_objects.h" | 9 #include "remoting/protocol/protocol_mock_objects.h" |
| 10 #include "remoting/protocol/test_event_matchers.h" |
| 10 #include "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 13 |
| 14 using ::testing::_; |
| 15 using ::testing::AllOf; |
| 16 using ::testing::PrintToString; |
| 17 |
| 13 namespace remoting { | 18 namespace remoting { |
| 14 | 19 |
| 15 using ::testing::_; | 20 using protocol::EqualsTouchPointCoordinates; |
| 16 using ::testing::PrintToString; | 21 using protocol::EqualsTouchPointRadii; |
| 17 using protocol::MockInputStub; | 22 using protocol::MockInputStub; |
| 18 using protocol::TouchEvent; | 23 using protocol::TouchEvent; |
| 19 using protocol::TouchEventPoint; | 24 using protocol::TouchEventPoint; |
| 20 | 25 |
| 21 namespace { | 26 namespace { |
| 22 | 27 |
| 23 // If the rounding error for the coordinates checked in TouchPoint* matcher are | |
| 24 // within 1 pixel diff, it should be acceptable. | |
| 25 const float kEpsilon = 1.0f; | |
| 26 | |
| 27 void LogNumTouchPointMismatchError(int expected_size, int actual_size) { | |
| 28 DVLOG(1) << "Expected number of touch points (" << expected_size | |
| 29 << ") does not match the actual size (" << actual_size << ")."; | |
| 30 } | |
| 31 | |
| 32 void LogPointMismatchError(const std::string& field_name, | |
| 33 int point_index, | |
| 34 float expected, | |
| 35 float actual) { | |
| 36 DVLOG(1) << "Point " << point_index << ": expected " << field_name | |
| 37 << " to be " << expected << ", actual " << actual | |
| 38 << " (not within rounding error grace " << kEpsilon << ")."; | |
| 39 } | |
| 40 | |
| 41 MATCHER_P(TouchPointCoordinateEqual, | |
| 42 expected_event, | |
| 43 "Expect point coordinates equal.") { | |
| 44 if (arg.touch_points().size() != expected_event.touch_points().size()) { | |
| 45 LogNumTouchPointMismatchError(expected_event.touch_points().size(), | |
| 46 arg.touch_points().size()); | |
| 47 return false; | |
| 48 } | |
| 49 | |
| 50 for (int i = 0; i < expected_event.touch_points().size(); ++i) { | |
| 51 const TouchEventPoint& arg_point = arg.touch_points(i); | |
| 52 const TouchEventPoint& expected_point = expected_event.touch_points(i); | |
| 53 if (std::abs(expected_point.x() - arg_point.x()) >= kEpsilon) { | |
| 54 LogPointMismatchError("X", i, expected_point.x(), arg_point.x()); | |
| 55 return false; | |
| 56 } | |
| 57 | |
| 58 if (std::abs(expected_point.y() - arg_point.y()) >= kEpsilon) { | |
| 59 LogPointMismatchError("Y", i, expected_point.y(), arg_point.y()); | |
| 60 return false; | |
| 61 } | |
| 62 } | |
| 63 return true; | |
| 64 } | |
| 65 | |
| 66 MATCHER_P(TouchPointRadiiEqual, expected_event, "Expected point radii equal.") { | |
| 67 if (arg.touch_points().size() != expected_event.touch_points().size()) { | |
| 68 LogNumTouchPointMismatchError(expected_event.touch_points().size(), | |
| 69 arg.touch_points().size()); | |
| 70 return false; | |
| 71 } | |
| 72 | |
| 73 for (int i = 0; i < expected_event.touch_points().size(); ++i) { | |
| 74 const TouchEventPoint& arg_point = arg.touch_points(i); | |
| 75 const TouchEventPoint& expected_point = expected_event.touch_points(i); | |
| 76 if (std::abs(expected_point.radius_x() - arg_point.radius_x()) >= | |
| 77 kEpsilon) { | |
| 78 LogPointMismatchError("radius X", i, expected_point.radius_x(), | |
| 79 arg_point.radius_x()); | |
| 80 return false; | |
| 81 } | |
| 82 | |
| 83 if (std::abs(expected_point.radius_y() - arg_point.radius_y()) >= | |
| 84 kEpsilon) { | |
| 85 LogPointMismatchError("radius Y", i, expected_point.radius_y(), | |
| 86 arg_point.radius_y()); | |
| 87 return false; | |
| 88 } | |
| 89 } | |
| 90 return true; | |
| 91 } | |
| 92 | |
| 93 const float kDefaultRadius = 30.0f; | 28 const float kDefaultRadius = 30.0f; |
| 94 const float kDefaultXCoord = 1.0f; | 29 const float kDefaultXCoord = 1.0f; |
| 95 const float kDefaultYCoord = 1.0f; | 30 const float kDefaultYCoord = 1.0f; |
| 96 | 31 |
| 97 struct PointInfo { | 32 struct PointInfo { |
| 98 PointInfo(float x, float y) | 33 PointInfo(float x, float y) |
| 99 : PointInfo(x, y, kDefaultRadius, kDefaultRadius) {} | 34 : PointInfo(x, y, kDefaultRadius, kDefaultRadius) {} |
| 100 PointInfo(float x, float y, float radius_x, float radius_y) | 35 PointInfo(float x, float y, float radius_x, float radius_y) |
| 101 : x(x), y(y), radius_x(radius_x), radius_y(radius_y) {} | 36 : x(x), y(y), radius_x(radius_x), radius_y(radius_y) {} |
| 102 | 37 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 SetInputDimensions(50, 60); | 128 SetInputDimensions(50, 60); |
| 194 SetOutputDimensions(50, 60); | 129 SetOutputDimensions(50, 60); |
| 195 | 130 |
| 196 AddInputCoordinate({10.0f, 15.0f}); | 131 AddInputCoordinate({10.0f, 15.0f}); |
| 197 TouchEvent expected_out; | 132 TouchEvent expected_out; |
| 198 TouchEventPoint* point = expected_out.add_touch_points(); | 133 TouchEventPoint* point = expected_out.add_touch_points(); |
| 199 point->set_x(10.0f); | 134 point->set_x(10.0f); |
| 200 point->set_y(15.0f); | 135 point->set_y(15.0f); |
| 201 | 136 |
| 202 EXPECT_CALL(mock_stub_, | 137 EXPECT_CALL(mock_stub_, |
| 203 InjectTouchEvent(TouchPointCoordinateEqual(expected_out))); | 138 InjectTouchEvent(EqualsTouchPointCoordinates(expected_out))); |
| 204 InjectTestTouchEvent(); | 139 InjectTestTouchEvent(); |
| 205 } | 140 } |
| 206 | 141 |
| 207 // Make sure clamping works. | 142 // Make sure clamping works. |
| 208 TEST_F(TouchInputScalerTest, ClampingNoScaling) { | 143 TEST_F(TouchInputScalerTest, ClampingNoScaling) { |
| 209 SetInputDimensions(50, 60); | 144 SetInputDimensions(50, 60); |
| 210 SetOutputDimensions(50, 60); | 145 SetOutputDimensions(50, 60); |
| 211 | 146 |
| 212 // Note that this could happen if touch started in the chromoting window but | 147 // Note that this could happen if touch started in the chromoting window but |
| 213 // the finger moved off the windows. | 148 // the finger moved off the windows. |
| 214 AddInputCoordinate({-1.0f, 1.0f}); | 149 AddInputCoordinate({-1.0f, 1.0f}); |
| 215 TouchEvent expected_out; | 150 TouchEvent expected_out; |
| 216 TouchEventPoint* point = expected_out.add_touch_points(); | 151 TouchEventPoint* point = expected_out.add_touch_points(); |
| 217 point->set_x(0.0f); | 152 point->set_x(0.0f); |
| 218 point->set_y(1.0f); | 153 point->set_y(1.0f); |
| 219 | 154 |
| 220 EXPECT_CALL(mock_stub_, | 155 EXPECT_CALL(mock_stub_, |
| 221 InjectTouchEvent(TouchPointCoordinateEqual(expected_out))); | 156 InjectTouchEvent(EqualsTouchPointCoordinates(expected_out))); |
| 222 InjectTestTouchEvent(); | 157 InjectTestTouchEvent(); |
| 223 } | 158 } |
| 224 | 159 |
| 225 TEST_F(TouchInputScalerTest, ClampingMultiplePointsNoScaling) { | 160 TEST_F(TouchInputScalerTest, ClampingMultiplePointsNoScaling) { |
| 226 SetInputDimensions(50, 60); | 161 SetInputDimensions(50, 60); |
| 227 SetOutputDimensions(50, 60); | 162 SetOutputDimensions(50, 60); |
| 228 | 163 |
| 229 AddInputCoordinate({-1.0f, 1.0f}); // Fall off left. | 164 AddInputCoordinate({-1.0f, 1.0f}); // Fall off left. |
| 230 TouchEvent expected_out; | 165 TouchEvent expected_out; |
| 231 TouchEventPoint* point = expected_out.add_touch_points(); | 166 TouchEventPoint* point = expected_out.add_touch_points(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 246 point = expected_out.add_touch_points(); | 181 point = expected_out.add_touch_points(); |
| 247 point->set_x(3.0f); | 182 point->set_x(3.0f); |
| 248 point->set_y(0.0f); | 183 point->set_y(0.0f); |
| 249 | 184 |
| 250 AddInputCoordinate({10.0f, 200.0f}); // Fall off below. | 185 AddInputCoordinate({10.0f, 200.0f}); // Fall off below. |
| 251 point = expected_out.add_touch_points(); | 186 point = expected_out.add_touch_points(); |
| 252 point->set_x(10.0f); | 187 point->set_x(10.0f); |
| 253 point->set_y(59.0f); | 188 point->set_y(59.0f); |
| 254 | 189 |
| 255 EXPECT_CALL(mock_stub_, | 190 EXPECT_CALL(mock_stub_, |
| 256 InjectTouchEvent(TouchPointCoordinateEqual(expected_out))); | 191 InjectTouchEvent(EqualsTouchPointCoordinates(expected_out))); |
| 257 InjectTestTouchEvent(); | 192 InjectTestTouchEvent(); |
| 258 } | 193 } |
| 259 | 194 |
| 260 // Verify up-scaling works. All coordinates should fall inside the output | 195 // Verify up-scaling works. All coordinates should fall inside the output |
| 261 // dimensions after scaling. | 196 // dimensions after scaling. |
| 262 TEST_F(TouchInputScalerTest, UpScalingNoClamping) { | 197 TEST_F(TouchInputScalerTest, UpScalingNoClamping) { |
| 263 SetInputDimensions(20, 20); | 198 SetInputDimensions(20, 20); |
| 264 SetOutputDimensions(40, 40); | 199 SetOutputDimensions(40, 40); |
| 265 | 200 |
| 266 AddInputCoordinate({1.0f, 1.0f}); | 201 AddInputCoordinate({1.0f, 1.0f}); |
| 267 TouchEvent expected_out; | 202 TouchEvent expected_out; |
| 268 TouchEventPoint* point = expected_out.add_touch_points(); | 203 TouchEventPoint* point = expected_out.add_touch_points(); |
| 269 point->set_x(2.0f); | 204 point->set_x(2.0f); |
| 270 point->set_y(2.0f); | 205 point->set_y(2.0f); |
| 271 | 206 |
| 272 AddInputCoordinate({1.2f, 4.2f}); | 207 AddInputCoordinate({1.2f, 4.2f}); |
| 273 point = expected_out.add_touch_points(); | 208 point = expected_out.add_touch_points(); |
| 274 point->set_x(2.4f); | 209 point->set_x(2.4f); |
| 275 point->set_y(8.4f); | 210 point->set_y(8.4f); |
| 276 | 211 |
| 277 EXPECT_CALL(mock_stub_, | 212 EXPECT_CALL(mock_stub_, |
| 278 InjectTouchEvent(TouchPointCoordinateEqual(expected_out))); | 213 InjectTouchEvent(EqualsTouchPointCoordinates(expected_out))); |
| 279 InjectTestTouchEvent(); | 214 InjectTestTouchEvent(); |
| 280 } | 215 } |
| 281 | 216 |
| 282 // Verify up-scaling works with clamping. | 217 // Verify up-scaling works with clamping. |
| 283 TEST_F(TouchInputScalerTest, UpScalingWithClamping) { | 218 TEST_F(TouchInputScalerTest, UpScalingWithClamping) { |
| 284 SetInputDimensions(20, 20); | 219 SetInputDimensions(20, 20); |
| 285 SetOutputDimensions(40, 40); | 220 SetOutputDimensions(40, 40); |
| 286 | 221 |
| 287 AddInputCoordinate({25.0f, 25.0f}); | 222 AddInputCoordinate({25.0f, 25.0f}); |
| 288 TouchEvent expected_out; | 223 TouchEvent expected_out; |
| 289 TouchEventPoint* point = expected_out.add_touch_points(); | 224 TouchEventPoint* point = expected_out.add_touch_points(); |
| 290 point->set_x(39.0f); | 225 point->set_x(39.0f); |
| 291 point->set_y(39.0f); | 226 point->set_y(39.0f); |
| 292 | 227 |
| 293 EXPECT_CALL(mock_stub_, | 228 EXPECT_CALL(mock_stub_, |
| 294 InjectTouchEvent(TouchPointCoordinateEqual(expected_out))); | 229 InjectTouchEvent(EqualsTouchPointCoordinates(expected_out))); |
| 295 InjectTestTouchEvent(); | 230 InjectTestTouchEvent(); |
| 296 } | 231 } |
| 297 | 232 |
| 298 // Verify down scaling works. All coordinates should fall inside the output | 233 // Verify down scaling works. All coordinates should fall inside the output |
| 299 // dimensions after scaling. | 234 // dimensions after scaling. |
| 300 TEST_F(TouchInputScalerTest, DownScalingNoClamping) { | 235 TEST_F(TouchInputScalerTest, DownScalingNoClamping) { |
| 301 SetInputDimensions(40, 40); | 236 SetInputDimensions(40, 40); |
| 302 SetOutputDimensions(20, 20); | 237 SetOutputDimensions(20, 20); |
| 303 | 238 |
| 304 AddInputCoordinate({2.0f, 2.0f}); | 239 AddInputCoordinate({2.0f, 2.0f}); |
| 305 TouchEvent expected_out; | 240 TouchEvent expected_out; |
| 306 TouchEventPoint* point = expected_out.add_touch_points(); | 241 TouchEventPoint* point = expected_out.add_touch_points(); |
| 307 point->set_x(1.0f); | 242 point->set_x(1.0f); |
| 308 point->set_y(1.0f); | 243 point->set_y(1.0f); |
| 309 | 244 |
| 310 AddInputCoordinate({6.0f, 3.0f}); | 245 AddInputCoordinate({6.0f, 3.0f}); |
| 311 point = expected_out.add_touch_points(); | 246 point = expected_out.add_touch_points(); |
| 312 point->set_x(3.0); | 247 point->set_x(3.0); |
| 313 point->set_y(1.5f); | 248 point->set_y(1.5f); |
| 314 | 249 |
| 315 EXPECT_CALL(mock_stub_, | 250 EXPECT_CALL(mock_stub_, |
| 316 InjectTouchEvent(TouchPointCoordinateEqual(expected_out))); | 251 InjectTouchEvent(EqualsTouchPointCoordinates(expected_out))); |
| 317 InjectTestTouchEvent(); | 252 InjectTestTouchEvent(); |
| 318 } | 253 } |
| 319 | 254 |
| 320 // Verify down scaling works with clamping. | 255 // Verify down scaling works with clamping. |
| 321 TEST_F(TouchInputScalerTest, DownScalingWithClamping) { | 256 TEST_F(TouchInputScalerTest, DownScalingWithClamping) { |
| 322 SetInputDimensions(40, 40); | 257 SetInputDimensions(40, 40); |
| 323 SetOutputDimensions(20, 20); | 258 SetOutputDimensions(20, 20); |
| 324 | 259 |
| 325 AddInputCoordinate({-20.0f, 10.0f}); | 260 AddInputCoordinate({-20.0f, 10.0f}); |
| 326 TouchEvent expected_out; | 261 TouchEvent expected_out; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 337 point = expected_out.add_touch_points(); | 272 point = expected_out.add_touch_points(); |
| 338 point->set_x(3.0f); | 273 point->set_x(3.0f); |
| 339 point->set_y(19.0f); | 274 point->set_y(19.0f); |
| 340 | 275 |
| 341 AddInputCoordinate({80.0f, 6.0f}); | 276 AddInputCoordinate({80.0f, 6.0f}); |
| 342 point = expected_out.add_touch_points(); | 277 point = expected_out.add_touch_points(); |
| 343 point->set_x(19.0f); | 278 point->set_x(19.0f); |
| 344 point->set_y(3.0f); | 279 point->set_y(3.0f); |
| 345 | 280 |
| 346 EXPECT_CALL(mock_stub_, | 281 EXPECT_CALL(mock_stub_, |
| 347 InjectTouchEvent(TouchPointCoordinateEqual(expected_out))); | 282 InjectTouchEvent(EqualsTouchPointCoordinates(expected_out))); |
| 348 InjectTestTouchEvent(); | 283 InjectTestTouchEvent(); |
| 349 } | 284 } |
| 350 | 285 |
| 351 // Verify that the radii are up-scaled. | 286 // Verify that the radii are up-scaled. |
| 352 TEST_F(TouchInputScalerTest, UpScaleRadii) { | 287 TEST_F(TouchInputScalerTest, UpScaleRadii) { |
| 353 SetInputDimensions(20, 20); | 288 SetInputDimensions(20, 20); |
| 354 SetOutputDimensions(40, 40); | 289 SetOutputDimensions(40, 40); |
| 355 | 290 |
| 356 AddInputCoordinate({0.0f, 0.0f, 1.0f, 2.0f}); | 291 AddInputCoordinate({0.0f, 0.0f, 1.0f, 2.0f}); |
| 357 TouchEvent expected_out; | 292 TouchEvent expected_out; |
| 358 TouchEventPoint* point = expected_out.add_touch_points(); | 293 TouchEventPoint* point = expected_out.add_touch_points(); |
| 359 point->set_radius_x(2.0f); | 294 point->set_radius_x(2.0f); |
| 360 point->set_radius_y(4.0f); | 295 point->set_radius_y(4.0f); |
| 361 | 296 |
| 362 EXPECT_CALL(mock_stub_, InjectTouchEvent(TouchPointRadiiEqual(expected_out))); | 297 EXPECT_CALL(mock_stub_, |
| 298 InjectTouchEvent(EqualsTouchPointRadii(expected_out))); |
| 363 InjectTestTouchEvent(); | 299 InjectTestTouchEvent(); |
| 364 } | 300 } |
| 365 | 301 |
| 366 // Verify that the radii are down-scaled. | 302 // Verify that the radii are down-scaled. |
| 367 TEST_F(TouchInputScalerTest, DownScaleRadii) { | 303 TEST_F(TouchInputScalerTest, DownScaleRadii) { |
| 368 SetInputDimensions(20, 20); | 304 SetInputDimensions(20, 20); |
| 369 SetOutputDimensions(10, 10); | 305 SetOutputDimensions(10, 10); |
| 370 | 306 |
| 371 AddInputCoordinate({0.0f, 0.0f, 5.0f, 4.0f}); | 307 AddInputCoordinate({0.0f, 0.0f, 5.0f, 4.0f}); |
| 372 TouchEvent expected_out; | 308 TouchEvent expected_out; |
| 373 TouchEventPoint* point = expected_out.add_touch_points(); | 309 TouchEventPoint* point = expected_out.add_touch_points(); |
| 374 point->set_radius_x(2.5f); | 310 point->set_radius_x(2.5f); |
| 375 point->set_radius_y(2.0f); | 311 point->set_radius_y(2.0f); |
| 376 | 312 |
| 377 EXPECT_CALL(mock_stub_, InjectTouchEvent(TouchPointRadiiEqual(expected_out))); | 313 EXPECT_CALL(mock_stub_, |
| 314 InjectTouchEvent(EqualsTouchPointRadii(expected_out))); |
| 378 InjectTestTouchEvent(); | 315 InjectTestTouchEvent(); |
| 379 } | 316 } |
| 380 | 317 |
| 381 // Verify that up-scaling with clamping works for x,y coordinates and radii all | 318 // Verify that up-scaling with clamping works for x,y coordinates and radii all |
| 382 // work together. | 319 // work together. |
| 383 TEST_F(TouchInputScalerTest, UpScaleCoordinatesAndRadii) { | 320 TEST_F(TouchInputScalerTest, UpScaleCoordinatesAndRadii) { |
| 384 SetInputDimensions(20, 20); | 321 SetInputDimensions(20, 20); |
| 385 SetOutputDimensions(40, 40); | 322 SetOutputDimensions(40, 40); |
| 386 | 323 |
| 387 AddInputCoordinate({5.0f, 12.0f, 3.0f, 2.0f}); | 324 AddInputCoordinate({5.0f, 12.0f, 3.0f, 2.0f}); |
| 388 TouchEvent expected_out; | 325 TouchEvent expected_out; |
| 389 TouchEventPoint* point = expected_out.add_touch_points(); | 326 TouchEventPoint* point = expected_out.add_touch_points(); |
| 390 point->set_x(10.0f); | 327 point->set_x(10.0f); |
| 391 point->set_y(24.0f); | 328 point->set_y(24.0f); |
| 392 point->set_radius_x(6.0f); | 329 point->set_radius_x(6.0f); |
| 393 point->set_radius_y(4.0f); | 330 point->set_radius_y(4.0f); |
| 394 | 331 |
| 395 // Make sure clamping and scaling all work. | 332 // Make sure clamping and scaling all work. |
| 396 AddInputCoordinate({22.0f, -1.0f, 8.0f, 3.0f}); | 333 AddInputCoordinate({22.0f, -1.0f, 8.0f, 3.0f}); |
| 397 point = expected_out.add_touch_points(); | 334 point = expected_out.add_touch_points(); |
| 398 point->set_x(39.0f); | 335 point->set_x(39.0f); |
| 399 point->set_y(0.0f); | 336 point->set_y(0.0f); |
| 400 point->set_radius_x(16.0f); | 337 point->set_radius_x(16.0f); |
| 401 point->set_radius_y(6.0f); | 338 point->set_radius_y(6.0f); |
| 402 | 339 |
| 403 EXPECT_CALL(mock_stub_, InjectTouchEvent(::testing::AllOf( | 340 EXPECT_CALL(mock_stub_, |
| 404 TouchPointCoordinateEqual(expected_out), | 341 InjectTouchEvent(AllOf(EqualsTouchPointCoordinates(expected_out), |
| 405 TouchPointRadiiEqual(expected_out)))); | 342 EqualsTouchPointRadii(expected_out)))); |
| 406 InjectTestTouchEvent(); | 343 InjectTestTouchEvent(); |
| 407 } | 344 } |
| 408 | 345 |
| 409 // Verify that down-scaling with clamping works for x,y coordinates and radii | 346 // Verify that down-scaling with clamping works for x,y coordinates and radii |
| 410 // all work together. | 347 // all work together. |
| 411 TEST_F(TouchInputScalerTest, DownScaleCoordinatesAndRadii) { | 348 TEST_F(TouchInputScalerTest, DownScaleCoordinatesAndRadii) { |
| 412 SetInputDimensions(60, 60); | 349 SetInputDimensions(60, 60); |
| 413 SetOutputDimensions(20, 20); | 350 SetOutputDimensions(20, 20); |
| 414 | 351 |
| 415 AddInputCoordinate({50.0f, 24.0f, 10.0f, 9.0f}); | 352 AddInputCoordinate({50.0f, 24.0f, 10.0f, 9.0f}); |
| 416 TouchEvent expected_out; | 353 TouchEvent expected_out; |
| 417 TouchEventPoint* point = expected_out.add_touch_points(); | 354 TouchEventPoint* point = expected_out.add_touch_points(); |
| 418 point->set_x(16.666f); | 355 point->set_x(16.666f); |
| 419 point->set_y(8.0f); | 356 point->set_y(8.0f); |
| 420 point->set_radius_x(3.333f); | 357 point->set_radius_x(3.333f); |
| 421 point->set_radius_y(3.0f); | 358 point->set_radius_y(3.0f); |
| 422 | 359 |
| 423 // Make sure clamping and scaling all work. | 360 // Make sure clamping and scaling all work. |
| 424 AddInputCoordinate({70.0f, 82.0f, 8.0f, 3.0f}); | 361 AddInputCoordinate({70.0f, 82.0f, 8.0f, 3.0f}); |
| 425 point = expected_out.add_touch_points(); | 362 point = expected_out.add_touch_points(); |
| 426 point->set_x(19.0f); | 363 point->set_x(19.0f); |
| 427 point->set_y(19.0f); | 364 point->set_y(19.0f); |
| 428 point->set_radius_x(2.666f); | 365 point->set_radius_x(2.666f); |
| 429 point->set_radius_y(1.0f); | 366 point->set_radius_y(1.0f); |
| 430 | 367 |
| 431 EXPECT_CALL(mock_stub_, InjectTouchEvent(::testing::AllOf( | 368 EXPECT_CALL(mock_stub_, |
| 432 TouchPointCoordinateEqual(expected_out), | 369 InjectTouchEvent(AllOf(EqualsTouchPointCoordinates(expected_out), |
| 433 TouchPointRadiiEqual(expected_out)))); | 370 EqualsTouchPointRadii(expected_out)))); |
| 434 InjectTestTouchEvent(); | 371 InjectTestTouchEvent(); |
| 435 } | 372 } |
| 436 | 373 |
| 437 } // namespace remoting | 374 } // namespace remoting |
| OLD | NEW |